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 SetCompositorFrameSink( | 41 void SetCompositorFrameSink( |
42 CompositorFrameSink* compositor_frame_sink) override; | 42 CompositorFrameSink* compositor_frame_sink) override; |
43 void ReleaseCompositorFrameSink() override; | 43 void ReleaseCompositorFrameSink() override; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void DidPrepareTiles() override; | 100 void DidPrepareTiles() override; |
101 void DidCompletePageScaleAnimationOnImplThread() override; | 101 void DidCompletePageScaleAnimationOnImplThread() override; |
102 void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; | 102 void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; |
103 | 103 |
104 void RequestNewCompositorFrameSink(); | 104 void RequestNewCompositorFrameSink(); |
105 | 105 |
106 // Called by the legacy path where RenderWidget does the scheduling. | 106 // Called by the legacy path where RenderWidget does the scheduling. |
107 void CompositeImmediately(base::TimeTicks frame_begin_time); | 107 void CompositeImmediately(base::TimeTicks frame_begin_time); |
108 | 108 |
109 protected: | 109 protected: |
110 SingleThreadProxy(LayerTreeHost* layer_tree_host, | 110 SingleThreadProxy(LayerTreeHostInProcess* layer_tree_host, |
111 LayerTreeHostSingleThreadClient* client, | 111 LayerTreeHostSingleThreadClient* client, |
112 TaskRunnerProvider* task_runner_provider); | 112 TaskRunnerProvider* task_runner_provider); |
113 | 113 |
114 private: | 114 private: |
115 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); | 115 void BeginMainFrame(const BeginFrameArgs& begin_frame_args); |
116 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); | 116 void BeginMainFrameAbortedOnImplThread(CommitEarlyOutReason reason); |
117 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); | 117 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); |
118 void DoCommit(); | 118 void DoCommit(); |
119 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); | 119 DrawResult DoComposite(LayerTreeHostImpl::FrameData* frame); |
120 void DoSwap(); | 120 void DoSwap(); |
121 void DidCommitAndDrawFrame(); | 121 void DidCommitAndDrawFrame(); |
122 void CommitComplete(); | 122 void CommitComplete(); |
123 | 123 |
124 bool ShouldComposite() const; | 124 bool ShouldComposite() const; |
125 void ScheduleRequestNewCompositorFrameSink(); | 125 void ScheduleRequestNewCompositorFrameSink(); |
126 | 126 |
127 // Accessed on main thread only. | 127 // Accessed on main thread only. |
128 LayerTreeHost* layer_tree_host_; | 128 LayerTreeHostInProcess* layer_tree_host_; |
129 LayerTreeHostSingleThreadClient* client_; | 129 LayerTreeHostSingleThreadClient* client_; |
130 | 130 |
131 TaskRunnerProvider* task_runner_provider_; | 131 TaskRunnerProvider* task_runner_provider_; |
132 | 132 |
133 // Used on the Thread, but checked on main thread during | 133 // Used on the Thread, but checked on main thread during |
134 // initialization/shutdown. | 134 // initialization/shutdown. |
135 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 135 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
136 | 136 |
137 // Accessed from both threads. | 137 // Accessed from both threads. |
138 std::unique_ptr<BeginFrameSource> external_begin_frame_source_; | 138 std::unique_ptr<BeginFrameSource> external_begin_frame_source_; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 private: | 237 private: |
238 DebugScopedSetImplThread impl_thread_; | 238 DebugScopedSetImplThread impl_thread_; |
239 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 239 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
240 | 240 |
241 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 241 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
242 }; | 242 }; |
243 | 243 |
244 } // namespace cc | 244 } // namespace cc |
245 | 245 |
246 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 246 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
OLD | NEW |