| 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> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 40 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 41 | 41 |
| 42 Surface* current_surface_for_testing() { | 42 Surface* current_surface_for_testing() { |
| 43 return surface_factory_.current_surface_for_testing(); | 43 return surface_factory_.current_surface_for_testing(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 const ReferencedSurfaceTracker& ReferenceTrackerForTesting() const { | 46 const ReferencedSurfaceTracker& ReferenceTrackerForTesting() const { |
| 47 return reference_tracker_; | 47 return reference_tracker_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // SurfaceFactoryClient implementation. |
| 51 void ReferencedSurfacesChanged( |
| 52 const LocalSurfaceId& local_surface_id, |
| 53 const std::vector<SurfaceId>* active_referenced_surfaces, |
| 54 const std::vector<SurfaceId>* pending_referenced_surfaces) override; |
| 55 void ReturnResources(const ReturnedResourceArray& resources) override; |
| 56 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; |
| 57 void WillDrawSurface(const LocalSurfaceId& local_surface_id, |
| 58 const gfx::Rect& damage_rect) override; |
| 59 |
| 50 void EvictFrame(); | 60 void EvictFrame(); |
| 51 void SetNeedsBeginFrame(bool needs_begin_frame); | 61 void SetNeedsBeginFrame(bool needs_begin_frame); |
| 52 void BeginFrameDidNotSwap(const BeginFrameAck& ack); | 62 void BeginFrameDidNotSwap(const BeginFrameAck& ack); |
| 53 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, | 63 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, |
| 54 CompositorFrame frame); | 64 CompositorFrame frame); |
| 55 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); | 65 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); |
| 56 void ForceReclaimResources(); | 66 void ForceReclaimResources(); |
| 57 void ClaimTemporaryReference(const SurfaceId& surface_id); | 67 void ClaimTemporaryReference(const SurfaceId& surface_id); |
| 58 | 68 |
| 59 private: | 69 private: |
| 60 // Update surface references with SurfaceManager for current CompositorFrame | 70 // Update surface references with SurfaceManager for current CompositorFrame |
| 61 // that has |local_surface_id|. UpdateReferences() must be called on | 71 // that has |local_surface_id|. UpdateReferences() must be called on |
| 62 // |reference_tracker_| before calling this. Will add and remove top-level | 72 // |reference_tracker_| before calling this. Will add and remove top-level |
| 63 // root references if |display_| is not null. | 73 // root references if |display_| is not null. |
| 64 void UpdateSurfaceReferences(const SurfaceId& last_surface_id, | 74 void UpdateSurfaceReferences(const SurfaceId& last_surface_id, |
| 65 const LocalSurfaceId& local_surface_id); | 75 const LocalSurfaceId& local_surface_id); |
| 66 | 76 |
| 67 void AddTopLevelRootReference(const SurfaceId& surface_id); | 77 void AddTopLevelRootReference(const SurfaceId& surface_id); |
| 68 void RemoveTopLevelRootReference(const SurfaceId& surface_id); | 78 void RemoveTopLevelRootReference(const SurfaceId& surface_id); |
| 69 | 79 |
| 70 void DidReceiveCompositorFrameAck(); | 80 void DidReceiveCompositorFrameAck(); |
| 71 | 81 |
| 72 // SurfaceFactoryClient implementation. | |
| 73 void ReferencedSurfacesChanged( | |
| 74 const LocalSurfaceId& local_surface_id, | |
| 75 const std::vector<SurfaceId>* active_referenced_surfaces, | |
| 76 const std::vector<SurfaceId>* pending_referenced_surfaces) override; | |
| 77 void ReturnResources(const ReturnedResourceArray& resources) override; | |
| 78 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; | |
| 79 void WillDrawSurface(const LocalSurfaceId& local_surface_id, | |
| 80 const gfx::Rect& damage_rect) override; | |
| 81 | |
| 82 // BeginFrameObserver implementation. | 82 // BeginFrameObserver implementation. |
| 83 void OnBeginFrame(const BeginFrameArgs& args) override; | 83 void OnBeginFrame(const BeginFrameArgs& args) override; |
| 84 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 84 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
| 85 void OnBeginFrameSourcePausedChanged(bool paused) override; | 85 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 86 | 86 |
| 87 void UpdateNeedsBeginFramesInternal(); | 87 void UpdateNeedsBeginFramesInternal(); |
| 88 | 88 |
| 89 CompositorFrameSinkSupportClient* const client_; | 89 CompositorFrameSinkSupportClient* const client_; |
| 90 | 90 |
| 91 SurfaceManager* const surface_manager_; | 91 SurfaceManager* const surface_manager_; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 const bool handles_frame_sink_id_invalidation_; | 129 const bool handles_frame_sink_id_invalidation_; |
| 130 | 130 |
| 131 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; | 131 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); | 133 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace cc | 136 } // namespace cc |
| 137 | 137 |
| 138 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 138 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| OLD | NEW |