| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef WTF_PartitionAllocator_h | 5 #ifndef WTF_PartitionAllocator_h |
| 6 #define WTF_PartitionAllocator_h | 6 #define WTF_PartitionAllocator_h |
| 7 | 7 |
| 8 // This is the allocator that is used for allocations that are not on the | 8 // This is the allocator that is used for allocations that are not on the |
| 9 // traced, garbage collected heap. It uses FastMalloc for collections, | 9 // traced, garbage collected heap. It uses FastMalloc for collections, |
| 10 // but uses the partition allocator for the backing store of the collections. | 10 // but uses the partition allocator for the backing store of the collections. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 static void Free(void* address) { WTF::Partitions::FastFree(address); } | 95 static void Free(void* address) { WTF::Partitions::FastFree(address); } |
| 96 template <typename T> | 96 template <typename T> |
| 97 static void* NewArray(size_t bytes) { | 97 static void* NewArray(size_t bytes) { |
| 98 return Malloc<void*, void>(bytes, WTF_HEAP_PROFILER_TYPE_NAME(T)); | 98 return Malloc<void*, void>(bytes, WTF_HEAP_PROFILER_TYPE_NAME(T)); |
| 99 } | 99 } |
| 100 static void DeleteArray(void* ptr) { | 100 static void DeleteArray(void* ptr) { |
| 101 Free(ptr); // Not the system free, the one from this class. | 101 Free(ptr); // Not the system free, the one from this class. |
| 102 } | 102 } |
| 103 | 103 |
| 104 static bool IsAllocationAllowed() { return true; } | 104 static bool IsAllocationAllowed() { return true; } |
| 105 static bool IsBackingReallocationAllowed() { return true; } |
| 105 | 106 |
| 106 static void EnterGCForbiddenScope() {} | 107 static void EnterGCForbiddenScope() {} |
| 107 static void LeaveGCForbiddenScope() {} | 108 static void LeaveGCForbiddenScope() {} |
| 108 | 109 |
| 109 private: | 110 private: |
| 110 static void* AllocateBacking(size_t, const char* type_name); | 111 static void* AllocateBacking(size_t, const char* type_name); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 // Specializations for heap profiling, so type profiling of |char| is possible | 114 // Specializations for heap profiling, so type profiling of |char| is possible |
| 114 // even in official builds (because |char| makes up a large portion of the | 115 // even in official builds (because |char| makes up a large portion of the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 135 void* operator new(size_t, NotNullTag, void* location) { \ | 136 void* operator new(size_t, NotNullTag, void* location) { \ |
| 136 DCHECK(location); \ | 137 DCHECK(location); \ |
| 137 return location; \ | 138 return location; \ |
| 138 } \ | 139 } \ |
| 139 void* operator new(size_t, void* location) { return location; } \ | 140 void* operator new(size_t, void* location) { return location; } \ |
| 140 \ | 141 \ |
| 141 private: \ | 142 private: \ |
| 142 typedef int __thisIsHereToForceASemicolonAfterThisMacro | 143 typedef int __thisIsHereToForceASemicolonAfterThisMacro |
| 143 | 144 |
| 144 #endif // WTF_PartitionAllocator_h | 145 #endif // WTF_PartitionAllocator_h |
| OLD | NEW |