| 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 12 matching lines...) Expand all Loading... |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 class WTF_EXPORT PartitionAllocator { | 25 class WTF_EXPORT PartitionAllocator { |
| 26 public: | 26 public: |
| 27 typedef PartitionAllocatorDummyVisitor Visitor; | 27 typedef PartitionAllocatorDummyVisitor Visitor; |
| 28 static const bool isGarbageCollected = false; | 28 static const bool isGarbageCollected = false; |
| 29 | 29 |
| 30 template <typename T> | 30 template <typename T> |
| 31 static size_t quantizedSize(size_t count) { | 31 static size_t quantizedSize(size_t count) { |
| 32 RELEASE_ASSERT(count <= base::kGenericMaxDirectMapped / sizeof(T)); | 32 RELEASE_ASSERT(count <= base::kGenericMaxDirectMapped / sizeof(T)); |
| 33 return partitionAllocActualSize(WTF::Partitions::bufferPartition(), | 33 return PartitionAllocActualSize(WTF::Partitions::bufferPartition(), |
| 34 count * sizeof(T)); | 34 count * sizeof(T)); |
| 35 } | 35 } |
| 36 template <typename T> | 36 template <typename T> |
| 37 static T* allocateVectorBacking(size_t size) { | 37 static T* allocateVectorBacking(size_t size) { |
| 38 return reinterpret_cast<T*>( | 38 return reinterpret_cast<T*>( |
| 39 allocateBacking(size, WTF_HEAP_PROFILER_TYPE_NAME(T))); | 39 allocateBacking(size, WTF_HEAP_PROFILER_TYPE_NAME(T))); |
| 40 } | 40 } |
| 41 template <typename T> | 41 template <typename T> |
| 42 static T* allocateExpandedVectorBacking(size_t size) { | 42 static T* allocateExpandedVectorBacking(size_t size) { |
| 43 return reinterpret_cast<T*>( | 43 return reinterpret_cast<T*>( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void* operator new(size_t, NotNullTag, void* location) { \ | 130 void* operator new(size_t, NotNullTag, void* location) { \ |
| 131 DCHECK(location); \ | 131 DCHECK(location); \ |
| 132 return location; \ | 132 return location; \ |
| 133 } \ | 133 } \ |
| 134 void* operator new(size_t, void* location) { return location; } \ | 134 void* operator new(size_t, void* location) { return location; } \ |
| 135 \ | 135 \ |
| 136 private: \ | 136 private: \ |
| 137 typedef int __thisIsHereToForceASemicolonAfterThisMacro | 137 typedef int __thisIsHereToForceASemicolonAfterThisMacro |
| 138 | 138 |
| 139 #endif // WTF_PartitionAllocator_h | 139 #endif // WTF_PartitionAllocator_h |
| OLD | NEW |