summaryrefslogtreecommitdiffstats
path: root/content/browser/tracing/tracing_controller_impl.cc
diff options
context:
space:
mode:
authoroysteine <oysteine@chromium.org>2015-08-25 18:33:06 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-26 01:33:38 +0000
commitf4ce0b06f671d8c6b4b9d7227c2af813d6581893 (patch)
treec5afb89357b48936efdcb8a51f925aee1ceb3de0 /content/browser/tracing/tracing_controller_impl.cc
parentd3b9bca27c47a65dd1b8a3a8fd6087eaa56b0336 (diff)
downloadchromium_src-f4ce0b06f671d8c6b4b9d7227c2af813d6581893.zip
chromium_src-f4ce0b06f671d8c6b4b9d7227c2af813d6581893.tar.gz
chromium_src-f4ce0b06f671d8c6b4b9d7227c2af813d6581893.tar.bz2
Background tracing: Simplify public interface and isolate trigger logic
Mostly mechanical preparatory patch to simplify adding new triggers to the system in the future. * Since setting up scenarios by code is mainly used by tests, the public interface now only accepts dicts and all rule type information is moved to the implementation. * Specific logic regarding specific rules has moved to background_tracing_rule_impl.cc * BackgroundTracingPreemptiveConfig and BackgroundTracingReactiveConfig have been merged together and there's far fewer separate codepaths between the two modes in general. Review URL: https://codereview.chromium.org/1297813002 Cr-Commit-Position: refs/heads/master@{#345523}
Diffstat (limited to 'content/browser/tracing/tracing_controller_impl.cc')
-rw-r--r--content/browser/tracing/tracing_controller_impl.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc
index ee280df..2e6a7dd 100644
--- a/content/browser/tracing/tracing_controller_impl.cc
+++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -494,8 +494,9 @@ void TracingControllerImpl::AddTraceMessageFilter(
trace_message_filter->SendEnableMonitoring(
TraceLog::GetInstance()->GetCurrentTraceConfig());
}
- if (!trace_message_filter_added_callback_.is_null())
- trace_message_filter_added_callback_.Run(trace_message_filter);
+
+ FOR_EACH_OBSERVER(TraceMessageFilterObserver, trace_message_filter_observers_,
+ OnTraceMessageFilterAdded(trace_message_filter));
}
void TracingControllerImpl::RemoveTraceMessageFilter(
@@ -853,16 +854,22 @@ uint64 TracingControllerImpl::GetTracingProcessId() const {
return ChildProcessHost::kBrowserTracingProcessId;
}
-void TracingControllerImpl::SetTraceMessageFilterAddedCallback(
- const TraceMessageFilterAddedCallback& callback) {
+void TracingControllerImpl::AddTraceMessageFilterObserver(
+ TraceMessageFilterObserver* observer) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- trace_message_filter_added_callback_ = callback;
+ trace_message_filter_observers_.AddObserver(observer);
+
+ for (auto& filter : trace_message_filters_)
+ observer->OnTraceMessageFilterAdded(filter.get());
}
-void TracingControllerImpl::GetTraceMessageFilters(
- TraceMessageFilterSet* filters) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- filters->insert(trace_message_filters_.begin(), trace_message_filters_.end());
+void TracingControllerImpl::RemoveTraceMessageFilterObserver(
+ TraceMessageFilterObserver* observer) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ trace_message_filter_observers_.RemoveObserver(observer);
+
+ for (auto& filter : trace_message_filters_)
+ observer->OnTraceMessageFilterRemoved(filter.get());
}
void TracingControllerImpl::OnProcessMemoryDumpResponse(