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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 2820433005: memory-infra: Start disentangling tracing from memory-infra (Closed)
Patch Set: update for comments Created 3 years, 8 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: 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 4e5f8a2f77d00afae4d3cffc59678a19421071e5..12eca0a8780cbbdcc644922608947a92fcd7221f 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -39,6 +39,7 @@ class Thread;
namespace trace_event {
+class MemoryTracingObserver;
class MemoryDumpManagerDelegate;
class MemoryDumpProvider;
class MemoryDumpSessionState;
@@ -46,7 +47,7 @@ class MemoryDumpSessionState;
// This is the interface exposed to the rest of the codebase to deal with
// memory tracing. The main entry point for clients is represented by
// RequestDumpPoint(). The extension by Un(RegisterDumpProvider).
-class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
+class BASE_EXPORT MemoryDumpManager {
public:
static const char* const kTraceCategory;
static const char* const kLogPrefix;
@@ -119,9 +120,14 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
void RequestGlobalDump(MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail);
- // TraceLog::EnabledStateObserver implementation.
- void OnTraceLogEnabled() override;
- void OnTraceLogDisabled() override;
+ // Prepare MemoryDumpManager for RequestGlobalMemoryDump calls.
+ // Starts the MemoryDumpManager thread.
+ // Also uses the given config to initialize the peak detector,
+ // scheduler and heap profiler.
+ void Enable(const TraceConfig::MemoryDumpConfig&);
+ // Tearsdown the MemoryDumpManager thread and various other state set up by
Primiano Tucci (use gerrit) 2017/04/21 13:14:16 nit, use blank space to separate comments when yo
hjd 2017/04/21 13:42:32 done, thanks!
+ // Enable.
+ void Disable();
// Enable heap profiling if kEnableHeapProfiling is specified.
void EnableHeapProfilingIfNeeded();
@@ -230,11 +236,12 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
static const char* const kSystemAllocatorPoolName;
MemoryDumpManager();
- ~MemoryDumpManager() override;
+ virtual ~MemoryDumpManager();
static void SetInstanceForTesting(MemoryDumpManager* instance);
static uint32_t GetDumpsSumKb(const std::string&, const ProcessMemoryDump*);
- static void FinalizeDumpAndAddToTrace(
+
+ void FinalizeDumpAndAddToTrace(
std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state);
// Internal, used only by MemoryDumpManagerDelegate.
@@ -284,6 +291,7 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
strict_thread_check_blacklist_;
std::unique_ptr<MemoryDumpManagerDelegate> delegate_;
+ std::unique_ptr<MemoryTracingObserver> tracing_observer_;
// Protects from concurrent accesses to the |dump_providers_*| and |delegate_|
// to guard against disabling logging while dumping on another thread.

Powered by Google App Engine
This is Rietveld 408576698