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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 void ScheduledActionBeginOutputSurfaceCreation() override; | 242 void ScheduledActionBeginOutputSurfaceCreation() override; |
243 void ScheduledActionPrepareTiles() override; | 243 void ScheduledActionPrepareTiles() override; |
244 void ScheduledActionInvalidateOutputSurface() override; | 244 void ScheduledActionInvalidateOutputSurface() override; |
245 void SendBeginFramesToChildren(const BeginFrameArgs& args) override; | 245 void SendBeginFramesToChildren(const BeginFrameArgs& args) override; |
246 void SendBeginMainFrameNotExpectedSoon() override; | 246 void SendBeginMainFrameNotExpectedSoon() override; |
247 | 247 |
248 // ProxyMain implementation | 248 // ProxyMain implementation |
249 base::WeakPtr<ProxyMain> GetMainWeakPtr() override; | 249 base::WeakPtr<ProxyMain> GetMainWeakPtr() override; |
250 void SetChannel(scoped_ptr<ThreadedChannel> threaded_channel) override; | 250 void SetChannel(scoped_ptr<ThreadedChannel> threaded_channel) override; |
251 void DidCompleteSwapBuffers() override; | 251 void DidCompleteSwapBuffers() override; |
| 252 void SetRendererCapabilitiesMainCopy( |
| 253 const RendererCapabilities& capabilities) override; |
| 254 void BeginMainFrameNotExpectedSoon() override; |
| 255 void DidCommitAndDrawFrame() override; |
| 256 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue) override; |
| 257 void DidLoseOutputSurface() override; |
| 258 void RequestNewOutputSurface() override; |
| 259 void DidInitializeOutputSurface( |
| 260 bool success, |
| 261 const RendererCapabilities& capabilities) override; |
| 262 void DidCompletePageScaleAnimation() override; |
| 263 void PostFrameTimingEventsOnMain( |
| 264 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 265 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) |
| 266 override; |
252 | 267 |
253 // ProxyImpl implementation | 268 // ProxyImpl implementation |
254 base::WeakPtr<ProxyImpl> GetImplWeakPtr() override; | 269 base::WeakPtr<ProxyImpl> GetImplWeakPtr() override; |
255 void SetThrottleFrameProductionOnImpl(bool throttle) override; | 270 void SetThrottleFrameProductionOnImpl(bool throttle) override; |
| 271 void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface) override; |
| 272 void MainThreadHasStoppedFlingingOnImpl() override; |
| 273 void SetInputThrottledUntilCommitOnImpl(bool is_throttled) override; |
| 274 void SetDeferCommitsOnImpl(bool defer_commits) override; |
| 275 void FinishAllRenderingOnImpl() override; |
| 276 void SetVisibleOnImpl(bool visible) override; |
| 277 void ReleaseOutputSurfaceOnImpl() override; |
| 278 void FinishGLOnImpl() override; |
| 279 void MainFrameWillHappenOnImplForTesting( |
| 280 bool* main_frame_will_happen) override; |
256 | 281 |
257 protected: | 282 protected: |
258 ThreadProxy( | 283 ThreadProxy( |
259 LayerTreeHost* layer_tree_host, | 284 LayerTreeHost* layer_tree_host, |
260 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 285 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
261 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 286 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
262 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 287 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
263 | 288 |
264 private: | 289 private: |
265 // Called on main thread. | 290 // Called on main thread. |
266 void SetRendererCapabilitiesMainThreadCopy( | |
267 const RendererCapabilities& capabilities); | |
268 void BeginMainFrame( | 291 void BeginMainFrame( |
269 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); | 292 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); |
270 void BeginMainFrameNotExpectedSoon(); | |
271 void DidCommitAndDrawFrame(); | |
272 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue); | |
273 void DidLoseOutputSurface(); | |
274 void RequestNewOutputSurface(); | |
275 void DidInitializeOutputSurface(bool success, | |
276 const RendererCapabilities& capabilities); | |
277 // Returns |true| if the request was actually sent, |false| if one was | 293 // Returns |true| if the request was actually sent, |false| if one was |
278 // already outstanding. | 294 // already outstanding. |
279 bool SendCommitRequestToImplThreadIfNeeded( | 295 bool SendCommitRequestToImplThreadIfNeeded( |
280 CommitPipelineStage required_stage); | 296 CommitPipelineStage required_stage); |
281 void DidCompletePageScaleAnimation(); | |
282 | 297 |
283 // Called on impl thread. | 298 // Called on impl thread. |
284 struct SchedulerStateRequest; | 299 struct SchedulerStateRequest; |
285 | 300 |
286 void StartCommitOnImplThread(CompletionEvent* completion); | 301 void StartCommitOnImplThread(CompletionEvent* completion); |
287 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); | 302 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); |
288 void FinishAllRenderingOnImplThread(CompletionEvent* completion); | |
289 void InitializeImplOnImplThread(CompletionEvent* completion); | 303 void InitializeImplOnImplThread(CompletionEvent* completion); |
290 void SetVisibleOnImplThread(CompletionEvent* completion, bool visible); | |
291 void HasInitializedOutputSurfaceOnImplThread( | |
292 CompletionEvent* completion, | |
293 bool* has_initialized_output_surface); | |
294 void DeleteContentsTexturesOnImplThread(CompletionEvent* completion); | |
295 void InitializeOutputSurfaceOnImplThread(OutputSurface* output_surface); | |
296 void ReleaseOutputSurfaceOnImplThread(CompletionEvent* completion); | |
297 void FinishGLOnImplThread(CompletionEvent* completion); | |
298 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); | 304 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); |
299 DrawResult DrawSwapInternal(bool forced_draw); | 305 DrawResult DrawSwapInternal(bool forced_draw); |
300 void MainFrameWillHappenOnImplThreadForTesting(CompletionEvent* completion, | |
301 bool* main_frame_will_happen); | |
302 void SetSwapUsedIncompleteTileOnImplThread(bool used_incomplete_tile); | |
303 void MainThreadHasStoppedFlingingOnImplThread(); | |
304 void SetInputThrottledUntilCommitOnImplThread(bool is_throttled); | |
305 void SetDeferCommitsOnImplThread(bool defer_commits) const; | |
306 void PostFrameTimingEvents( | |
307 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | |
308 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); | |
309 | 306 |
310 LayerTreeHost* layer_tree_host(); | 307 LayerTreeHost* layer_tree_host(); |
311 const LayerTreeHost* layer_tree_host() const; | 308 const LayerTreeHost* layer_tree_host() const; |
312 | 309 |
313 // Use accessors instead of this variable directly. | 310 // Use accessors instead of this variable directly. |
314 MainThreadOnly main_thread_only_vars_unsafe_; | 311 MainThreadOnly main_thread_only_vars_unsafe_; |
315 MainThreadOnly& main(); | 312 MainThreadOnly& main(); |
316 | 313 |
317 // Use accessors instead of this variable directly. | 314 // Use accessors instead of this variable directly. |
318 MainThreadOrBlockedMainThread main_thread_or_blocked_vars_unsafe_; | 315 MainThreadOrBlockedMainThread main_thread_or_blocked_vars_unsafe_; |
319 MainThreadOrBlockedMainThread& blocked_main(); | 316 MainThreadOrBlockedMainThread& blocked_main(); |
320 | 317 |
321 // Use accessors instead of this variable directly. | 318 // Use accessors instead of this variable directly. |
322 CompositorThreadOnly compositor_thread_vars_unsafe_; | 319 CompositorThreadOnly compositor_thread_vars_unsafe_; |
323 CompositorThreadOnly& impl(); | 320 CompositorThreadOnly& impl(); |
324 | 321 |
325 // TODO(khushalsagar): Remove this. Temporary variable to hold the channel. | 322 // TODO(khushalsagar): Remove this. Temporary variable to hold the channel. |
326 scoped_ptr<ThreadedChannel> threaded_channel_; | 323 scoped_ptr<ThreadedChannel> threaded_channel_; |
327 | 324 |
328 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; | 325 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; |
329 base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_; | 326 base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_; |
330 | 327 |
331 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); | 328 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); |
332 }; | 329 }; |
333 | 330 |
334 } // namespace cc | 331 } // namespace cc |
335 | 332 |
336 #endif // CC_TREES_THREAD_PROXY_H_ | 333 #endif // CC_TREES_THREAD_PROXY_H_ |
OLD | NEW |