| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_set> | 9 #include <unordered_set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "cc/output/compositor_frame.h" | 14 #include "cc/output/compositor_frame.h" |
| 15 #include "cc/scheduler/begin_frame_source.h" | 15 #include "cc/scheduler/begin_frame_source.h" |
| 16 #include "cc/surfaces/frame_sink_manager_client.h" |
| 16 #include "cc/surfaces/referenced_surface_tracker.h" | 17 #include "cc/surfaces/referenced_surface_tracker.h" |
| 18 #include "cc/surfaces/surface_aggregator_client.h" |
| 17 #include "cc/surfaces/surface_factory.h" | 19 #include "cc/surfaces/surface_factory.h" |
| 18 #include "cc/surfaces/surface_factory_client.h" | 20 #include "cc/surfaces/surface_factory_client.h" |
| 19 #include "cc/surfaces/surface_id.h" | 21 #include "cc/surfaces/surface_id.h" |
| 22 #include "cc/surfaces/surface_resource_holder_client.h" |
| 20 #include "cc/surfaces/surfaces_export.h" | 23 #include "cc/surfaces/surfaces_export.h" |
| 21 | 24 |
| 22 namespace cc { | 25 namespace cc { |
| 23 | 26 |
| 24 class CompositorFrameSinkSupportClient; | 27 class CompositorFrameSinkSupportClient; |
| 25 class SurfaceManager; | 28 class SurfaceManager; |
| 26 | 29 |
| 27 class CC_SURFACES_EXPORT CompositorFrameSinkSupport | 30 class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| 28 : public SurfaceFactoryClient, | 31 : public SurfaceFactoryClient, |
| 29 public BeginFrameObserver { | 32 public BeginFrameObserver, |
| 33 public SurfaceAggregatorClient, |
| 34 public SurfaceResourceHolderClient, |
| 35 public FrameSinkManagerClient { |
| 30 public: | 36 public: |
| 31 static std::unique_ptr<CompositorFrameSinkSupport> Create( | 37 static std::unique_ptr<CompositorFrameSinkSupport> Create( |
| 32 CompositorFrameSinkSupportClient* client, | 38 CompositorFrameSinkSupportClient* client, |
| 33 SurfaceManager* surface_manager, | 39 SurfaceManager* surface_manager, |
| 34 const FrameSinkId& frame_sink_id, | 40 const FrameSinkId& frame_sink_id, |
| 35 bool is_root, | 41 bool is_root, |
| 36 bool handles_frame_sink_id_invalidation, | 42 bool handles_frame_sink_id_invalidation, |
| 37 bool needs_sync_points); | 43 bool needs_sync_points); |
| 38 | 44 |
| 39 ~CompositorFrameSinkSupport() override; | 45 ~CompositorFrameSinkSupport() override; |
| 40 | 46 |
| 41 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 47 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 42 | 48 |
| 43 Surface* current_surface_for_testing() { | 49 Surface* current_surface_for_testing() { |
| 44 return surface_factory_->current_surface_for_testing(); | 50 return surface_factory_->current_surface_for_testing(); |
| 45 } | 51 } |
| 46 | 52 |
| 47 const ReferencedSurfaceTracker& ReferenceTrackerForTesting() const { | 53 const ReferencedSurfaceTracker& ReferenceTrackerForTesting() const { |
| 48 return reference_tracker_; | 54 return reference_tracker_; |
| 49 } | 55 } |
| 50 | 56 |
| 51 // SurfaceFactoryClient implementation. | 57 // SurfaceFactoryClient implementation. |
| 52 void ReferencedSurfacesChanged( | 58 void ReferencedSurfacesChanged( |
| 53 const LocalSurfaceId& local_surface_id, | 59 const LocalSurfaceId& local_surface_id, |
| 54 const std::vector<SurfaceId>* active_referenced_surfaces) override; | 60 const std::vector<SurfaceId>* active_referenced_surfaces) override; |
| 61 |
| 62 // SurfaceResourceHolderClient implementation. |
| 55 void ReturnResources(const ReturnedResourceArray& resources) override; | 63 void ReturnResources(const ReturnedResourceArray& resources) override; |
| 64 |
| 65 // FrameSinkManagerClient implementation. |
| 56 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; | 66 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; |
| 67 |
| 68 // SurfaceAggregatorClient implementation. |
| 57 void WillDrawSurface(const LocalSurfaceId& local_surface_id, | 69 void WillDrawSurface(const LocalSurfaceId& local_surface_id, |
| 58 const gfx::Rect& damage_rect) override; | 70 const gfx::Rect& damage_rect) override; |
| 59 | 71 |
| 60 void EvictFrame(); | 72 void EvictFrame(); |
| 61 void SetNeedsBeginFrame(bool needs_begin_frame); | 73 void SetNeedsBeginFrame(bool needs_begin_frame); |
| 62 void BeginFrameDidNotSwap(const BeginFrameAck& ack); | 74 void BeginFrameDidNotSwap(const BeginFrameAck& ack); |
| 63 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, | 75 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, |
| 64 CompositorFrame frame); | 76 CompositorFrame frame); |
| 65 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); | 77 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); |
| 66 void ForceReclaimResources(); | 78 void ForceReclaimResources(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 const bool handles_frame_sink_id_invalidation_; | 149 const bool handles_frame_sink_id_invalidation_; |
| 138 | 150 |
| 139 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; | 151 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; |
| 140 | 152 |
| 141 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); | 153 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); |
| 142 }; | 154 }; |
| 143 | 155 |
| 144 } // namespace cc | 156 } // namespace cc |
| 145 | 157 |
| 146 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 158 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| OLD | NEW |