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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 1333873002: [tracing] Fix MemoryDumpManager to support startup tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re dsinclair #5 (nits, invert Initialize args) Created 5 years, 3 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 | « no previous file | 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 760ad7b871de3c76176ee71203beb1ec960729f5..1092a264830aa1dc1d3280d48aaaf707e4f46d24 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -40,12 +40,19 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
static MemoryDumpManager* GetInstance();
- // Invoked once per process to register the TraceLog observer.
- void Initialize();
-
- // See the lifetime and thread-safety requirements on the delegate below in
- // the |MemoryDumpManagerDelegate| docstring.
- void SetDelegate(MemoryDumpManagerDelegate* delegate);
+ // Invoked once per process to listen to trace begin / end events.
+ // Initialization can happen after (Un)RegisterMemoryDumpProvider() calls
+ // and the MemoryDumpManager guarantees to support this.
+ // On the other side, the MemoryDumpManager will not be fully operational
+ // (i.e. will NACK any RequestGlobalMemoryDump()) until initialized.
+ // Arguments:
+ // is_coordinator: if true this MemoryDumpManager instance will act as a
+ // coordinator and schedule periodic dumps (if enabled via TraceConfig);
+ // false when the MemoryDumpManager is initialized in a slave process.
+ // delegate: inversion-of-control interface for embedder-specific behaviors
+ // (multiprocess handshaking). See the lifetime and thread-safety
+ // requirements in the |MemoryDumpManagerDelegate| docstring.
+ void Initialize(MemoryDumpManagerDelegate* delegate, bool is_coordinator);
// MemoryDumpManager does NOT take memory ownership of |mdp|, which is
// expected to either be a singleton or unregister itself.
@@ -108,9 +115,6 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
friend struct DefaultSingletonTraits<MemoryDumpManager>;
friend class MemoryDumpManagerDelegate;
friend class MemoryDumpManagerTest;
- FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers);
- FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest,
- UnregisterDumperFromThreadWhileDumping);
// Descriptor struct used to hold information about registered MDPs. It is
// deliberately copyable, in order to allow it to be used as std::set value.
@@ -208,6 +212,9 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
MemoryDumpManagerDelegate* delegate_; // Not owned.
+ // When true, this instance is in charge of coordinating periodic dumps.
+ bool is_coordinator_;
+
// Protects from concurrent accesses to the |dump_providers_*| and |delegate_|
// to guard against disabling logging while dumping on another thread.
Lock lock_;
@@ -241,10 +248,6 @@ class BASE_EXPORT MemoryDumpManagerDelegate {
virtual void RequestGlobalMemoryDump(const MemoryDumpRequestArgs& args,
const MemoryDumpCallback& callback) = 0;
- // Determines whether the MemoryDumpManager instance should be the master
- // (the ones which initiates and coordinates the multiprocess dumps) or not.
- virtual bool IsCoordinatorProcess() const = 0;
-
// Returns tracing process id of the current process. This is used by
// MemoryDumpManager::GetTracingProcessId.
virtual uint64 GetTracingProcessId() const = 0;
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698