diff options
author | ssid <ssid@chromium.org> | 2015-06-25 11:38:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-25 18:39:39 +0000 |
commit | a3e7c30a16e711b59226da21f993522ee47ac674 (patch) | |
tree | b0825a2a075f2d215eda9e098a189528240ae4c5 /components/tracing | |
parent | c766e527bd875dd56567cd8f4915ebcc83cb8dec (diff) | |
download | chromium_src-a3e7c30a16e711b59226da21f993522ee47ac674.zip chromium_src-a3e7c30a16e711b59226da21f993522ee47ac674.tar.gz chromium_src-a3e7c30a16e711b59226da21f993522ee47ac674.tar.bz2 |
[tracing] Send unique tracing process id for cross-process memory dumps identification.
The memory shared between browser and renderer must be identified with
the same unique id for memory dumps in tracing. Currently the child
process is not aware of its unique child process id. But, the child
process id cannot be exposed in the child process (see discussion in
crrev.com/1155683009).
So, a hash of the child process id allocated by the browser process is
sent to child process along with begin tracing message and will be
exposed in the child process MemoryDumpManager. The allocator that
needs to create a global guid will use the id to identify memory dumps.
See the design doc https://goo.gl/ncMfUV for more details.
BUG=497726
Review URL: https://codereview.chromium.org/1173263004
Cr-Commit-Position: refs/heads/master@{#336210}
Diffstat (limited to 'components/tracing')
-rw-r--r-- | components/tracing/child_trace_message_filter.cc | 8 | ||||
-rw-r--r-- | components/tracing/child_trace_message_filter.h | 3 | ||||
-rw-r--r-- | components/tracing/tracing_messages.h | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/components/tracing/child_trace_message_filter.cc b/components/tracing/child_trace_message_filter.cc index b3babc2..8832b67 100644 --- a/components/tracing/child_trace_message_filter.cc +++ b/components/tracing/child_trace_message_filter.cc @@ -59,7 +59,8 @@ ChildTraceMessageFilter::~ChildTraceMessageFilter() {} void ChildTraceMessageFilter::OnBeginTracing( const std::string& trace_config_str, - base::TraceTicks browser_time) { + base::TraceTicks browser_time, + int tracing_process_id) { #if defined(__native_client__) // NaCl and system times are offset by a bit, so subtract some time from // the captured timestamps. The value might be off by a bit due to messaging @@ -67,6 +68,8 @@ void ChildTraceMessageFilter::OnBeginTracing( base::TimeDelta time_offset = base::TraceTicks::Now() - browser_time; TraceLog::GetInstance()->SetTimeOffset(time_offset); #endif + ChildMemoryDumpManagerDelegateImpl::GetInstance()->set_tracing_process_id( + tracing_process_id); TraceLog::GetInstance()->SetEnabled( base::trace_event::TraceConfig(trace_config_str), base::trace_event::TraceLog::RECORDING_MODE); @@ -81,6 +84,9 @@ void ChildTraceMessageFilter::OnEndTracing() { // OnTraceDataCollected calls will not be deferred. TraceLog::GetInstance()->Flush( base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected, this)); + + ChildMemoryDumpManagerDelegateImpl::GetInstance()->set_tracing_process_id( + base::trace_event::MemoryDumpManager::kInvalidTracingProcessId); } void ChildTraceMessageFilter::OnCancelTracing() { diff --git a/components/tracing/child_trace_message_filter.h b/components/tracing/child_trace_message_filter.h index a075edb..5917512 100644 --- a/components/tracing/child_trace_message_filter.h +++ b/components/tracing/child_trace_message_filter.h @@ -41,7 +41,8 @@ class ChildTraceMessageFilter : public IPC::MessageFilter { private: // Message handlers. void OnBeginTracing(const std::string& trace_config_str, - base::TraceTicks browser_time); + base::TraceTicks browser_time, + int tracing_process_id); void OnEndTracing(); void OnCancelTracing(); void OnEnableMonitoring(const std::string& trace_config_str, diff --git a/components/tracing/tracing_messages.h b/components/tracing/tracing_messages.h index ebdefc1..dd14b90 100644 --- a/components/tracing/tracing_messages.h +++ b/components/tracing/tracing_messages.h @@ -32,9 +32,10 @@ IPC_ENUM_TRAITS_MAX_VALUE( static_cast<int>(base::trace_event::MemoryDumpType::LAST)) // Sent to all child processes to enable trace event recording. -IPC_MESSAGE_CONTROL2(TracingMsg_BeginTracing, +IPC_MESSAGE_CONTROL3(TracingMsg_BeginTracing, std::string /* trace_config_str */, - base::TraceTicks /* browser_time */) + base::TraceTicks /* browser_time */, + int /* Tracing process id (hash of child id) */) // Sent to all child processes to disable trace event recording. IPC_MESSAGE_CONTROL0(TracingMsg_EndTracing) |