Remove overrides folder.
This is a part of moving the overrides to Chromium. See bug comment #65 for all steps. Depends on https://codereview.chromium.org/1357913002/ BUG=chromium:468375 TBR=tommi@webrtc.org Review URL: https://codereview.webrtc.org/1350393003 Cr-Commit-Position: refs/heads/master@{#10117}
This commit is contained in:
parent
bbda54e6fa
commit
4a8e9c556a
5
DEPS
5
DEPS
@ -46,11 +46,6 @@ include_rules = [
|
||||
'+vpx',
|
||||
]
|
||||
|
||||
# checkdeps.py shouldn't check include paths for files in these dirs:
|
||||
skip_child_includes = [
|
||||
'webrtc/overrides',
|
||||
]
|
||||
|
||||
hooks = [
|
||||
{
|
||||
# Check for legacy named top-level dir (named 'trunk').
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
henrika@webrtc.org
|
||||
henrikg@webrtc.org
|
||||
hta@webrtc.org
|
||||
jiayl@webrtc.org
|
||||
juberti@webrtc.org
|
||||
mflodman@webrtc.org
|
||||
perkj@webrtc.org
|
||||
pthatcher@webrtc.org
|
||||
sergeyu@chromium.org
|
||||
tommi@webrtc.org
|
||||
|
||||
per-file BUILD.gn=kjellander@webrtc.org
|
||||
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef THIRD_PARTY_LIBJINGLE_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_
|
||||
#define THIRD_PARTY_LIBJINGLE_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "third_party/webrtc/base/checks.h"
|
||||
#include "third_party/webrtc/base/scoped_ref_ptr.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ConstantLabel can be used to easily generate string names from constant
|
||||
// values. This can be useful for logging descriptive names of error messages.
|
||||
// Usage:
|
||||
// const ConstantLabel LIBRARY_ERRORS[] = {
|
||||
// KLABEL(SOME_ERROR),
|
||||
// KLABEL(SOME_OTHER_ERROR),
|
||||
// ...
|
||||
// LASTLABEL
|
||||
// }
|
||||
//
|
||||
// int err = LibraryFunc();
|
||||
// LOG(LS_ERROR) << "LibraryFunc returned: "
|
||||
// << ErrorName(err, LIBRARY_ERRORS);
|
||||
|
||||
struct ConstantLabel {
|
||||
int value;
|
||||
const char* label;
|
||||
};
|
||||
#define KLABEL(x) { x, #x }
|
||||
#define LASTLABEL { 0, 0 }
|
||||
|
||||
const char* FindLabel(int value, const ConstantLabel entries[]);
|
||||
std::string ErrorName(int err, const ConstantLabel* err_table);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Note that the non-standard LoggingSeverity aliases exist because they are
|
||||
// still in broad use. The meanings of the levels are:
|
||||
// LS_SENSITIVE: Information which should only be logged with the consent
|
||||
// of the user, due to privacy concerns.
|
||||
// LS_VERBOSE: This level is for data which we do not want to appear in the
|
||||
// normal debug log, but should appear in diagnostic logs.
|
||||
// LS_INFO: Chatty level used in debugging for all sorts of things, the default
|
||||
// in debug builds.
|
||||
// LS_WARNING: Something that may warrant investigation.
|
||||
// LS_ERROR: Something that should not have occurred.
|
||||
// Note that LoggingSeverity is mapped over to chromiums verbosity levels where
|
||||
// anything lower than or equal to the current verbosity level is written to
|
||||
// file which is the opposite of logging severity in libjingle where higher
|
||||
// severity numbers than or equal to the current severity level are written to
|
||||
// file. Also, note that the values are explicitly defined here for convenience
|
||||
// since the command line flag must be set using numerical values.
|
||||
// TODO(tommi): To keep things simple, we should just use the same values for
|
||||
// these constants as Chrome does.
|
||||
enum LoggingSeverity { LS_ERROR = 1,
|
||||
LS_WARNING = 2,
|
||||
LS_INFO = 3,
|
||||
LS_VERBOSE = 4,
|
||||
LS_SENSITIVE = 5,
|
||||
INFO = LS_INFO,
|
||||
WARNING = LS_WARNING,
|
||||
LERROR = LS_ERROR };
|
||||
|
||||
// LogErrorContext assists in interpreting the meaning of an error value.
|
||||
enum LogErrorContext {
|
||||
ERRCTX_NONE,
|
||||
ERRCTX_ERRNO, // System-local errno
|
||||
ERRCTX_HRESULT, // Windows HRESULT
|
||||
ERRCTX_OSSTATUS, // MacOS OSStatus
|
||||
|
||||
// Abbreviations for LOG_E macro
|
||||
ERRCTX_EN = ERRCTX_ERRNO, // LOG_E(sev, EN, x)
|
||||
ERRCTX_HR = ERRCTX_HRESULT, // LOG_E(sev, HR, x)
|
||||
ERRCTX_OS = ERRCTX_OSSTATUS, // LOG_E(sev, OS, x)
|
||||
};
|
||||
|
||||
// Class that writes a log message to the logging delegate ("WebRTC logging
|
||||
// stream" in Chrome) and to Chrome's logging stream.
|
||||
class DiagnosticLogMessage {
|
||||
public:
|
||||
DiagnosticLogMessage(const char* file, int line, LoggingSeverity severity,
|
||||
LogErrorContext err_ctx, int err);
|
||||
DiagnosticLogMessage(const char* file, int line, LoggingSeverity severity,
|
||||
LogErrorContext err_ctx, int err, const char* module);
|
||||
~DiagnosticLogMessage();
|
||||
|
||||
void CreateTimestamp();
|
||||
|
||||
std::ostream& stream() { return print_stream_; }
|
||||
|
||||
private:
|
||||
const char* file_name_;
|
||||
const int line_;
|
||||
const LoggingSeverity severity_;
|
||||
const bool log_to_chrome_;
|
||||
|
||||
std::string extra_;
|
||||
|
||||
std::ostringstream print_stream_;
|
||||
};
|
||||
|
||||
// This class is used to explicitly ignore values in the conditional
|
||||
// logging macros. This avoids compiler warnings like "value computed
|
||||
// is not used" and "statement has no effect".
|
||||
class LogMessageVoidify {
|
||||
public:
|
||||
LogMessageVoidify() { }
|
||||
// This has to be an operator with a precedence lower than << but
|
||||
// higher than ?:
|
||||
void operator&(std::ostream&) { }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Logging Helpers
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
class LogMultilineState {
|
||||
public:
|
||||
size_t unprintable_count_[2];
|
||||
LogMultilineState() {
|
||||
unprintable_count_[0] = unprintable_count_[1] = 0;
|
||||
}
|
||||
};
|
||||
|
||||
class LogMessage {
|
||||
public:
|
||||
static void LogToDebug(int min_sev);
|
||||
};
|
||||
|
||||
// When possible, pass optional state variable to track various data across
|
||||
// multiple calls to LogMultiline. Otherwise, pass NULL.
|
||||
void LogMultiline(LoggingSeverity level, const char* label, bool input,
|
||||
const void* data, size_t len, bool hex_mode,
|
||||
LogMultilineState* state);
|
||||
|
||||
// TODO(grunell): Change name to InitDiagnosticLoggingDelegate or
|
||||
// InitDiagnosticLogging. Change also in init_webrtc.h/cc.
|
||||
// TODO(grunell): typedef the delegate function.
|
||||
void InitDiagnosticLoggingDelegateFunction(
|
||||
void (*delegate)(const std::string&));
|
||||
|
||||
void SetExtraLoggingInit(
|
||||
void (*function)(void (*delegate)(const std::string&)));
|
||||
} // namespace rtc
|
||||
|
||||
#endif // THIRD_PARTY_LIBJINGLE_OVERRIDES_WEBRTC_BASE_DIAGNOSTIC_LOGGING_H_
|
||||
@ -1,378 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// IMPORTANT
|
||||
// Since this file includes Chromium headers, it must not include
|
||||
// third_party/webrtc/base/logging.h since it defines some of the same macros as
|
||||
// Chromium does and we'll run into conflicts.
|
||||
|
||||
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif // OS_MACOSX
|
||||
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
|
||||
#include "base/atomicops.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "third_party/webrtc/base/ipaddress.h"
|
||||
#include "third_party/webrtc/base/stream.h"
|
||||
#include "third_party/webrtc/base/stringencode.h"
|
||||
#include "third_party/webrtc/base/stringutils.h"
|
||||
#include "third_party/webrtc/base/timeutils.h"
|
||||
#include "third_party/webrtc/overrides/webrtc/base/diagnostic_logging.h"
|
||||
|
||||
// From this file we can't use VLOG since it expands into usage of the __FILE__
|
||||
// macro (for correct filtering). The actual logging call from DIAGNOSTIC_LOG in
|
||||
// ~DiagnosticLogMessage. Note that the second parameter to the LAZY_STREAM
|
||||
// macro is true since the filter check has already been done for
|
||||
// DIAGNOSTIC_LOG.
|
||||
#define LOG_LAZY_STREAM_DIRECT(file_name, line_number, sev) \
|
||||
LAZY_STREAM(logging::LogMessage(file_name, line_number, sev).stream(), \
|
||||
true)
|
||||
|
||||
namespace rtc {
|
||||
|
||||
void (*g_logging_delegate_function)(const std::string&) = NULL;
|
||||
void (*g_extra_logging_init_function)(
|
||||
void (*logging_delegate_function)(const std::string&)) = NULL;
|
||||
#ifndef NDEBUG
|
||||
static_assert(sizeof(base::subtle::Atomic32) == sizeof(base::PlatformThreadId),
|
||||
"Atomic32 not same size as PlatformThreadId");
|
||||
base::subtle::Atomic32 g_init_logging_delegate_thread_id = 0;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Constant Labels
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char* FindLabel(int value, const ConstantLabel entries[]) {
|
||||
for (int i = 0; entries[i].label; ++i) {
|
||||
if (value == entries[i].value) return entries[i].label;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string ErrorName(int err, const ConstantLabel* err_table) {
|
||||
if (err == 0)
|
||||
return "No error";
|
||||
|
||||
if (err_table != 0) {
|
||||
if (const char * value = FindLabel(err, err_table))
|
||||
return value;
|
||||
}
|
||||
|
||||
char buffer[16];
|
||||
base::snprintf(buffer, sizeof(buffer), "0x%08x", err);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Log helper functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline int WebRtcSevToChromeSev(LoggingSeverity sev) {
|
||||
switch (sev) {
|
||||
case LS_ERROR:
|
||||
return ::logging::LOG_ERROR;
|
||||
case LS_WARNING:
|
||||
return ::logging::LOG_WARNING;
|
||||
case LS_INFO:
|
||||
return ::logging::LOG_INFO;
|
||||
case LS_VERBOSE:
|
||||
case LS_SENSITIVE:
|
||||
return ::logging::LOG_VERBOSE;
|
||||
default:
|
||||
NOTREACHED();
|
||||
return ::logging::LOG_FATAL;
|
||||
}
|
||||
}
|
||||
|
||||
inline int WebRtcVerbosityLevel(LoggingSeverity sev) {
|
||||
switch (sev) {
|
||||
case LS_ERROR:
|
||||
return -2;
|
||||
case LS_WARNING:
|
||||
return -1;
|
||||
case LS_INFO: // We treat 'info' and 'verbose' as the same verbosity level.
|
||||
case LS_VERBOSE:
|
||||
return 1;
|
||||
case LS_SENSITIVE:
|
||||
return 2;
|
||||
default:
|
||||
NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates extra information for LOG_E.
|
||||
static std::string GenerateExtra(LogErrorContext err_ctx,
|
||||
int err,
|
||||
const char* module) {
|
||||
if (err_ctx != ERRCTX_NONE) {
|
||||
std::ostringstream tmp;
|
||||
tmp << ": ";
|
||||
tmp << "[0x" << std::setfill('0') << std::hex << std::setw(8) << err << "]";
|
||||
switch (err_ctx) {
|
||||
case ERRCTX_ERRNO:
|
||||
tmp << " " << strerror(err);
|
||||
break;
|
||||
#if defined(WEBRTC_WIN)
|
||||
case ERRCTX_HRESULT: {
|
||||
char msgbuf[256];
|
||||
DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM;
|
||||
HMODULE hmod = GetModuleHandleA(module);
|
||||
if (hmod)
|
||||
flags |= FORMAT_MESSAGE_FROM_HMODULE;
|
||||
if (DWORD len = FormatMessageA(
|
||||
flags, hmod, err,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
msgbuf, sizeof(msgbuf) / sizeof(msgbuf[0]), NULL)) {
|
||||
while ((len > 0) &&
|
||||
isspace(static_cast<unsigned char>(msgbuf[len-1]))) {
|
||||
msgbuf[--len] = 0;
|
||||
}
|
||||
tmp << " " << msgbuf;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // OS_WIN
|
||||
#if defined(WEBRTC_IOS)
|
||||
case ERRCTX_OSSTATUS:
|
||||
tmp << " " << "Unknown LibJingle error: " << err;
|
||||
break;
|
||||
#elif defined(WEBRTC_MAC)
|
||||
case ERRCTX_OSSTATUS: {
|
||||
tmp << " " << nonnull(GetMacOSStatusErrorString(err), "Unknown error");
|
||||
if (const char* desc = GetMacOSStatusCommentString(err)) {
|
||||
tmp << ": " << desc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // OS_MACOSX
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tmp.str();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
DiagnosticLogMessage::DiagnosticLogMessage(const char* file,
|
||||
int line,
|
||||
LoggingSeverity severity,
|
||||
LogErrorContext err_ctx,
|
||||
int err)
|
||||
: file_name_(file),
|
||||
line_(line),
|
||||
severity_(severity),
|
||||
log_to_chrome_(CheckVlogIsOnHelper(severity, file, strlen(file) + 1)) {
|
||||
extra_ = GenerateExtra(err_ctx, err, NULL);
|
||||
}
|
||||
|
||||
DiagnosticLogMessage::DiagnosticLogMessage(const char* file,
|
||||
int line,
|
||||
LoggingSeverity severity,
|
||||
LogErrorContext err_ctx,
|
||||
int err,
|
||||
const char* module)
|
||||
: file_name_(file),
|
||||
line_(line),
|
||||
severity_(severity),
|
||||
log_to_chrome_(CheckVlogIsOnHelper(severity, file, strlen(file) + 1)) {
|
||||
extra_ = GenerateExtra(err_ctx, err, module);
|
||||
}
|
||||
|
||||
DiagnosticLogMessage::~DiagnosticLogMessage() {
|
||||
const bool call_delegate =
|
||||
g_logging_delegate_function && severity_ <= LS_INFO;
|
||||
|
||||
if (call_delegate || log_to_chrome_) {
|
||||
print_stream_ << extra_;
|
||||
const std::string& str = print_stream_.str();
|
||||
if (log_to_chrome_) {
|
||||
LOG_LAZY_STREAM_DIRECT(file_name_, line_,
|
||||
rtc::WebRtcSevToChromeSev(severity_)) << str;
|
||||
}
|
||||
|
||||
if (g_logging_delegate_function && severity_ <= LS_INFO) {
|
||||
g_logging_delegate_function(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LogMessage::LogToDebug(int min_sev) {
|
||||
logging::SetMinLogLevel(min_sev);
|
||||
}
|
||||
|
||||
// Note: this function is a copy from the overriden libjingle implementation.
|
||||
void LogMultiline(LoggingSeverity level, const char* label, bool input,
|
||||
const void* data, size_t len, bool hex_mode,
|
||||
LogMultilineState* state) {
|
||||
// TODO(grunell): This will not do the expected verbosity level checking. We
|
||||
// need a macro for the multiline logging.
|
||||
// https://code.google.com/p/webrtc/issues/detail?id=5011
|
||||
if (!LOG_CHECK_LEVEL_V(level))
|
||||
return;
|
||||
|
||||
const char * direction = (input ? " << " : " >> ");
|
||||
|
||||
// NULL data means to flush our count of unprintable characters.
|
||||
if (!data) {
|
||||
if (state && state->unprintable_count_[input]) {
|
||||
LOG_V(level) << label << direction << "## "
|
||||
<< state->unprintable_count_[input]
|
||||
<< " consecutive unprintable ##";
|
||||
state->unprintable_count_[input] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// The ctype classification functions want unsigned chars.
|
||||
const unsigned char* udata = static_cast<const unsigned char*>(data);
|
||||
|
||||
if (hex_mode) {
|
||||
const size_t LINE_SIZE = 24;
|
||||
char hex_line[LINE_SIZE * 9 / 4 + 2], asc_line[LINE_SIZE + 1];
|
||||
while (len > 0) {
|
||||
memset(asc_line, ' ', sizeof(asc_line));
|
||||
memset(hex_line, ' ', sizeof(hex_line));
|
||||
size_t line_len = std::min(len, LINE_SIZE);
|
||||
for (size_t i = 0; i < line_len; ++i) {
|
||||
unsigned char ch = udata[i];
|
||||
asc_line[i] = isprint(ch) ? ch : '.';
|
||||
hex_line[i*2 + i/4] = hex_encode(ch >> 4);
|
||||
hex_line[i*2 + i/4 + 1] = hex_encode(ch & 0xf);
|
||||
}
|
||||
asc_line[sizeof(asc_line)-1] = 0;
|
||||
hex_line[sizeof(hex_line)-1] = 0;
|
||||
LOG_V(level) << label << direction
|
||||
<< asc_line << " " << hex_line << " ";
|
||||
udata += line_len;
|
||||
len -= line_len;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
size_t consecutive_unprintable = state ? state->unprintable_count_[input] : 0;
|
||||
|
||||
const unsigned char* end = udata + len;
|
||||
while (udata < end) {
|
||||
const unsigned char* line = udata;
|
||||
const unsigned char* end_of_line = strchrn<unsigned char>(udata,
|
||||
end - udata,
|
||||
'\n');
|
||||
if (!end_of_line) {
|
||||
udata = end_of_line = end;
|
||||
} else {
|
||||
udata = end_of_line + 1;
|
||||
}
|
||||
|
||||
bool is_printable = true;
|
||||
|
||||
// If we are in unprintable mode, we need to see a line of at least
|
||||
// kMinPrintableLine characters before we'll switch back.
|
||||
const ptrdiff_t kMinPrintableLine = 4;
|
||||
if (consecutive_unprintable && ((end_of_line - line) < kMinPrintableLine)) {
|
||||
is_printable = false;
|
||||
} else {
|
||||
// Determine if the line contains only whitespace and printable
|
||||
// characters.
|
||||
bool is_entirely_whitespace = true;
|
||||
for (const unsigned char* pos = line; pos < end_of_line; ++pos) {
|
||||
if (isspace(*pos))
|
||||
continue;
|
||||
is_entirely_whitespace = false;
|
||||
if (!isprint(*pos)) {
|
||||
is_printable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Treat an empty line following unprintable data as unprintable.
|
||||
if (consecutive_unprintable && is_entirely_whitespace) {
|
||||
is_printable = false;
|
||||
}
|
||||
}
|
||||
if (!is_printable) {
|
||||
consecutive_unprintable += (udata - line);
|
||||
continue;
|
||||
}
|
||||
// Print out the current line, but prefix with a count of prior unprintable
|
||||
// characters.
|
||||
if (consecutive_unprintable) {
|
||||
LOG_V(level) << label << direction << "## " << consecutive_unprintable
|
||||
<< " consecutive unprintable ##";
|
||||
consecutive_unprintable = 0;
|
||||
}
|
||||
// Strip off trailing whitespace.
|
||||
while ((end_of_line > line) && isspace(*(end_of_line-1))) {
|
||||
--end_of_line;
|
||||
}
|
||||
// Filter out any private data
|
||||
std::string substr(reinterpret_cast<const char*>(line), end_of_line - line);
|
||||
std::string::size_type pos_private = substr.find("Email");
|
||||
if (pos_private == std::string::npos) {
|
||||
pos_private = substr.find("Passwd");
|
||||
}
|
||||
if (pos_private == std::string::npos) {
|
||||
LOG_V(level) << label << direction << substr;
|
||||
} else {
|
||||
LOG_V(level) << label << direction << "## omitted for privacy ##";
|
||||
}
|
||||
}
|
||||
|
||||
if (state) {
|
||||
state->unprintable_count_[input] = consecutive_unprintable;
|
||||
}
|
||||
}
|
||||
|
||||
void InitDiagnosticLoggingDelegateFunction(
|
||||
void (*delegate)(const std::string&)) {
|
||||
#ifndef NDEBUG
|
||||
// Ensure that this function is always called from the same thread.
|
||||
base::subtle::NoBarrier_CompareAndSwap(&g_init_logging_delegate_thread_id, 0,
|
||||
static_cast<base::subtle::Atomic32>(base::PlatformThread::CurrentId()));
|
||||
DCHECK_EQ(
|
||||
g_init_logging_delegate_thread_id,
|
||||
static_cast<base::subtle::Atomic32>(base::PlatformThread::CurrentId()));
|
||||
#endif
|
||||
CHECK(delegate);
|
||||
// This function may be called with the same argument several times if the
|
||||
// page is reloaded or there are several PeerConnections on one page with
|
||||
// logging enabled. This is OK, we simply don't have to do anything.
|
||||
if (delegate == g_logging_delegate_function)
|
||||
return;
|
||||
CHECK(!g_logging_delegate_function);
|
||||
#ifdef NDEBUG
|
||||
IPAddress::set_strip_sensitive(true);
|
||||
#endif
|
||||
g_logging_delegate_function = delegate;
|
||||
|
||||
if (g_extra_logging_init_function)
|
||||
g_extra_logging_init_function(delegate);
|
||||
}
|
||||
|
||||
void SetExtraLoggingInit(
|
||||
void (*function)(void (*delegate)(const std::string&))) {
|
||||
CHECK(function);
|
||||
CHECK(!g_extra_logging_init_function);
|
||||
g_extra_logging_init_function = function;
|
||||
}
|
||||
|
||||
bool CheckVlogIsOnHelper(
|
||||
rtc::LoggingSeverity severity, const char* file, size_t N) {
|
||||
return rtc::WebRtcVerbosityLevel(severity) <=
|
||||
::logging::GetVlogLevelHelper(file, N);
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// This file overrides the logging macros in libjingle (webrtc/base/logging.h).
|
||||
// Instead of using libjingle's logging implementation, the libjingle macros are
|
||||
// mapped to the corresponding base/logging.h macro (chromium's VLOG).
|
||||
// If this file is included outside of libjingle (e.g. in wrapper code) it
|
||||
// should be included after base/logging.h (if any) or compiler error or
|
||||
// unexpected behavior may occur (macros that have the same name in libjingle as
|
||||
// in chromium will use the libjingle definition if this file is included
|
||||
// first).
|
||||
|
||||
// Setting the LoggingSeverity (and lower) that should be written to file should
|
||||
// be done via command line by specifying the flags:
|
||||
// --vmodule or --v please see base/logging.h for details on how to use them.
|
||||
// Specifying what file to write to is done using InitLogging also in
|
||||
// base/logging.h.
|
||||
|
||||
// The macros and classes declared in here are not described as they are
|
||||
// NOT TO BE USED outside of libjingle.
|
||||
|
||||
#ifndef THIRD_PARTY_LIBJINGLE_OVERRIDES_WEBRTC_BASE_LOGGING_H_
|
||||
#define THIRD_PARTY_LIBJINGLE_OVERRIDES_WEBRTC_BASE_LOGGING_H_
|
||||
|
||||
#include "third_party/webrtc/overrides/webrtc/base/diagnostic_logging.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Libjingle macros which are mapped over to their VLOG equivalent in
|
||||
// base/logging.h
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(LOGGING_INSIDE_WEBRTC)
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Note that |N| is the size *with* the null terminator.
|
||||
bool CheckVlogIsOnHelper(LoggingSeverity severity,
|
||||
const char* file, size_t N);
|
||||
|
||||
template <size_t N>
|
||||
bool CheckVlogIsOn(LoggingSeverity severity, const char (&file)[N]) {
|
||||
return CheckVlogIsOnHelper(severity, file, N);
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#define DIAGNOSTIC_LOG(sev, ctx, err, ...) \
|
||||
rtc::DiagnosticLogMessage( \
|
||||
__FILE__, __LINE__, sev, rtc::ERRCTX_ ## ctx, err, ##__VA_ARGS__).stream()
|
||||
|
||||
#define LOG_CHECK_LEVEL(sev) CheckVlogIsOn(rtc::sev, __FILE__)
|
||||
#define LOG_CHECK_LEVEL_V(sev) CheckVlogIsOn(sev, __FILE__)
|
||||
|
||||
#define LOG_V(sev) DIAGNOSTIC_LOG(sev, NONE, 0)
|
||||
#undef LOG
|
||||
#define LOG(sev) DIAGNOSTIC_LOG(rtc::sev, NONE, 0)
|
||||
|
||||
// The _F version prefixes the message with the current function name.
|
||||
#if defined(__GNUC__) && defined(_DEBUG)
|
||||
#define LOG_F(sev) LOG(sev) << __PRETTY_FUNCTION__ << ": "
|
||||
#else
|
||||
#define LOG_F(sev) LOG(sev) << __FUNCTION__ << ": "
|
||||
#endif
|
||||
|
||||
#define LOG_E(sev, ctx, err, ...) \
|
||||
DIAGNOSTIC_LOG(rtc::sev, ctx, err, ##__VA_ARGS__)
|
||||
|
||||
#undef LOG_ERRNO_EX
|
||||
#define LOG_ERRNO_EX(sev, err) LOG_E(sev, ERRNO, err)
|
||||
#undef LOG_ERRNO
|
||||
#define LOG_ERRNO(sev) LOG_ERRNO_EX(sev, errno)
|
||||
|
||||
#if defined(WEBRTC_WIN)
|
||||
#define LOG_GLE_EX(sev, err) LOG_E(sev, HRESULT, err)
|
||||
#define LOG_GLE(sev) LOG_GLE_EX(sev, GetLastError())
|
||||
#define LOG_GLEM(sev, mod) LOG_E(sev, HRESULT, GetLastError(), mod)
|
||||
#define LOG_ERR_EX(sev, err) LOG_GLE_EX(sev, err)
|
||||
#define LOG_ERR(sev) LOG_GLE(sev)
|
||||
#define LAST_SYSTEM_ERROR (::GetLastError())
|
||||
#else
|
||||
#define LOG_ERR_EX(sev, err) LOG_ERRNO_EX(sev, err)
|
||||
#define LOG_ERR(sev) LOG_ERRNO(sev)
|
||||
#define LAST_SYSTEM_ERROR (errno)
|
||||
#endif // OS_WIN
|
||||
|
||||
#undef PLOG
|
||||
#define PLOG(sev, err) LOG_ERR_EX(sev, err)
|
||||
|
||||
#endif // LOGGING_INSIDE_WEBRTC
|
||||
|
||||
#endif // THIRD_PARTY_LIBJINGLE_OVERRIDES_WEBRTC_BASE_LOGGING_H_
|
||||
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// Redirect Libjingle's winsock initialization activity into Chromium's
|
||||
// singleton object that managest precisely that for the browser.
|
||||
|
||||
#include "webrtc/base/win32socketinit.h"
|
||||
|
||||
#include "net/base/winsock_init.h"
|
||||
|
||||
#if !defined(WEBRTC_WIN)
|
||||
#error "Only compile this on Windows"
|
||||
#endif
|
||||
|
||||
namespace rtc {
|
||||
|
||||
void EnsureWinsockInit() {
|
||||
net::EnsureWinsockInit();
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
Loading…
x
Reference in New Issue
Block a user