OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #include "wtf/allocator/PartitionAllocator.h" | 5 #include "platform/wtf/allocator/PartitionAllocator.h" |
6 | 6 |
7 #include "base/allocator/partition_allocator/partition_alloc.h" | 7 #include "base/allocator/partition_allocator/partition_alloc.h" |
8 #include "wtf/allocator/Partitions.h" | 8 #include "platform/wtf/allocator/Partitions.h" |
9 | 9 |
10 namespace WTF { | 10 namespace WTF { |
11 | 11 |
12 void* PartitionAllocator::allocateBacking(size_t size, const char* typeName) { | 12 void* PartitionAllocator::allocateBacking(size_t size, const char* typeName) { |
13 return Partitions::bufferMalloc(size, typeName); | 13 return Partitions::bufferMalloc(size, typeName); |
14 } | 14 } |
15 | 15 |
16 void PartitionAllocator::freeVectorBacking(void* address) { | 16 void PartitionAllocator::freeVectorBacking(void* address) { |
17 Partitions::bufferFree(address); | 17 Partitions::bufferFree(address); |
18 } | 18 } |
19 | 19 |
20 void PartitionAllocator::freeHashTableBacking(void* address) { | 20 void PartitionAllocator::freeHashTableBacking(void* address) { |
21 Partitions::bufferFree(address); | 21 Partitions::bufferFree(address); |
22 } | 22 } |
23 | 23 |
24 template <> | 24 template <> |
25 char* PartitionAllocator::allocateVectorBacking<char>(size_t size) { | 25 char* PartitionAllocator::allocateVectorBacking<char>(size_t size) { |
26 return reinterpret_cast<char*>( | 26 return reinterpret_cast<char*>( |
27 allocateBacking(size, "PartitionAllocator::allocateVectorBacking<char>")); | 27 allocateBacking(size, "PartitionAllocator::allocateVectorBacking<char>")); |
28 } | 28 } |
29 | 29 |
30 template <> | 30 template <> |
31 char* PartitionAllocator::allocateExpandedVectorBacking<char>(size_t size) { | 31 char* PartitionAllocator::allocateExpandedVectorBacking<char>(size_t size) { |
32 return reinterpret_cast<char*>(allocateBacking( | 32 return reinterpret_cast<char*>(allocateBacking( |
33 size, "PartitionAllocator::allocateExpandedVectorBacking<char>")); | 33 size, "PartitionAllocator::allocateExpandedVectorBacking<char>")); |
34 } | 34 } |
35 | 35 |
36 } // namespace WTF | 36 } // namespace WTF |
OLD | NEW |