| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "cc/output/begin_frame_args.h" | 13 #include "cc/output/begin_frame_args.h" |
| 14 #include "cc/scheduler/scheduler.h" | 14 #include "cc/scheduler/scheduler.h" |
| 15 #include "cc/trees/blocking_task_runner.h" | 15 #include "cc/trees/blocking_task_runner.h" |
| 16 #include "cc/trees/layer_tree_host_impl.h" | 16 #include "cc/trees/layer_tree_host_impl.h" |
| 17 #include "cc/trees/proxy.h" | 17 #include "cc/trees/proxy.h" |
| 18 #include "cc/trees/task_runner_provider.h" | 18 #include "cc/trees/task_runner_provider.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class MutatorEvents; | 22 class MutatorEvents; |
| 23 class BeginFrameSource; | 23 class BeginFrameSource; |
| 24 class LayerTreeHostInProcess; | 24 class LayerTreeHost; |
| 25 class LayerTreeHostSingleThreadClient; | 25 class LayerTreeHostSingleThreadClient; |
| 26 | 26 |
| 27 class CC_EXPORT SingleThreadProxy : public Proxy, | 27 class CC_EXPORT SingleThreadProxy : public Proxy, |
| 28 NON_EXPORTED_BASE(LayerTreeHostImplClient), | 28 NON_EXPORTED_BASE(LayerTreeHostImplClient), |
| 29 public SchedulerClient { | 29 public SchedulerClient { |
| 30 public: | 30 public: |
| 31 static std::unique_ptr<Proxy> Create( | 31 static std::unique_ptr<Proxy> Create( |
| 32 LayerTreeHostInProcess* layer_tree_host, | 32 LayerTreeHost* layer_tree_host, |
| 33 LayerTreeHostSingleThreadClient* client, | 33 LayerTreeHostSingleThreadClient* client, |
| 34 TaskRunnerProvider* task_runner_provider_); | 34 TaskRunnerProvider* task_runner_provider_); |
| 35 ~SingleThreadProxy() override; | 35 ~SingleThreadProxy() override; |
| 36 | 36 |
| 37 // Proxy implementation | 37 // Proxy implementation |
| 38 bool IsStarted() const override; | 38 bool IsStarted() const override; |
| 39 bool CommitToActiveTree() const override; | 39 bool CommitToActiveTree() const override; |
| 40 void SetCompositorFrameSink( | 40 void SetCompositorFrameSink( |
| 41 CompositorFrameSink* compositor_frame_sink) override; | 41 CompositorFrameSink* compositor_frame_sink) override; |
| 42 void ReleaseCompositorFrameSink() override; | 42 void ReleaseCompositorFrameSink() override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void DidPrepareTiles() override; | 95 void DidPrepareTiles() override; |
| 96 void DidCompletePageScaleAnimationOnImplThread() override; | 96 void DidCompletePageScaleAnimationOnImplThread() override; |
| 97 void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; | 97 void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; |
| 98 | 98 |
| 99 void RequestNewCompositorFrameSink(); | 99 void RequestNewCompositorFrameSink(); |
| 100 | 100 |
| 101 // Called by the legacy path where RenderWidget does the scheduling. | 101 // Called by the legacy path where RenderWidget does the scheduling. |
| 102 void CompositeImmediately(base::TimeTicks frame_begin_time); | 102 void CompositeImmediately(base::TimeTicks frame_begin_time); |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 SingleThreadProxy(LayerTreeHostInProcess* layer_tree_host, | 105 SingleThreadProxy(LayerTreeHost* layer_tree_host, |
| 106 LayerTreeHostSingleThreadClient* client, | 106 LayerTreeHostSingleThreadClient* client, |
| 107 TaskRunnerProvider* task_runner_provider); | 107 TaskRunnerProvider* task_runner_provider); |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); | 110 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); |
| 111 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); | 111 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); |
| 112 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); | 112 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); |
| 113 void DoCommit(); | 113 void DoCommit(); |
| 114 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); | 114 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); |
| 115 void DoSwap(); | 115 void DoSwap(); |
| 116 void DidCommitAndDrawFrame(); | 116 void DidCommitAndDrawFrame(); |
| 117 void CommitComplete(); | 117 void CommitComplete(); |
| 118 | 118 |
| 119 bool ShouldComposite() const; | 119 bool ShouldComposite() const; |
| 120 void ScheduleRequestNewCompositorFrameSink(); | 120 void ScheduleRequestNewCompositorFrameSink(); |
| 121 | 121 |
| 122 // Accessed on main thread only. | 122 // Accessed on main thread only. |
| 123 LayerTreeHostInProcess* layer_tree_host_; | 123 LayerTreeHost* layer_tree_host_; |
| 124 LayerTreeHostSingleThreadClient* single_thread_client_; | 124 LayerTreeHostSingleThreadClient* single_thread_client_; |
| 125 | 125 |
| 126 TaskRunnerProvider* task_runner_provider_; | 126 TaskRunnerProvider* task_runner_provider_; |
| 127 | 127 |
| 128 // Used on the Thread, but checked on main thread during | 128 // Used on the Thread, but checked on main thread during |
| 129 // initialization/shutdown. | 129 // initialization/shutdown. |
| 130 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 130 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| 131 | 131 |
| 132 // Accessed from both threads. | 132 // Accessed from both threads. |
| 133 std::unique_ptr<Scheduler> scheduler_on_impl_thread_; | 133 std::unique_ptr<Scheduler> scheduler_on_impl_thread_; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 private: | 231 private: |
| 232 DebugScopedSetImplThread impl_thread_; | 232 DebugScopedSetImplThread impl_thread_; |
| 233 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 233 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
| 234 | 234 |
| 235 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 235 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 } // namespace cc | 238 } // namespace cc |
| 239 | 239 |
| 240 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 240 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
| OLD | NEW |