OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 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 // --- |
| 6 // Author: Simon Que |
| 7 |
| 8 #include "base/custom_allocator.h" |
| 9 |
| 10 // static |
| 11 void CustomAllocator::SetArena(LowLevelAlloc::Arena* arena) { |
| 12 arena_ = arena; |
| 13 } |
| 14 |
| 15 // static |
| 16 void* CustomAllocator::Allocate(size_t size) { |
| 17 if (arena_) |
| 18 return LowLevelAlloc::AllocWithArena(size, arena_); |
| 19 |
| 20 return LowLevelAlloc::Alloc(size); |
| 21 } |
| 22 |
| 23 // static |
| 24 void CustomAllocator::Free(void* ptr, size_t /* size */) { |
| 25 LowLevelAlloc::Free(ptr); |
| 26 } |
| 27 |
| 28 // static |
| 29 LowLevelAlloc::Arena* CustomAllocator::arena_ = NULL; |
OLD | NEW |