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_THREAD_PROXY_H_ | 5 #ifndef CC_TREES_THREAD_PROXY_H_ |
6 #define CC_TREES_THREAD_PROXY_H_ | 6 #define CC_TREES_THREAD_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 class CC_EXPORT ThreadProxy : public Proxy, | 35 class CC_EXPORT ThreadProxy : public Proxy, |
36 NON_EXPORTED_BASE(LayerTreeHostImplClient), | 36 NON_EXPORTED_BASE(LayerTreeHostImplClient), |
37 NON_EXPORTED_BASE(SchedulerClient), | 37 NON_EXPORTED_BASE(SchedulerClient), |
38 NON_EXPORTED_BASE(ResourceUpdateControllerClient) { | 38 NON_EXPORTED_BASE(ResourceUpdateControllerClient) { |
39 public: | 39 public: |
40 static scoped_ptr<Proxy> Create( | 40 static scoped_ptr<Proxy> Create( |
41 LayerTreeHost* layer_tree_host, | 41 LayerTreeHost* layer_tree_host, |
42 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
43 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 43 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
44 | 44 |
45 virtual ~ThreadProxy(); | 45 ~ThreadProxy() override; |
46 | 46 |
47 struct BeginMainFrameAndCommitState { | 47 struct BeginMainFrameAndCommitState { |
48 BeginMainFrameAndCommitState(); | 48 BeginMainFrameAndCommitState(); |
49 ~BeginMainFrameAndCommitState(); | 49 ~BeginMainFrameAndCommitState(); |
50 | 50 |
51 unsigned int begin_frame_id; | 51 unsigned int begin_frame_id; |
52 BeginFrameArgs begin_frame_args; | 52 BeginFrameArgs begin_frame_args; |
53 scoped_ptr<ScrollAndScaleSet> scroll_info; | 53 scoped_ptr<ScrollAndScaleSet> scroll_info; |
54 size_t memory_allocation_limit_bytes; | 54 size_t memory_allocation_limit_bytes; |
55 int memory_allocation_priority_cutoff; | 55 int memory_allocation_priority_cutoff; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl; | 140 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl; |
141 base::WeakPtrFactory<ThreadProxy> weak_factory; | 141 base::WeakPtrFactory<ThreadProxy> weak_factory; |
142 }; | 142 }; |
143 | 143 |
144 const MainThreadOnly& main() const; | 144 const MainThreadOnly& main() const; |
145 const MainThreadOrBlockedMainThread& blocked_main() const; | 145 const MainThreadOrBlockedMainThread& blocked_main() const; |
146 const CompositorThreadOnly& impl() const; | 146 const CompositorThreadOnly& impl() const; |
147 | 147 |
148 // Proxy implementation | 148 // Proxy implementation |
149 virtual void FinishAllRendering() override; | 149 void FinishAllRendering() override; |
150 virtual bool IsStarted() const override; | 150 bool IsStarted() const override; |
151 virtual void SetOutputSurface(scoped_ptr<OutputSurface>) override; | 151 void SetOutputSurface(scoped_ptr<OutputSurface>) override; |
152 virtual void SetLayerTreeHostClientReady() override; | 152 void SetLayerTreeHostClientReady() override; |
153 virtual void SetVisible(bool visible) override; | 153 void SetVisible(bool visible) override; |
154 virtual const RendererCapabilities& GetRendererCapabilities() const override; | 154 const RendererCapabilities& GetRendererCapabilities() const override; |
155 virtual void SetNeedsAnimate() override; | 155 void SetNeedsAnimate() override; |
156 virtual void SetNeedsUpdateLayers() override; | 156 void SetNeedsUpdateLayers() override; |
157 virtual void SetNeedsCommit() override; | 157 void SetNeedsCommit() override; |
158 virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) override; | 158 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; |
159 virtual void SetNextCommitWaitsForActivation() override; | 159 void SetNextCommitWaitsForActivation() override; |
160 virtual void NotifyInputThrottledUntilCommit() override; | 160 void NotifyInputThrottledUntilCommit() override; |
161 virtual void SetDeferCommits(bool defer_commits) override; | 161 void SetDeferCommits(bool defer_commits) override; |
162 virtual bool CommitRequested() const override; | 162 bool CommitRequested() const override; |
163 virtual bool BeginMainFrameRequested() const override; | 163 bool BeginMainFrameRequested() const override; |
164 virtual void MainThreadHasStoppedFlinging() override; | 164 void MainThreadHasStoppedFlinging() override; |
165 virtual void Start() override; | 165 void Start() override; |
166 virtual void Stop() override; | 166 void Stop() override; |
167 virtual size_t MaxPartialTextureUpdates() const override; | 167 size_t MaxPartialTextureUpdates() const override; |
168 virtual void ForceSerializeOnSwapBuffers() override; | 168 void ForceSerializeOnSwapBuffers() override; |
169 virtual bool SupportsImplScrolling() const override; | 169 bool SupportsImplScrolling() const override; |
170 virtual void SetDebugState(const LayerTreeDebugState& debug_state) override; | 170 void SetDebugState(const LayerTreeDebugState& debug_state) override; |
171 virtual void AsValueInto(base::debug::TracedValue* value) const override; | 171 void AsValueInto(base::debug::TracedValue* value) const override; |
172 virtual bool MainFrameWillHappenForTesting() override; | 172 bool MainFrameWillHappenForTesting() override; |
173 | 173 |
174 // LayerTreeHostImplClient implementation | 174 // LayerTreeHostImplClient implementation |
175 virtual void UpdateRendererCapabilitiesOnImplThread() override; | 175 void UpdateRendererCapabilitiesOnImplThread() override; |
176 virtual void DidLoseOutputSurfaceOnImplThread() override; | 176 void DidLoseOutputSurfaceOnImplThread() override; |
177 virtual void CommitVSyncParameters(base::TimeTicks timebase, | 177 void CommitVSyncParameters(base::TimeTicks timebase, |
178 base::TimeDelta interval) override; | 178 base::TimeDelta interval) override; |
179 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; | 179 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; |
180 virtual void SetMaxSwapsPendingOnImplThread(int max) override; | 180 void SetMaxSwapsPendingOnImplThread(int max) override; |
181 virtual void DidSwapBuffersOnImplThread() override; | 181 void DidSwapBuffersOnImplThread() override; |
182 virtual void DidSwapBuffersCompleteOnImplThread() override; | 182 void DidSwapBuffersCompleteOnImplThread() override; |
183 virtual void OnCanDrawStateChanged(bool can_draw) override; | 183 void OnCanDrawStateChanged(bool can_draw) override; |
184 virtual void NotifyReadyToActivate() override; | 184 void NotifyReadyToActivate() override; |
185 // Please call these 3 functions through | 185 // Please call these 3 functions through |
186 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 186 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
187 // SetNeedsAnimate(). | 187 // SetNeedsAnimate(). |
188 virtual void SetNeedsRedrawOnImplThread() override; | 188 void SetNeedsRedrawOnImplThread() override; |
189 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) | 189 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; |
190 override; | 190 void SetNeedsAnimateOnImplThread() override; |
191 virtual void SetNeedsAnimateOnImplThread() override; | 191 void SetNeedsManageTilesOnImplThread() override; |
192 virtual void SetNeedsManageTilesOnImplThread() override; | 192 void DidInitializeVisibleTileOnImplThread() override; |
193 virtual void DidInitializeVisibleTileOnImplThread() override; | 193 void SetNeedsCommitOnImplThread() override; |
194 virtual void SetNeedsCommitOnImplThread() override; | 194 void PostAnimationEventsToMainThreadOnImplThread( |
195 virtual void PostAnimationEventsToMainThreadOnImplThread( | |
196 scoped_ptr<AnimationEventsVector> queue) override; | 195 scoped_ptr<AnimationEventsVector> queue) override; |
197 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, | 196 bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, |
198 int priority_cutoff) | 197 int priority_cutoff) override; |
199 override; | 198 bool IsInsideDraw() override; |
200 virtual bool IsInsideDraw() override; | 199 void RenewTreePriority() override; |
201 virtual void RenewTreePriority() override; | 200 void PostDelayedScrollbarFadeOnImplThread(const base::Closure& start_fade, |
202 virtual void PostDelayedScrollbarFadeOnImplThread( | 201 base::TimeDelta delay) override; |
203 const base::Closure& start_fade, | 202 void DidActivateSyncTree() override; |
204 base::TimeDelta delay) override; | 203 void DidManageTiles() override; |
205 virtual void DidActivateSyncTree() override; | |
206 virtual void DidManageTiles() override; | |
207 | 204 |
208 // SchedulerClient implementation | 205 // SchedulerClient implementation |
209 virtual BeginFrameSource* ExternalBeginFrameSource() override; | 206 BeginFrameSource* ExternalBeginFrameSource() override; |
210 virtual void WillBeginImplFrame(const BeginFrameArgs& args) override; | 207 void WillBeginImplFrame(const BeginFrameArgs& args) override; |
211 virtual void ScheduledActionSendBeginMainFrame() override; | 208 void ScheduledActionSendBeginMainFrame() override; |
212 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() override; | 209 DrawResult ScheduledActionDrawAndSwapIfPossible() override; |
213 virtual DrawResult ScheduledActionDrawAndSwapForced() override; | 210 DrawResult ScheduledActionDrawAndSwapForced() override; |
214 virtual void ScheduledActionAnimate() override; | 211 void ScheduledActionAnimate() override; |
215 virtual void ScheduledActionCommit() override; | 212 void ScheduledActionCommit() override; |
216 virtual void ScheduledActionUpdateVisibleTiles() override; | 213 void ScheduledActionUpdateVisibleTiles() override; |
217 virtual void ScheduledActionActivateSyncTree() override; | 214 void ScheduledActionActivateSyncTree() override; |
218 virtual void ScheduledActionBeginOutputSurfaceCreation() override; | 215 void ScheduledActionBeginOutputSurfaceCreation() override; |
219 virtual void ScheduledActionManageTiles() override; | 216 void ScheduledActionManageTiles() override; |
220 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) override; | 217 void DidAnticipatedDrawTimeChange(base::TimeTicks time) override; |
221 virtual base::TimeDelta DrawDurationEstimate() override; | 218 base::TimeDelta DrawDurationEstimate() override; |
222 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() override; | 219 base::TimeDelta BeginMainFrameToCommitDurationEstimate() override; |
223 virtual base::TimeDelta CommitToActivateDurationEstimate() override; | 220 base::TimeDelta CommitToActivateDurationEstimate() override; |
224 virtual void DidBeginImplFrameDeadline() override; | 221 void DidBeginImplFrameDeadline() override; |
225 | 222 |
226 // ResourceUpdateControllerClient implementation | 223 // ResourceUpdateControllerClient implementation |
227 virtual void ReadyToFinalizeTextureUpdates() override; | 224 void ReadyToFinalizeTextureUpdates() override; |
228 | 225 |
229 protected: | 226 protected: |
230 ThreadProxy(LayerTreeHost* layer_tree_host, | 227 ThreadProxy(LayerTreeHost* layer_tree_host, |
231 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 228 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
232 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 229 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
233 | 230 |
234 private: | 231 private: |
235 // Called on main thread. | 232 // Called on main thread. |
236 void SetRendererCapabilitiesMainThreadCopy( | 233 void SetRendererCapabilitiesMainThreadCopy( |
237 const RendererCapabilities& capabilities); | 234 const RendererCapabilities& capabilities); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 290 |
294 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; | 291 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; |
295 base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_; | 292 base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_; |
296 | 293 |
297 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); | 294 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); |
298 }; | 295 }; |
299 | 296 |
300 } // namespace cc | 297 } // namespace cc |
301 | 298 |
302 #endif // CC_TREES_THREAD_PROXY_H_ | 299 #endif // CC_TREES_THREAD_PROXY_H_ |
OLD | NEW |