Index: base/process_util_mac.mm |
=================================================================== |
--- base/process_util_mac.mm (revision 57057) |
+++ base/process_util_mac.mm (working copy) |
@@ -17,6 +17,7 @@ |
#include <sys/mman.h> |
#include <sys/sysctl.h> |
#include <sys/types.h> |
+#include <sys/utsname.h> |
#include <sys/wait.h> |
#include <new> |
@@ -613,11 +614,18 @@ |
g_oom_killer_enabled = true; |
- int32 os_major; |
- int32 os_minor; |
- int32 os_bugfix; |
- SysInfo::OperatingSystemVersionNumbers(&os_major, &os_minor, &os_bugfix); |
+ // Not SysInfo::OperatingSystemVersionNumbers as that calls through to Gestalt |
+ // which ends up (on > 10.6) spawning threads. |
+ struct utsname machine_info; |
+ if (uname(&machine_info)) { |
+ return; |
+ } |
+ // The string machine_info.release is the xnu/Darwin version number, "9.xxx" |
+ // on Mac OS X 10.5, and "10.xxx" on Mac OS X 10.6. See |
+ // http://en.wikipedia.org/wiki/Darwin_(operating_system) . |
+ long darwin_version = strtol(machine_info.release, (char**)NULL, 10); |
Mark Mentovai
2010/08/24 15:13:24
Do you really need this cast?
Avi (use Gerrit)
2010/08/24 15:16:37
No. Done.
|
+ |
// === C malloc/calloc/valloc/realloc/posix_memalign === |
// This approach is not perfect, as requests for amounts of memory larger than |
@@ -635,8 +643,7 @@ |
!g_old_memalign_purgeable) << "Old allocators unexpectedly non-null"; |
// See http://trac.webkit.org/changeset/53362/trunk/WebKitTools/DumpRenderTree/mac |
- bool zone_allocators_protected = |
- ((os_major == 10 && os_minor > 6) || os_major > 10); |
+ bool zone_allocators_protected = darwin_version > 10; |
ChromeMallocZone* default_zone = |
reinterpret_cast<ChromeMallocZone*>(malloc_default_zone()); |
@@ -752,7 +759,7 @@ |
<< "Old allocators unexpectedly non-null"; |
bool cf_allocator_internals_known = |
- (os_major == 10 && (os_minor == 5 || os_minor == 6)); |
+ (darwin_version == 9) || (darwin_version == 10); |
Mark Mentovai
2010/08/24 15:13:24
The parentheses aren’t necessary and I don’t think
Avi (use Gerrit)
2010/08/24 15:16:37
Done.
|
if (cf_allocator_internals_known) { |
ChromeCFAllocatorRef allocator = const_cast<ChromeCFAllocatorRef>( |