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

Unified Diff: cc/scheduler/begin_frame_source.h

Issue 1022483003: cc: Adding a BeginFrameObserverMultiplexer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Trying to get windows to work. Created 5 years, 9 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 | cc/scheduler/begin_frame_source.cc » ('j') | cc/scheduler/begin_frame_source.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/begin_frame_source.h
diff --git a/cc/scheduler/begin_frame_source.h b/cc/scheduler/begin_frame_source.h
index d845dacd8e417505e27b3663246ae38c53234285..a1b7c20b0afecda7fe8b11996898662a1cfe409c 100644
--- a/cc/scheduler/begin_frame_source.h
+++ b/cc/scheduler/begin_frame_source.h
@@ -86,6 +86,37 @@ class CC_EXPORT BeginFrameObserverMixIn : public BeginFrameObserver {
int64_t dropped_begin_frame_args_;
};
+// A "virtual" frame observer which forwards any received BeginFrame messages
+// to all registered observers. Also provides a callback allowing detection of
+// observers existing.
+class CC_EXPORT BeginFrameObserverMultiplexer : public BeginFrameObserverMixIn {
simonhong 2015/03/25 02:03:22 As dana said, how about subclassing BeginFrameObse
mithro-old 2015/03/25 02:34:47 Implementing BeginFrameObserver means duplicating
+ public:
+ using HasObserversCallback = base::Callback<void(bool has_observers)>;
+
+ static scoped_ptr<BeginFrameObserverMultiplexer> Create();
+ ~BeginFrameObserverMultiplexer() override;
+
+ void AddObserver(BeginFrameObserver* obs);
+ void RemoveObserver(BeginFrameObserver* obs);
+ bool HasObservers();
+ void SetHasObserverCallback(const HasObserversCallback& cb);
+
+ void AsValueInto(base::trace_event::TracedValue* dict) const override;
+
+ protected:
+ BeginFrameObserverMultiplexer();
+
+ bool last_callback_state_;
+ HasObserversCallback has_observers_callback_;
+ void CallCallbackOnChange();
+ void CallCallback(bool has_observers);
+
+ // BeginFrameObserverMixIn
+ bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override;
+
+ ObserverList<BeginFrameObserver> observer_list_;
+};
+
// Interface for a class which produces BeginFrame calls to a
// BeginFrameObserver.
//
« no previous file with comments | « no previous file | cc/scheduler/begin_frame_source.cc » ('j') | cc/scheduler/begin_frame_source.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698