| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 5 |
| 6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <crt_externs.h> | 9 #include <crt_externs.h> |
| 10 #include <dlfcn.h> | 10 #include <dlfcn.h> |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 // === C++ operator new === | 617 // === C++ operator new === |
| 618 | 618 |
| 619 void oom_killer_new() { | 619 void oom_killer_new() { |
| 620 debug::BreakDebugger(); | 620 debug::BreakDebugger(); |
| 621 } | 621 } |
| 622 | 622 |
| 623 // === Core Foundation CFAllocators === | 623 // === Core Foundation CFAllocators === |
| 624 | 624 |
| 625 bool CanGetContextForCFAllocator(long darwin_version) { | 625 bool CanGetContextForCFAllocator(long darwin_version) { |
| 626 // TODO(avi): remove at final release; http://crbug.com/74589 | |
| 627 if (darwin_version == 11) { | |
| 628 NSLog(@"Unsure about the internals of CFAllocator but going to patch them " | |
| 629 "anyway. Watch out for crashes inside of CFAllocatorAllocate."); | |
| 630 } | |
| 631 return darwin_version == 9 || | 626 return darwin_version == 9 || |
| 632 darwin_version == 10 || | 627 darwin_version == 10 || |
| 633 darwin_version == 11; | 628 darwin_version == 11; |
| 634 } | 629 } |
| 635 | 630 |
| 636 CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator, | 631 CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator, |
| 637 long darwin_version) { | 632 long darwin_version) { |
| 638 if (darwin_version == 9 || darwin_version == 10) { | 633 if (darwin_version == 9 || darwin_version == 10) { |
| 639 ChromeCFAllocator9and10* our_allocator = | 634 ChromeCFAllocator9and10* our_allocator = |
| 640 const_cast<ChromeCFAllocator9and10*>( | 635 const_cast<ChromeCFAllocator9and10*>( |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) { | 909 if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) { |
| 915 PLOG(ERROR) << "sysctl"; | 910 PLOG(ERROR) << "sysctl"; |
| 916 return -1; | 911 return -1; |
| 917 } | 912 } |
| 918 if (length == 0) | 913 if (length == 0) |
| 919 return -1; | 914 return -1; |
| 920 return info.kp_eproc.e_ppid; | 915 return info.kp_eproc.e_ppid; |
| 921 } | 916 } |
| 922 | 917 |
| 923 } // namespace base | 918 } // namespace base |
| OLD | NEW |