OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_TREES_SINGLE_THREAD_PROXY_H_ | 5 #ifndef CC_TREES_SINGLE_THREAD_PROXY_H_ |
6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ | 6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 public: | 31 public: |
32 static std::unique_ptr<Proxy> Create( | 32 static std::unique_ptr<Proxy> Create( |
33 LayerTreeHost* layer_tree_host, | 33 LayerTreeHost* layer_tree_host, |
34 LayerTreeHostSingleThreadClient* client, | 34 LayerTreeHostSingleThreadClient* client, |
35 TaskRunnerProvider* task_runner_provider_); | 35 TaskRunnerProvider* task_runner_provider_); |
36 ~SingleThreadProxy() override; | 36 ~SingleThreadProxy() override; |
37 | 37 |
38 // Proxy implementation | 38 // Proxy implementation |
39 bool IsStarted() const override; | 39 bool IsStarted() const override; |
40 bool CommitToActiveTree() const override; | 40 bool CommitToActiveTree() const override; |
41 void SetOutputSurface(OutputSurface* output_surface) override; | 41 void SetCompositorFrameSink( |
42 void ReleaseOutputSurface() override; | 42 CompositorFrameSink* compositor_frame_sink) override; |
| 43 void ReleaseCompositorFrameSink() override; |
43 void SetVisible(bool visible) override; | 44 void SetVisible(bool visible) override; |
44 void SetNeedsAnimate() override; | 45 void SetNeedsAnimate() override; |
45 void SetNeedsUpdateLayers() override; | 46 void SetNeedsUpdateLayers() override; |
46 void SetNeedsCommit() override; | 47 void SetNeedsCommit() override; |
47 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; | 48 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; |
48 void SetNextCommitWaitsForActivation() override; | 49 void SetNextCommitWaitsForActivation() override; |
49 void NotifyInputThrottledUntilCommit() override {} | 50 void NotifyInputThrottledUntilCommit() override {} |
50 void SetDeferCommits(bool defer_commits) override; | 51 void SetDeferCommits(bool defer_commits) override; |
51 bool CommitRequested() const override; | 52 bool CommitRequested() const override; |
52 bool BeginMainFrameRequested() const override; | 53 bool BeginMainFrameRequested() const override; |
53 void MainThreadHasStoppedFlinging() override {} | 54 void MainThreadHasStoppedFlinging() override {} |
54 void Start( | 55 void Start( |
55 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; | 56 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override; |
56 void Stop() override; | 57 void Stop() override; |
57 void SetMutator(std::unique_ptr<LayerTreeMutator> mutator) override; | 58 void SetMutator(std::unique_ptr<LayerTreeMutator> mutator) override; |
58 bool SupportsImplScrolling() const override; | 59 bool SupportsImplScrolling() const override; |
59 bool MainFrameWillHappenForTesting() override; | 60 bool MainFrameWillHappenForTesting() override; |
60 void UpdateTopControlsState(TopControlsState constraints, | 61 void UpdateTopControlsState(TopControlsState constraints, |
61 TopControlsState current, | 62 TopControlsState current, |
62 bool animate) override; | 63 bool animate) override; |
63 | 64 |
64 // SchedulerClient implementation | 65 // SchedulerClient implementation |
65 void WillBeginImplFrame(const BeginFrameArgs& args) override; | 66 void WillBeginImplFrame(const BeginFrameArgs& args) override; |
66 void DidFinishImplFrame() override; | 67 void DidFinishImplFrame() override; |
67 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override; | 68 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override; |
68 DrawResult ScheduledActionDrawAndSwapIfPossible() override; | 69 DrawResult ScheduledActionDrawAndSwapIfPossible() override; |
69 DrawResult ScheduledActionDrawAndSwapForced() override; | 70 DrawResult ScheduledActionDrawAndSwapForced() override; |
70 void ScheduledActionCommit() override; | 71 void ScheduledActionCommit() override; |
71 void ScheduledActionActivateSyncTree() override; | 72 void ScheduledActionActivateSyncTree() override; |
72 void ScheduledActionBeginOutputSurfaceCreation() override; | 73 void ScheduledActionBeginCompositorFrameSinkCreation() override; |
73 void ScheduledActionPrepareTiles() override; | 74 void ScheduledActionPrepareTiles() override; |
74 void ScheduledActionInvalidateOutputSurface() override; | 75 void ScheduledActionInvalidateCompositorFrameSink() override; |
75 void SendBeginMainFrameNotExpectedSoon() override; | 76 void SendBeginMainFrameNotExpectedSoon() override; |
76 | 77 |
77 // LayerTreeHostImplClient implementation | 78 // LayerTreeHostImplClient implementation |
78 void DidLoseOutputSurfaceOnImplThread() override; | 79 void DidLoseCompositorFrameSinkOnImplThread() override; |
79 void SetBeginFrameSource(BeginFrameSource* source) override; | 80 void SetBeginFrameSource(BeginFrameSource* source) override; |
80 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; | 81 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; |
81 void DidSwapBuffersCompleteOnImplThread() override; | 82 void DidSwapBuffersCompleteOnImplThread() override; |
82 void OnCanDrawStateChanged(bool can_draw) override; | 83 void OnCanDrawStateChanged(bool can_draw) override; |
83 void NotifyReadyToActivate() override; | 84 void NotifyReadyToActivate() override; |
84 void NotifyReadyToDraw() override; | 85 void NotifyReadyToDraw() override; |
85 void SetNeedsRedrawOnImplThread() override; | 86 void SetNeedsRedrawOnImplThread() override; |
86 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; | 87 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; |
87 void SetNeedsOneBeginImplFrameOnImplThread() override; | 88 void SetNeedsOneBeginImplFrameOnImplThread() override; |
88 void SetNeedsPrepareTilesOnImplThread() override; | 89 void SetNeedsPrepareTilesOnImplThread() override; |
89 void SetNeedsCommitOnImplThread() override; | 90 void SetNeedsCommitOnImplThread() override; |
90 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; | 91 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; |
91 void PostAnimationEventsToMainThreadOnImplThread( | 92 void PostAnimationEventsToMainThreadOnImplThread( |
92 std::unique_ptr<AnimationEvents> events) override; | 93 std::unique_ptr<AnimationEvents> events) override; |
93 bool IsInsideDraw() override; | 94 bool IsInsideDraw() override; |
94 void RenewTreePriority() override {} | 95 void RenewTreePriority() override {} |
95 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, | 96 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
96 base::TimeDelta delay) override {} | 97 base::TimeDelta delay) override {} |
97 void DidActivateSyncTree() override; | 98 void DidActivateSyncTree() override; |
98 void WillPrepareTiles() override; | 99 void WillPrepareTiles() override; |
99 void DidPrepareTiles() override; | 100 void DidPrepareTiles() override; |
100 void DidCompletePageScaleAnimationOnImplThread() override; | 101 void DidCompletePageScaleAnimationOnImplThread() override; |
101 void OnDrawForOutputSurface(bool resourceless_software_draw) override; | 102 void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; |
102 | 103 |
103 void RequestNewOutputSurface(); | 104 void RequestNewCompositorFrameSink(); |
104 | 105 |
105 // Called by the legacy path where RenderWidget does the scheduling. | 106 // Called by the legacy path where RenderWidget does the scheduling. |
106 void CompositeImmediately(base::TimeTicks frame_begin_time); | 107 void CompositeImmediately(base::TimeTicks frame_begin_time); |
107 | 108 |
108 protected: | 109 protected: |
109 SingleThreadProxy(LayerTreeHost* layer_tree_host, | 110 SingleThreadProxy(LayerTreeHost* layer_tree_host, |
110 LayerTreeHostSingleThreadClient* client, | 111 LayerTreeHostSingleThreadClient* client, |
111 TaskRunnerProvider* task_runner_provider); | 112 TaskRunnerProvider* task_runner_provider); |
112 | 113 |
113 private: | 114 private: |
114 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); | 115 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); |
115 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); | 116 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); |
116 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); | 117 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); |
117 void DoCommit(); | 118 void DoCommit(); |
118 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); | 119 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); |
119 void DoSwap(); | 120 void DoSwap(); |
120 void DidCommitAndDrawFrame(); | 121 void DidCommitAndDrawFrame(); |
121 void CommitComplete(); | 122 void CommitComplete(); |
122 | 123 |
123 bool ShouldComposite() const; | 124 bool ShouldComposite() const; |
124 void ScheduleRequestNewOutputSurface(); | 125 void ScheduleRequestNewCompositorFrameSink(); |
125 | 126 |
126 // Accessed on main thread only. | 127 // Accessed on main thread only. |
127 LayerTreeHost* layer_tree_host_; | 128 LayerTreeHost* layer_tree_host_; |
128 LayerTreeHostSingleThreadClient* client_; | 129 LayerTreeHostSingleThreadClient* client_; |
129 | 130 |
130 TaskRunnerProvider* task_runner_provider_; | 131 TaskRunnerProvider* task_runner_provider_; |
131 | 132 |
132 // Used on the Thread, but checked on main thread during | 133 // Used on the Thread, but checked on main thread during |
133 // initialization/shutdown. | 134 // initialization/shutdown. |
134 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 135 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
(...skipping 10 matching lines...) Expand all Loading... |
145 bool inside_impl_frame_; | 146 bool inside_impl_frame_; |
146 #endif | 147 #endif |
147 bool inside_draw_; | 148 bool inside_draw_; |
148 bool defer_commits_; | 149 bool defer_commits_; |
149 bool animate_requested_; | 150 bool animate_requested_; |
150 bool commit_requested_; | 151 bool commit_requested_; |
151 bool inside_synchronous_composite_; | 152 bool inside_synchronous_composite_; |
152 | 153 |
153 // True if a request to the LayerTreeHostClient to create an output surface | 154 // True if a request to the LayerTreeHostClient to create an output surface |
154 // is still outstanding. | 155 // is still outstanding. |
155 bool output_surface_creation_requested_; | 156 bool compositor_frame_sink_creation_requested_; |
156 // When output surface is lost, is set to true until a new output surface is | 157 // When output surface is lost, is set to true until a new output surface is |
157 // initialized. | 158 // initialized. |
158 bool output_surface_lost_; | 159 bool compositor_frame_sink_lost_; |
159 | 160 |
160 // This is the callback for the scheduled RequestNewOutputSurface. | 161 // This is the callback for the scheduled RequestNewCompositorFrameSink. |
161 base::CancelableClosure output_surface_creation_callback_; | 162 base::CancelableClosure compositor_frame_sink_creation_callback_; |
162 | 163 |
163 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; | 164 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; |
164 | 165 |
165 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); | 166 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); |
166 }; | 167 }; |
167 | 168 |
168 // For use in the single-threaded case. In debug builds, it pretends that the | 169 // For use in the single-threaded case. In debug builds, it pretends that the |
169 // code is running on the impl thread to satisfy assertion checks. | 170 // code is running on the impl thread to satisfy assertion checks. |
170 class DebugScopedSetImplThread { | 171 class DebugScopedSetImplThread { |
171 public: | 172 public: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 private: | 237 private: |
237 DebugScopedSetImplThread impl_thread_; | 238 DebugScopedSetImplThread impl_thread_; |
238 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 239 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
239 | 240 |
240 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 241 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
241 }; | 242 }; |
242 | 243 |
243 } // namespace cc | 244 } // namespace cc |
244 | 245 |
245 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 246 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
OLD | NEW |