summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 22:35:22 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 22:35:22 +0000
commit1388ccffaf0ca5aa7783c9f267c0d2df2f17b0e5 (patch)
tree931b1f4889c29020426c459d7da9ea56639293b0 /base
parent73159d6d12b09405ca23fcc801e957104c85f74d (diff)
downloadchromium_src-1388ccffaf0ca5aa7783c9f267c0d2df2f17b0e5.zip
chromium_src-1388ccffaf0ca5aa7783c9f267c0d2df2f17b0e5.tar.gz
chromium_src-1388ccffaf0ca5aa7783c9f267c0d2df2f17b0e5.tar.bz2
Add preliminary OOM support for Mountain Lion.
BUG=117476 TEST=run base_unittests on Mountain Lion Review URL: http://codereview.chromium.org/9701031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/mac/mac_util.h3
-rw-r--r--base/mac/mac_util.mm6
-rw-r--r--base/mac/mac_util_unittest.mm3
-rw-r--r--base/process_util_mac.mm20
-rw-r--r--base/process_util_unittest.cc2
5 files changed, 15 insertions, 19 deletions
diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h
index 3d50d61..a308ccd 100644
--- a/base/mac/mac_util.h
+++ b/base/mac/mac_util.h
@@ -150,8 +150,6 @@ BASE_EXPORT bool IsOSMountainLionOrLater();
// unborn) OS releases.
BASE_EXPORT
bool IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement();
-// TODO(rsesek|avi): Remove when allocators gonna allocate.
-BASE_EXPORT bool IsOSLaterThanLion();
// When the deployment target is set, the code produced cannot run on earlier
// OS releases. That enables some of the IsOS* family to be implemented as
@@ -179,7 +177,6 @@ inline bool IsOSLionOrLater() { return true; }
#define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7
inline bool IsOSLion() { return false; }
inline bool IsOSLionOrEarlier() { return false; }
-inline bool IsOSLaterThanLion() { return true; }
#endif
#if defined(MAC_OS_X_VERSION_10_8) && \
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index 41d76a2..ad73596 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -625,12 +625,6 @@ bool IsOSLionOrLater() {
}
#endif
-#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7)
-bool IsOSLaterThanLion() {
- return MacOSXMinorVersion() > LION_MINOR_VERSION;
-}
-#endif
-
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8)
bool IsOSMountainLion() {
return MacOSXMinorVersion() == MOUNTAIN_LION_MINOR_VERSION;
diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
index d7f2b3d..b09d685 100644
--- a/base/mac/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -164,7 +164,6 @@ TEST_F(MacUtilTest, IsOSEllipsis) {
EXPECT_FALSE(IsOSMountainLionOrLater());
EXPECT_FALSE(
IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement());
- EXPECT_FALSE(IsOSLaterThanLion());
} else if (minor == 6) {
EXPECT_FALSE(IsOSLeopard());
EXPECT_FALSE(IsOSLeopardOrEarlier());
@@ -178,7 +177,6 @@ TEST_F(MacUtilTest, IsOSEllipsis) {
EXPECT_FALSE(IsOSMountainLionOrLater());
EXPECT_FALSE(
IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement());
- EXPECT_FALSE(IsOSLaterThanLion());
} else if (minor == 7) {
EXPECT_FALSE(IsOSLeopard());
EXPECT_FALSE(IsOSLeopardOrEarlier());
@@ -205,7 +203,6 @@ TEST_F(MacUtilTest, IsOSEllipsis) {
EXPECT_TRUE(IsOSMountainLionOrLater());
EXPECT_FALSE(
IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement());
- EXPECT_TRUE(IsOSLaterThanLion());
} else {
// Not five, six, seven, or eight. Ah, ah, ah.
EXPECT_TRUE(false);
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index ee150c5..ae8e6f1 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -718,8 +718,16 @@ void oom_killer_new() {
// === Core Foundation CFAllocators ===
bool CanGetContextForCFAllocator() {
- // TODO(rsesek|avi): See mac_util.h:153 for removing/updating this.
- return !base::mac::IsOSLaterThanLion();
+ // TODO(avi): remove at final release; http://crbug.com/117476
+ if (base::mac::IsOSMountainLion()) {
+ NSLog(@"Unsure about the internals of CFAllocator but going to patch them "
+ "anyway. If there is a crash inside of CFAllocatorAllocate, please "
+ "report it at http://crbug.com/117476 . If there is a crash and it "
+ "is NOT inside of CFAllocatorAllocate, it is NOT RELATED. DO NOT "
+ "REPORT IT THERE but rather FILE A NEW BUG.");
+ }
+ return !base::mac::
+ IsOSDangerouslyLaterThanMountainLionForUseByCFAllocatorReplacement();
}
CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator) {
@@ -728,10 +736,10 @@ CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator) {
const_cast<ChromeCFAllocatorLeopards*>(
reinterpret_cast<const ChromeCFAllocatorLeopards*>(allocator));
return &our_allocator->_context;
- } else if (base::mac::IsOSLion()) {
- ChromeCFAllocatorLion* our_allocator =
- const_cast<ChromeCFAllocatorLion*>(
- reinterpret_cast<const ChromeCFAllocatorLion*>(allocator));
+ } else if (base::mac::IsOSLion() || base::mac::IsOSMountainLion()) {
+ ChromeCFAllocatorLions* our_allocator =
+ const_cast<ChromeCFAllocatorLions*>(
+ reinterpret_cast<const ChromeCFAllocatorLions*>(allocator));
return &our_allocator->_context;
} else {
return NULL;
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 071f7aa..8d26375f 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -1118,7 +1118,7 @@ TEST_F(OutOfMemoryDeathTest, PosixMemalignPurgeable) {
// Since these allocation functions take a signed size, it's possible that
// calling them just once won't be enough to exhaust memory. In the 32-bit
// environment, it's likely that these allocation attempts will fail because
-// not enough contiguous address space is availble. In the 64-bit environment,
+// not enough contiguous address space is available. In the 64-bit environment,
// it's likely that they'll fail because they would require a preposterous
// amount of (virtual) memory.