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

Unified Diff: third_party/WebKit/public/platform/WebMemoryDumpProvider.h

Issue 1391933004: [Tracing] Add hook to PartitionAlloc for heap profiling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address primiano comments Created 5 years, 2 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
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

Powered by Google App Engine
This is Rietveld 408576698