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

Unified Diff: base/trace_event/trace_log.h

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_event_unittest.cc ('k') | base/trace_event/trace_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_log.h
diff --git a/base/trace_event/trace_log.h b/base/trace_event/trace_log.h
index 540d7d0bd3e0e06aa910b65cb2850ef08143cc62..9f4aaff3c1ea8038d60cfcdcde6870ccbdcb8dd8 100644
--- a/base/trace_event/trace_log.h
+++ b/base/trace_event/trace_log.h
@@ -113,6 +113,11 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
// |lock_|. TraceLog::IsEnabled() is true at this point.
virtual void OnTraceLogEnabled() = 0;
+ // Called just before the tracing system disables, outside of the |lock_|.
+ // TraceLog::IsEnabled() is true at this point. It is still possible to
+ // emit trace events from the observer.
+ virtual void OnBeforeTraceLogDisabled() {}
+
// Called just after the tracing system disables, outside of the |lock_|.
// TraceLog::IsEnabled() is false at this point.
virtual void OnTraceLogDisabled() = 0;
@@ -480,6 +485,10 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
// This lock protects TraceLog member accesses (except for members protected
// by thread_info_lock_) from arbitrary threads.
mutable Lock lock_;
+ // This lock protects TraceLog::SetDisable from being entered by multiple
+ // threads. The generic |lock_| could be unlocked during iterating over
+ // EnabledStateObserver's.
+ mutable Lock disabling_lock_;
// This lock protects accesses to thread_names_, thread_event_start_times_
// and thread_colors_.
Lock thread_info_lock_;
« no previous file with comments | « base/trace_event/trace_event_unittest.cc ('k') | base/trace_event/trace_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698