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

Unified Diff: base/trace_event/memory_dump_manager.h

Issue 2694083005: memory-infra: Finish moving memory_infra from TracingController (Closed)
Patch Set: review Created 3 years, 10 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') | base/trace_event/memory_dump_manager.cc » ('J')
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 7579285f84a44da64ad40c115172ec292c0b5c89..dd4edba10b80e7f737df969109ac18333dcd30eb 100644
--- a/base/trace_event/memory_dump_manager.h
+++ b/base/trace_event/memory_dump_manager.h
@@ -43,7 +43,7 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
static const char* const kLogPrefix;
// This value is returned as the tracing id of the child processes by
- // GetTracingProcessId() when tracing is not enabled.
+ // tracing_process_id() when tracing is not enabled.
static const uint64_t kInvalidTracingProcessId;
static MemoryDumpManager* GetInstance();
@@ -54,13 +54,10 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// 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);
+ void Initialize(std::unique_ptr<MemoryDumpManagerDelegate> delegate);
Primiano Tucci (use gerrit) 2017/02/17 19:08:44 the MDM is a leaky singleton, passing ownership of
chiniforooshan 2017/02/22 05:16:34 Done.
// (Un)Registers a MemoryDumpProvider instance.
// Args:
@@ -135,7 +132,10 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
// retrieved by child processes only when tracing is enabled. This is
// intended to express cross-process sharing of memory dumps on the
// child-process side, without having to know its own child process id.
- uint64_t GetTracingProcessId() const;
+ uint64_t tracing_process_id() const { return tracing_process_id_; }
Primiano Tucci (use gerrit) 2017/02/17 19:08:44 Renaming this getter will require you a lot more o
chiniforooshan 2017/02/22 05:16:34 Done.
+ void set_tracing_process_id(uint64_t tracing_process_id) {
+ tracing_process_id_ = tracing_process_id;
+ }
// Returns the name for a the allocated_objects dump. Use this to declare
// suballocator dumps from other dump providers.
@@ -371,10 +371,7 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver {
std::unordered_set<StringPiece, StringPieceHash>
strict_thread_check_blacklist_;
- MemoryDumpManagerDelegate* delegate_; // Not owned.
-
- // When true, this instance is in charge of coordinating periodic dumps.
- bool is_coordinator_;
+ std::unique_ptr<MemoryDumpManagerDelegate> delegate_;
// Protects from concurrent accesses to the |dump_providers_*| and |delegate_|
// to guard against disabling logging while dumping on another thread.
@@ -411,11 +408,11 @@ class BASE_EXPORT MemoryDumpManagerDelegate {
virtual void RequestGlobalMemoryDump(const MemoryDumpRequestArgs& args,
const MemoryDumpCallback& callback) = 0;
- // Returns tracing process id of the current process. This is used by
- // MemoryDumpManager::GetTracingProcessId.
- virtual uint64_t GetTracingProcessId() const = 0;
+ virtual bool IsCoordinator() const = 0;
protected:
+ friend std::default_delete<MemoryDumpManagerDelegate>;
+
MemoryDumpManagerDelegate() {}
virtual ~MemoryDumpManagerDelegate() {}
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | base/trace_event/memory_dump_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698