| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef BASE_ALLOCATOR_TYPE_PROFILER_H_ | |
| 6 #define BASE_ALLOCATOR_TYPE_PROFILER_H_ | |
| 7 | |
| 8 #if defined(TYPE_PROFILING) | |
| 9 | |
| 10 #include <stddef.h> // for size_t | |
| 11 #include <typeinfo> // for std::typeinfo | |
| 12 | |
| 13 namespace base { | |
| 14 namespace type_profiler { | |
| 15 | |
| 16 typedef void* InterceptFunction(void*, size_t, const std::type_info&); | |
| 17 | |
| 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); | |
| 25 | |
| 26 private: | |
| 27 friend class TypeProfilerTest; | |
| 28 | |
| 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(); | |
| 33 }; | |
| 34 | |
| 35 } // namespace type_profiler | |
| 36 } // namespace base | |
| 37 | |
| 38 #endif // defined(TYPE_PROFILING) | |
| 39 | |
| 40 #endif // BASE_ALLOCATOR_TYPE_PROFILER_H_ | |
| OLD | NEW |