Bug 951207 - Rename the chromium LOG macro to CHROMIUM_LOG; r=bent

This commit is contained in:
Ehsan Akhgari 2013-12-17 13:26:45 -05:00
parent 80bf630499
commit 124f372395
29 changed files with 144 additions and 144 deletions

View File

@ -21,8 +21,8 @@
+ (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;

View File

@ -116,13 +116,13 @@ 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;
}
@ -130,13 +130,13 @@ class SymbolContext {
}
// 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;
}
@ -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_);

View File

@ -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;
}
@ -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:
@ -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;

View File

@ -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;
@ -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;

View File

@ -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;
@ -274,7 +274,7 @@ 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);
@ -282,7 +282,7 @@ bool Histogram::DeserializeHistogramInfo(const std::string& histogram_info) {
// 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;
}
@ -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;
}
@ -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...
@ -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;

View File

@ -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
@ -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)

View File

@ -212,7 +212,7 @@ NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
// 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 {
@ -227,7 +227,7 @@ NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
// 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;
}
@ -241,7 +241,7 @@ NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
} 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);
}
}
@ -280,13 +280,13 @@ bool NamedProcessIterator::CheckForNextProcess() {
// 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;
}
@ -295,7 +295,7 @@ bool NamedProcessIterator::CheckForNextProcess() {
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);

View File

@ -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;

View File

