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" |
(...skipping 12 matching lines...) Expand all Loading... | |
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( | 29 CompositorFrameSinkSupport( |
30 CompositorFrameSinkSupportClient* client, | 30 CompositorFrameSinkSupportClient* client, |
31 SurfaceManager* surface_manager, | 31 SurfaceManager* surface_manager, |
32 const FrameSinkId& frame_sink_id, | 32 const FrameSinkId& frame_sink_id, |
33 std::unique_ptr<Display> display, | 33 Display* display, |
34 std::unique_ptr<BeginFrameSource> display_begin_frame_source); | 34 std::unique_ptr<BeginFrameSource> display_begin_frame_source); |
35 | 35 |
36 ~CompositorFrameSinkSupport() override; | 36 ~CompositorFrameSinkSupport() override; |
37 | 37 |
38 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 38 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
39 | 39 |
40 void EvictFrame(); | 40 void EvictFrame(); |
41 void SetNeedsBeginFrame(bool needs_begin_frame); | 41 void SetNeedsBeginFrame(bool needs_begin_frame); |
42 void SubmitCompositorFrame(const LocalFrameId& local_frame_id, | 42 void SubmitCompositorFrame(const LocalFrameId& local_frame_id, |
43 CompositorFrame frame); | 43 CompositorFrame frame); |
44 void Require(const LocalFrameId& local_frame_id, | 44 void Require(const LocalFrameId& local_frame_id, |
45 const SurfaceSequence& sequence); | 45 const SurfaceSequence& sequence); |
46 void Satisfy(const SurfaceSequence& sequence); | 46 void Satisfy(const SurfaceSequence& sequence); |
47 void AddChildFrameSink(const FrameSinkId& child_frame_sink_id); | 47 void AddChildFrameSink(const FrameSinkId& child_frame_sink_id); |
48 void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id); | 48 void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id); |
49 void SetNeedsSyncPoints(bool needs_sync_points); | |
50 void ForceReclaimResources(); | |
51 void RegisterFrameSinkId(); | |
52 void InvalidateFrameSinkId(); | |
49 | 53 |
50 Display* display() { return display_.get(); } | 54 Display* display() { return display_.get(); } |
51 | 55 |
52 private: | 56 private: |
53 void DidReceiveCompositorFrameAck(); | 57 void DidReceiveCompositorFrameAck(); |
54 | 58 |
55 // DisplayClient implementation. | 59 // DisplayClient implementation. |
56 void DisplayOutputSurfaceLost() override; | 60 void DisplayOutputSurfaceLost() override; |
57 void DisplayWillDrawAndSwap(bool will_draw_and_swap, | 61 void DisplayWillDrawAndSwap(bool will_draw_and_swap, |
58 const RenderPassList& render_passes) override; | 62 const RenderPassList& render_passes) override; |
(...skipping 15 matching lines...) Expand all Loading... | |
74 CompositorFrameSinkSupportClient* const client_; | 78 CompositorFrameSinkSupportClient* const client_; |
75 | 79 |
76 SurfaceManager* const surface_manager_; | 80 SurfaceManager* const surface_manager_; |
77 | 81 |
78 const FrameSinkId frame_sink_id_; | 82 const FrameSinkId frame_sink_id_; |
79 | 83 |
80 // GpuCompositorFrameSink holds a Display and its BeginFrameSource if it | 84 // GpuCompositorFrameSink holds a Display and its BeginFrameSource if it |
81 // created with non-null gpu::SurfaceHandle. In the window server, the display | 85 // created with non-null gpu::SurfaceHandle. In the window server, the display |
82 // root window's CompositorFrameSink will have a valid gpu::SurfaceHandle. | 86 // root window's CompositorFrameSink will have a valid gpu::SurfaceHandle. |
83 std::unique_ptr<BeginFrameSource> display_begin_frame_source_; | 87 std::unique_ptr<BeginFrameSource> display_begin_frame_source_; |
84 std::unique_ptr<Display> display_; | 88 std::unique_ptr<Display> display_; |
Fady Samuel
2017/01/04 21:53:05
This should be a raw pointer!
Alex Z.
2017/01/05 00:30:13
Done.
| |
85 | 89 |
86 LocalFrameId local_frame_id_; | 90 LocalFrameId local_frame_id_; |
87 SurfaceFactory surface_factory_; | 91 SurfaceFactory surface_factory_; |
88 // Counts the number of CompositorFrames that have been submitted and have not | 92 // Counts the number of CompositorFrames that have been submitted and have not |
89 // yet received an ACK. | 93 // yet received an ACK. |
90 int ack_pending_count_ = 0; | 94 int ack_pending_count_ = 0; |
91 ReturnedResourceArray surface_returned_resources_; | 95 ReturnedResourceArray surface_returned_resources_; |
92 | 96 |
93 // The begin frame source being observered. Null if none. | 97 // The begin frame source being observered. Null if none. |
94 BeginFrameSource* begin_frame_source_ = nullptr; | 98 BeginFrameSource* begin_frame_source_ = nullptr; |
(...skipping 11 matching lines...) Expand all Loading... | |
106 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; | 110 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; |
107 | 111 |
108 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; | 112 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; |
109 | 113 |
110 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); | 114 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); |
111 }; | 115 }; |
112 | 116 |
113 } // namespace cc | 117 } // namespace cc |
114 | 118 |
115 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 119 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
OLD | NEW |