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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 2820433005: memory-infra: Start disentangling tracing from memory-infra (Closed)
Patch Set: add todo 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
« no previous file with comments | « base/BUILD.gn ('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 d359a8c3e9722f8441c907d06a2ae3b91cc8b7c8..1583c9ee6c7b5d37e104f1763015bce07454ec64 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,15 @@ 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
+ // Enable.
+ void Disable();
// Enable heap profiling if kEnableHeapProfiling is specified.
void EnableHeapProfilingIfNeeded();
@@ -230,11 +237,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 +292,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.
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698