Chromium Code Reviews| Index: cc/surfaces/compositor_frame_sink_support.h |
| diff --git a/cc/surfaces/compositor_frame_sink_support.h b/cc/surfaces/compositor_frame_sink_support.h |
| index 33e44f9e5423ea1d88860ec1446b236a6691266d..4977ddf38b3daab7ef37bc7d545d46e660ec85b1 100644 |
| --- a/cc/surfaces/compositor_frame_sink_support.h |
| +++ b/cc/surfaces/compositor_frame_sink_support.h |
| @@ -14,23 +14,27 @@ |
| #include "cc/output/compositor_frame.h" |
| #include "cc/scheduler/begin_frame_source.h" |
| #include "cc/surfaces/framesink_manager_client.h" |
| +#include "cc/surfaces/pending_frame_observer.h" |
| #include "cc/surfaces/referenced_surface_tracker.h" |
| -#include "cc/surfaces/surface_factory.h" |
| -#include "cc/surfaces/surface_factory_client.h" |
| #include "cc/surfaces/surface_id.h" |
| +#include "cc/surfaces/surface_resource_holder.h" |
| #include "cc/surfaces/surface_resource_holder_client.h" |
| #include "cc/surfaces/surfaces_export.h" |
| namespace cc { |
| +namespace test { |
| +class CompositorFrameSinkSupportTest; |
| +} // namespae test |
|
danakj
2017/04/28 17:44:23
typo, but you don't need this comment when the blo
Alex Z.
2017/05/01 14:48:34
Done.
|
| class CompositorFrameSinkSupportClient; |
| +class SurfaceAggregator; |
| class SurfaceManager; |
| class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| - : public SurfaceFactoryClient, |
| - public BeginFrameObserver, |
| + : public BeginFrameObserver, |
| public SurfaceResourceHolderClient, |
| - public FrameSinkManagerClient { |
| + public FrameSinkManagerClient, |
| + public PendingFrameObserver { |
| public: |
| static std::unique_ptr<CompositorFrameSinkSupport> Create( |
| CompositorFrameSinkSupportClient* client, |
| @@ -44,19 +48,14 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| - Surface* current_surface_for_testing() { |
| - return surface_factory_->current_surface_for_testing(); |
| - } |
| + Surface* current_surface_for_testing() { return current_surface_.get(); } |
| + SurfaceManager* surface_manager() { return surface_manager_; } |
| + bool needs_sync_points() { return needs_sync_points_; } |
| const ReferencedSurfaceTracker& ReferenceTrackerForTesting() const { |
| return reference_tracker_; |
| } |
| - // SurfaceFactoryClient implementation. |
| - void ReferencedSurfacesChanged( |
| - const LocalSurfaceId& local_surface_id, |
| - const std::vector<SurfaceId>* active_referenced_surfaces) override; |
| - |
| // SurfaceResourceHolderClient implementation. |
| void ReturnResources(const ReturnedResourceArray& resources) override; |
| @@ -80,6 +79,14 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| void Init(SurfaceManager* surface_manager, bool needs_sync_points); |
| private: |
| + friend class Surface; |
|
danakj
2017/04/28 17:44:23
Can you explain these friends, why they are needed
Alex Z.
2017/05/01 14:48:34
Done.
|
| + friend class SurfaceAggregator; |
| + friend class test::CompositorFrameSinkSupportTest; |
| + |
| + void ReceiveFromChild(const TransferableResourceArray& resources); |
| + void RefResources(const TransferableResourceArray& resources); |
| + void UnrefResources(const ReturnedResourceArray& resources); |
| + |
| // Update surface references with SurfaceManager for current CompositorFrame |
| // that has |local_surface_id|. UpdateReferences() must be called on |
| // |reference_tracker_| before calling this. Will add and remove top-level |
| @@ -89,6 +96,9 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| void AddTopLevelRootReference(const SurfaceId& surface_id); |
| void RemoveTopLevelRootReference(const SurfaceId& surface_id); |
| + void ReferencedSurfacesChanged( |
| + const LocalSurfaceId& local_surface_id, |
| + const std::vector<SurfaceId>* active_referenced_surfaces); |
| void DidReceiveCompositorFrameAck(); |
| void WillDrawSurface(const LocalSurfaceId& local_surface_id, |
| @@ -99,7 +109,18 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| const BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
| void OnBeginFrameSourcePausedChanged(bool paused) override; |
| + // PendingFrameObserver implementation. |
| + void OnSurfaceActivated(Surface* surface) override; |
| + void OnSurfaceDependenciesChanged( |
| + Surface* surface, |
| + const SurfaceDependencies& added_dependencies, |
| + const SurfaceDependencies& removed_dependencies) override; |
| + void OnSurfaceDiscarded(Surface* surface) override; |
| + |
| void UpdateNeedsBeginFramesInternal(); |
| + std::unique_ptr<Surface> CreateSurface( |
| + const LocalSurfaceId& local_surface_id); |
| + void DestroyCurrentSurface(); |
| CompositorFrameSinkSupportClient* const client_; |
| @@ -107,7 +128,9 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| const FrameSinkId frame_sink_id_; |
| - std::unique_ptr<SurfaceFactory> surface_factory_; |
| + SurfaceResourceHolder surface_resource_holder_; |
| + |
| + std::unique_ptr<Surface> current_surface_; |
| // Counts the number of CompositorFrames that have been submitted and have not |
| // yet received an ACK. |
| int ack_pending_count_ = 0; |
| @@ -130,6 +153,8 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| ReferencedSurfaceTracker reference_tracker_; |
| const bool is_root_; |
| + bool needs_sync_points_; |
| + bool seen_first_frame_activation_ = false; |
| // TODO(staraz): Remove this flag once ui::Compositor no longer needs to call |
| // RegisterFrameSinkId(). |