| Index: third_party/tcmalloc/chromium/src/base/custom_allocator.cc
|
| diff --git a/third_party/tcmalloc/chromium/src/base/custom_allocator.cc b/third_party/tcmalloc/chromium/src/base/custom_allocator.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a225d6711fe5b840384552d575aa3e3e21220896
|
| --- /dev/null
|
| +++ b/third_party/tcmalloc/chromium/src/base/custom_allocator.cc
|
| @@ -0,0 +1,29 @@
|
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// ---
|
| +// Author: Simon Que
|
| +
|
| +#include "base/custom_allocator.h"
|
| +
|
| +// static
|
| +void CustomAllocator::SetArena(LowLevelAlloc::Arena* arena) {
|
| + arena_ = arena;
|
| +}
|
| +
|
| +// static
|
| +void* CustomAllocator::Allocate(size_t size) {
|
| + if (arena_)
|
| + return LowLevelAlloc::AllocWithArena(size, arena_);
|
| +
|
| + return LowLevelAlloc::Alloc(size);
|
| +}
|
| +
|
| +// static
|
| +void CustomAllocator::Free(void* ptr, size_t /* size */) {
|
| + LowLevelAlloc::Free(ptr);
|
| +}
|
| +
|
| +// static
|
| +LowLevelAlloc::Arena* CustomAllocator::arena_ = NULL;
|
|
|