diff options
author | nednguyen@google.com <nednguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-04 16:30:52 +0000 |
---|---|---|
committer | nednguyen@google.com <nednguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-04 16:30:52 +0000 |
commit | 4753b9ec770f3f51722fc7df6b0568479c19acaf (patch) | |
tree | e5252f3ba3ae220e3c3c80213dc6d4088fedfe77 /components/tracing | |
parent | 99c453b803e326a1ff2a9e60bfc43ccc265401c3 (diff) | |
download | chromium_src-4753b9ec770f3f51722fc7df6b0568479c19acaf.zip chromium_src-4753b9ec770f3f51722fc7df6b0568479c19acaf.tar.gz chromium_src-4753b9ec770f3f51722fc7df6b0568479c19acaf.tar.bz2 |
Refactor tracing to pass around base::debug::TraceOptions to reduce spaghetti
Previously, the options for tracing were passed around with different ad hoc
systems. Strings in some places, base::debug::TraceOptions enum in others,
and a content::TraceOptions in yet another. There were two separate ad-hoc
string formats. Similar messes were present with category filters: sometimes
we passed strings, sometimes the CategoryFilter.
This patch though enormous looking simply consolidates all this ad-hockery
into base::debug::TraceOptions. It may look like the call sites have gotten
more verbose,
but the end result of this is a consistent understanding of TraceOptions.
There is one exception to this consolidation: devtools has to maintain its own
mapping of string->TraceOptions encoding. This is because DevTools makes
guarantees about backward compatibility: if base changes its mind about the
string form of a TraceOption, devtools needs to keep supporting the old form.
BUG=396081
TBR=cevans@chromium.org
Review URL: https://codereview.chromium.org/425593002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287348 0039d316-1c4b-4281-b951-d872f2087c98
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 | 4 | ||||
-rw-r--r-- | components/tracing/tracing_messages.h | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/components/tracing/child_trace_message_filter.cc b/components/tracing/child_trace_message_filter.cc index 3df0f70..e3daa1a 100644 --- a/components/tracing/child_trace_message_filter.cc +++ b/components/tracing/child_trace_message_filter.cc @@ -50,7 +50,7 @@ ChildTraceMessageFilter::~ChildTraceMessageFilter() {} void ChildTraceMessageFilter::OnBeginTracing( const std::string& category_filter_str, base::TimeTicks browser_time, - int options) { + const std::string& options) { #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 @@ -63,7 +63,7 @@ void ChildTraceMessageFilter::OnBeginTracing( TraceLog::GetInstance()->SetEnabled( base::debug::CategoryFilter(category_filter_str), base::debug::TraceLog::RECORDING_MODE, - static_cast<base::debug::TraceLog::Options>(options)); + base::debug::TraceOptions(options)); } void ChildTraceMessageFilter::OnEndTracing() { @@ -80,11 +80,11 @@ void ChildTraceMessageFilter::OnEndTracing() { void ChildTraceMessageFilter::OnEnableMonitoring( const std::string& category_filter_str, base::TimeTicks browser_time, - int options) { + const std::string& options) { TraceLog::GetInstance()->SetEnabled( base::debug::CategoryFilter(category_filter_str), base::debug::TraceLog::MONITORING_MODE, - static_cast<base::debug::TraceLog::Options>(options)); + base::debug::TraceOptions(options)); } void ChildTraceMessageFilter::OnDisableMonitoring() { diff --git a/components/tracing/child_trace_message_filter.h b/components/tracing/child_trace_message_filter.h index 5bd993e..596e738 100644 --- a/components/tracing/child_trace_message_filter.h +++ b/components/tracing/child_trace_message_filter.h @@ -32,11 +32,11 @@ class ChildTraceMessageFilter : public IPC::MessageFilter { // Message handlers. void OnBeginTracing(const std::string& category_filter_str, base::TimeTicks browser_time, - int options); + const std::string& options); void OnEndTracing(); void OnEnableMonitoring(const std::string& category_filter_str, base::TimeTicks browser_time, - int options); + const std::string& options); void OnDisableMonitoring(); void OnCaptureMonitoringSnapshot(); void OnGetTraceBufferPercentFull(); diff --git a/components/tracing/tracing_messages.h b/components/tracing/tracing_messages.h index 0a1fdc9..ff891a0 100644 --- a/components/tracing/tracing_messages.h +++ b/components/tracing/tracing_messages.h @@ -19,7 +19,7 @@ IPC_MESSAGE_CONTROL3(TracingMsg_BeginTracing, std::string /* category_filter_str */, base::TimeTicks /* browser_time */, - int /* base::debug::TraceLog::Options */) + std::string /* base::debug::TraceOptions */) // Sent to all child processes to disable trace event recording. IPC_MESSAGE_CONTROL0(TracingMsg_EndTracing) @@ -28,7 +28,7 @@ IPC_MESSAGE_CONTROL0(TracingMsg_EndTracing) IPC_MESSAGE_CONTROL3(TracingMsg_EnableMonitoring, std::string /* category_filter_str */, base::TimeTicks /* browser_time */, - int /* base::debug::TraceLog::Options */) + std::string /* base::debug::TraceOptions */) // Sent to all child processes to stop monitoring. IPC_MESSAGE_CONTROL0(TracingMsg_DisableMonitoring) |