Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Unified Diff: third_party/WebKit/Source/platform/heap/HeapAllocator.h

Issue 1721333002: Bug fix: Add BlinkGC allocation hooks to CSS, Node and vector/table backing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698