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/time/time.h" | 10 #include "base/time/time.h" |
11 #include "cc/animation/animation_events.h" | 11 #include "cc/animation/animation_events.h" |
12 #include "cc/output/begin_frame_args.h" | 12 #include "cc/output/begin_frame_args.h" |
13 #include "cc/scheduler/scheduler.h" | 13 #include "cc/scheduler/scheduler.h" |
14 #include "cc/trees/layer_tree_host_impl.h" | 14 #include "cc/trees/layer_tree_host_impl.h" |
15 #include "cc/trees/proxy.h" | 15 #include "cc/trees/proxy.h" |
16 #include "cc/trees/proxy_timing_history.h" | 16 #include "cc/trees/proxy_timing_history.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
| 20 class BeginFrameManager; |
20 class ContextProvider; | 21 class ContextProvider; |
21 class LayerTreeHost; | 22 class LayerTreeHost; |
22 class LayerTreeHostSingleThreadClient; | 23 class LayerTreeHostSingleThreadClient; |
23 | 24 |
24 class CC_EXPORT SingleThreadProxy : public Proxy, | 25 class CC_EXPORT SingleThreadProxy : public Proxy, |
25 NON_EXPORTED_BASE(LayerTreeHostImplClient), | 26 NON_EXPORTED_BASE(LayerTreeHostImplClient), |
26 SchedulerClient { | 27 SchedulerClient { |
27 public: | 28 public: |
28 static scoped_ptr<Proxy> Create( | 29 static scoped_ptr<Proxy> Create( |
29 LayerTreeHost* layer_tree_host, | 30 LayerTreeHost* layer_tree_host, |
30 LayerTreeHostSingleThreadClient* client, | 31 LayerTreeHostSingleThreadClient* client, |
31 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 32 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 33 BeginFrameManager* begin_frame_manager); |
32 virtual ~SingleThreadProxy(); | 34 virtual ~SingleThreadProxy(); |
33 | 35 |
34 // Proxy implementation | 36 // Proxy implementation |
35 virtual void FinishAllRendering() OVERRIDE; | 37 virtual void FinishAllRendering() OVERRIDE; |
36 virtual bool IsStarted() const OVERRIDE; | 38 virtual bool IsStarted() const OVERRIDE; |
37 virtual void SetLayerTreeHostClientReady() OVERRIDE; | 39 virtual void SetLayerTreeHostClientReady() OVERRIDE; |
38 virtual void SetVisible(bool visible) OVERRIDE; | 40 virtual void SetVisible(bool visible) OVERRIDE; |
39 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; | 41 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; |
40 virtual void SetNeedsAnimate() OVERRIDE; | 42 virtual void SetNeedsAnimate() OVERRIDE; |
41 virtual void SetNeedsUpdateLayers() OVERRIDE; | 43 virtual void SetNeedsUpdateLayers() OVERRIDE; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted with the result. | 112 // LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted with the result. |
111 void CreateAndInitializeOutputSurface(); | 113 void CreateAndInitializeOutputSurface(); |
112 | 114 |
113 // Called by the legacy path where RenderWidget does the scheduling. | 115 // Called by the legacy path where RenderWidget does the scheduling. |
114 void CompositeImmediately(base::TimeTicks frame_begin_time); | 116 void CompositeImmediately(base::TimeTicks frame_begin_time); |
115 | 117 |
116 private: | 118 private: |
117 SingleThreadProxy( | 119 SingleThreadProxy( |
118 LayerTreeHost* layer_tree_host, | 120 LayerTreeHost* layer_tree_host, |
119 LayerTreeHostSingleThreadClient* client, | 121 LayerTreeHostSingleThreadClient* client, |
120 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 122 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 123 BeginFrameManager* begin_frame_manager); |
121 | 124 |
122 void BeginMainFrame(); | 125 void BeginMainFrame(); |
123 void DoCommit(base::TimeTicks frame_begin_time); | 126 void DoCommit(base::TimeTicks frame_begin_time); |
124 DrawResult DoComposite(base::TimeTicks frame_begin_time, | 127 DrawResult DoComposite(base::TimeTicks frame_begin_time, |
125 LayerTreeHostImpl::FrameData* frame); | 128 LayerTreeHostImpl::FrameData* frame); |
126 void DoSwap(); | 129 void DoSwap(); |
127 void DidCommitAndDrawFrame(); | 130 void DidCommitAndDrawFrame(); |
128 | 131 |
129 bool ShouldComposite() const; | 132 bool ShouldComposite() const; |
130 void UpdateBackgroundAnimateTicking(); | 133 void UpdateBackgroundAnimateTicking(); |
(...skipping 11 matching lines...) Expand all Loading... |
142 scoped_ptr<Scheduler> scheduler_on_impl_thread_; | 145 scoped_ptr<Scheduler> scheduler_on_impl_thread_; |
143 ProxyTimingHistory timing_history_; | 146 ProxyTimingHistory timing_history_; |
144 | 147 |
145 bool next_frame_is_newly_committed_frame_; | 148 bool next_frame_is_newly_committed_frame_; |
146 | 149 |
147 bool inside_draw_; | 150 bool inside_draw_; |
148 bool defer_commits_; | 151 bool defer_commits_; |
149 bool commit_was_deferred_; | 152 bool commit_was_deferred_; |
150 bool commit_requested_; | 153 bool commit_requested_; |
151 | 154 |
| 155 // Not owned. |
| 156 BeginFrameManager* begin_frame_manager_; |
| 157 |
152 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; | 158 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; |
153 | 159 |
154 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); | 160 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); |
155 }; | 161 }; |
156 | 162 |
157 // For use in the single-threaded case. In debug builds, it pretends that the | 163 // For use in the single-threaded case. In debug builds, it pretends that the |
158 // code is running on the impl thread to satisfy assertion checks. | 164 // code is running on the impl thread to satisfy assertion checks. |
159 class DebugScopedSetImplThread { | 165 class DebugScopedSetImplThread { |
160 public: | 166 public: |
161 explicit DebugScopedSetImplThread(Proxy* proxy) : proxy_(proxy) { | 167 explicit DebugScopedSetImplThread(Proxy* proxy) : proxy_(proxy) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 private: | 217 private: |
212 DebugScopedSetImplThread impl_thread_; | 218 DebugScopedSetImplThread impl_thread_; |
213 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 219 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
214 | 220 |
215 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 221 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
216 }; | 222 }; |
217 | 223 |
218 } // namespace cc | 224 } // namespace cc |
219 | 225 |
220 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 226 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
OLD | NEW |