@ -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() {

View File

@ -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
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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.

View File

@ -210,13 +210,13 @@ bool ClientConnectToFifo(const std::string &pipe_name, int* client_socket) {
// Create socket.
int fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
LOG(ERROR) << "fd is invalid";
CHROMIUM_LOG(ERROR) << "fd is invalid";
return false;
}
// Make socket non-blocking
if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
LOG(ERROR) << "fcntl failed";
CHROMIUM_LOG(ERROR) << "fcntl failed";
HANDLE_EINTR(close(fd));
return false;
}
@ -263,9 +263,9 @@ Channel::ChannelImpl::ChannelImpl(const std::wstring& channel_id, Mode mode,
if (!CreatePipe(channel_id, mode)) {
// The pipe may have been closed already.
LOG(WARNING) << "Unable to create pipe named \"" << channel_id <<
"\" in " << (mode == MODE_SERVER ? "server" : "client") <<
" mode error(" << strerror(errno) << ").";
CHROMIUM_LOG(WARNING) << "Unable to create pipe named \"" << channel_id <<
"\" in " << (mode == MODE_SERVER ? "server" : "client") <<
" mode error(" << strerror(errno) << ").";
}
}
@ -443,7 +443,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
if (errno == EAGAIN) {
return true;
} else {
LOG(ERROR) << "pipe error (" << pipe_ << "): " << strerror(errno);
CHROMIUM_LOG(ERROR) << "pipe error (" << pipe_ << "): " << strerror(errno);
return false;
}
} else if (bytes_read == 0) {
@ -491,9 +491,9 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
num_wire_fds = payload_len / 4;
if (msg.msg_flags & MSG_CTRUNC) {
LOG(ERROR) << "SCM_RIGHTS message was truncated"
<< " cmsg_len:" << cmsg->cmsg_len
<< " fd:" << pipe_;
CHROMIUM_LOG(ERROR) << "SCM_RIGHTS message was truncated"
<< " cmsg_len:" << cmsg->cmsg_len
<< " fd:" << pipe_;
for (unsigned i = 0; i < num_wire_fds; ++i)
HANDLE_EINTR(close(wire_fds[i]));
return false;
@ -515,7 +515,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
if (input_overflow_buf_.size() >
static_cast<size_t>(kMaximumMessageSize - bytes_read)) {
ClearAndShrink(input_overflow_buf_, Channel::kReadBufferSize);
LOG(ERROR) << "IPC message is too big";
CHROMIUM_LOG(ERROR) << "IPC message is too big";
return false;
}
input_overflow_buf_.append(input_buf_, bytes_read);
@ -562,12 +562,12 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
}
if (error) {
LOG(WARNING) << error
<< " channel:" << this
<< " message-type:" << m.type()
<< " header()->num_fds:" << m.header()->num_fds
<< " num_fds:" << num_fds
<< " fds_i:" << fds_i;
CHROMIUM_LOG(WARNING) << error
<< " channel:" << this
<< " message-type:" << m.type()
<< " header()->num_fds:" << m.header()->num_fds
<< " num_fds:" << num_fds
<< " fds_i:" << fds_i;
// close the existing file descriptors so that we don't leak them
for (unsigned i = fds_i; i < num_fds; ++i)
HANDLE_EINTR(close(fds[i]));
@ -668,7 +668,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
const unsigned num_fds = msg->file_descriptor_set()->size();
if (num_fds > FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE) {
LOG(FATAL) << "Too many file descriptors!";
CHROMIUM_LOG(FATAL) << "Too many file descriptors!";
// This should not be reached.
return false;
}
@ -707,7 +707,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
#endif
if (bytes_written < 0 && errno != EAGAIN) {
LOG(ERROR) << "pipe error: " << strerror(errno);
CHROMIUM_LOG(ERROR) << "pipe error: " << strerror(errno);
return false;
}

View File

@ -41,8 +41,8 @@ Channel::ChannelImpl::ChannelImpl(const std::wstring& channel_id, Mode mode,
if (!CreatePipe(channel_id, mode)) {
// The pipe may have been closed already.
LOG(WARNING) << "Unable to create pipe named \"" << channel_id <<
"\" in " << (mode == 0 ? "server" : "client") << " mode.";
CHROMIUM_LOG(WARNING) << "Unable to create pipe named \"" << channel_id <<
"\" in " << (mode == 0 ? "server" : "client") << " mode.";
}
}
@ -195,7 +195,7 @@ bool Channel::ChannelImpl::CreatePipe(const std::wstring& channel_id,
}
if (pipe_ == INVALID_HANDLE_VALUE) {
// If this process is being closed, the pipe may be gone already.
LOG(WARNING) << "failed to create pipe: " << GetLastError();
CHROMIUM_LOG(WARNING) << "failed to create pipe: " << GetLastError();
return false;
}
@ -309,7 +309,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages(
input_state_.is_pending = true;
return true;
}
LOG(ERROR) << "pipe error: " << err;
CHROMIUM_LOG(ERROR) << "pipe error: " << err;
return false;
}
input_state_.is_pending = true;
@ -326,7 +326,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages(
} else {
if (input_overflow_buf_.size() > (kMaximumMessageSize - bytes_read)) {
input_overflow_buf_.clear();
LOG(ERROR) << "IPC message is too big";
CHROMIUM_LOG(ERROR) << "IPC message is too big";
return false;
}
input_overflow_buf_.append(input_buf_, bytes_read);
@ -376,7 +376,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages(
output_state_.is_pending = false;
if (!context || bytes_written == 0) {
DWORD err = GetLastError();
LOG(ERROR) << "pipe error: " << err;
CHROMIUM_LOG(ERROR) << "pipe error: " << err;
return false;
}
// Message was sent.
@ -411,7 +411,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages(
return true;
}
LOG(ERROR) << "pipe error: " << err;
CHROMIUM_LOG(ERROR) << "pipe error: " << err;
return false;
}

View File

@ -24,7 +24,7 @@ MachMessageSource::MachMessageSource(mach_port_t port,
NULL));
if (cf_mach_port_ref.get() == NULL) {
LOG(WARNING) << "CFMachPortCreate failed";
CHROMIUM_LOG(WARNING) << "CFMachPortCreate failed";
*success = false;
return;
}
@ -36,7 +36,7 @@ MachMessageSource::MachMessageSource(mach_port_t port,
0));
if (machport_runloop_ref_.get() == NULL) {
LOG(WARNING) << "CFMachPortCreateRunLoopSource failed";
CHROMIUM_LOG(WARNING) << "CFMachPortCreateRunLoopSource failed";
*success = false;
return;
}

View File

@ -125,8 +125,8 @@ NotificationService::~NotificationService() {
// This may not be completely fixable -- see
// http://code.google.com/p/chromium/issues/detail?id=11010 .
// But any new leaks should be fixed.
LOG(WARNING) << observer_counts_[i] << " notification observer(s) leaked"
<< " of notification type " << i;
CHROMIUM_LOG(WARNING) << observer_counts_[i] << " notification observer(s) leaked"
<< " of notification type " << i;
}
}
#endif

View File

@ -115,8 +115,8 @@ private:
WaitForChildExit();
}
else {
LOG(ERROR) << "Failed to deliver SIGKILL to " << process_ << "!"
<< "("<< errno << ").";
CHROMIUM_LOG(ERROR) << "Failed to deliver SIGKILL to " << process_ << "!"
<< "("<< errno << ").";
}
process_ = 0;
}

View File

