summaryrefslogtreecommitdiffstats
path: root/base/process_util_mac.mm
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 21:48:00 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-26 21:48:00 +0000
commita42d4638f0335dbfd14c1c9f6b05a7b09703a78e (patch)
tree96d7687e21b42cd5b5de4b23b2a1da472572e60c /base/process_util_mac.mm
parent1b5eee12138e3963415453974c824472429c4d80 (diff)
downloadchromium_src-a42d4638f0335dbfd14c1c9f6b05a7b09703a78e.zip
chromium_src-a42d4638f0335dbfd14c1c9f6b05a7b09703a78e.tar.gz
chromium_src-a42d4638f0335dbfd14c1c9f6b05a7b09703a78e.tar.bz2
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
Diffstat (limited to 'base/process_util_mac.mm')
-rw-r--r--base/process_util_mac.mm29
1 files changed, 15 insertions, 14 deletions
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index e364d1b..5519d21 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -75,7 +75,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* filter)
// 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";
+ DLOG(ERROR) << "failed to get the size needed for the process list";
kinfo_procs_.resize(0);
done = true;
} else {
@@ -90,7 +90,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* filter)
// 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";
+ DLOG(ERROR) << "failed to get the process list";
kinfo_procs_.resize(0);
done = true;
}
@@ -104,7 +104,7 @@ ProcessIterator::ProcessIterator(const ProcessFilter* filter)
} while (!done && (try_num++ < max_tries));
if (!done) {
- LOG(ERROR) << "failed to collect the process list in a few tries";
+ DLOG(ERROR) << "failed to collect the process list in a few tries";
kinfo_procs_.resize(0);
}
}
@@ -149,7 +149,7 @@ bool ProcessIterator::CheckForNextProcess() {
// to populate |entry_.exe_file_|.
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";
+ DLOG(ERROR) << "command line data didn't match expected format";
continue;
}
@@ -248,7 +248,7 @@ static bool GetCPUTypeForProcess(pid_t pid, cpu_type_t* cpu_type) {
NULL,
0);
if (result != 0) {
- PLOG(ERROR) << "sysctlbyname(""sysctl.proc_cputype"")";
+ DPLOG(ERROR) << "sysctlbyname(""sysctl.proc_cputype"")";
return false;
}
@@ -280,7 +280,7 @@ bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
mach_port_t task = TaskForPid(process_);
if (task == MACH_PORT_NULL) {
- LOG(ERROR) << "Invalid process";
+ DLOG(ERROR) << "Invalid process";
return false;
}
@@ -319,7 +319,7 @@ bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
// We're at the end of the address space.
break;
} else if (kr != KERN_SUCCESS) {
- LOG(ERROR) << "Calling mach_vm_region failed with error: "
+ DLOG(ERROR) << "Calling mach_vm_region failed with error: "
<< mach_error_string(kr);
return false;
}
@@ -354,7 +354,7 @@ bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
vm_size_t page_size;
kr = host_page_size(task, &page_size);
if (kr != KERN_SUCCESS) {
- LOG(ERROR) << "Failed to fetch host page size, error: "
+ DLOG(ERROR) << "Failed to fetch host page size, error: "
<< mach_error_string(kr);
return false;
}
@@ -472,14 +472,14 @@ size_t GetSystemCommitCharge() {
reinterpret_cast<host_info_t>(&data),
&count);
if (kr) {
- LOG(WARNING) << "Failed to fetch host statistics.";
+ DLOG(WARNING) << "Failed to fetch host statistics.";
return 0;
}
vm_size_t page_size;
kr = host_page_size(host, &page_size);
if (kr) {
- LOG(ERROR) << "Failed to fetch host page size.";
+ DLOG(ERROR) << "Failed to fetch host page size.";
return 0;
}
@@ -497,7 +497,7 @@ const char* LookUpLibCPath() {
if (dladdr(addr, &info))
return info.dli_fname;
- LOG(WARNING) << "Could not find image path for malloc()";
+ DLOG(WARNING) << "Could not find image path for malloc()";
return NULL;
}
@@ -545,6 +545,7 @@ malloc_error_break_t LookUpMallocErrorBreak() {
void CrMallocErrorBreak() {
g_original_malloc_error_break();
+ // A unit test checks this error message, so it needs to be in release builds.
LOG(ERROR) <<
"Terminating process due to a potential for future heap corruption";
int* death_ptr = NULL;
@@ -556,7 +557,7 @@ void CrMallocErrorBreak() {
void EnableTerminationOnHeapCorruption() {
malloc_error_break_t malloc_error_break = LookUpMallocErrorBreak();
if (!malloc_error_break) {
- LOG(WARNING) << "Could not find malloc_error_break";
+ DLOG(WARNING) << "Could not find malloc_error_break";
return;
}
@@ -566,7 +567,7 @@ void EnableTerminationOnHeapCorruption() {
(void**)&g_original_malloc_error_break);
if (err != err_none)
- LOG(WARNING) << "Could not override malloc_error_break; error = " << err;
+ DLOG(WARNING) << "Could not override malloc_error_break; error = " << err;
}
// ------------------------------------------------------------------------
@@ -976,7 +977,7 @@ ProcessId GetParentProcessId(ProcessHandle process) {
size_t length = sizeof(struct kinfo_proc);
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) {
- PLOG(ERROR) << "sysctl";
+ DPLOG(ERROR) << "sysctl";
return -1;
}
if (length == 0)