void * __cdecl dhw_calloc( size_t count, size_t size ) { tm_thread *t = tm_get_thread(); ++t->suppress_tracing; uint32_t start = PR_IntervalNow(); void* result = DHW_ORIGINAL(CALLOC_, getCallocHooker())(count,size); uint32_t end = PR_IntervalNow(); --t->suppress_tracing; CallocCallback(result, count, size, start, end, t); return result; }
void * __cdecl dhw_vec_new(size_t size) { tm_thread *t = tm_get_thread(); ++t->suppress_tracing; // need to suppress since new[] calls new uint32_t start = PR_IntervalNow(); void* result = DHW_ORIGINAL(VEC_NEW_, getVecNewHooker())(size); uint32_t end = PR_IntervalNow(); --t->suppress_tracing; MallocCallback(result, size, start, end, t);//do we need a different one for new[]? return result; }
void __cdecl dhw_free( void* p ) { tm_thread *t = tm_get_thread(); ++t->suppress_tracing; uint32_t start = PR_IntervalNow(); DHW_ORIGINAL(FREE_, getFreeHooker())(p); uint32_t end = PR_IntervalNow(); --t->suppress_tracing; /* FIXME bug 392008: We could race with reallocation of p. */ FreeCallback(p, start, end, t); }
void * __cdecl dhw_malloc( size_t size ) { tm_thread *t = tm_get_thread(); ++t->suppress_tracing; PRUint32 start = PR_IntervalNow(); void* result = DHW_ORIGINAL(MALLOC_, getMallocHooker())(size); PRUint32 end = PR_IntervalNow(); --t->suppress_tracing; MallocCallback(result, size, start, end, t); return result; }
void * __cdecl dhw_new(size_t size) { tm_thread *t = tm_get_thread(); ++t->suppress_tracing; PRUint32 start = PR_IntervalNow(); void* result = DHW_ORIGINAL(NEW_, getNewHooker())(size); PRUint32 end = PR_IntervalNow(); --t->suppress_tracing; MallocCallback(result, size, start, end, t);//do we need a different one for new? return result; }
void * __cdecl dhw_realloc(void * pin, size_t size) { tm_thread *t = tm_get_thread(); ++t->suppress_tracing; uint32_t start = PR_IntervalNow(); void* pout = DHW_ORIGINAL(REALLOC_, getReallocHooker())(pin, size); uint32_t end = PR_IntervalNow(); --t->suppress_tracing; /* FIXME bug 392008: We could race with reallocation of pin. */ ReallocCallback(pin, pout, size, start, end, t); return pout; }
void dhw_orig_free(void* p) { DHW_ORIGINAL(FREE_, getFreeHooker())(p); }
void* dhw_orig_realloc(void* pin, size_t size) { return DHW_ORIGINAL(REALLOC_, getReallocHooker())(pin, size); }
void* dhw_orig_calloc(size_t count, size_t size) { return DHW_ORIGINAL(CALLOC_, getCallocHooker())(count,size); }
void* dhw_orig_malloc(size_t size) { return DHW_ORIGINAL(MALLOC_, getMallocHooker())(size); }