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 #ifndef BASE_ALLOCATOR_TYPE_PROFILER_H_
6 #define BASE_ALLOCATOR_TYPE_PROFILER_H_
8 #if defined(TYPE_PROFILING)
10 #include <stddef.h> // for size_t
11 #include <typeinfo> // for std::typeinfo
14 namespace type_profiler
{
16 typedef void* InterceptFunction(void*, size_t, const std::type_info
&);
18 class InterceptFunctions
{
20 // It must be called only once in a process while it is in single-thread.
21 // For now, ContentMainRunnerImpl::Initialize is the only supposed caller
22 // of this function except for single-threaded unit tests.
23 static void SetFunctions(InterceptFunction
* new_intercept
,
24 InterceptFunction
* delete_intercept
);
27 friend class TypeProfilerTest
;
29 // These functions are not thread safe.
30 // They must be used only from single-threaded unit tests.
31 static void ResetFunctions();
32 static bool IsAvailable();
35 } // namespace type_profiler
38 #endif // defined(TYPE_PROFILING)
40 #endif // BASE_ALLOCATOR_TYPE_PROFILER_H_