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 e14b275411b2d98f57ad978f884a0f64cbe56a99..ad4b5d721dba3a916ed9a48284b74498ec8d83b4 100644 |
--- a/cc/surfaces/compositor_frame_sink_support.h |
+++ b/cc/surfaces/compositor_frame_sink_support.h |
@@ -13,10 +13,10 @@ |
#include "base/memory/weak_ptr.h" |
#include "cc/output/compositor_frame.h" |
#include "cc/scheduler/begin_frame_source.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/surfaces_export.h" |
namespace cc { |
@@ -25,8 +25,8 @@ class CompositorFrameSinkSupportClient; |
class SurfaceManager; |
class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
- : public SurfaceFactoryClient, |
- public BeginFrameObserver { |
+ : public BeginFrameObserver, |
+ public PendingFrameObserver { |
public: |
CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client, |
SurfaceManager* surface_manager, |
@@ -39,9 +39,9 @@ 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_; |
@@ -55,10 +55,17 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); |
void ForceReclaimResources(); |
void ClaimTemporaryReference(const SurfaceId& surface_id); |
+ void ReceiveFromChild(const TransferableResourceArray& resources); |
Fady Samuel
2017/04/06 21:53:23
Make these private?
Alex Z.
2017/04/13 17:15:30
I'm leaving them public following our discussion o
|
+ void RefResources(const TransferableResourceArray& resources); |
+ void UnrefResources(const ReturnedResourceArray& resources); |
BeginFrameSource* BeginFrameSourceForTesting() const; |
private: |
+ friend class SurfaceResourceHolder; |
+ friend class FrameSinkManager; |
+ friend class SurfaceAggregator; |
+ |
// 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 |
@@ -71,30 +78,41 @@ class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
void DidReceiveCompositorFrameAck(); |
- // SurfaceFactoryClient implementation. |
- void ReferencedSurfacesChanged( |
- const LocalSurfaceId& local_surface_id, |
- const std::vector<SurfaceId>* active_referenced_surfaces, |
- const std::vector<SurfaceId>* pending_referenced_surfaces) override; |
- void ReturnResources(const ReturnedResourceArray& resources) override; |
- void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; |
+ void ReturnResources(const ReturnedResourceArray& resources); |
+ void SetBeginFrameSource(BeginFrameSource* begin_frame_source); |
void WillDrawSurface(const LocalSurfaceId& local_surface_id, |
- const gfx::Rect& damage_rect) override; |
+ const gfx::Rect& damage_rect); |
// BeginFrameObserver implementation. |
void OnBeginFrame(const BeginFrameArgs& args) override; |
const BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
void OnBeginFrameSourcePausedChanged(bool paused) override; |
+ // PendingFrameObserver implementation. |
+ void OnReferencedSurfacesChanged( |
+ Surface* surface, |
+ const std::vector<SurfaceId>* active_referenced_surfaces, |
+ const std::vector<SurfaceId>* pending_referenced_surfaces) override; |
+ 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_; |
SurfaceManager* const surface_manager_; |
+ SurfaceResourceHolder surface_resource_holder_; |
const FrameSinkId frame_sink_id_; |
- SurfaceFactory surface_factory_; |
+ 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; |
@@ -117,6 +135,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(). |