Replace most LOG/CHECK statements with DLOG/DCHECK statements in base.
[ Reland of 107042 http://codereview.chromium.org/8368009 ]
I tried hard not to change CHECKs that had side effects. I kept fatal checks
that seemed security or debugging-info (in crash reports) sensitive, and ones
that seems particularly well-conceived.
Review URL: http://codereview.chromium.org/8341026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107434 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: a42d4638f0335dbfd14c1c9f6b05a7b09703a78e
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
index b7973e8..97bbf90 100644
--- a/base/allocator/allocator_shim.cc
+++ b/base/allocator/allocator_shim.cc
@@ -297,7 +297,7 @@
char* secondary_value = secondary_length ? buffer : "TCMALLOC";
// Force renderer (or other subprocesses) to use secondary_value.
int ret_val = _putenv_s(primary_name, secondary_value);
- CHECK_EQ(0, ret_val);
+ DCHECK_EQ(0, ret_val);
}
#endif // ENABLE_DYNAMIC_ALLOCATOR_SWITCHING
}
diff --git a/base/android/jni_array.cc b/base/android/jni_array.cc
index 08cb42e..ae2f185 100644
--- a/base/android/jni_array.cc
+++ b/base/android/jni_array.cc
@@ -17,7 +17,7 @@
size_t len) {
jbyteArray byte_array = env->NewByteArray(len);
CheckException(env);
- CHECK(byte_array);
+ DCHECK(byte_array);
jbyte* elements = env->GetByteArrayElements(byte_array, NULL);
memcpy(elements, bytes, len);
diff --git a/base/base_paths_linux.cc b/base/base_paths_linux.cc
index 82f4841..36d5ee7 100644
--- a/base/base_paths_linux.cc
+++ b/base/base_paths_linux.cc
@@ -88,8 +88,8 @@
*result = path;
return true;
} else {
- LOG(WARNING) << "CR_SOURCE_ROOT is set, but it appears to not "
- << "point to the correct source root directory.";
+ DLOG(WARNING) << "CR_SOURCE_ROOT is set, but it appears to not "
+ << "point to the correct source root directory.";
}
}
// On POSIX, unit tests execute two levels deep from the source root.
@@ -118,8 +118,8 @@
*result = path;
return true;
}
- LOG(ERROR) << "Couldn't find your source root. "
- << "Try running from your chromium/src directory.";
+ DLOG(ERROR) << "Couldn't find your source root. "
+ << "Try running from your chromium/src directory.";
return false;
}
case base::DIR_CACHE:
diff --git a/base/command_line.cc b/base/command_line.cc
index 22977af..0237ffe 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -268,8 +268,8 @@
const std::string& switch_string) const {
StringType value = GetSwitchValueNative(switch_string);
if (!IsStringASCII(value)) {
- LOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII.";
- return "";
+ DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII.";
+ return std::string();
}
#if defined(OS_WIN)
return WideToASCII(value);
@@ -394,8 +394,8 @@
wchar_t** args = NULL;
args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args);
- PLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: " <<
- command_line;
+ DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: "
+ << command_line;
InitFromArgv(num_args, args);
LocalFree(args);
}
diff --git a/base/debug/debugger.cc b/base/debug/debugger.cc
index 3777fa1..a0d8a92 100644
--- a/base/debug/debugger.cc
+++ b/base/debug/debugger.cc
@@ -15,8 +15,8 @@
#if defined(OS_ANDROID)
// The pid from which we know which process to attach to are not output by
// android ddms, so we have to print it out explicitly.
- LOG(INFO) << "DebugUtil::WaitForDebugger(pid=" << static_cast<int>(getpid())
- << ")";
+ DLOG(INFO) << "DebugUtil::WaitForDebugger(pid=" << static_cast<int>(getpid())
+ << ")";
#endif
for (int i = 0; i < wait_seconds * 10; ++i) {
if (BeingDebugged()) {
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
index 8b24cca..63f057f 100644
--- a/base/debug/trace_event.cc
+++ b/base/debug/trace_event.cc
@@ -322,7 +322,7 @@
const TraceCategory* TraceLog::GetCategory(const char* name) {
TraceLog* tracelog = GetInstance();
if (!tracelog){
- CHECK(!g_category_already_shutdown->enabled);
+ DCHECK(!g_category_already_shutdown->enabled);
return g_category_already_shutdown;
}
return tracelog->GetCategoryInternal(name);
diff --git a/base/dir_reader_posix_unittest.cc b/base/dir_reader_posix_unittest.cc
index 5aefb9a..a6adfdb 100644
--- a/base/dir_reader_posix_unittest.cc
+++ b/base/dir_reader_posix_unittest.cc
@@ -27,10 +27,10 @@
char kDirTemplate[] = "/tmp/org.chromium.dir-reader-posix-XXXXXX";
const char* dir = mkdtemp(kDirTemplate);
- CHECK(dir);
+ ASSERT_TRUE(dir);
const int prev_wd = open(".", O_RDONLY | O_DIRECTORY);
- CHECK_GE(prev_wd, 0);
+ DCHECK_GE(prev_wd, 0);
PCHECK(chdir(dir) == 0);
diff --git a/base/file_util.cc b/base/file_util.cc
index e9f1d4e..dc186d9 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -342,7 +342,7 @@
NULL, NULL);
if (file_ == base::kInvalidPlatformFileValue) {
- LOG(ERROR) << "Couldn't open " << file_name.value();
+ DLOG(ERROR) << "Couldn't open " << file_name.value();
return false;
}
diff --git a/base/file_util.h b/base/file_util.h
index b0c2459..90ec1ae 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -426,7 +426,7 @@
inline void operator()(int* x) const {
if (x && *x >= 0) {
if (HANDLE_EINTR(close(*x)) < 0)
- PLOG(ERROR) << "close";
+ DPLOG(ERROR) << "close";
}
}
};
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 8d9fb29..c365869 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -95,33 +95,33 @@
const std::set<gid_t>& group_gids) {
stat_wrapper_t stat_info;
if (CallLstat(path.value().c_str(), &stat_info) != 0) {
- PLOG(ERROR) << "Failed to get information on path "
- << path.value();
+ DPLOG(ERROR) << "Failed to get information on path "
+ << path.value();
return false;
}
if (S_ISLNK(stat_info.st_mode)) {
- LOG(ERROR) << "Path " << path.value()
+ DLOG(ERROR) << "Path " << path.value()
<< " is a symbolic link.";
return false;
}
if (stat_info.st_uid != owner_uid) {
- LOG(ERROR) << "Path " << path.value()
- << " is owned by the wrong user.";
+ DLOG(ERROR) << "Path " << path.value()
+ << " is owned by the wrong user.";
return false;
}
if ((stat_info.st_mode & S_IWGRP) &&
!ContainsKey(group_gids, stat_info.st_gid)) {
- LOG(ERROR) << "Path " << path.value()
- << " is writable by an unprivileged group.";
+ DLOG(ERROR) << "Path " << path.value()
+ << " is writable by an unprivileged group.";
return false;
}
if (stat_info.st_mode & S_IWOTH) {
- LOG(ERROR) << "Path " << path.value()
- << " is writable by any user.";
+ DLOG(ERROR) << "Path " << path.value()
+ << " is writable by any user.";
return false;
}
@@ -173,7 +173,7 @@
stat_wrapper_t st;
int test = CallStat(path.Append(ent->d_name).value().c_str(), &st);
if (test != 0) {
- PLOG(ERROR) << "stat64 failed";
+ DPLOG(ERROR) << "stat64 failed";
continue;
}
// Here, we use Time::TimeT(), which discards microseconds. This
@@ -322,8 +322,8 @@
FileEnumerator::FindInfo info;
FilePath current = from_path;
if (stat(from_path.value().c_str(), &info.stat) < 0) {
- LOG(ERROR) << "CopyDirectory() couldn't stat source directory: " <<
- from_path.value() << " errno = " << errno;
+ DLOG(ERROR) << "CopyDirectory() couldn't stat source directory: "
+ << from_path.value() << " errno = " << errno;
success = false;
}
struct stat to_path_stat;
@@ -353,19 +353,19 @@
if (S_ISDIR(info.stat.st_mode)) {
if (mkdir(target_path.value().c_str(), info.stat.st_mode & 01777) != 0 &&
errno != EEXIST) {
- LOG(ERROR) << "CopyDirectory() couldn't create directory: " <<
- target_path.value() << " errno = " << errno;
+ DLOG(ERROR) << "CopyDirectory() couldn't create directory: "
+ << target_path.value() << " errno = " << errno;
success = false;
}
} else if (S_ISREG(info.stat.st_mode)) {
if (!CopyFile(current, target_path)) {
- LOG(ERROR) << "CopyDirectory() couldn't create file: " <<
- target_path.value();
+ DLOG(ERROR) << "CopyDirectory() couldn't create file: "
+ << target_path.value();
success = false;
}
} else {
- LOG(WARNING) << "CopyDirectory() skipping non-regular file: " <<
- current.value();
+ DLOG(WARNING) << "CopyDirectory() skipping non-regular file: "
+ << current.value();
}
current = traversal.Next();
@@ -511,8 +511,8 @@
const FilePath::StringType& name_tmpl,
FilePath* new_dir) {
base::ThreadRestrictions::AssertIOAllowed(); // For call to mkdtemp().
- CHECK(name_tmpl.find("XXXXXX") != FilePath::StringType::npos)
- << "Directory name template must contain \"XXXXXX\".";
+ DCHECK(name_tmpl.find("XXXXXX") != FilePath::StringType::npos)
+ << "Directory name template must contain \"XXXXXX\".";
FilePath sub_dir = base_dir.Append(name_tmpl);
std::string sub_dir_string = sub_dir.value();
@@ -823,8 +823,8 @@
// Print the stat() error message unless it was ENOENT and we're
// following symlinks.
if (!(errno == ENOENT && !show_links)) {
- PLOG(ERROR) << "Couldn't stat "
- << source.Append(dent->d_name).value();
+ DPLOG(ERROR) << "Couldn't stat "
+ << source.Append(dent->d_name).value();
}
memset(&info.stat, 0, sizeof(info.stat));
}
@@ -849,7 +849,7 @@
struct stat file_stat;
if (fstat(file_, &file_stat) == base::kInvalidPlatformFileValue) {
- LOG(ERROR) << "Couldn't fstat " << file_ << ", errno " << errno;
+ DLOG(ERROR) << "Couldn't fstat " << file_ << ", errno " << errno;
return false;
}
length_ = file_stat.st_size;
@@ -857,7 +857,7 @@
data_ = static_cast<uint8*>(
mmap(NULL, length_, PROT_READ, MAP_SHARED, file_, 0));
if (data_ == MAP_FAILED)
- LOG(ERROR) << "Couldn't mmap " << file_ << ", errno " << errno;
+ DLOG(ERROR) << "Couldn't mmap " << file_ << ", errno " << errno;
return data_ != MAP_FAILED;
}
@@ -927,7 +927,7 @@
return FilePath(home_dir);
#if defined(OS_ANDROID)
- LOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented.";
+ DLOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented.";
#else
// g_get_home_dir calls getpwent, which can fall through to LDAP calls.
base::ThreadRestrictions::AssertIOAllowed();
@@ -998,8 +998,8 @@
uid_t owner_uid,
const std::set<gid_t>& group_gids) {
if (base != path && !base.IsParent(path)) {
- LOG(ERROR) << "|base| must be a subdirectory of |path|. base = \""
- << base.value() << "\", path = \"" << path.value() << "\"";
+ DLOG(ERROR) << "|base| must be a subdirectory of |path|. base = \""
+ << base.value() << "\", path = \"" << path.value() << "\"";
return false;
}
@@ -1015,8 +1015,8 @@
// |base| must be a subpath of |path|, so all components should match.
// If these CHECKs fail, look at the test that base is a parent of
// path at the top of this function.
- CHECK(ip != path_components.end());
- CHECK(*ip == *ib);
+ DCHECK(ip != path_components.end());
+ DCHECK(*ip == *ib);
}
FilePath current_path = base;
@@ -1050,8 +1050,8 @@
for (int i = 0, ie = arraysize(kAdminGroupNames); i < ie; ++i) {
struct group *group_record = getgrnam(kAdminGroupNames[i]);
if (!group_record) {
- PLOG(ERROR) << "Could not get the group ID of group \""
- << kAdminGroupNames[i] << "\".";
+ DPLOG(ERROR) << "Could not get the group ID of group \""
+ << kAdminGroupNames[i] << "\".";
continue;
}
diff --git a/base/global_descriptors_posix.cc b/base/global_descriptors_posix.cc
index 65e7955..d8884a5 100644
--- a/base/global_descriptors_posix.cc
+++ b/base/global_descriptors_posix.cc
@@ -23,7 +23,7 @@
const int ret = MaybeGet(key);
if (ret == -1)
- LOG(FATAL) << "Unknown global descriptor: " << key;
+ DLOG(FATAL) << "Unknown global descriptor: " << key;
return ret;
}
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index 4f17f17..e5bbe17 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -68,13 +68,13 @@
HMODULE module = LoadLibrary(data_path.value().c_str());
if (!module) {
- LOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME;
+ DLOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME;
return false;
}
FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL);
if (!addr) {
- LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in "
+ DLOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in "
<< ICU_UTIL_DATA_SHARED_MODULE_NAME;
return false;
}
@@ -113,11 +113,11 @@
FilePath data_path =
base::mac::PathForMainAppBundleResource(CFSTR(ICU_UTIL_DATA_FILE_NAME));
if (data_path.empty()) {
- LOG(ERROR) << ICU_UTIL_DATA_FILE_NAME << " not found in bundle";
+ DLOG(ERROR) << ICU_UTIL_DATA_FILE_NAME << " not found in bundle";
return false;
}
if (!mapped_file.Initialize(data_path)) {
- LOG(ERROR) << "Couldn't mmap " << data_path.value();
+ DLOG(ERROR) << "Couldn't mmap " << data_path.value();
return false;
}
}
diff --git a/base/i18n/time_formatting.cc b/base/i18n/time_formatting.cc
index 419e8db..9906dba 100644
--- a/base/i18n/time_formatting.cc
+++ b/base/i18n/time_formatting.cc
@@ -75,15 +75,15 @@
UErrorCode status = U_ZERO_ERROR;
scoped_ptr<icu::DateTimePatternGenerator> generator(
icu::DateTimePatternGenerator::createInstance(status));
- CHECK(U_SUCCESS(status));
+ DCHECK(U_SUCCESS(status));
const char* base_pattern = (type == k12HourClock ? "ahm" : "Hm");
icu::UnicodeString generated_pattern =
generator->getBestPattern(icu::UnicodeString(base_pattern), status);
- CHECK(U_SUCCESS(status));
+ DCHECK(U_SUCCESS(status));
// Then, format the time using the generated pattern.
icu::SimpleDateFormat formatter(generated_pattern, status);
- CHECK(U_SUCCESS(status));
+ DCHECK(U_SUCCESS(status));
if (ampm == kKeepAmPm) {
return TimeFormat(&formatter, time);
} else {
diff --git a/base/linux_util.cc b/base/linux_util.cc
index c0757fa..6751469 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -88,7 +88,7 @@
const ssize_t n = readlink(path, buf, sizeof(buf) - 1);
if (n == -1) {
if (log) {
- LOG(WARNING) << "Failed to read the inode number for a socket from /proc"
+ DLOG(WARNING) << "Failed to read the inode number for a socket from /proc"
"(" << errno << ")";
}
return false;
@@ -97,8 +97,8 @@
if (memcmp(kSocketLinkPrefix, buf, sizeof(kSocketLinkPrefix) - 1)) {
if (log) {
- LOG(WARNING) << "The descriptor passed from the crashing process wasn't a"
- " UNIX domain socket.";
+ DLOG(WARNING) << "The descriptor passed from the crashing process wasn't "
+ " a UNIX domain socket.";
}
return false;
}
@@ -111,8 +111,8 @@
if (inode_ul == ULLONG_MAX) {
if (log) {
- LOG(WARNING) << "Failed to parse a socket's inode number: the number was "
- "too large. Please report this bug: " << buf;
+ DLOG(WARNING) << "Failed to parse a socket's inode number: the number "
+ "was too large. Please report this bug: " << buf;
}
return false;
}
@@ -201,7 +201,7 @@
DIR* proc = opendir("/proc");
if (!proc) {
- LOG(WARNING) << "Cannot open /proc";
+ DLOG(WARNING) << "Cannot open /proc";
return false;
}
@@ -263,7 +263,7 @@
DIR* task = opendir(buf);
if (!task) {
- LOG(WARNING) << "Cannot open " << buf;
+ DLOG(WARNING) << "Cannot open " << buf;
return -1;
}
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 593c03c..553efb1 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -258,7 +258,7 @@
void MessageLoop::PostTask(
const tracked_objects::Location& from_here, Task* task) {
- CHECK(task);
+ DCHECK(task);
PendingTask pending_task(
base::Bind(
&base::subtle::TaskClosureAdapter::Run,
@@ -270,7 +270,7 @@
void MessageLoop::PostDelayedTask(
const tracked_objects::Location& from_here, Task* task, int64 delay_ms) {
- CHECK(task);
+ DCHECK(task);
PendingTask pending_task(
base::Bind(
&base::subtle::TaskClosureAdapter::Run,
@@ -282,7 +282,7 @@
void MessageLoop::PostNonNestableTask(
const tracked_objects::Location& from_here, Task* task) {
- CHECK(task);
+ DCHECK(task);
PendingTask pending_task(
base::Bind(
&base::subtle::TaskClosureAdapter::Run,
@@ -294,7 +294,7 @@
void MessageLoop::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here, Task* task, int64 delay_ms) {
- CHECK(task);
+ DCHECK(task);
PendingTask pending_task(
base::Bind(
&base::subtle::TaskClosureAdapter::Run,
@@ -306,7 +306,7 @@
void MessageLoop::PostTask(
const tracked_objects::Location& from_here, const base::Closure& task) {
- CHECK(!task.is_null()) << from_here.ToString();
+ DCHECK(!task.is_null()) << from_here.ToString();
PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), true);
AddToIncomingQueue(&pending_task);
}
@@ -314,7 +314,7 @@
void MessageLoop::PostDelayedTask(
const tracked_objects::Location& from_here, const base::Closure& task,
int64 delay_ms) {
- CHECK(!task.is_null()) << from_here.ToString();
+ DCHECK(!task.is_null()) << from_here.ToString();
PendingTask pending_task(task, from_here,
CalculateDelayedRuntime(delay_ms), true);
AddToIncomingQueue(&pending_task);
@@ -322,7 +322,7 @@
void MessageLoop::PostNonNestableTask(
const tracked_objects::Location& from_here, const base::Closure& task) {
- CHECK(!task.is_null()) << from_here.ToString();
+ DCHECK(!task.is_null()) << from_here.ToString();
PendingTask pending_task(task, from_here, CalculateDelayedRuntime(0), false);
AddToIncomingQueue(&pending_task);
}
@@ -330,7 +330,7 @@
void MessageLoop::PostNonNestableDelayedTask(
const tracked_objects::Location& from_here, const base::Closure& task,
int64 delay_ms) {
- CHECK(!task.is_null()) << from_here.ToString();
+ DCHECK(!task.is_null()) << from_here.ToString();
PendingTask pending_task(task, from_here,
CalculateDelayedRuntime(delay_ms), false);
AddToIncomingQueue(&pending_task);
diff --git a/base/message_pump_glib.cc b/base/message_pump_glib.cc
index 20fc8ea..19a0eea 100644
--- a/base/message_pump_glib.cc
+++ b/base/message_pump_glib.cc
@@ -145,7 +145,10 @@
wakeup_gpollfd_(new GPollFD) {
// Create our wakeup pipe, which is used to flag when work was scheduled.
int fds[2];
- CHECK_EQ(pipe(fds), 0);
+ int ret = pipe(fds);
+ DCHECK_EQ(ret, 0);
+ (void)ret; // Prevent warning in release mode.
+
wakeup_pipe_read_ = fds[0];
wakeup_pipe_write_ = fds[1];
wakeup_gpollfd_->fd = wakeup_pipe_read_;
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index 1b4c023..9bef229 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -129,11 +129,11 @@
delete wakeup_event_;
if (wakeup_pipe_in_ >= 0) {
if (HANDLE_EINTR(close(wakeup_pipe_in_)) < 0)
- PLOG(ERROR) << "close";
+ DPLOG(ERROR) << "close";
}
if (wakeup_pipe_out_ >= 0) {
if (HANDLE_EINTR(close(wakeup_pipe_out_)) < 0)
- PLOG(ERROR) << "close";
+ DPLOG(ERROR) << "close";
}
event_base_free(event_base_);
}
diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc
index a9b1b8a..15276e4 100644
--- a/base/message_pump_x.cc
+++ b/base/message_pump_x.cc
@@ -66,7 +66,7 @@
int event, err;
if (!XQueryExtension(display, "XInputExtension", &xiopcode, &event, &err)) {
- VLOG(1) << "X Input extension not available.";
+ DVLOG(1) << "X Input extension not available.";
xiopcode = -1;
return;
}
@@ -78,13 +78,13 @@
int major = 2, minor = 0;
#endif
if (XIQueryVersion(display, &major, &minor) == BadRequest) {
- VLOG(1) << "XInput2 not supported in the server.";
+ DVLOG(1) << "XInput2 not supported in the server.";
xiopcode = -1;
return;
}
#if defined(USE_XI2_MT)
if (major < 2 || (major == 2 && minor < USE_XI2_MT)) {
- VLOG(1) << "XI version on server is " << major << "." << minor << ". "
+ DVLOG(1) << "XI version on server is " << major << "." << minor << ". "
<< "But 2." << USE_XI2_MT << " is required.";
xiopcode = -1;
return;
@@ -148,7 +148,7 @@
DCHECK(!x_source_);
GPollFD* x_poll = new GPollFD();
Display* display = GetDefaultXDisplay();
- CHECK(display) << "Unable to get connection to X server";
+ DCHECK(display) << "Unable to get connection to X server";
x_poll->fd = ConnectionNumber(display);
x_poll->events = G_IO_IN;
@@ -186,7 +186,7 @@
should_quit = true;
Quit();
} else if (status == MessagePumpDispatcher::EVENT_IGNORED) {
- VLOG(1) << "Event (" << xev->type << ") not handled.";
+ DVLOG(1) << "Event (" << xev->type << ") not handled.";
}
DidProcessXEvent(xev);
}
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index 484d095..7077b09 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -268,7 +268,7 @@
!pickle.ReadInt(&iter, &histogram_type) ||
!pickle.ReadInt(&iter, &pickle_flags) ||
!sample.Histogram::SampleSet::Deserialize(&iter, pickle)) {
- LOG(ERROR) << "Pickle error decoding Histogram: " << histogram_name;
+ DLOG(ERROR) << "Pickle error decoding Histogram: " << histogram_name;
return false;
}
DCHECK(pickle_flags & kIPCSerializationSourceFlag);
@@ -276,7 +276,7 @@
// 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;
+ DLOG(ERROR) << "Values error decoding Histogram: " << histogram_name;
return false;
}
@@ -295,8 +295,8 @@
} else if (histogram_type == BOOLEAN_HISTOGRAM) {
render_histogram = BooleanHistogram::FactoryGet(histogram_name, flags);
} else {
- LOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: "
- << histogram_type;
+ DLOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: "
+ << histogram_type;
return false;
}
@@ -433,7 +433,7 @@
if (StatisticsRecorder::dump_on_exit()) {
std::string output;
WriteAscii(true, "\n", &output);
- LOG(INFO) << output;
+ DLOG(INFO) << output;
}
// Just to make sure most derived class did this properly...
@@ -1025,7 +1025,7 @@
if (dump_on_exit_) {
std::string output;
WriteGraph("", &output);
- LOG(INFO) << output;
+ DLOG(INFO) << output;
}
// Clean up.
HistogramMap* histograms = NULL;
diff --git a/base/metrics/stats_table.cc b/base/metrics/stats_table.cc
index 3db008e..2bccc90 100644
--- a/base/metrics/stats_table.cc
+++ b/base/metrics/stats_table.cc
@@ -265,7 +265,7 @@
impl_ = Private::New(name, table_size, max_threads, max_counters);
if (!impl_)
- PLOG(ERROR) << "StatsTable did not initialize";
+ DPLOG(ERROR) << "StatsTable did not initialize";
}
StatsTable::~StatsTable() {
diff --git a/base/mime_util_xdg.cc b/base/mime_util_xdg.cc
index a25a0d5..294638d 100644
--- a/base/mime_util_xdg.cc
+++ b/base/mime_util_xdg.cc
@@ -371,7 +371,7 @@
while ((epos = dirs.find(',', pos)) != std::string::npos) {
TrimWhitespaceASCII(dirs.substr(pos, epos - pos), TRIM_ALL, &dir);
if (dir.length() == 0) {
- LOG(WARNING) << "Invalid index.theme: blank subdir";
+ DLOG(WARNING) << "Invalid index.theme: blank subdir";
return false;
}
subdirs_[dir] = num++;
@@ -379,7 +379,7 @@
}
TrimWhitespaceASCII(dirs.substr(pos), TRIM_ALL, &dir);
if (dir.length() == 0) {
- LOG(WARNING) << "Invalid index.theme: blank subdir";
+ DLOG(WARNING) << "Invalid index.theme: blank subdir";
return false;
}
subdirs_[dir] = num++;
diff --git a/base/native_library_linux.cc b/base/native_library_linux.cc
index bcc4ffb..4b82ff4 100644
--- a/base/native_library_linux.cc
+++ b/base/native_library_linux.cc
@@ -34,7 +34,7 @@
void UnloadNativeLibrary(NativeLibrary library) {
int ret = dlclose(library);
if (ret < 0) {
- LOG(ERROR) << "dlclose failed: " << dlerror();
+ DLOG(ERROR) << "dlclose failed: " << dlerror();
NOTREACHED();
}
}
diff --git a/base/process_linux.cc b/base/process_linux.cc
index dfdc20e..3f78a31 100644
--- a/base/process_linux.cc
+++ b/base/process_linux.cc
@@ -113,7 +113,7 @@
setpriority(
PRIO_PROCESS, process_, current_priority + kPriorityAdjustment);
if (result == -1) {
- LOG(ERROR) << "Failed to lower priority, errno: " << errno;
+ DLOG(ERROR) << "Failed to lower priority, errno: " << errno;
return false;
}
saved_priority_ = current_priority;
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index f9d151b..2f433d9 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -84,7 +84,7 @@
DIR* dir = opendir(path.value().c_str());
if (!dir) {
- PLOG(ERROR) << "opendir(" << path.value() << ")";
+ DPLOG(ERROR) << "opendir(" << path.value() << ")";
return -1;
}
@@ -273,7 +273,7 @@
size_t ProcessMetrics::GetPagefileUsage() const {
std::vector<std::string> proc_stats;
if (!GetProcStats(process_, &proc_stats))
- LOG(WARNING) << "Failed to get process stats.";
+ DLOG(WARNING) << "Failed to get process stats.";
const size_t kVmSize = 22;
if (proc_stats.size() > kVmSize) {
int vm_size;
@@ -287,7 +287,7 @@
size_t ProcessMetrics::GetPeakPagefileUsage() const {
std::vector<std::string> proc_stats;
if (!GetProcStats(process_, &proc_stats))
- LOG(WARNING) << "Failed to get process stats.";
+ DLOG(WARNING) << "Failed to get process stats.";
const size_t kVmPeak = 21;
if (proc_stats.size() > kVmPeak) {
int vm_peak;
@@ -301,7 +301,7 @@
size_t ProcessMetrics::GetWorkingSetSize() const {
std::vector<std::string> proc_stats;
if (!GetProcStats(process_, &proc_stats))
- LOG(WARNING) << "Failed to get process stats.";
+ DLOG(WARNING) << "Failed to get process stats.";
const size_t kVmRss = 23;
if (proc_stats.size() > kVmRss) {
int num_pages;
@@ -315,7 +315,7 @@
size_t ProcessMetrics::GetPeakWorkingSetSize() const {
std::vector<std::string> proc_stats;
if (!GetProcStats(process_, &proc_stats))
- LOG(WARNING) << "Failed to get process stats.";
+ DLOG(WARNING) << "Failed to get process stats.";
const size_t kVmHwm = 23;
if (proc_stats.size() > kVmHwm) {
int num_pages;
@@ -576,14 +576,14 @@
FilePath meminfo_file("/proc/meminfo");
std::string meminfo_data;
if (!file_util::ReadFileToString(meminfo_file, &meminfo_data)) {
- LOG(WARNING) << "Failed to open /proc/meminfo.";
+ DLOG(WARNING) << "Failed to open /proc/meminfo.";
return false;
}
std::vector<std::string> meminfo_fields;
SplitStringAlongWhitespace(meminfo_data, &meminfo_fields);
if (meminfo_fields.size() < kMemCachedIndex) {
- LOG(WARNING) << "Failed to parse /proc/meminfo. Only found " <<
+ DLOG(WARNING) << "Failed to parse /proc/meminfo. Only found " <<
meminfo_fields.size() << " fields.";
return false;
}
@@ -752,7 +752,8 @@
FilePath oom_file = oom_path.AppendASCII("oom_score_adj");
if (file_util::PathExists(oom_file)) {
std::string score_str = base::IntToString(score);
- VLOG(1) << "Adjusting oom_score_adj of " << process << " to " << score_str;
+ DVLOG(1) << "Adjusting oom_score_adj of " << process << " to "
+ << score_str;
int score_len = static_cast<int>(score_str.length());
return (score_len == file_util::WriteFile(oom_file,
score_str.c_str(),
@@ -765,7 +766,7 @@
if (file_util::PathExists(oom_file)) {
std::string score_str = base::IntToString(
score * kMaxOldOomScore / kMaxOomScore);
- VLOG(1) << "Adjusting oom_adj of " << process << " to " << score_str;
+ DVLOG(1) << "Adjusting oom_adj of " << process << " to " << score_str;
int score_len = static_cast<int>(score_str.length());
return (score_len == file_util::WriteFile(oom_file,
score_str.c_str(),
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 06fa779..055edcc 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -131,7 +131,7 @@
if (debug::BeingDebugged())
debug::BreakDebugger();
- LOG(ERROR) << "Received signal " << signal;
+ DLOG(ERROR) << "Received signal " << signal;
debug::StackTrace().PrintBacktrace();
// TODO(shess): Port to Linux.
@@ -296,7 +296,7 @@
bool KillProcessGroup(ProcessHandle process_group_id) {
bool result = kill(-1 * process_group_id, SIGKILL) == 0;
if (!result)
- PLOG(ERROR) << "Unable to terminate process group " << process_group_id;
+ DPLOG(ERROR) << "Unable to terminate process group " << process_group_id;
return result;
}
@@ -565,11 +565,11 @@
// synchronize means "return from LaunchProcess but don't let the child
// run until LaunchSynchronize is called". These two options are highly
// incompatible.
- CHECK(!options.wait);
+ DCHECK(!options.wait);
// Create the pipe used for synchronization.
if (HANDLE_EINTR(pipe(synchronization_pipe_fds)) != 0) {
- PLOG(ERROR) << "pipe";
+ DPLOG(ERROR) << "pipe";
return false;
}
@@ -594,7 +594,7 @@
}
if (pid < 0) {
- PLOG(ERROR) << "fork";
+ DPLOG(ERROR) << "fork";
return false;
} else if (pid == 0) {
// Child process
@@ -749,7 +749,7 @@
// Write a '\0' character to the pipe.
if (HANDLE_EINTR(write(synchronization_fd, "", 1)) != 1) {
- PLOG(ERROR) << "write";
+ DPLOG(ERROR) << "write";
}
}
#endif // defined(OS_MACOSX)
@@ -789,7 +789,7 @@
int status = 0;
const pid_t result = HANDLE_EINTR(waitpid(handle, &status, WNOHANG));
if (result == -1) {
- PLOG(ERROR) << "waitpid(" << handle << ")";
+ DPLOG(ERROR) << "waitpid(" << handle << ")";
if (exit_code)
*exit_code = 0;
return TERMINATION_STATUS_NORMAL_TERMINATION;
@@ -874,7 +874,7 @@
int kq = kqueue();
if (kq == -1) {
- PLOG(ERROR) << "kqueue";
+ DPLOG(ERROR) << "kqueue";
return false;
}
file_util::ScopedFD kq_closer(&kq);
@@ -888,7 +888,7 @@
return true;
}
- PLOG(ERROR) << "kevent (setup " << handle << ")";
+ DPLOG(ERROR) << "kevent (setup " << handle << ")";
return false;
}
@@ -928,11 +928,11 @@
}
if (result < 0) {
- PLOG(ERROR) << "kevent (wait " << handle << ")";
+ DPLOG(ERROR) << "kevent (wait " << handle << ")";
return false;
} else if (result > 1) {
- LOG(ERROR) << "kevent (wait " << handle << "): unexpected result "
- << result;
+ DLOG(ERROR) << "kevent (wait " << handle << "): unexpected result "
+ << result;
return false;
} else if (result == 0) {
// Timed out.
@@ -944,10 +944,10 @@
if (event.filter != EVFILT_PROC ||
(event.fflags & NOTE_EXIT) == 0 ||
event.ident != static_cast<uintptr_t>(handle)) {
- LOG(ERROR) << "kevent (wait " << handle
- << "): unexpected event: filter=" << event.filter
- << ", fflags=" << event.fflags
- << ", ident=" << event.ident;
+ DLOG(ERROR) << "kevent (wait " << handle
+ << "): unexpected event: filter=" << event.filter
+ << ", fflags=" << event.fflags
+ << ", ident=" << event.ident;
return false;
}
diff --git a/base/rand_util_posix.cc b/base/rand_util_posix.cc
index 43dfd1e..f23330a 100644
--- a/base/rand_util_posix.cc
+++ b/base/rand_util_posix.cc
@@ -23,7 +23,7 @@
public:
URandomFd() {
fd_ = open("/dev/urandom", O_RDONLY);
- CHECK_GE(fd_, 0) << "Cannot open /dev/urandom: " << errno;
+ DCHECK_GE(fd_, 0) << "Cannot open /dev/urandom: " << errno;
}
~URandomFd() {
diff --git a/base/scoped_temp_dir.cc b/base/scoped_temp_dir.cc
index fc886e5..6a51d6d 100644
--- a/base/scoped_temp_dir.cc
+++ b/base/scoped_temp_dir.cc
@@ -12,7 +12,7 @@
ScopedTempDir::~ScopedTempDir() {
if (!path_.empty() && !Delete())
- LOG(WARNING) << "Could not delete temp dir in dtor.";
+ DLOG(WARNING) << "Could not delete temp dir in dtor.";
}
bool ScopedTempDir::CreateUniqueTempDir() {
@@ -67,7 +67,7 @@
// We only clear the path if deleted the directory.
path_.clear();
} else {
- LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
+ DLOG(ERROR) << "ScopedTempDir unable to delete " << path_.value();
}
return ret;
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 942a04c..3e5699a 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -91,7 +91,7 @@
void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
DCHECK_GE(handle.fd, 0);
if (HANDLE_EINTR(close(handle.fd)) < 0)
- PLOG(ERROR) << "close";
+ DPLOG(ERROR) << "close";
}
bool SharedMemory::CreateAndMapAnonymous(uint32 size) {
@@ -175,7 +175,7 @@
PLOG(ERROR) << "Unable to access(W_OK|X_OK) " << dir.value();
if (dir.value() == "/dev/shm") {
LOG(FATAL) << "This is frequently caused by incorrect permissions on "
- << "/dev/shm. Try 'sudo chmod 1777 /dev/shm' to fix.";
+ << "/dev/shm. Try 'sudo chmod 1777 /dev/shm' to fix.";
}
}
#else
diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc
index 82ad91c..f50d20b 100644
--- a/base/sync_socket_posix.cc
+++ b/base/sync_socket_posix.cc
@@ -69,11 +69,11 @@
cleanup:
if (handles[0] != kInvalidHandle) {
if (HANDLE_EINTR(close(handles[0])) < 0)
- PLOG(ERROR) << "close";
+ DPLOG(ERROR) << "close";
}
if (handles[1] != kInvalidHandle) {
if (HANDLE_EINTR(close(handles[1])) < 0)
- PLOG(ERROR) << "close";
+ DPLOG(ERROR) << "close";
}
delete tmp_sockets[0];
delete tmp_sockets[1];
@@ -86,7 +86,7 @@
}
int retval = HANDLE_EINTR(close(handle_));
if (retval < 0)
- PLOG(ERROR) << "close";
+ DPLOG(ERROR) << "close";
handle_ = kInvalidHandle;
return (retval == 0);
}
diff --git a/base/system_monitor/system_monitor.cc b/base/system_monitor/system_monitor.cc
index 2631789..5131fbf 100644
--- a/base/system_monitor/system_monitor.cc
+++ b/base/system_monitor/system_monitor.cc
@@ -86,18 +86,18 @@
}
void SystemMonitor::NotifyPowerStateChange() {
- VLOG(1) << "PowerStateChange: " << (BatteryPower() ? "On" : "Off")
- << " battery";
+ DVLOG(1) << "PowerStateChange: " << (BatteryPower() ? "On" : "Off")
+ << " battery";
observer_list_->Notify(&PowerObserver::OnPowerStateChange, BatteryPower());
}
void SystemMonitor::NotifySuspend() {
- VLOG(1) << "Power Suspending";
+ DVLOG(1) << "Power Suspending";
observer_list_->Notify(&PowerObserver::OnSuspend);
}
void SystemMonitor::NotifyResume() {
- VLOG(1) << "Power Resuming";
+ DVLOG(1) << "Power Resuming";
observer_list_->Notify(&PowerObserver::OnResume);
}
diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc
index cca17b5..0096c9e 100644
--- a/base/test/test_file_util_posix.cc
+++ b/base/test/test_file_util_posix.cc
@@ -73,8 +73,8 @@
FileEnumerator::FindInfo info;
FilePath current = source_dir;
if (stat(source_dir.value().c_str(), &info.stat) < 0) {
- LOG(ERROR) << "CopyRecursiveDirNoCache() couldn't stat source directory: "
- << source_dir.value() << " errno = " << errno;
+ DLOG(ERROR) << "CopyRecursiveDirNoCache() couldn't stat source directory: "
+ << source_dir.value() << " errno = " << errno;
success = false;
}
@@ -92,8 +92,8 @@
if (S_ISDIR(info.stat.st_mode)) {
if (mkdir(target_path.value().c_str(), info.stat.st_mode & 01777) != 0 &&
errno != EEXIST) {
- LOG(ERROR) << "CopyRecursiveDirNoCache() couldn't create directory: " <<
- target_path.value() << " errno = " << errno;
+ DLOG(ERROR) << "CopyRecursiveDirNoCache() couldn't create directory: "
+ << target_path.value() << " errno = " << errno;
success = false;
}
} else if (S_ISREG(info.stat.st_mode)) {
@@ -101,13 +101,13 @@
success = EvictFileFromSystemCache(target_path);
DCHECK(success);
} else {
- LOG(ERROR) << "CopyRecursiveDirNoCache() couldn't create file: " <<
- target_path.value();
+ DLOG(ERROR) << "CopyRecursiveDirNoCache() couldn't create file: "
+ << target_path.value();
success = false;
}
} else {
- LOG(WARNING) << "CopyRecursiveDirNoCache() skipping non-regular file: " <<
- current.value();
+ DLOG(WARNING) << "CopyRecursiveDirNoCache() skipping non-regular file: "
+ << current.value();
}
current = traversal.Next();
diff --git a/base/threading/non_thread_safe_unittest.cc b/base/threading/non_thread_safe_unittest.cc
index 01efe28..3236278 100644
--- a/base/threading/non_thread_safe_unittest.cc
+++ b/base/threading/non_thread_safe_unittest.cc
@@ -20,7 +20,7 @@
// Verifies that it was called on the same thread as the constructor.
void DoStuff() {
- CHECK(CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
}
void DetachFromThread() {
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index d1fb7bb..e6b8e64 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -186,14 +186,14 @@
int err = dynamic_pthread_setname_np(pthread_self(),
shortened_name.c_str());
if (err < 0)
- LOG(ERROR) << "pthread_setname_np: " << safe_strerror(err);
+ DLOG(ERROR) << "pthread_setname_np: " << safe_strerror(err);
} else {
// Implementing this function without glibc is simple enough. (We
// don't do the name length clipping as above because it will be
// truncated by the callee (see TASK_COMM_LEN above).)
int err = prctl(PR_SET_NAME, name);
if (err < 0)
- PLOG(ERROR) << "prctl(PR_SET_NAME)";
+ DPLOG(ERROR) << "prctl(PR_SET_NAME)";
}
}
#elif defined(OS_MACOSX)
diff --git a/base/threading/simple_thread.cc b/base/threading/simple_thread.cc
index 4441477..a5dd763 100644
--- a/base/threading/simple_thread.cc
+++ b/base/threading/simple_thread.cc
@@ -29,7 +29,7 @@
void SimpleThread::Start() {
DCHECK(!HasBeenStarted()) << "Tried to Start a thread multiple times.";
bool success = PlatformThread::Create(options_.stack_size(), this, &thread_);
- CHECK(success);
+ DCHECK(success);
event_.Wait(); // Wait for the thread to complete initialization.
}
diff --git a/base/threading/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc
index 2808048..e1e5715 100644
--- a/base/threading/thread_checker_unittest.cc
+++ b/base/threading/thread_checker_unittest.cc
@@ -20,7 +20,7 @@
// Verifies that it was called on the same thread as the constructor.
void DoStuff() {
- CHECK(CalledOnValidThread());
+ DCHECK(CalledOnValidThread());
}
void DetachFromThread() {
diff --git a/base/threading/thread_local_posix.cc b/base/threading/thread_local_posix.cc
index 2071ad8..4951006 100644
--- a/base/threading/thread_local_posix.cc
+++ b/base/threading/thread_local_posix.cc
@@ -32,7 +32,7 @@
// static
void ThreadLocalPlatform::SetValueInSlot(SlotType& slot, void* value) {
int error = pthread_setspecific(slot, value);
- CHECK_EQ(error, 0);
+ DCHECK_EQ(error, 0);
}
} // namespace internal
diff --git a/base/vlog.cc b/base/vlog.cc
index 41bf2a5..332de38 100644
--- a/base/vlog.cc
+++ b/base/vlog.cc
@@ -52,23 +52,23 @@
if (base::StringToInt(v_switch, &vlog_level)) {
SetMaxVlogLevel(vlog_level);
} else {
- LOG(WARNING) << "Could not parse v switch \"" << v_switch << "\"";
+ DLOG(WARNING) << "Could not parse v switch \"" << v_switch << "\"";
}
}
std::vector<KVPair> kv_pairs;
if (!base::SplitStringIntoKeyValuePairs(
vmodule_switch, '=', ',', &kv_pairs)) {
- LOG(WARNING) << "Could not fully parse vmodule switch \""
- << vmodule_switch << "\"";
+ DLOG(WARNING) << "Could not fully parse vmodule switch \""
+ << vmodule_switch << "\"";
}
for (std::vector<KVPair>::const_iterator it = kv_pairs.begin();
it != kv_pairs.end(); ++it) {
VmodulePattern pattern(it->first);
if (!base::StringToInt(it->second, &pattern.vlog_level)) {
- LOG(WARNING) << "Parsed vlog level for \""
- << it->first << "=" << it->second
- << "\" as " << pattern.vlog_level;
+ DLOG(WARNING) << "Parsed vlog level for \""
+ << it->first << "=" << it->second
+ << "\" as " << pattern.vlog_level;
}
vmodule_levels_.push_back(pattern);
}