OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chrome_browser_main_mac.h" | 5 #include "chrome/browser/chrome_browser_main_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <sys/sysctl.h> | 8 #include <sys/sysctl.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 SABER_TOOTHED_CAT_32 = 0, | 50 SABER_TOOTHED_CAT_32 = 0, |
51 SABER_TOOTHED_CAT_64, | 51 SABER_TOOTHED_CAT_64, |
52 | 52 |
53 // Known cats. | 53 // Known cats. |
54 SNOW_LEOPARD_32, | 54 SNOW_LEOPARD_32, |
55 SNOW_LEOPARD_64, | 55 SNOW_LEOPARD_64, |
56 LION_32, // Unexpected, Lion requires a 64-bit CPU. | 56 LION_32, // Unexpected, Lion requires a 64-bit CPU. |
57 LION_64, | 57 LION_64, |
58 MOUNTAIN_LION_32, // Unexpected, Mountain Lion requires a 64-bit CPU. | 58 MOUNTAIN_LION_32, // Unexpected, Mountain Lion requires a 64-bit CPU. |
59 MOUNTAIN_LION_64, | 59 MOUNTAIN_LION_64, |
60 MAVERICKS_32, // Unexpected, Mavericks requires a 64-bit CPU. | |
61 MAVERICKS_64, | |
60 | 62 |
61 // DON'T add new constants here. It's important to keep the constant values, | 63 // DON'T add new constants here. It's important to keep the constant values, |
62 // um, constant. Add new constants at the bottom. | 64 // um, constant. Add new constants at the bottom. |
63 | 65 |
64 // Newer than any known cat. | |
65 FUTURE_CAT_32, // Unexpected, it's unlikely Apple will un-obsolete old CPUs. | |
66 FUTURE_CAT_64, | |
67 | |
68 // What if the bitsiness of the CPU can't be determined? | 66 // What if the bitsiness of the CPU can't be determined? |
69 SABER_TOOTHED_CAT_DUNNO, | 67 SABER_TOOTHED_CAT_DUNNO, |
70 SNOW_LEOPARD_DUNNO, | 68 SNOW_LEOPARD_DUNNO, |
71 LION_DUNNO, | 69 LION_DUNNO, |
72 MOUNTAIN_LION_DUNNO, | 70 MOUNTAIN_LION_DUNNO, |
71 MAVERICKS_DUNNO, | |
72 | |
73 // Newer than any known cat. | |
74 FUTURE_CAT_32, // Unexpected, it's unlikely Apple will un-obsolete old CPUs. | |
Nico
2013/10/01 20:57:45
Should this be FUTURE_CALI now? :-P
| |
75 FUTURE_CAT_64, | |
73 FUTURE_CAT_DUNNO, | 76 FUTURE_CAT_DUNNO, |
74 | 77 |
75 // Add new constants here. | 78 // As new versions of Mac OS X are released with sillier and sillier names, |
Mark Mentovai
2013/10/01 20:25:37
:)
| |
79 // rename the FUTURE_CAT enum values to match those names, and re-create | |
80 // FUTURE_CAT_[32|64|DUNNO] here. | |
76 | 81 |
77 CAT_SIXTY_FOUR_MAX | 82 CAT_SIXTY_FOUR_MAX |
78 }; | 83 }; |
79 | 84 |
80 CatSixtyFour CatSixtyFourValue() { | 85 CatSixtyFour CatSixtyFourValue() { |
81 #if defined(ARCH_CPU_64_BITS) | 86 #if defined(ARCH_CPU_64_BITS) |
82 // If 64-bit code is running, then it's established that this CPU can run | 87 // If 64-bit code is running, then it's established that this CPU can run |
83 // 64-bit code, and no further inquiry is necessary. | 88 // 64-bit code, and no further inquiry is necessary. |
84 int cpu64 = 1; | 89 int cpu64 = 1; |
85 bool cpu64_known = true; | 90 bool cpu64_known = true; |
(...skipping 21 matching lines...) Expand all Loading... | |
107 SNOW_LEOPARD_DUNNO; | 112 SNOW_LEOPARD_DUNNO; |
108 } | 113 } |
109 if (base::mac::IsOSLion()) { | 114 if (base::mac::IsOSLion()) { |
110 return cpu64_known ? (cpu64 ? LION_64 : LION_32) : | 115 return cpu64_known ? (cpu64 ? LION_64 : LION_32) : |
111 LION_DUNNO; | 116 LION_DUNNO; |
112 } | 117 } |
113 if (base::mac::IsOSMountainLion()) { | 118 if (base::mac::IsOSMountainLion()) { |
114 return cpu64_known ? (cpu64 ? MOUNTAIN_LION_64 : MOUNTAIN_LION_32) : | 119 return cpu64_known ? (cpu64 ? MOUNTAIN_LION_64 : MOUNTAIN_LION_32) : |
115 MOUNTAIN_LION_DUNNO; | 120 MOUNTAIN_LION_DUNNO; |
116 } | 121 } |
117 if (base::mac::IsOSLaterThanMountainLion_DontCallThis()) { | 122 if (base::mac::IsOSMavericks()) { |
123 return cpu64_known ? (cpu64 ? MAVERICKS_64 : MAVERICKS_32) : | |
124 MAVERICKS_DUNNO; | |
125 } | |
126 if (base::mac::IsOSLaterThanMavericks_DontCallThis()) { | |
118 return cpu64_known ? (cpu64 ? FUTURE_CAT_64 : FUTURE_CAT_32) : | 127 return cpu64_known ? (cpu64 ? FUTURE_CAT_64 : FUTURE_CAT_32) : |
119 FUTURE_CAT_DUNNO; | 128 FUTURE_CAT_DUNNO; |
120 } | 129 } |
121 | 130 |
122 // If it's not any of the expected OS versions or later than them, it must | 131 // If it's not any of the expected OS versions or later than them, it must |
123 // be prehistoric. | 132 // be prehistoric. |
124 return cpu64_known ? (cpu64 ? SABER_TOOTHED_CAT_64 : SABER_TOOTHED_CAT_32) : | 133 return cpu64_known ? (cpu64 ? SABER_TOOTHED_CAT_64 : SABER_TOOTHED_CAT_32) : |
125 SABER_TOOTHED_CAT_DUNNO; | 134 SABER_TOOTHED_CAT_DUNNO; |
126 } | 135 } |
127 | 136 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 void ChromeBrowserMainPartsMac::PostProfileInit() { | 269 void ChromeBrowserMainPartsMac::PostProfileInit() { |
261 ChromeBrowserMainPartsPosix::PostProfileInit(); | 270 ChromeBrowserMainPartsPosix::PostProfileInit(); |
262 g_browser_process->metrics_service()->RecordBreakpadRegistration( | 271 g_browser_process->metrics_service()->RecordBreakpadRegistration( |
263 IsCrashReporterEnabled()); | 272 IsCrashReporterEnabled()); |
264 } | 273 } |
265 | 274 |
266 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { | 275 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { |
267 AppController* appController = [NSApp delegate]; | 276 AppController* appController = [NSApp delegate]; |
268 [appController didEndMainMessageLoop]; | 277 [appController didEndMainMessageLoop]; |
269 } | 278 } |
OLD | NEW |