Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Unified Diff: base/trace_event/trace_log.cc

Issue 2327333002: Add OnBeforeTraceLogDisabled notification to EnabledStateObserver (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/trace_log.h ('k') | content/browser/tracing/tracing_controller_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_log.cc
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc
index 1a9af140551254bf6111c54ed4fb2a55d2e50121..8b8ef76c6f8b502618fb184f78898dc7602dc2df 100644
--- a/base/trace_event/trace_log.cc
+++ b/base/trace_event/trace_log.cc
@@ -818,7 +818,8 @@ TraceConfig TraceLog::GetCurrentTraceConfig() const {
}
void TraceLog::SetDisabled() {
- AutoLock lock(lock_);
+ AutoLock lock1(disabling_lock_);
+ AutoLock lock2(lock_);
SetDisabledWhileLocked();
}
@@ -834,6 +835,18 @@ void TraceLog::SetDisabledWhileLocked() {
return;
}
+ std::vector<EnabledStateObserver*> observer_list =
+ enabled_state_observer_list_;
+ dispatching_to_observer_list_ = true;
+ {
+ // Dispatch to observers outside the lock in case the observer triggers a
+ // trace event.
+ AutoUnlock unlock(lock_);
+ for (EnabledStateObserver* observer : observer_list)
+ observer->OnBeforeTraceLogDisabled();
+ }
+ dispatching_to_observer_list_ = false;
+
mode_ = DISABLED;
if (sampling_thread_) {
@@ -855,12 +868,9 @@ void TraceLog::SetDisabledWhileLocked() {
// Remove metadata events so they will not get added to a subsequent trace.
metadata_events_.clear();
- dispatching_to_observer_list_ = true;
- std::vector<EnabledStateObserver*> observer_list =
- enabled_state_observer_list_;
std::map<AsyncEnabledStateObserver*, RegisteredAsyncObserver> observer_map =
async_observers_;
-
+ dispatching_to_observer_list_ = true;
{
// Dispatch to observers outside the lock in case the observer triggers a
// trace event.
« no previous file with comments | « base/trace_event/trace_log.h ('k') | content/browser/tracing/tracing_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698