| 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 AnimationEvents; | 22 class AnimationEvents; |
| 23 class BeginFrameSource; | 23 class BeginFrameSource; |
| 24 class ContextProvider; | 24 class ContextProvider; |
| 25 class LayerTreeHost; | 25 class LayerTreeHostInProcess; |
| 26 class LayerTreeHostSingleThreadClient; | 26 class LayerTreeHostSingleThreadClient; |
| 27 | 27 |
| 28 class CC_EXPORT SingleThreadProxy : public Proxy, | 28 class CC_EXPORT SingleThreadProxy : public Proxy, |
| 29 NON_EXPORTED_BASE(LayerTreeHostImplClient), | 29 NON_EXPORTED_BASE(LayerTreeHostImplClient), |
| 30 SchedulerClient { | 30 SchedulerClient { |
| 31 public: | 31 public: |
| 32 static std::unique_ptr<Proxy> Create( | 32 static std::unique_ptr<Proxy> Create( |
| 33 LayerTreeHost* layer_tree_host, | 33 LayerTreeHostInProcess* layer_tree_host, |
| 34 LayerTreeHostSingleThreadClient* client, | 34 LayerTreeHostSingleThreadClient* client, |
| 35 TaskRunnerProvider* task_runner_provider_); | 35 TaskRunnerProvider* task_runner_provider_); |
| 36 ~SingleThreadProxy() override; | 36 ~SingleThreadProxy() override; |
| 37 | 37 |
| 38 // Proxy implementation | 38 // Proxy implementation |
| 39 bool IsStarted() const override; | 39 bool IsStarted() const override; |
| 40 bool CommitToActiveTree() const override; | 40 bool CommitToActiveTree() const override; |
| 41 void SetOutputSurface(OutputSurface* output_surface) override; | 41 void SetOutputSurface(OutputSurface* output_surface) override; |
| 42 void ReleaseOutputSurface() override; | 42 void ReleaseOutputSurface() override; |
| 43 void SetVisible(bool visible) override; | 43 void SetVisible(bool visible) override; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void DidPrepareTiles() override; | 99 void DidPrepareTiles() override; |
| 100 void DidCompletePageScaleAnimationOnImplThread() override; | 100 void DidCompletePageScaleAnimationOnImplThread() override; |
| 101 void OnDrawForOutputSurface(bool resourceless_software_draw) override; | 101 void OnDrawForOutputSurface(bool resourceless_software_draw) override; |
| 102 | 102 |
| 103 void RequestNewOutputSurface(); | 103 void RequestNewOutputSurface(); |
| 104 | 104 |
| 105 // Called by the legacy path where RenderWidget does the scheduling. | 105 // Called by the legacy path where RenderWidget does the scheduling. |
| 106 void CompositeImmediately(base::TimeTicks frame_begin_time); | 106 void CompositeImmediately(base::TimeTicks frame_begin_time); |
| 107 | 107 |
| 108 protected: | 108 protected: |
| 109 SingleThreadProxy(LayerTreeHost* layer_tree_host, | 109 SingleThreadProxy(LayerTreeHostInProcess* layer_tree_host, |
| 110 LayerTreeHostSingleThreadClient* client, | 110 LayerTreeHostSingleThreadClient* client, |
| 111 TaskRunnerProvider* task_runner_provider); | 111 TaskRunnerProvider* task_runner_provider); |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); | 114 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); |
| 115 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); | 115 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); |
| 116 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); | 116 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); |
| 117 void DoCommit(); | 117 void DoCommit(); |
| 118 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); | 118 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); |
| 119 void DoSwap(); | 119 void DoSwap(); |
| 120 void DidCommitAndDrawFrame(); | 120 void DidCommitAndDrawFrame(); |
| 121 void CommitComplete(); | 121 void CommitComplete(); |
| 122 | 122 |
| 123 bool ShouldComposite() const; | 123 bool ShouldComposite() const; |
| 124 void ScheduleRequestNewOutputSurface(); | 124 void ScheduleRequestNewOutputSurface(); |
| 125 | 125 |
| 126 // Accessed on main thread only. | 126 // Accessed on main thread only. |
| 127 LayerTreeHost* layer_tree_host_; | 127 LayerTreeHostInProcess* layer_tree_host_; |
| 128 LayerTreeHostSingleThreadClient* client_; | 128 LayerTreeHostSingleThreadClient* client_; |
| 129 | 129 |
| 130 TaskRunnerProvider* task_runner_provider_; | 130 TaskRunnerProvider* task_runner_provider_; |
| 131 | 131 |
| 132 // Used on the Thread, but checked on main thread during | 132 // Used on the Thread, but checked on main thread during |
| 133 // initialization/shutdown. | 133 // initialization/shutdown. |
| 134 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 134 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| 135 | 135 |
| 136 // Accessed from both threads. | 136 // Accessed from both threads. |
| 137 std::unique_ptr<BeginFrameSource> external_begin_frame_source_; | 137 std::unique_ptr<BeginFrameSource> external_begin_frame_source_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 private: | 236 private: |
| 237 DebugScopedSetImplThread impl_thread_; | 237 DebugScopedSetImplThread impl_thread_; |
| 238 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 238 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
| 239 | 239 |
| 240 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 240 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 } // namespace cc | 243 } // namespace cc |
| 244 | 244 |
| 245 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 245 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
| OLD | NEW |