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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 2777343003: [memory-infra] Add api to enable heap profiling in MemoryDumpManager
Patch Set: nits. Created 3 years, 9 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 | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.h
diff --git a/base/trace_event/memory_dump_manager.h b/base/trace_event/memory_dump_manager.h
index ebee048691628d5c29201eadd9efe17fe5032349..73efcc37528c86f9847d7b7763de58c7da46c495 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -126,6 +126,10 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// Enable heap profiling if kEnableHeapProfiling is specified.
void EnableHeapProfilingIfNeeded();
+ // Enable heap profiling with specified |capture_mode|. Disabling heap
+ // profiler will disable it permanently and cannot be enabled again.
+ void EnableHeapProfiling(AllocationContextTracker::CaptureMode capture_mode);
+
// Returns true if the dump mode is allowed for current tracing session.
bool IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode);
@@ -346,6 +350,10 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
void UnregisterPollingMDPOnDumpThread(
scoped_refptr<MemoryDumpProviderInfo> mdpinfo);
+ // Helper to enable heap profiling.
+ void EnableHeapProfilingLocked(
+ AllocationContextTracker::CaptureMode capture_mode);
+
// An ordererd set of registered MemoryDumpProviderInfo(s), sorted by task
// runner affinity (MDPs belonging to the same task runners are adjacent).
MemoryDumpProviderInfo::OrderedSet dump_providers_;
@@ -383,8 +391,11 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// When true, calling |RegisterMemoryDumpProvider| is a no-op.
bool dumper_registrations_ignored_for_testing_;
- // Whether new memory dump providers should be told to enable heap profiling.
- bool heap_profiling_enabled_;
+ // Heap profiling can be enabled and disabled only once in the process.
+ // New memory dump providers should be told to enable heap profiling if state
+ // is ENABLED.
+ enum class HeapProfilingState { DISABLED, ENABLED, DISABLED_PERMANENTLY };
+ HeapProfilingState heap_profiling_state_;
DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager);
};
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698