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