| 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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| 11 #include "cc/scheduler/begin_frame_source.h" | 11 #include "cc/scheduler/begin_frame_source.h" |
| 12 #include "cc/surfaces/display.h" | 12 #include "cc/surfaces/display.h" |
| 13 #include "cc/surfaces/display_client.h" | 13 #include "cc/surfaces/display_client.h" |
| 14 #include "cc/surfaces/surface_factory.h" | 14 #include "cc/surfaces/surface_factory.h" |
| 15 #include "cc/surfaces/surface_factory_client.h" | 15 #include "cc/surfaces/surface_factory_client.h" |
| 16 #include "cc/surfaces/surfaces_export.h" | 16 #include "cc/surfaces/surfaces_export.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 | 19 |
| 20 class CompositorFrameSinkSupportClient; | 20 class CompositorFrameSinkSupportClient; |
| 21 class Display; | 21 class Display; |
| 22 class SurfaceManager; | 22 class SurfaceManager; |
| 23 | 23 |
| 24 class CC_SURFACES_EXPORT CompositorFrameSinkSupport | 24 class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| 25 : public NON_EXPORTED_BASE(DisplayClient), | 25 : public NON_EXPORTED_BASE(DisplayClient), |
| 26 public SurfaceFactoryClient, | 26 public SurfaceFactoryClient, |
| 27 public BeginFrameObserver { | 27 public BeginFrameObserver { |
| 28 public: | 28 public: |
| 29 CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client, | 29 CompositorFrameSinkSupport( |
| 30 SurfaceManager* surface_manager, | 30 CompositorFrameSinkSupportClient* client, |
| 31 const FrameSinkId& frame_sink_id, | 31 SurfaceManager* surface_manager, |
| 32 std::unique_ptr<Display> display); | 32 const FrameSinkId& frame_sink_id, |
| 33 std::unique_ptr<Display> display, |
| 34 std::unique_ptr<BeginFrameSource> display_begin_frame_source); |
| 33 | 35 |
| 34 ~CompositorFrameSinkSupport() override; | 36 ~CompositorFrameSinkSupport() override; |
| 35 | 37 |
| 36 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 38 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 37 | 39 |
| 38 void EvictFrame(); | 40 void EvictFrame(); |
| 39 void SetNeedsBeginFrame(bool needs_begin_frame); | 41 void SetNeedsBeginFrame(bool needs_begin_frame); |
| 40 void SubmitCompositorFrame(const LocalFrameId& local_frame_id, | 42 void SubmitCompositorFrame(const LocalFrameId& local_frame_id, |
| 41 CompositorFrame frame); | 43 CompositorFrame frame); |
| 42 void Require(const LocalFrameId& local_frame_id, | 44 void Require(const LocalFrameId& local_frame_id, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 66 void OnBeginFrameSourcePausedChanged(bool paused) override; | 68 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 67 | 69 |
| 68 void UpdateNeedsBeginFramesInternal(); | 70 void UpdateNeedsBeginFramesInternal(); |
| 69 | 71 |
| 70 CompositorFrameSinkSupportClient* const client_; | 72 CompositorFrameSinkSupportClient* const client_; |
| 71 | 73 |
| 72 SurfaceManager* const surface_manager_; | 74 SurfaceManager* const surface_manager_; |
| 73 | 75 |
| 74 const FrameSinkId frame_sink_id_; | 76 const FrameSinkId frame_sink_id_; |
| 75 | 77 |
| 76 // GpuCompositorFrameSink holds a Display if it created with | 78 // GpuCompositorFrameSink holds a Display and its BeginFrameSource if it |
| 77 // non-null gpu::SurfaceHandle. In the window server, the display root | 79 // created with non-null gpu::SurfaceHandle. In the window server, the display |
| 78 // window's CompositorFrameSink will have a valid gpu::SurfaceHandle. | 80 // root window's CompositorFrameSink will have a valid gpu::SurfaceHandle. |
| 81 std::unique_ptr<BeginFrameSource> display_begin_frame_source_; |
| 79 std::unique_ptr<Display> display_; | 82 std::unique_ptr<Display> display_; |
| 80 | 83 |
| 81 LocalFrameId local_frame_id_; | 84 LocalFrameId local_frame_id_; |
| 82 SurfaceFactory surface_factory_; | 85 SurfaceFactory surface_factory_; |
| 83 // Counts the number of CompositorFrames that have been submitted and have not | 86 // Counts the number of CompositorFrames that have been submitted and have not |
| 84 // yet received an ACK. | 87 // yet received an ACK. |
| 85 int ack_pending_count_ = 0; | 88 int ack_pending_count_ = 0; |
| 86 ReturnedResourceArray surface_returned_resources_; | 89 ReturnedResourceArray surface_returned_resources_; |
| 87 | 90 |
| 88 // The begin frame source being observered. Null if none. | 91 // The begin frame source being observered. Null if none. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 101 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; | 104 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; |
| 102 | 105 |
| 103 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; | 106 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; |
| 104 | 107 |
| 105 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); | 108 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 } // namespace cc | 111 } // namespace cc |
| 109 | 112 |
| 110 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 113 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| OLD | NEW |