Index: third_party/WebKit/public/platform/WebMemoryDumpProvider.h |
diff --git a/third_party/WebKit/public/platform/WebMemoryDumpProvider.h b/third_party/WebKit/public/platform/WebMemoryDumpProvider.h |
index df151e8297bd2e1e5a406a6f8703a4d8a6bdff2a..6ab4bbc732bd3882464288212f3c0d3cc96840cd 100644 |
--- a/third_party/WebKit/public/platform/WebMemoryDumpProvider.h |
+++ b/third_party/WebKit/public/platform/WebMemoryDumpProvider.h |
@@ -23,6 +23,11 @@ enum class WebMemoryDumpLevelOfDetail { |
// Platform::registerMemoryDumpProvider()) to dump stats for their allocators. |
class BLINK_PLATFORM_EXPORT WebMemoryDumpProvider { |
public: |
+ // Function types for functions that can be called on alloc and free to do |
+ // heap profiling. |
+ typedef void AllocationHook(void* address, size_t); |
+ typedef void FreeHook(void* address); |
+ |
virtual ~WebMemoryDumpProvider(); |
// Called by the MemoryDumpManager when generating memory dumps. |
@@ -32,6 +37,17 @@ public: |
// on success or false if anything went wrong and the dump should be |
// considered invalid. |
virtual bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) = 0; |
+ |
+ // Because Blink cannot depend on base, heap profiling bookkeeping has to |
+ // be done in the glue layer for now. This method allows the glue layer to |
+ // detect for which dump provider it should do the bookkeeping. |
+ virtual bool supportsHeapProfiling() { return false; } |
+ |
+ // Called by the memory dump manager to enable heap profiling (with |
+ // non-null hook functions) or called to disable heap profiling (with null |
+ // pointers). This is a workaround for the fact that Blink cannot use |
+ // |base::trace_event::AllocationRegister| and do the bookkeeping itself. |
+ virtual void onHeapProfilingEnabled(AllocationHook* allocationHook, FreeHook* freeHook) {} |
}; |
} // namespace blink |