This source file includes following definitions.
- NopIntercept
- __op_new_intercept__
- __op_delete_intercept__
- SetFunctions
- ResetFunctions
- IsAvailable
#if defined(TYPE_PROFILING)
#include "base/allocator/type_profiler.h"
#include <assert.h>
namespace {
void* NopIntercept(void* ptr, size_t size, const std::type_info& type) {
return ptr;
}
base::type_profiler::InterceptFunction* g_new_intercept = NopIntercept;
base::type_profiler::InterceptFunction* g_delete_intercept = NopIntercept;
}
void* __op_new_intercept__(void* ptr,
size_t size,
const std::type_info& type) {
return g_new_intercept(ptr, size, type);
}
void* __op_delete_intercept__(void* ptr,
size_t size,
const std::type_info& type) {
return g_delete_intercept(ptr, size, type);
}
namespace base {
namespace type_profiler {
void InterceptFunctions::SetFunctions(InterceptFunction* new_intercept,
InterceptFunction* delete_intercept) {
assert(g_new_intercept == NopIntercept);
assert(g_delete_intercept == NopIntercept);
g_new_intercept = new_intercept;
g_delete_intercept = delete_intercept;
}
void InterceptFunctions::ResetFunctions() {
g_new_intercept = NopIntercept;
g_delete_intercept = NopIntercept;
}
bool InterceptFunctions::IsAvailable() {
return g_new_intercept != NopIntercept || g_delete_intercept != NopIntercept;
}
}
}
#endif