Chromium Code Reviews| 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 e34bdb0853cc6200d3a494969fe8582eb2040f79..9b59b3b49c27b7c6ad71b11d04f5a614a16127ba 100644 |
| --- a/base/trace_event/memory_dump_manager.h |
| +++ b/base/trace_event/memory_dump_manager.h |
| @@ -36,6 +36,7 @@ class MemoryDumpSessionState; |
| // RequestDumpPoint(). The extension by Un(RegisterDumpProvider). |
| class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver { |
| public: |
| + static const int kInvalidTracingProcessId = -1; |
| static const char* const kTraceCategoryForTesting; |
| static MemoryDumpManager* GetInstance(); |
| @@ -81,6 +82,16 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver { |
| return session_state_; |
| } |
| + // This is used by browser to hash child id to get the tracing_process_id |
|
Primiano Tucci (use gerrit)
2015/06/24 09:31:00
Add the following comment here
// Derives a traci
|
| + // for child. |
| + static int ChildProcessIdToTracingProcessId(int child_id); |
| + |
| + int tracing_process_id() const { |
|
Primiano Tucci (use gerrit)
2015/06/24 09:31:00
Add a comment saying:
// Returns a unique id for
|
| + // This cannot be requested out of scope of a trace. |
| + DCHECK_NE(tracing_process_id_, kInvalidTracingProcessId); |
| + return tracing_process_id_; |
| + } |
| + |
| private: |
| // Descriptor struct used to hold information about registered MDPs. It is |
| // deliberately copyable, in order to allow to be used as hash_map value. |
| @@ -121,6 +132,13 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver { |
| MemoryDumpProvider* mdp, |
| scoped_refptr<ProcessMemoryDumpHolder> pmd_holder); |
| + // Pass kInvalidTracingProcessId for invalidating the id. |
| + void set_tracing_process_id(int id) { |
| + DCHECK(tracing_process_id_ == kInvalidTracingProcessId || |
| + id == kInvalidTracingProcessId); |
| + tracing_process_id_ = id; |
| + } |
| + |
| hash_map<MemoryDumpProvider*, MemoryDumpProviderInfo> dump_providers_; |
| // Shared among all the PMDs to keep state scoped to the tracing session. |
| @@ -139,6 +157,10 @@ class BASE_EXPORT MemoryDumpManager : public TraceLog::EnabledStateObserver { |
| // For time-triggered periodic dumps. |
| RepeatingTimer<MemoryDumpManager> periodic_dump_timer_; |
| + // The unique id of the child process. This is created only for tracing and is |
| + // expected to be valid only when tracing is enabled. |
| + int tracing_process_id_; |
| + |
| // Skips the auto-registration of the core dumpers during Initialize(). |
| bool skip_core_dumpers_auto_registration_for_testing_; |
| @@ -165,6 +187,10 @@ class BASE_EXPORT MemoryDumpManagerDelegate { |
| MemoryDumpManager::GetInstance()->CreateProcessDump(args, callback); |
| } |
| + void set_tracing_process_id(int id) { |
| + MemoryDumpManager::GetInstance()->set_tracing_process_id(id); |
| + } |
| + |
| private: |
| DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); |
| }; |