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