Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| diff --git a/third_party/WebKit/Source/platform/heap/HeapAllocator.h b/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| index c5bf93760a821ef77cf19528bfcdca261c01b98e..f0bf239211d98ec9aabe8bcad911e5e8207e2a34 100644 |
| --- a/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| +++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.h |
| @@ -62,7 +62,10 @@ public: |
| { |
| size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>::index(); |
| ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); |
| - return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, BlinkGC::InlineVectorHeapIndex, gcInfoIndex)); |
| + Address address = Heap::allocateOnHeapIndex(state, size, BlinkGC::InlineVectorHeapIndex, gcInfoIndex); |
| + const char* typeName = WTF_HEAP_PROFILER_TYPE_NAME(T); |
| + HeapAllocHooks::allocationHookIfEnabled(address, size, typeName); |
|
sof
2016/02/23 09:13:02
Can you guarantee that this doesn't add a single e
hajimehoshi
2016/02/23 09:27:17
Yes. The actual hooks doesn't allocate any objects
Primiano Tucci (use gerrit)
2016/02/25 06:55:51
Is there any way we can make this future proof suc
hajimehoshi
2016/02/25 07:06:01
Good point. Such hooks should be in allocateOnHeap
hajimehoshi
2016/02/26 09:37:13
Done.
|
| + return reinterpret_cast<T*>(address); |
| } |
| static void freeInlineVectorBacking(void*); |
| static bool expandInlineVectorBacking(void*, size_t); |
| @@ -73,7 +76,10 @@ public: |
| { |
| size_t gcInfoIndex = GCInfoTrait<HeapHashTableBacking<HashTable>>::index(); |
| ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); |
| - return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, BlinkGC::HashTableHeapIndex, gcInfoIndex)); |
| + Address address = Heap::allocateOnHeapIndex(state, size, BlinkGC::HashTableHeapIndex, gcInfoIndex); |
| + const char* typeName = WTF_HEAP_PROFILER_TYPE_NAME(T); |
| + HeapAllocHooks::allocationHookIfEnabled(address, size, typeName); |
| + return reinterpret_cast<T*>(address); |
| } |
| template <typename T, typename HashTable> |
| static T* allocateZeroedHashTableBacking(size_t size) |