| 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/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "cc/animation/animation_events.h" | 12 #include "cc/animation/animation_events.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 | 19 |
| 19 namespace cc { | 20 namespace cc { |
| 20 | 21 |
| 21 class BeginFrameSource; | 22 class BeginFrameSource; |
| 22 class ContextProvider; | 23 class ContextProvider; |
| 23 class LayerTreeHost; | 24 class LayerTreeHost; |
| 24 class LayerTreeHostSingleThreadClient; | 25 class LayerTreeHostSingleThreadClient; |
| 25 | 26 |
| 26 class CC_EXPORT SingleThreadProxy : public Proxy, | 27 class CC_EXPORT SingleThreadProxy : public Proxy, |
| 27 NON_EXPORTED_BASE(LayerTreeHostImplClient), | 28 NON_EXPORTED_BASE(LayerTreeHostImplClient), |
| 28 SchedulerClient { | 29 SchedulerClient { |
| 29 public: | 30 public: |
| 30 static scoped_ptr<Proxy> Create( | 31 static scoped_ptr<Proxy> Create( |
| 31 LayerTreeHost* layer_tree_host, | 32 LayerTreeHost* layer_tree_host, |
| 32 LayerTreeHostSingleThreadClient* client, | 33 LayerTreeHostSingleThreadClient* client, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 34 TaskRunnerProvider* task_runner_provider_, |
| 34 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 35 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
| 35 ~SingleThreadProxy() override; | 36 ~SingleThreadProxy() override; |
| 36 | 37 |
| 37 // Proxy implementation | 38 // Proxy implementation |
| 38 void FinishAllRendering() override; | 39 void FinishAllRendering() override; |
| 39 bool IsStarted() const override; | 40 bool IsStarted() const override; |
| 40 bool CommitToActiveTree() const override; | 41 bool CommitToActiveTree() const override; |
| 41 void SetOutputSurface(OutputSurface* output_surface) override; | 42 void SetOutputSurface(OutputSurface* output_surface) override; |
| 42 void ReleaseOutputSurface() override; | 43 void ReleaseOutputSurface() override; |
| 43 void SetVisible(bool visible) override; | 44 void SetVisible(bool visible) override; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 113 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 113 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) | 114 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) |
| 114 override; | 115 override; |
| 115 | 116 |
| 116 void RequestNewOutputSurface(); | 117 void RequestNewOutputSurface(); |
| 117 | 118 |
| 118 // Called by the legacy path where RenderWidget does the scheduling. | 119 // Called by the legacy path where RenderWidget does the scheduling. |
| 119 void CompositeImmediately(base::TimeTicks frame_begin_time); | 120 void CompositeImmediately(base::TimeTicks frame_begin_time); |
| 120 | 121 |
| 121 protected: | 122 protected: |
| 122 SingleThreadProxy( | 123 SingleThreadProxy(LayerTreeHost* layer_tree_host, |
| 123 LayerTreeHost* layer_tree_host, | 124 LayerTreeHostSingleThreadClient* client, |
| 124 LayerTreeHostSingleThreadClient* client, | 125 TaskRunnerProvider* task_runner_provider, |
| 125 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 126 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
| 126 scoped_ptr<BeginFrameSource> external_begin_frame_source); | |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); | 129 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); |
| 130 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); | 130 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); |
| 131 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); | 131 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); |
| 132 void DoCommit(); | 132 void DoCommit(); |
| 133 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); | 133 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); |
| 134 void DoSwap(); | 134 void DoSwap(); |
| 135 void DidCommitAndDrawFrame(); | 135 void DidCommitAndDrawFrame(); |
| 136 void CommitComplete(); | 136 void CommitComplete(); |
| 137 | 137 |
| 138 bool ShouldComposite() const; | 138 bool ShouldComposite() const; |
| 139 void ScheduleRequestNewOutputSurface(); | 139 void ScheduleRequestNewOutputSurface(); |
| 140 | 140 |
| 141 // Accessed on main thread only. | 141 // Accessed on main thread only. |
| 142 LayerTreeHost* layer_tree_host_; | 142 LayerTreeHost* layer_tree_host_; |
| 143 LayerTreeHostSingleThreadClient* client_; | 143 LayerTreeHostSingleThreadClient* client_; |
| 144 | 144 |
| 145 TaskRunnerProvider* task_runner_provider_; |
| 146 |
| 145 // Used on the Thread, but checked on main thread during | 147 // Used on the Thread, but checked on main thread during |
| 146 // initialization/shutdown. | 148 // initialization/shutdown. |
| 147 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 149 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| 148 RendererCapabilities renderer_capabilities_for_main_thread_; | 150 RendererCapabilities renderer_capabilities_for_main_thread_; |
| 149 | 151 |
| 150 // Accessed from both threads. | 152 // Accessed from both threads. |
| 151 scoped_ptr<BeginFrameSource> external_begin_frame_source_; | 153 scoped_ptr<BeginFrameSource> external_begin_frame_source_; |
| 152 scoped_ptr<Scheduler> scheduler_on_impl_thread_; | 154 scoped_ptr<Scheduler> scheduler_on_impl_thread_; |
| 153 | 155 |
| 154 scoped_ptr<BlockingTaskRunner::CapturePostTasks> commit_blocking_task_runner_; | 156 scoped_ptr<BlockingTaskRunner::CapturePostTasks> commit_blocking_task_runner_; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 private: | 238 private: |
| 237 DebugScopedSetImplThread impl_thread_; | 239 DebugScopedSetImplThread impl_thread_; |
| 238 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 240 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
| 239 | 241 |
| 240 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 242 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
| 241 }; | 243 }; |
| 242 | 244 |
| 243 } // namespace cc | 245 } // namespace cc |
| 244 | 246 |
| 245 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 247 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
| OLD | NEW |