@ -43,9 +43,9 @@ TransportDIB* TransportDIB::Create(size_t size, uint32_t sequence_num) {
TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) {
TransportDIB* dib = new TransportDIB(handle);
if (!dib->shared_memory_.Map(0 /* map whole shared memory segment */)) {
LOG(ERROR) << "Failed to map transport DIB"
<< " handle:" << handle
<< " error:" << GetLastError();
CHROMIUM_LOG(ERROR) << "Failed to map transport DIB"
<< " handle:" << handle
<< " error:" << GetLastError();
delete dib;
return NULL;
}

View File

@ -57,13 +57,13 @@
#include "nsServiceManagerUtils.h"
#include "nsCOMPtr.h"
#undef LOG
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GonkDBus", args);
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GonkDBus", args);
#else
#define BTDEBUG true
#define LOG(args...) if (BTDEBUG) printf(args);
#define CHROMIUM_LOG(args...) if (BTDEBUG) printf(args);
#endif
namespace mozilla {

View File

@ -20,12 +20,12 @@
#include "nsAutoPtr.h"
#include "DBusUtils.h"
#undef LOG
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#else
#define LOG(args...) printf(args);
#define CHROMIUM_LOG(args...) printf(args);
#endif
namespace mozilla {
@ -72,11 +72,11 @@ void
log_and_free_dbus_error(DBusError* err, const char* function, DBusMessage* msg)
{
if (msg) {
LOG("%s: D-Bus error in %s: %s (%s)", function,
dbus_message_get_member((msg)), (err)->name, (err)->message);
CHROMIUM_LOG("%s: D-Bus error in %s: %s (%s)", function,
dbus_message_get_member((msg)), (err)->name, (err)->message);
} else {
LOG("%s: D-Bus error: %s (%s)", __FUNCTION__,
(err)->name, (err)->message);
CHROMIUM_LOG("%s: D-Bus error: %s (%s)", __FUNCTION__,
(err)->name, (err)->message);
}
dbus_error_free((err));
}

View File

@ -12,15 +12,15 @@
#include "DBusUtils.h"
#include "RawDBusConnection.h"
#ifdef LOG
#undef LOG
#ifdef CHROMIUM_LOG
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#else
#define LOG(args...) printf(args);
#define CHROMIUM_LOG(args...) printf(args);
#endif
/* TODO: Remove BlueZ constant */
@ -288,13 +288,13 @@ DBusMessage* RawDBusConnection::BuildDBusMessage(const char* aPath,
DBusMessage* msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC,
aPath, aIntf, aFunc);
if (!msg) {
LOG("Could not allocate D-Bus message object!");
CHROMIUM_LOG("Could not allocate D-Bus message object!");
return nullptr;
}
/* append arguments */
if (!dbus_message_append_args_valist(msg, aFirstArgType, aArgs)) {
LOG("Could not append argument to method call!");
CHROMIUM_LOG("Could not append argument to method call!");
dbus_message_unref(msg);
return nullptr;
}

View File

@ -679,32 +679,32 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
kern_return_t err = parent_recv_port.WaitForMessage(&child_message, kTimeoutMs);
if (err != KERN_SUCCESS) {
std::string errString = StringPrintf("0x%x %s", err, mach_error_string(err));
LOG(ERROR) << "parent WaitForMessage() failed: " << errString;
CHROMIUM_LOG(ERROR) << "parent WaitForMessage() failed: " << errString;
return false;
}
task_t child_task = child_message.GetTranslatedPort(0);
if (child_task == MACH_PORT_NULL) {
LOG(ERROR) << "parent GetTranslatedPort(0) failed.";
CHROMIUM_LOG(ERROR) << "parent GetTranslatedPort(0) failed.";
return false;
}
if (child_message.GetTranslatedPort(1) == MACH_PORT_NULL) {
LOG(ERROR) << "parent GetTranslatedPort(1) failed.";
CHROMIUM_LOG(ERROR) << "parent GetTranslatedPort(1) failed.";
return false;
}
MachPortSender parent_sender(child_message.GetTranslatedPort(1));
MachSendMessage parent_message(/* id= */0);
if (!parent_message.AddDescriptor(bootstrap_port)) {
LOG(ERROR) << "parent AddDescriptor(" << bootstrap_port << ") failed.";
CHROMIUM_LOG(ERROR) << "parent AddDescriptor(" << bootstrap_port << ") failed.";
return false;
}
err = parent_sender.SendMessage(parent_message, kTimeoutMs);
if (err != KERN_SUCCESS) {
std::string errString = StringPrintf("0x%x %s", err, mach_error_string(err));
LOG(ERROR) << "parent SendMessage() failed: " << errString;
CHROMIUM_LOG(ERROR) << "parent SendMessage() failed: " << errString;
return false;
}
#endif

View File

@ -7,12 +7,12 @@
#include <fcntl.h>
#include <sys/stat.h>
#undef LOG
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define LOG(args...) printf(args);
#define CHROMIUM_LOG(args...) printf(args);
#endif
#include "KeyStore.h"

View File

@ -18,7 +18,7 @@
#include "nsThreadUtils.h"
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#define ICS_SYS_USB_RNDIS_MAC "/sys/class/android_usb/android0/f_rndis/ethaddr"
#define INVALID_SOCKET -1
#define MAX_RECONNECT_TIMES 10
@ -53,7 +53,7 @@ InitRndisAddress()
fd.rwget() = open(ICS_SYS_USB_RNDIS_MAC, O_WRONLY);
if (fd.rwget() == -1) {
LOG("Unable to open file %s.", ICS_SYS_USB_RNDIS_MAC);
CHROMIUM_LOG("Unable to open file %s.", ICS_SYS_USB_RNDIS_MAC);
return false;
}
@ -73,7 +73,7 @@ InitRndisAddress()
length = strlen(mac);
ret = write(fd.get(), mac, length);
if (ret != length) {
LOG("Fail to write file %s.", ICS_SYS_USB_RNDIS_MAC);
CHROMIUM_LOG("Fail to write file %s.", ICS_SYS_USB_RNDIS_MAC);
return false;
}
return true;
@ -106,23 +106,23 @@ NetdClient::OpenSocket()
ANDROID_SOCKET_NAMESPACE_RESERVED,
SOCK_STREAM);
if (mSocket.rwget() < 0) {
LOG("Error connecting to : netd (%s) - will retry", strerror(errno));
CHROMIUM_LOG("Error connecting to : netd (%s) - will retry", strerror(errno));
return false;
}
// Add FD_CLOEXEC flag.
int flags = fcntl(mSocket.get(), F_GETFD);
if (flags == -1) {
LOG("Error doing fcntl with F_GETFD command(%s)", strerror(errno));
CHROMIUM_LOG("Error doing fcntl with F_GETFD command(%s)", strerror(errno));
return false;
}
flags |= FD_CLOEXEC;
if (fcntl(mSocket.get(), F_SETFD, flags) == -1) {
LOG("Error doing fcntl with F_SETFD command(%s)", strerror(errno));
CHROMIUM_LOG("Error doing fcntl with F_SETFD command(%s)", strerror(errno));
return false;
}
// Set non-blocking.
if (fcntl(mSocket.get(), F_SETFL, O_NONBLOCK) == -1) {
LOG("Error set non-blocking socket(%s)", strerror(errno));
CHROMIUM_LOG("Error set non-blocking socket(%s)", strerror(errno));
return false;
}
if (!MessageLoopForIO::current()->
@ -131,7 +131,7 @@ NetdClient::OpenSocket()
MessageLoopForIO::WATCH_READ,
&mReadWatcher,
this)) {
LOG("Error set socket read watcher(%s)", strerror(errno));
CHROMIUM_LOG("Error set socket read watcher(%s)", strerror(errno));
return false;
}
@ -144,7 +144,7 @@ NetdClient::OpenSocket()
this);
}
LOG("Connected to netd");
CHROMIUM_LOG("Connected to netd");
return true;
}
@ -165,7 +165,7 @@ void NetdClient::OnLineRead(int aFd, nsDependentCSubstring& aMessage)
}
if (!responseCode) {
LOG("Can't parse netd's response");
CHROMIUM_LOG("Can't parse netd's response");
}
}
@ -201,15 +201,15 @@ NetdClient::Start()
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
if (!gNetdClient) {
LOG("Netd Client is not initialized");
CHROMIUM_LOG("Netd Client is not initialized");
return;
}
if (!gNetdClient->OpenSocket()) {
// Socket open failed, try again in a second.
LOG("Fail to connect to Netd");
CHROMIUM_LOG("Fail to connect to Netd");
if (++gNetdClient->mReConnectTimes > MAX_RECONNECT_TIMES) {
LOG("Fail to connect to Netd after retry %d times", MAX_RECONNECT_TIMES);
CHROMIUM_LOG("Fail to connect to Netd after retry %d times", MAX_RECONNECT_TIMES);
return;
}
@ -230,14 +230,14 @@ NetdClient::SendNetdCommandIOThread(NetdCommand* aMessage)
MOZ_ASSERT(aMessage);
if (!gNetdClient) {
LOG("Netd Client is not initialized");
CHROMIUM_LOG("Netd Client is not initialized");
return;
}
gNetdClient->mOutgoingQ.push(aMessage);
if (gNetdClient->mSocket.get() == INVALID_SOCKET) {
LOG("Netd connection is not established, push the message to queue");
CHROMIUM_LOG("Netd connection is not established, push the message to queue");
return;
}
@ -259,7 +259,7 @@ NetdClient::WriteNetdCommand()
mCurrentNetdCommand->mData + mCurrentWriteOffset,
write_amount);
if (written < 0) {
LOG("Cannot write to network, error %d\n", (int) written);
CHROMIUM_LOG("Cannot write to network, error %d\n", (int) written);
OnError();
return;
}
@ -269,7 +269,7 @@ NetdClient::WriteNetdCommand()
}
if (written != write_amount) {
LOG("WriteNetdCommand fail !!! Write is not completed");
CHROMIUM_LOG("WriteNetdCommand fail !!! Write is not completed");
break;
}
}
@ -304,7 +304,7 @@ InitNetdIOThread()
// usb tethering only. Others service such as wifi tethering still need
// to use ipc to communicate with netd.
if (!result) {
LOG("fail to give rndis interface an address");
CHROMIUM_LOG("fail to give rndis interface an address");
}
}
gNetdClient = new NetdClient();

