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/blocking_task_runner.h" |
14 #include "cc/trees/layer_tree_host_impl.h" | 15 #include "cc/trees/layer_tree_host_impl.h" |
15 #include "cc/trees/proxy.h" | 16 #include "cc/trees/proxy.h" |
16 #include "cc/trees/proxy_timing_history.h" | 17 #include "cc/trees/proxy_timing_history.h" |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 | 20 |
20 class ContextProvider; | 21 class ContextProvider; |
21 class LayerTreeHost; | 22 class LayerTreeHost; |
22 class LayerTreeHostSingleThreadClient; | 23 class LayerTreeHostSingleThreadClient; |
23 | 24 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 virtual void PostAnimationEventsToMainThreadOnImplThread( | 96 virtual void PostAnimationEventsToMainThreadOnImplThread( |
96 scoped_ptr<AnimationEventsVector> events) OVERRIDE; | 97 scoped_ptr<AnimationEventsVector> events) OVERRIDE; |
97 virtual bool ReduceContentsTextureMemoryOnImplThread( | 98 virtual bool ReduceContentsTextureMemoryOnImplThread( |
98 size_t limit_bytes, | 99 size_t limit_bytes, |
99 int priority_cutoff) OVERRIDE; | 100 int priority_cutoff) OVERRIDE; |
100 virtual bool IsInsideDraw() OVERRIDE; | 101 virtual bool IsInsideDraw() OVERRIDE; |
101 virtual void RenewTreePriority() OVERRIDE {} | 102 virtual void RenewTreePriority() OVERRIDE {} |
102 virtual void PostDelayedScrollbarFadeOnImplThread( | 103 virtual void PostDelayedScrollbarFadeOnImplThread( |
103 const base::Closure& start_fade, | 104 const base::Closure& start_fade, |
104 base::TimeDelta delay) OVERRIDE {} | 105 base::TimeDelta delay) OVERRIDE {} |
105 virtual void DidActivateSyncTree() OVERRIDE {} | 106 virtual void DidActivateSyncTree() OVERRIDE; |
106 virtual void DidManageTiles() OVERRIDE; | 107 virtual void DidManageTiles() OVERRIDE; |
107 virtual void SetDebugState(const LayerTreeDebugState& debug_state) OVERRIDE {} | 108 virtual void SetDebugState(const LayerTreeDebugState& debug_state) OVERRIDE {} |
108 | 109 |
109 void RequestNewOutputSurface(); | 110 void RequestNewOutputSurface(); |
110 | 111 |
111 // Called by the legacy path where RenderWidget does the scheduling. | 112 // Called by the legacy path where RenderWidget does the scheduling. |
112 void CompositeImmediately(base::TimeTicks frame_begin_time); | 113 void CompositeImmediately(base::TimeTicks frame_begin_time); |
113 | 114 |
114 private: | 115 private: |
115 SingleThreadProxy( | 116 SingleThreadProxy( |
116 LayerTreeHost* layer_tree_host, | 117 LayerTreeHost* layer_tree_host, |
117 LayerTreeHostSingleThreadClient* client, | 118 LayerTreeHostSingleThreadClient* client, |
118 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 119 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
119 | 120 |
120 void BeginMainFrame(); | 121 void BeginMainFrame(); |
121 void BeginMainFrameAbortedOnImplThread(); | 122 void BeginMainFrameAbortedOnImplThread(); |
122 void DoCommit(const BeginFrameArgs& begin_frame_args); | 123 void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); |
| 124 void DoCommit(); |
123 DrawResult DoComposite(base::TimeTicks frame_begin_time, | 125 DrawResult DoComposite(base::TimeTicks frame_begin_time, |
124 LayerTreeHostImpl::FrameData* frame); | 126 LayerTreeHostImpl::FrameData* frame); |
125 void DoSwap(); | 127 void DoSwap(); |
126 void DidCommitAndDrawFrame(); | 128 void DidCommitAndDrawFrame(); |
| 129 void CommitComplete(); |
127 | 130 |
128 bool ShouldComposite() const; | 131 bool ShouldComposite() const; |
129 void UpdateBackgroundAnimateTicking(); | 132 void UpdateBackgroundAnimateTicking(); |
130 | 133 |
131 // Accessed on main thread only. | 134 // Accessed on main thread only. |
132 LayerTreeHost* layer_tree_host_; | 135 LayerTreeHost* layer_tree_host_; |
133 LayerTreeHostSingleThreadClient* client_; | 136 LayerTreeHostSingleThreadClient* client_; |
134 | 137 |
135 // Used on the Thread, but checked on main thread during | 138 // Used on the Thread, but checked on main thread during |
136 // initialization/shutdown. | 139 // initialization/shutdown. |
137 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 140 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
138 RendererCapabilities renderer_capabilities_for_main_thread_; | 141 RendererCapabilities renderer_capabilities_for_main_thread_; |
139 | 142 |
140 // Accessed from both threads. | 143 // Accessed from both threads. |
141 scoped_ptr<Scheduler> scheduler_on_impl_thread_; | 144 scoped_ptr<Scheduler> scheduler_on_impl_thread_; |
142 ProxyTimingHistory timing_history_; | 145 ProxyTimingHistory timing_history_; |
143 | 146 |
| 147 scoped_ptr<BlockingTaskRunner::CapturePostTasks> commit_blocking_task_runner_; |
| 148 scoped_ptr<ResourceUpdateQueue> queue_for_commit_; |
144 bool next_frame_is_newly_committed_frame_; | 149 bool next_frame_is_newly_committed_frame_; |
145 | 150 |
146 bool inside_draw_; | 151 bool inside_draw_; |
147 bool defer_commits_; | 152 bool defer_commits_; |
148 bool commit_was_deferred_; | 153 bool commit_was_deferred_; |
149 bool commit_requested_; | 154 bool commit_requested_; |
150 | 155 |
151 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; | 156 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; |
152 | 157 |
153 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); | 158 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 private: | 215 private: |
211 DebugScopedSetImplThread impl_thread_; | 216 DebugScopedSetImplThread impl_thread_; |
212 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 217 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
213 | 218 |
214 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 219 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
215 }; | 220 }; |
216 | 221 |
217 } // namespace cc | 222 } // namespace cc |
218 | 223 |
219 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 224 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
OLD | NEW |