Index: cc/surfaces/frame_sink_manager.h |
diff --git a/cc/surfaces/frame_sink_manager.h b/cc/surfaces/frame_sink_manager.h |
index 0d54a8e3d8f002356887f22bc78f6e512d041401..4d68dc4237dcf8123a2f70a1213aefdff33fec47 100644 |
--- a/cc/surfaces/frame_sink_manager.h |
+++ b/cc/surfaces/frame_sink_manager.h |
@@ -13,7 +13,9 @@ |
#include "base/logging.h" |
#include "base/macros.h" |
+#include "base/observer_list.h" |
#include "cc/surfaces/frame_sink_id.h" |
+#include "cc/surfaces/frame_sink_observer.h" |
#include "cc/surfaces/surfaces_export.h" |
namespace cc { |
@@ -50,12 +52,23 @@ class CC_SURFACES_EXPORT FrameSinkManager { |
FrameSinkManagerClient* client); |
void UnregisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id); |
+ // Creates a BeginFrameSource that tracks the first registered |
+ // BeginFrameSource. |
+ std::unique_ptr<BeginFrameSource> CreatePrimaryBeginFrameSource(); |
+ |
+ void AddObserver(FrameSinkObserver* obs) { observer_list_.AddObserver(obs); } |
+ |
+ void RemoveObserver(FrameSinkObserver* obs) { |
+ observer_list_.RemoveObserver(obs); |
+ } |
+ |
// Associates a |source| with a particular framesink. That framesink and |
// any children of that framesink with valid clients can potentially use |
// that |source|. |
void RegisterBeginFrameSource(BeginFrameSource* source, |
const FrameSinkId& frame_sink_id); |
void UnregisterBeginFrameSource(BeginFrameSource* source); |
+ BeginFrameSource* GetPrimaryBeginFrameSource(); |
// Register a relationship between two framesinks. This relationship means |
// that surfaces from the child framesik will be displayed in the parent. |
@@ -99,18 +112,20 @@ class CC_SURFACES_EXPORT FrameSinkManager { |
~FrameSinkSourceMapping(); |
bool has_children() const { return !children.empty(); } |
// The currently assigned begin frame source for this client. |
- BeginFrameSource* source; |
+ BeginFrameSource* source = nullptr; |
// This represents a dag of parent -> children mapping. |
std::vector<FrameSinkId> children; |
}; |
+ base::ObserverList<FrameSinkObserver> observer_list_; |
+ |
std::unordered_map<FrameSinkId, FrameSinkManagerClient*, FrameSinkIdHash> |
clients_; |
std::unordered_map<FrameSinkId, FrameSinkSourceMapping, FrameSinkIdHash> |
frame_sink_source_map_; |
- // Set of which sources are registered to which frmesinks. Any child |
+ // Set of BeginFrameSource along with associated FrameSinkIds. Any child |
// that is implicitly using this framesink must be reachable by the |
// parent in the dag. |
std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; |