| 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(CompletionEvent* completion) override; |
| 276 void SetVisibleOnImpl(CompletionEvent* completion, bool visible) override; |
| 277 void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) override; |
| 278 void FinishGLOnImpl(CompletionEvent* completion) override; |
| 279 void MainFrameWillHappenOnImplForTesting( |
| 280 CompletionEvent* completion, |
| 281 bool* main_frame_will_happen) override; |
| 256 | 282 |
| 257 protected: | 283 protected: |
| 258 ThreadProxy( | 284 ThreadProxy( |
| 259 LayerTreeHost* layer_tree_host, | 285 LayerTreeHost* layer_tree_host, |
| 260 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 286 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 261 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 287 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 262 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 288 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
| 263 | 289 |
| 264 private: | 290 private: |
| 265 // Called on main thread. | 291 // Called on main thread. |
| 266 void SetRendererCapabilitiesMainThreadCopy( | |
| 267 const RendererCapabilities& capabilities); | |
| 268 void BeginMainFrame( | 292 void BeginMainFrame( |
| 269 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); | 293 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 | 294 // Returns |true| if the request was actually sent, |false| if one was |
| 278 // already outstanding. | 295 // already outstanding. |
| 279 bool SendCommitRequestToImplThreadIfNeeded( | 296 bool SendCommitRequestToImplThreadIfNeeded( |
| 280 CommitPipelineStage required_stage); | 297 CommitPipelineStage required_stage); |
| 281 void DidCompletePageScaleAnimation(); | |
| 282 | 298 |
| 283 // Called on impl thread. | 299 // Called on impl thread. |
| 284 struct SchedulerStateRequest; | 300 struct SchedulerStateRequest; |
| 285 | 301 |
| 286 void StartCommitOnImplThread(CompletionEvent* completion); | 302 void StartCommitOnImplThread(CompletionEvent* completion); |
| 287 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); | 303 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); |
| 288 void FinishAllRenderingOnImplThread(CompletionEvent* completion); | |
| 289 void InitializeImplOnImplThread(CompletionEvent* completion); | 304 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); | 305 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); |
| 299 DrawResult DrawSwapInternal(bool forced_draw); | 306 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 | 307 |
| 310 LayerTreeHost* layer_tree_host(); | 308 LayerTreeHost* layer_tree_host(); |
| 311 const LayerTreeHost* layer_tree_host() const; | 309 const LayerTreeHost* layer_tree_host() const; |
| 312 | 310 |
| 313 // Use accessors instead of this variable directly. | 311 // Use accessors instead of this variable directly. |
| 314 MainThreadOnly main_thread_only_vars_unsafe_; | 312 MainThreadOnly main_thread_only_vars_unsafe_; |
| 315 MainThreadOnly& main(); | 313 MainThreadOnly& main(); |
| 316 | 314 |
| 317 // Use accessors instead of this variable directly. | 315 // Use accessors instead of this variable directly. |
| 318 MainThreadOrBlockedMainThread main_thread_or_blocked_vars_unsafe_; | 316 MainThreadOrBlockedMainThread main_thread_or_blocked_vars_unsafe_; |
| 319 MainThreadOrBlockedMainThread& blocked_main(); | 317 MainThreadOrBlockedMainThread& blocked_main(); |
| 320 | 318 |
| 321 // Use accessors instead of this variable directly. | 319 // Use accessors instead of this variable directly. |
| 322 CompositorThreadOnly compositor_thread_vars_unsafe_; | 320 CompositorThreadOnly compositor_thread_vars_unsafe_; |
| 323 CompositorThreadOnly& impl(); | 321 CompositorThreadOnly& impl(); |
| 324 | 322 |
| 325 // TODO(khushalsagar): Remove this. Temporary variable to hold the channel. | 323 // TODO(khushalsagar): Remove this. Temporary variable to hold the channel. |
| 326 scoped_ptr<ThreadedChannel> threaded_channel_; | 324 scoped_ptr<ThreadedChannel> threaded_channel_; |
| 327 | 325 |
| 328 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; | 326 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; |
| 329 base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_; | 327 base::WeakPtr<ThreadProxy> impl_thread_weak_ptr_; |
| 330 | 328 |
| 331 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); | 329 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); |
| 332 }; | 330 }; |
| 333 | 331 |
| 334 } // namespace cc | 332 } // namespace cc |
| 335 | 333 |
| 336 #endif // CC_TREES_THREAD_PROXY_H_ | 334 #endif // CC_TREES_THREAD_PROXY_H_ |
| OLD | NEW |