Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: base/process/memory_mac.mm

Issue 278923002: Use the new ScopedMachVM class and the MACH_LOG family of logging macros (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto r269793 Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/discardable_memory_mac.cc ('k') | base/process/process_metrics_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/memory_mac.mm
diff --git a/base/process/memory_mac.mm b/base/process/memory_mac.mm
index 6cf1297b26f01f680f4da4917bf175259122a2db..8503bbb809f3bc69497aa958408f07c17d42a3c1 100644
--- a/base/process/memory_mac.mm
+++ b/base/process/memory_mac.mm
@@ -16,6 +16,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
+#include "base/mac/mach_logging.h"
#include "base/scoped_clear_errno.h"
#include "third_party/apple_apsl/CFBase.h"
#include "third_party/apple_apsl/malloc.h"
@@ -222,10 +223,12 @@ void DeprotectMallocZone(ChromeMallocZone* default_zone,
reinterpret_cast<vm_region_info_t>(&info),
&count,
&unused);
- CHECK(result == KERN_SUCCESS);
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_region";
- result = mach_port_deallocate(mach_task_self(), unused);
- CHECK(result == KERN_SUCCESS);
+ // The kernel always returns a null object for VM_REGION_BASIC_INFO_64, but
+ // balance it with a deallocate in case this ever changes. See 10.9.2
+ // xnu-2422.90.20/osfmk/vm/vm_map.c vm_map_region.
+ mach_port_deallocate(mach_task_self(), unused);
// Does the region fully enclose the zone pointers? Possibly unwarranted
// simplification used: using the size of a full version 8 malloc zone rather
@@ -248,7 +251,7 @@ void DeprotectMallocZone(ChromeMallocZone* default_zone,
*reprotection_length,
false,
info.protection | VM_PROT_WRITE);
- CHECK(result == KERN_SUCCESS);
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect";
}
}
@@ -646,7 +649,7 @@ void EnableTerminationOnOutOfMemory() {
default_reprotection_length,
false,
default_reprotection_value);
- CHECK(result == KERN_SUCCESS);
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect";
}
if (purgeable_reprotection_start) {
@@ -655,7 +658,7 @@ void EnableTerminationOnOutOfMemory() {
purgeable_reprotection_length,
false,
purgeable_reprotection_value);
- CHECK(result == KERN_SUCCESS);
+ MACH_CHECK(result == KERN_SUCCESS, result) << "mach_vm_protect";
}
#endif
« no previous file with comments | « base/memory/discardable_memory_mac.cc ('k') | base/process/process_metrics_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698