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

Unified Diff: base/debug/trace_event_impl.h

Issue 16829002: Notify TraceLog observers outside of the lock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « no previous file | base/debug/trace_event_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_impl.h
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h
index 384e09fc751133655377c00fb2865c42cc002ff1..a7ebaf2d4d155132f9c3f4e4bb70905e27f42c46 100644
--- a/base/debug/trace_event_impl.h
+++ b/base/debug/trace_event_impl.h
@@ -332,21 +332,18 @@ class BASE_EXPORT TraceLog {
// Enabled state listeners give a callback when tracing is enabled or
// disabled. This can be used to tie into other library's tracing systems
// on-demand.
- class EnabledStateChangedObserver {
+ class EnabledStateObserver {
public:
- // Called just before the tracing system becomes
- // enabled. TraceLog::IsEnabled will return false at this point and trace
- // macros and methods called within the observer will deadlock.
- virtual void OnTraceLogWillEnable() { }
-
- // Called just before the tracing system disables. TraceLog::IsEnabled is
- // still false at this point TRACE macros will still be capturing
- // data. However, trace macros and methods called within the observer will
- // deadlock.
- virtual void OnTraceLogWillDisable() { }
+ // Called just after the tracing system becomes enabled, outside of the
+ // |lock_|. TraceLog::IsEnabled() is true at this point.
+ virtual void OnTraceLogEnabled() = 0;
+
+ // Called just after the tracing system disables, outside of the |lock_|.
+ // TraceLog::IsEnabled() is false at this point.
+ virtual void OnTraceLogDisabled() = 0;
};
- void AddEnabledStateObserver(EnabledStateChangedObserver* listener);
- void RemoveEnabledStateObserver(EnabledStateChangedObserver* listener);
+ void AddEnabledStateObserver(EnabledStateObserver* listener);
+ void RemoveEnabledStateObserver(EnabledStateObserver* listener);
float GetBufferPercentFull() const;
@@ -458,6 +455,8 @@ class BASE_EXPORT TraceLog {
// that should be reported.
void SetTimeOffset(TimeDelta offset);
+ size_t GetObserverCountForTest() const;
+
private:
// This allows constructor and destructor to be private and usable only
// by the Singleton class.
@@ -538,7 +537,7 @@ class BASE_EXPORT TraceLog {
scoped_ptr<TraceBuffer> logged_events_;
EventCallback event_callback_;
bool dispatching_to_observer_list_;
- ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_;
+ std::vector<EnabledStateObserver*> enabled_state_observer_list_;
base::hash_map<int, std::string> thread_names_;
base::hash_map<int, std::stack<TimeTicks> > thread_event_start_times_;
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698