View File

@ -12,12 +12,12 @@
#include <sys/socket.h>
#include <sys/un.h>
#undef LOG
#undef CHROMIUM_LOG
#if (defined(MOZ_WIDGET_GONK) && defined(DEBUG))
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define LOG(args...)
#define CHROMIUM_LOG(args...)
#endif
#include "jsfriendapi.h"
@ -328,20 +328,20 @@ void
NfcConsumer::OnConnectSuccess()
{
// Nothing to do here.
LOG("NFC: %s\n", __FUNCTION__);
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
}
void
NfcConsumer::OnConnectError()
{
LOG("NFC: %s\n", __FUNCTION__);
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
CloseSocket();
}
void
NfcConsumer::OnDisconnect()
{
LOG("NFC: %s\n", __FUNCTION__);
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
if (!mShutdown) {
ConnectSocket(new NfcConnector(), mAddress.get(), 1000);
}

View File

@ -11,12 +11,12 @@
#include <sys/un.h>
#include <netdb.h> // For gethostbyname.
#undef LOG
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define LOG(args...) printf(args);
#define CHROMIUM_LOG(args...) printf(args);
#endif
#include "jsfriendapi.h"
@ -361,20 +361,20 @@ void
RilConsumer::OnConnectSuccess()
{
// Nothing to do here.
LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
CHROMIUM_LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
}
void
RilConsumer::OnConnectError()
{
LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
CHROMIUM_LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
CloseSocket();
}
void
RilConsumer::OnDisconnect()
{
LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
CHROMIUM_LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
if (!mShutdown) {
ConnectSocket(new RilConnector(mClientId), mAddress.get(), 1000);
}

View File

@ -24,13 +24,13 @@
static const size_t MAX_READ_SIZE = 1 << 16;
#undef LOG
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GonkDBus", args);
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GonkDBus", args);
#else
#define BTDEBUG true
#define LOG(args...) if (BTDEBUG) printf(args);
#define CHROMIUM_LOG(args...) if (BTDEBUG) printf(args);
#endif
static const int SOCKET_RETRY_TIME_MS = 1000;
@ -515,14 +515,14 @@ UnixSocketImpl::Accept()
if (bind(mFd.get(), (struct sockaddr*)&mAddr, mAddrSize)) {
#ifdef DEBUG
LOG("...bind(%d) gave errno %d", mFd.get(), errno);
CHROMIUM_LOG("...bind(%d) gave errno %d", mFd.get(), errno);
#endif
return;
}
if (listen(mFd.get(), 1)) {
#ifdef DEBUG
LOG("...listen(%d) gave errno %d", mFd.get(), errno);
CHROMIUM_LOG("...listen(%d) gave errno %d", mFd.get(), errno);
#endif
return;
}
@ -609,12 +609,12 @@ UnixSocketImpl::Connect()
this);
#ifdef DEBUG
LOG("UnixSocket Connection delayed!");
CHROMIUM_LOG("UnixSocket Connection delayed!");
#endif
return;
}
#if DEBUG
LOG("Socket connect errno=%d\n", errno);
CHROMIUM_LOG("Socket connect errno=%d\n", errno);
#endif
mFd.reset(-1);
nsRefPtr<OnSocketEventTask> t =