Skip to content

Commit

Permalink
Bug 951207 - Rename the chromium LOG macro to CHROMIUM_LOG; r=bent
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan committed Dec 17, 2013
1 parent 5290e10 commit ae6b29e
Show file tree
Hide file tree
Showing 29 changed files with 144 additions and 144 deletions.
4 changes: 2 additions & 2 deletions ipc/chromium/src/base/chrome_application_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ @implementation CrApplication
+ (NSApplication*)sharedApplication {
NSApplication* app = [super sharedApplication];
if (![NSApp isKindOfClass:self]) {
LOG(ERROR) << "NSApp should be of type " << [[self className] UTF8String]
<< ", not " << [[NSApp className] UTF8String];
CHROMIUM_LOG(ERROR) << "NSApp should be of type " << [[self className] UTF8String]
<< ", not " << [[NSApp className] UTF8String];
DCHECK(false) << "NSApp is of wrong type";
}
return app;
Expand Down
22 changes: 11 additions & 11 deletions ipc/chromium/src/base/debug_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,27 +116,27 @@ class SymbolContext {
}

// Returns the error code of a failed initialization. This should only be
// called if Init() has been called. We do not LOG(FATAL) here because
// this code is called might be triggered by a LOG(FATAL) itself. Instead,
// called if Init() has been called. We do not CHROMIUM_LOG(FATAL) here because
// this code is called might be triggered by a CHROMIUM_LOG(FATAL) itself. Instead,
// we log an ERROR, and return ERROR_INVALID_DATA.
DWORD init_error() {
if (!initialized_) {
LOG(ERROR) << "Calling GetInitError() before Init() was called. "
<< "Returning ERROR_INVALID_DATA.";
CHROMIUM_LOG(ERROR) << "Calling GetInitError() before Init() was called. "
<< "Returning ERROR_INVALID_DATA.";
return ERROR_INVALID_DATA;
}

return init_error_;
}

// Returns the process this was initialized for. This should only be
// called if Init() has been called. We LOG(ERROR) in this situation.
// LOG(FATAL) is not used because this code is might be triggered
// by a LOG(FATAL) itself.
// called if Init() has been called. We CHROMIUM_LOG(ERROR) in this situation.
// CHROMIUM_LOG(FATAL) is not used because this code is might be triggered
// by a CHROMIUM_LOG(FATAL) itself.
HANDLE process() {
if (!initialized_) {
LOG(ERROR) << "Calling process() before Init() was called. "
<< "Returning NULL.";
CHROMIUM_LOG(ERROR) << "Calling process() before Init() was called. "
<< "Returning NULL.";
return NULL;
}

Expand All @@ -149,8 +149,8 @@ class SymbolContext {
// <tab>SymbolName[0xAddress+Offset] (FileName:LineNo)
//
// This function should only be called if Init() has been called. We do not
// LOG(FATAL) here because this code is called might be triggered by a
// LOG(FATAL) itself.
// CHROMIUM_LOG(FATAL) here because this code is called might be triggered by a
// CHROMIUM_LOG(FATAL) itself.
void OutputTraceToStream(const std::vector<void*>& trace, std::ostream* os) {
AutoLock lock(lock_);

Expand Down
8 changes: 4 additions & 4 deletions ipc/chromium/src/base/file_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ bool CopyDirectory(const FilePath& from_path,
char* dir_list[] = { top_dir, NULL };
FTS* fts = fts_open(dir_list, FTS_PHYSICAL | FTS_NOSTAT, NULL);
if (!fts) {
LOG(ERROR) << "fts_open failed: " << strerror(errno);
CHROMIUM_LOG(ERROR) << "fts_open failed: " << strerror(errno);
return false;
}

Expand Down Expand Up @@ -203,11 +203,11 @@ bool CopyDirectory(const FilePath& from_path,
break;
case FTS_SL: // Symlink.
case FTS_SLNONE: // Symlink with broken target.
LOG(WARNING) << "CopyDirectory() skipping symbolic link: " <<
CHROMIUM_LOG(WARNING) << "CopyDirectory() skipping symbolic link: " <<
ent->fts_path;
continue;
case FTS_DEFAULT: // Some other sort of file.
LOG(WARNING) << "CopyDirectory() skipping file of unknown type: " <<
CHROMIUM_LOG(WARNING) << "CopyDirectory() skipping file of unknown type: " <<
ent->fts_path;
continue;
default:
Expand All @@ -227,7 +227,7 @@ bool CopyDirectory(const FilePath& from_path,
}

if (error) {
LOG(ERROR) << "CopyDirectory(): " << strerror(error);
CHROMIUM_LOG(ERROR) << "CopyDirectory(): " << strerror(error);
return false;
}
return true;
Expand Down
6 changes: 3 additions & 3 deletions ipc/chromium/src/base/file_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
0,
NULL));
if (file == INVALID_HANDLE_VALUE) {
LOG(WARNING) << "CreateFile failed for path " << filename.value() <<
CHROMIUM_LOG(WARNING) << "CreateFile failed for path " << filename.value() <<
" error code=" << GetLastError() <<
" error text=" << win_util::FormatLastWin32Error();
return -1;
Expand All @@ -326,12 +326,12 @@ int WriteFile(const FilePath& filename, const char* data, int size) {

if (!result) {
// WriteFile failed.
LOG(WARNING) << "writing file " << filename.value() <<
CHROMIUM_LOG(WARNING) << "writing file " << filename.value() <<
" failed, error code=" << GetLastError() <<
" description=" << win_util::FormatLastWin32Error();
} else {
// Didn't write all the bytes.
LOG(WARNING) << "wrote" << written << " bytes to " <<
CHROMIUM_LOG(WARNING) << "wrote" << written << " bytes to " <<
filename.value() << " expected " << size;
}
return -1;
Expand Down
14 changes: 7 additions & 7 deletions ipc/chromium/src/base/histogram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace base {

#define DVLOG(x) LOG(ERROR)
#define DVLOG(x) CHROMIUM_LOG(ERROR)
#define CHECK_GT DCHECK_GT
#define CHECK_LT DCHECK_LT
typedef ::Lock Lock;
Expand Down Expand Up @@ -274,15 +274,15 @@ bool Histogram::DeserializeHistogramInfo(const std::string& histogram_info) {
!pickle.ReadInt(&iter, &histogram_type) ||
!pickle.ReadInt(&iter, &pickle_flags) ||
!sample.Histogram::SampleSet::Deserialize(&iter, pickle)) {
LOG(ERROR) << "Pickle error decoding Histogram: " << histogram_name;
CHROMIUM_LOG(ERROR) << "Pickle error decoding Histogram: " << histogram_name;
return false;
}
DCHECK(pickle_flags & kIPCSerializationSourceFlag);
// Since these fields may have come from an untrusted renderer, do additional
// checks above and beyond those in Histogram::Initialize()
if (declared_max <= 0 || declared_min <= 0 || declared_max < declared_min ||
INT_MAX / sizeof(Count) <= bucket_count || bucket_count < 2) {
LOG(ERROR) << "Values error decoding Histogram: " << histogram_name;
CHROMIUM_LOG(ERROR) << "Values error decoding Histogram: " << histogram_name;
return false;
}

Expand All @@ -301,8 +301,8 @@ bool Histogram::DeserializeHistogramInfo(const std::string& histogram_info) {
} else if (histogram_type == BOOLEAN_HISTOGRAM) {
render_histogram = BooleanHistogram::FactoryGet(histogram_name, flags);
} else {
LOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: "
<< histogram_type;
CHROMIUM_LOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: "
<< histogram_type;
return false;
}

Expand Down Expand Up @@ -457,7 +457,7 @@ Histogram::~Histogram() {
if (StatisticsRecorder::dump_on_exit()) {
std::string output;
WriteAscii(true, "\n", &output);
LOG(INFO) << output;
CHROMIUM_LOG(INFO) << output;
}

// Just to make sure most derived class did this properly...
Expand Down Expand Up @@ -1139,7 +1139,7 @@ StatisticsRecorder::~StatisticsRecorder() {
if (dump_on_exit_) {
std::string output;
WriteGraph("", &output);
LOG(INFO) << output;
CHROMIUM_LOG(INFO) << output;
}
// Clean up.
HistogramMap* histograms = NULL;
Expand Down
10 changes: 5 additions & 5 deletions ipc/chromium/src/base/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ const mozilla::EmptyLog& operator <<(const mozilla::EmptyLog& log, const T&)
}

#ifdef NO_CHROMIUM_LOGGING
#define LOG(info) std::stringstream()
#define CHROMIUM_LOG(info) std::stringstream()
#define LOG_IF(info, condition) if (!(condition)) std::stringstream()
#else
#define LOG(info) mozilla::LogWrapper(mozilla::LOG_ ## info, __FILE__, __LINE__)
#define CHROMIUM_LOG(info) mozilla::LogWrapper(mozilla::LOG_ ## info, __FILE__, __LINE__)
#define LOG_IF(info, condition) \
if (!(condition)) mozilla::LogWrapper(mozilla::LOG_ ## info, __FILE__, __LINE__)
#endif


#ifdef DEBUG
#define DLOG(info) LOG(info)
#define DLOG(info) CHROMIUM_LOG(info)
#define DLOG_IF(info) LOG_IF(info)
#define DCHECK(condition) CHECK(condition)
#else
Expand All @@ -111,8 +111,8 @@ const mozilla::EmptyLog& operator <<(const mozilla::EmptyLog& log, const T&)
#define LOG_ASSERT(cond) CHECK(0)
#define DLOG_ASSERT(cond) DCHECK(0)

#define NOTREACHED() LOG(ERROR)
#define NOTIMPLEMENTED() LOG(ERROR)
#define NOTREACHED() CHROMIUM_LOG(ERROR)
#define NOTIMPLEMENTED() CHROMIUM_LOG(ERROR)

#define CHECK(condition) LOG_IF(FATAL, condition)

Expand Down
12 changes: 6 additions & 6 deletions ipc/chromium/src/base/process_util_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {
// Get the size of the buffer
size_t len = 0;
if (sysctl(mib, arraysize(mib), NULL, &len, NULL, 0) < 0) {
LOG(ERROR) << "failed to get the size needed for the process list";
CHROMIUM_LOG(ERROR) << "failed to get the size needed for the process list";
kinfo_procs_.resize(0);
done = true;
} else {
Expand All @@ -227,7 +227,7 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {
// If we get a mem error, it just means we need a bigger buffer, so
// loop around again. Anything else is a real error and give up.
if (errno != ENOMEM) {
LOG(ERROR) << "failed to get the process list";
CHROMIUM_LOG(ERROR) << "failed to get the process list";
kinfo_procs_.resize(0);
done = true;
}
Expand All @@ -241,7 +241,7 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {
} while (!done && (try_num++ < max_tries));

if (!done) {
LOG(ERROR) << "failed to collect the process list in a few tries";
CHROMIUM_LOG(ERROR) << "failed to collect the process list in a few tries";
kinfo_procs_.resize(0);
}
}
Expand Down Expand Up @@ -280,13 +280,13 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {
// Found out what size buffer we need
size_t data_len = 0;
if (sysctl(mib, arraysize(mib), NULL, &data_len, NULL, 0) < 0) {
LOG(ERROR) << "failed to figure out the buffer size for a commandline";
CHROMIUM_LOG(ERROR) << "failed to figure out the buffer size for a commandline";
continue;
}

data.resize(data_len);
if (sysctl(mib, arraysize(mib), &data[0], &data_len, NULL, 0) < 0) {
LOG(ERROR) << "failed to fetch a commandline";
CHROMIUM_LOG(ERROR) << "failed to fetch a commandline";
continue;
}

Expand All @@ -295,7 +295,7 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {

size_t exec_name_end = data.find('\0');
if (exec_name_end == std::string::npos) {
LOG(ERROR) << "command line data didn't match expected format";
CHROMIUM_LOG(ERROR) << "command line data didn't match expected format";
continue;
}
size_t last_slash = data.rfind('/', exec_name_end);
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/process_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ bool DidProcessCrash(bool* child_exited, ProcessHandle handle) {
// The dead process originally spawned from Nuwa might be taken as not
// crashed because the above waitpid() call returns -1 and ECHILD. The
// caller shouldn't behave incorrectly because of this false negative.
LOG(ERROR) << "waitpid failed pid:" << handle << " errno:" << errno;
CHROMIUM_LOG(ERROR) << "waitpid failed pid:" << handle << " errno:" << errno;
if (child_exited)
*child_exited = false;
return false;
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/scoped_temp_dir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ScopedTempDir::ScopedTempDir() {

ScopedTempDir::~ScopedTempDir() {
if (!path_.empty() && !file_util::Delete(path_, true))
LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
CHROMIUM_LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
}

bool ScopedTempDir::CreateUniqueTempDir() {
Expand Down
4 changes: 2 additions & 2 deletions ipc/chromium/src/base/stats_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ StatsTable::StatsTable(const std::string& name, int max_threads,
// TODO(port): clean up this error reporting.
#if defined(OS_WIN)
if (!impl_)
LOG(ERROR) << "StatsTable did not initialize:" << GetLastError();
CHROMIUM_LOG(ERROR) << "StatsTable did not initialize:" << GetLastError();
#elif defined(OS_POSIX)
if (!impl_)
LOG(ERROR) << "StatsTable did not initialize:" << strerror(errno);
CHROMIUM_LOG(ERROR) << "StatsTable did not initialize:" << strerror(errno);
#endif
}

Expand Down
8 changes: 4 additions & 4 deletions ipc/chromium/src/base/system_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ void SystemMonitor::RemoveObserver(PowerObserver* obs) {
}

void SystemMonitor::NotifyPowerStateChange() {
LOG(INFO) << "PowerStateChange: "
<< (BatteryPower() ? "On" : "Off") << " battery";
CHROMIUM_LOG(INFO) << "PowerStateChange: "
<< (BatteryPower() ? "On" : "Off") << " battery";
observer_list_->Notify(&PowerObserver::OnPowerStateChange, this);
}

void SystemMonitor::NotifySuspend() {
LOG(INFO) << "Power Suspending";
CHROMIUM_LOG(INFO) << "Power Suspending";
observer_list_->Notify(&PowerObserver::OnSuspend, this);
}

void SystemMonitor::NotifyResume() {
LOG(INFO) << "Power Resuming";
CHROMIUM_LOG(INFO) << "Power Resuming";
observer_list_->Notify(&PowerObserver::OnResume, this);
}

Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/base/system_monitor_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) {
bool SystemMonitor::IsBatteryPower() {
SYSTEM_POWER_STATUS status;
if (!GetSystemPowerStatus(&status)) {
LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError();
CHROMIUM_LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError();
return false;
}
return (status.ACLineStatus == 0);
Expand Down
2 changes: 1 addition & 1 deletion ipc/chromium/src/chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const wchar_t kDisableLogging[] = L"disable-logging";
// INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3.
const wchar_t kLoggingLevel[] = L"log-level";

// Make plugin processes log their sent and received messages to LOG(INFO).
// Make plugin processes log their sent and received messages to CHROMIUM_LOG(INFO).
const wchar_t kLogPluginMessages[] = L"log-plugin-messages";

// Dump any accumualted histograms to the log when browser terminates (requires
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FileDescriptorSet::~FileDescriptorSet() {
if (consumed_descriptor_highwater_ == descriptors_.size())
return;

LOG(WARNING) << "FileDescriptorSet destroyed with unconsumed descriptors";
CHROMIUM_LOG(WARNING) << "FileDescriptorSet destroyed with unconsumed descriptors";
// We close all the descriptors where the close flag is set. If this
// message should have been transmitted, then closing those with close
// flags set mirrors the expected behaviour.
Expand Down
Loading

0 comments on commit ae6b29e

Please sign in to comment.