diff options
-rw-r--r-- | base/mac/mac_util.h | 29 | ||||
-rw-r--r-- | base/mac/mac_util.mm | 25 | ||||
-rw-r--r-- | base/mac/mac_util_unittest.mm | 28 | ||||
-rw-r--r-- | base/process/memory_mac.mm | 2 | ||||
-rw-r--r-- | base/test/expectations/expectation.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_mac.mm | 21 | ||||
-rw-r--r-- | content/renderer/renderer_main_platform_delegate_mac.mm | 6 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 25 |
8 files changed, 110 insertions, 28 deletions
diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h index 23b57ed..5f82f43 100644 --- a/base/mac/mac_util.h +++ b/base/mac/mac_util.h @@ -145,12 +145,22 @@ BASE_EXPORT bool IsOSLionOrLater(); // Mountain Lion is Mac OS X 10.8, Darwin 12. BASE_EXPORT bool IsOSMountainLion(); +BASE_EXPORT bool IsOSMountainLionOrEarlier(); BASE_EXPORT bool IsOSMountainLionOrLater(); +// Mavericks is Mac OS X 10.9, Darwin 13. +BASE_EXPORT bool IsOSMavericks(); +BASE_EXPORT bool IsOSMavericksOrLater(); + // This should be infrequently used. It only makes sense to use this to avoid // codepaths that are very likely to break on future (unreleased, untested, // unborn) OS releases, or to log when the OS is newer than any known version. -BASE_EXPORT bool IsOSLaterThanMountainLion_DontCallThis(); +BASE_EXPORT bool IsOSLaterThanMavericks_DontCallThis(); + +// Inline functions that are redundant due to version ranges being mutually- +// exclusive. +inline bool IsOSLionOrEarlier() { return !IsOSMountainLionOrLater(); } +inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); } // 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 @@ -168,7 +178,6 @@ inline bool IsOSLionOrLater() { return true; } MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_7 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7 inline bool IsOSLion() { return false; } -inline bool IsOSLionOrEarlier() { return false; } #endif #if defined(MAC_OS_X_VERSION_10_8) && \ @@ -181,9 +190,19 @@ inline bool IsOSMountainLionOrLater() { return true; } MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 #define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8 inline bool IsOSMountainLion() { return false; } -inline bool IsOSLaterThanMountainLion_DontCallThis() { - return true; -} +#endif + +#if defined(MAC_OS_X_VERSION_10_9) && \ + MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 +#define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_9 +inline bool IsOSMavericksOrLater() { return true; } +#endif + +#if defined(MAC_OS_X_VERSION_10_9) && \ + MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9 +#define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_9 +inline bool IsOSMavericks() { return false; } +inline bool IsOSLaterThanMavericks_DontCallThis() { return true; } #endif // Retrieve the system's model identifier string from the IOKit registry: diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm index 04311ec..dd65eee 100644 --- a/base/mac/mac_util.mm +++ b/base/mac/mac_util.mm @@ -610,6 +610,7 @@ enum { SNOW_LEOPARD_MINOR_VERSION = 6, LION_MINOR_VERSION = 7, MOUNTAIN_LION_MINOR_VERSION = 8, + MAVERICKS_MINOR_VERSION = 9, }; } // namespace @@ -626,12 +627,6 @@ bool IsOSLion() { } #endif -#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) -bool IsOSLionOrEarlier() { - return MacOSXMinorVersion() <= LION_MINOR_VERSION; -} -#endif - #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_7) bool IsOSLionOrLater() { return MacOSXMinorVersion() >= LION_MINOR_VERSION; @@ -650,9 +645,21 @@ bool IsOSMountainLionOrLater() { } #endif -#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8) -bool IsOSLaterThanMountainLion_DontCallThis() { - return MacOSXMinorVersion() > MOUNTAIN_LION_MINOR_VERSION; +#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_9) +bool IsOSMavericks() { + return MacOSXMinorVersion() == MAVERICKS_MINOR_VERSION; +} +#endif + +#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_9) +bool IsOSMavericksOrLater() { + return MacOSXMinorVersion() >= MAVERICKS_MINOR_VERSION; +} +#endif + +#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_9) +bool IsOSLaterThanMavericks_DontCallThis() { + return MacOSXMinorVersion() > MAVERICKS_MINOR_VERSION; } #endif diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm index d246757..0688b5a 100644 --- a/base/mac/mac_util_unittest.mm +++ b/base/mac/mac_util_unittest.mm @@ -161,26 +161,46 @@ TEST_F(MacUtilTest, IsOSEllipsis) { EXPECT_TRUE(IsOSLionOrEarlier()); EXPECT_FALSE(IsOSLionOrLater()); EXPECT_FALSE(IsOSMountainLion()); + EXPECT_TRUE(IsOSMountainLionOrEarlier()); EXPECT_FALSE(IsOSMountainLionOrLater()); - EXPECT_FALSE(IsOSLaterThanMountainLion_DontCallThis()); + EXPECT_FALSE(IsOSMavericks()); + EXPECT_FALSE(IsOSMavericksOrLater()); + EXPECT_FALSE(IsOSLaterThanMavericks_DontCallThis()); } else if (minor == 7) { EXPECT_FALSE(IsOSSnowLeopard()); EXPECT_TRUE(IsOSLion()); EXPECT_TRUE(IsOSLionOrEarlier()); EXPECT_TRUE(IsOSLionOrLater()); EXPECT_FALSE(IsOSMountainLion()); + EXPECT_TRUE(IsOSMountainLionOrEarlier()); EXPECT_FALSE(IsOSMountainLionOrLater()); - EXPECT_FALSE(IsOSLaterThanMountainLion_DontCallThis()); + EXPECT_FALSE(IsOSMavericks()); + EXPECT_FALSE(IsOSMavericksOrLater()); + EXPECT_FALSE(IsOSLaterThanMavericks_DontCallThis()); } else if (minor == 8) { EXPECT_FALSE(IsOSSnowLeopard()); EXPECT_FALSE(IsOSLion()); EXPECT_FALSE(IsOSLionOrEarlier()); EXPECT_TRUE(IsOSLionOrLater()); EXPECT_TRUE(IsOSMountainLion()); + EXPECT_TRUE(IsOSMountainLionOrEarlier()); EXPECT_TRUE(IsOSMountainLionOrLater()); - EXPECT_FALSE(IsOSLaterThanMountainLion_DontCallThis()); + EXPECT_FALSE(IsOSMavericks()); + EXPECT_FALSE(IsOSMavericksOrLater()); + EXPECT_FALSE(IsOSLaterThanMavericks_DontCallThis()); + } else if (minor == 9) { + EXPECT_FALSE(IsOSSnowLeopard()); + EXPECT_FALSE(IsOSLion()); + EXPECT_FALSE(IsOSLionOrEarlier()); + EXPECT_TRUE(IsOSLionOrLater()); + EXPECT_FALSE(IsOSMountainLion()); + EXPECT_FALSE(IsOSMountainLionOrEarlier()); + EXPECT_TRUE(IsOSMountainLionOrLater()); + EXPECT_TRUE(IsOSMavericks()); + EXPECT_TRUE(IsOSMavericksOrLater()); + EXPECT_FALSE(IsOSLaterThanMavericks_DontCallThis()); } else { - // Not five, six, seven, or eight. Ah, ah, ah. + // Not five, six, seven, eight, or nine. Ah, ah, ah. EXPECT_TRUE(false); } } else { diff --git a/base/process/memory_mac.mm b/base/process/memory_mac.mm index dd30e70..6fba300 100644 --- a/base/process/memory_mac.mm +++ b/base/process/memory_mac.mm @@ -422,7 +422,7 @@ void oom_killer_new() { // === Core Foundation CFAllocators === bool CanGetContextForCFAllocator() { - return !base::mac::IsOSLaterThanMountainLion_DontCallThis(); + return !base::mac::IsOSMavericksOrLater(); } CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator) { diff --git a/base/test/expectations/expectation.cc b/base/test/expectations/expectation.cc index 31a387e..e5bfb69 100644 --- a/base/test/expectations/expectation.cc +++ b/base/test/expectations/expectation.cc @@ -108,6 +108,8 @@ Platform GetCurrentPlatform() { platform.variant = "10.7"; else if (base::mac::IsOSMountainLion()) platform.variant = "10.8"; + else if (base::mac::IsOSMavericks()) + platform.variant = "10.9"; #elif defined(OS_CHROMEOS) platform.name = "ChromeOS"; #elif defined(OS_ANDROID) diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index 83c1c06..0303b84 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm @@ -57,22 +57,27 @@ enum CatSixtyFour { LION_64, MOUNTAIN_LION_32, // Unexpected, Mountain Lion requires a 64-bit CPU. MOUNTAIN_LION_64, + MAVERICKS_32, // Unexpected, Mavericks requires a 64-bit CPU. + MAVERICKS_64, // DON'T add new constants here. It's important to keep the constant values, // um, constant. Add new constants at the bottom. - // Newer than any known cat. - FUTURE_CAT_32, // Unexpected, it's unlikely Apple will un-obsolete old CPUs. - FUTURE_CAT_64, - // What if the bitsiness of the CPU can't be determined? SABER_TOOTHED_CAT_DUNNO, SNOW_LEOPARD_DUNNO, LION_DUNNO, MOUNTAIN_LION_DUNNO, + MAVERICKS_DUNNO, + + // Newer than any known cat. + FUTURE_CAT_32, // Unexpected, it's unlikely Apple will un-obsolete old CPUs. + FUTURE_CAT_64, FUTURE_CAT_DUNNO, - // Add new constants here. + // As new versions of Mac OS X are released with sillier and sillier names, + // rename the FUTURE_CAT enum values to match those names, and re-create + // FUTURE_CAT_[32|64|DUNNO] here. CAT_SIXTY_FOUR_MAX }; @@ -114,7 +119,11 @@ CatSixtyFour CatSixtyFourValue() { return cpu64_known ? (cpu64 ? MOUNTAIN_LION_64 : MOUNTAIN_LION_32) : MOUNTAIN_LION_DUNNO; } - if (base::mac::IsOSLaterThanMountainLion_DontCallThis()) { + if (base::mac::IsOSMavericks()) { + return cpu64_known ? (cpu64 ? MAVERICKS_64 : MAVERICKS_32) : + MAVERICKS_DUNNO; + } + if (base::mac::IsOSLaterThanMavericks_DontCallThis()) { return cpu64_known ? (cpu64 ? FUTURE_CAT_64 : FUTURE_CAT_32) : FUTURE_CAT_DUNNO; } diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm index e7cf9ff..b121144 100644 --- a/content/renderer/renderer_main_platform_delegate_mac.mm +++ b/content/renderer/renderer_main_platform_delegate_mac.mm @@ -127,7 +127,7 @@ bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { } bool RendererMainPlatformDelegate::EnableSandbox() { - // http://openradar.appspot.com/radar?id=1156410 is fixed on OS X 10.9+. + // rdar://9251340 http://openradar.me/9251340 // See http://crbug.com/31225 and http://crbug.com/152566 // To check if this is broken: // 1. Enable Multi language input (simplified chinese) @@ -140,8 +140,8 @@ bool RendererMainPlatformDelegate::EnableSandbox() { // and then kill that pid to make it go away.) // // Chinese Handwriting was introduced in 10.6 and is confirmed broken on - // 10.6, 10.7, and 10.8. It's reportedly fixed on 10.9. - bool needs_ime_hack = !base::mac::IsOSLaterThanMountainLion_DontCallThis(); + // 10.6, 10.7, and 10.8. It's fixed on 10.9. + bool needs_ime_hack = base::mac::IsOSMountainLionOrEarlier(); if (needs_ime_hack) { mach_error_t err = mach_override_ptr( diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index b800102..c8be1c1 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -10829,6 +10829,10 @@ other types of suffix sets. </summary> </histogram> +<histogram name="OSX.CatSixtyFour" enum="CatSixtyFour"> + <summary>The cat's flavor and how many bits there are in it.</summary> +</histogram> + <histogram name="OutdatedUpgradeBubble.NumLaterPerReinstall"> <summary> Counts the number of times the user clicked on the later button of the @@ -19780,6 +19784,27 @@ other types of suffix sets. <int value="3" label="webgl"/> </enum> +<enum name="CatSixtyFour" type="int"> + <int value="0" label="Saber-Toothed Cat (<10.6), 32-bit (?)"/> + <int value="1" label="Saber-Toothed Cat (<10.6), 64-bit (?)"/> + <int value="2" label="Snow Leopard (10.6), 32-bit"/> + <int value="3" label="Snow Leopard (10.6), 64-bit"/> + <int value="4" label="Lion (10.7), 32-bit (?)"/> + <int value="5" label="Lion (10.7), 64-bit"/> + <int value="6" label="Mountain Lion (10.8), 32-bit (?)"/> + <int value="7" label="Mountain Lion (10.8), 64-bit"/> + <int value="8" label="Mavericks (10.9), 32-bit (?)"/> + <int value="9" label="Mavericks (10.9), 64-bit"/> + <int value="10" label="Saber-Toothed Cat (<10.6), 8-bit (?)"/> + <int value="11" label="Snow Leopard (10.6), 8-bit (?)"/> + <int value="12" label="Lion (10.7), 8-bit (?)"/> + <int value="13" label="Mountain Lion (10.8), 8-bit (?)"/> + <int value="14" label="Mavericks (10.9), 8-bit (?)"/> + <int value="15" label="FutureCat (>10.9), 32-bit (?)"/> + <int value="16" label="FutureCat (>10.9), 64-bit"/> + <int value="17" label="FutureCat (>10.9), 8-bit (?)"/> +</enum> + <enum name="ChannelLayout" type="int"> <int value="0" label="CHANNEL_LAYOUT_NONE"/> <int value="1" label="CHANNEL_LAYOUT_UNSUPPORTED"/> |