| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 // Unfortunately, it's the best we can do. Also note that this does not affect | 589 // Unfortunately, it's the best we can do. Also note that this does not affect |
| 590 // allocations from non-default zones. | 590 // allocations from non-default zones. |
| 591 | 591 |
| 592 CHECK(!g_old_malloc && !g_old_calloc && !g_old_valloc && !g_old_realloc && | 592 CHECK(!g_old_malloc && !g_old_calloc && !g_old_valloc && !g_old_realloc && |
| 593 !g_old_memalign) << "Old allocators unexpectedly non-null"; | 593 !g_old_memalign) << "Old allocators unexpectedly non-null"; |
| 594 | 594 |
| 595 CHECK(!g_old_malloc_purgeable && !g_old_calloc_purgeable && | 595 CHECK(!g_old_malloc_purgeable && !g_old_calloc_purgeable && |
| 596 !g_old_valloc_purgeable && !g_old_realloc_purgeable && | 596 !g_old_valloc_purgeable && !g_old_realloc_purgeable && |
| 597 !g_old_memalign_purgeable) << "Old allocators unexpectedly non-null"; | 597 !g_old_memalign_purgeable) << "Old allocators unexpectedly non-null"; |
| 598 | 598 |
| 599 // See http://trac.webkit.org/changeset/53362/trunk/WebKitTools/DumpRenderTree
/mac | 599 // See http://trac.webkit.org/changeset/53362/trunk/Tools/DumpRenderTree/mac |
| 600 bool zone_allocators_protected = darwin_version > 10; | 600 bool zone_allocators_protected = darwin_version > 10; |
| 601 | 601 |
| 602 ChromeMallocZone* default_zone = | 602 ChromeMallocZone* default_zone = |
| 603 reinterpret_cast<ChromeMallocZone*>(malloc_default_zone()); | 603 reinterpret_cast<ChromeMallocZone*>(malloc_default_zone()); |
| 604 ChromeMallocZone* purgeable_zone = | 604 ChromeMallocZone* purgeable_zone = |
| 605 reinterpret_cast<ChromeMallocZone*>(GetPurgeableZone()); | 605 reinterpret_cast<ChromeMallocZone*>(GetPurgeableZone()); |
| 606 | 606 |
| 607 vm_address_t page_start_default = NULL; | 607 vm_address_t page_start_default = NULL; |
| 608 vm_address_t page_start_purgeable = NULL; | 608 vm_address_t page_start_purgeable = NULL; |
| 609 vm_size_t len_default = 0; | 609 vm_size_t len_default = 0; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 @selector(allocWithZone:)); | 754 @selector(allocWithZone:)); |
| 755 g_old_allocWithZone = reinterpret_cast<allocWithZone_t>( | 755 g_old_allocWithZone = reinterpret_cast<allocWithZone_t>( |
| 756 method_getImplementation(orig_method)); | 756 method_getImplementation(orig_method)); |
| 757 CHECK(g_old_allocWithZone) | 757 CHECK(g_old_allocWithZone) |
| 758 << "Failed to get allocWithZone allocation function."; | 758 << "Failed to get allocWithZone allocation function."; |
| 759 method_setImplementation(orig_method, | 759 method_setImplementation(orig_method, |
| 760 reinterpret_cast<IMP>(oom_killer_allocWithZone)); | 760 reinterpret_cast<IMP>(oom_killer_allocWithZone)); |
| 761 } | 761 } |
| 762 | 762 |
| 763 } // namespace base | 763 } // namespace base |
| OLD | NEW |