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_; |