Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/tcmalloc/chromium/src/base/custom_allocator.cc

Issue 986503002: components/metrics: Add runtime memory leak detector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dummy function; Exclude sources if leak_detector!=1; Add headers to sources! Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698