summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 01:26:09 +0000
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 01:26:09 +0000
commit3b8c933e27be80f9e8ef2cee25df431b0983c1ab (patch)
tree8e5cf6bb6e5a870f326e535c7922958dcec65ea0 /components
parent586f891d1414c2b68908cc7c154d0cb9db0bd084 (diff)
downloadchromium_src-3b8c933e27be80f9e8ef2cee25df431b0983c1ab.zip
chromium_src-3b8c933e27be80f9e8ef2cee25df431b0983c1ab.tar.gz
chromium_src-3b8c933e27be80f9e8ef2cee25df431b0983c1ab.tar.bz2
Fix --trace-startup.
Some subprocesses handle --trace-startup by themselves to start tracing as early as possible if the switch presents. However, previously TraceController would enable tracing of the subprocess again by sending TracingMsg_BeginTracing when it knew a new subprocess has been started. This caused tracing of the subprocess not to be properly stopped and flushed when startup tracing is ended. Changes: - Pass tracing_startup parameter through TracingMsg_BeginTracing; subprocess won't start tracing again if tracing_startup is true and tracing has already been started; - Don't pass --trace-startup to renderer if startup tracing has already finished. BUG=310395 Review URL: https://codereview.chromium.org/48903003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/tracing/child_trace_message_filter.cc15
-rw-r--r--components/tracing/child_trace_message_filter.h3
-rw-r--r--components/tracing/tracing_messages.h5
3 files changed, 16 insertions, 7 deletions
diff --git a/components/tracing/child_trace_message_filter.cc b/components/tracing/child_trace_message_filter.cc
index 9925f3f..721c676 100644
--- a/components/tracing/child_trace_message_filter.cc
+++ b/components/tracing/child_trace_message_filter.cc
@@ -52,7 +52,8 @@ ChildTraceMessageFilter::~ChildTraceMessageFilter() {}
void ChildTraceMessageFilter::OnBeginTracing(
const std::string& category_filter_str,
base::TimeTicks browser_time,
- int options) {
+ int options,
+ bool tracing_startup) {
#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
@@ -61,9 +62,15 @@ void ChildTraceMessageFilter::OnBeginTracing(
browser_time;
TraceLog::GetInstance()->SetTimeOffset(time_offset);
#endif
- TraceLog::GetInstance()->SetEnabled(
- base::debug::CategoryFilter(category_filter_str),
- static_cast<base::debug::TraceLog::Options>(options));
+
+ // Some subprocesses handle --trace-startup by themselves to begin
+ // trace as early as possible. Don't start twice, otherwise the trace
+ // buffer can't be correctly flushed on the end of startup tracing.
+ if (!tracing_startup || !TraceLog::GetInstance()->IsEnabled()) {
+ TraceLog::GetInstance()->SetEnabled(
+ base::debug::CategoryFilter(category_filter_str),
+ static_cast<base::debug::TraceLog::Options>(options));
+ }
}
void ChildTraceMessageFilter::OnEndTracing() {
diff --git a/components/tracing/child_trace_message_filter.h b/components/tracing/child_trace_message_filter.h
index cbd300f..8fe301a 100644
--- a/components/tracing/child_trace_message_filter.h
+++ b/components/tracing/child_trace_message_filter.h
@@ -32,7 +32,8 @@ class ChildTraceMessageFilter : public IPC::ChannelProxy::MessageFilter {
// Message handlers.
void OnBeginTracing(const std::string& category_filter_str,
base::TimeTicks browser_time,
- int options);
+ int options,
+ bool tracing_startup);
void OnEndTracing();
void OnEnableMonitoring(const std::string& category_filter_str,
base::TimeTicks browser_time,
diff --git a/components/tracing/tracing_messages.h b/components/tracing/tracing_messages.h
index 25b45bd..2b491ba 100644
--- a/components/tracing/tracing_messages.h
+++ b/components/tracing/tracing_messages.h
@@ -16,10 +16,11 @@
#define IPC_MESSAGE_START TracingMsgStart
// Sent to all child processes to enable trace event recording.
-IPC_MESSAGE_CONTROL3(TracingMsg_BeginTracing,
+IPC_MESSAGE_CONTROL4(TracingMsg_BeginTracing,
std::string /* category_filter_str */,
base::TimeTicks /* browser_time */,
- int /* base::debug::TraceLog::Options */)
+ int /* base::debug::TraceLog::Options */,
+ bool /* tracing_startup */)
// Sent to all child processes to disable trace event recording.
IPC_MESSAGE_CONTROL0(TracingMsg_EndTracing)