Invoke LeakSanitizer on teardown of RenderFrameImplTest
[chromium-blink-merge.git] / base / allocator / type_profiler_tcmalloc.cc
blobe5e10e0d12931c499cb873cf111d520ad06699f2
1 // Copyright 2012 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.
5 #if defined(TYPE_PROFILING)
7 #include "base/allocator/type_profiler_tcmalloc.h"
9 #include "base/allocator/type_profiler_control.h"
10 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
11 #include "third_party/tcmalloc/chromium/src/gperftools/type_profiler_map.h"
13 namespace base {
14 namespace type_profiler {
16 void* NewInterceptForTCMalloc(void* ptr,
17 size_t size,
18 const std::type_info& type) {
19 if (Controller::IsProfiling())
20 InsertType(ptr, size, type);
22 return ptr;
25 void* DeleteInterceptForTCMalloc(void* ptr,
26 size_t size,
27 const std::type_info& type) {
28 if (Controller::IsProfiling())
29 EraseType(ptr);
31 return ptr;
34 } // namespace type_profiler
35 } // namespace base
37 #endif // defined(TYPE_PROFILING)