Make castv2 performance test work.
[chromium-blink-merge.git] / base / allocator / type_profiler.h
blob86b5711a9d015e57b389425e28e8a75ef76523f3
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
13 namespace base {
14 namespace type_profiler {
16 typedef void* InterceptFunction(void*, size_t, const std::type_info&);
18 class InterceptFunctions {
19 public:
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);
26 private:
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
36 } // namespace base
38 #endif // defined(TYPE_PROFILING)
40 #endif // BASE_ALLOCATOR_TYPE_PROFILER_H_