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_THREAD_PROXY_H_ | 5 #ifndef CC_TREES_THREAD_PROXY_H_ |
6 #define CC_TREES_THREAD_PROXY_H_ | 6 #define CC_TREES_THREAD_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 virtual bool CommitPendingForTesting() OVERRIDE; | 65 virtual bool CommitPendingForTesting() OVERRIDE; |
66 virtual std::string SchedulerStateAsStringForTesting() OVERRIDE; | 66 virtual std::string SchedulerStateAsStringForTesting() OVERRIDE; |
67 | 67 |
68 // LayerTreeHostImplClient implementation | 68 // LayerTreeHostImplClient implementation |
69 virtual void DidTryInitializeRendererOnImplThread( | 69 virtual void DidTryInitializeRendererOnImplThread( |
70 bool success, | 70 bool success, |
71 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; | 71 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; |
72 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; | 72 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; |
73 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; | 73 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; |
74 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) OVERRIDE; | 74 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) OVERRIDE; |
| 75 virtual void DidBeginFrameDeadlineOnImplThread() OVERRIDE; |
75 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; | 76 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; |
| 77 virtual void NotifyReadyToActivate() OVERRIDE; |
76 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE; | 78 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE; |
77 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; | 79 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; |
78 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; | 80 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; |
79 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; | 81 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; |
80 virtual void SetNeedsCommitOnImplThread() OVERRIDE; | 82 virtual void SetNeedsCommitOnImplThread() OVERRIDE; |
81 virtual void PostAnimationEventsToMainThreadOnImplThread( | 83 virtual void PostAnimationEventsToMainThreadOnImplThread( |
82 scoped_ptr<AnimationEventsVector> queue, | 84 scoped_ptr<AnimationEventsVector> queue, |
83 base::Time wall_clock_time) OVERRIDE; | 85 base::Time wall_clock_time) OVERRIDE; |
84 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, | 86 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, |
85 int priority_cutoff) | 87 int priority_cutoff) |
86 OVERRIDE; | 88 OVERRIDE; |
87 virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE; | 89 virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE; |
88 virtual void SendManagedMemoryStats() OVERRIDE; | 90 virtual void SendManagedMemoryStats() OVERRIDE; |
89 virtual bool IsInsideDraw() OVERRIDE; | 91 virtual bool IsInsideDraw() OVERRIDE; |
90 virtual void RenewTreePriority() OVERRIDE; | 92 virtual void RenewTreePriority() OVERRIDE; |
91 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) | 93 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) |
92 OVERRIDE; | 94 OVERRIDE; |
93 virtual void DidActivatePendingTree() OVERRIDE; | 95 virtual void DidActivatePendingTree() OVERRIDE; |
94 | 96 |
95 // SchedulerClient implementation | 97 // SchedulerClient implementation |
96 virtual void SetNeedsBeginFrameOnImplThread(bool enable) OVERRIDE; | 98 virtual void SetNeedsBeginFrameOnImplThread(bool enable) OVERRIDE; |
97 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE; | 99 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE; |
98 virtual ScheduledActionDrawAndSwapResult | 100 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() |
99 ScheduledActionDrawAndSwapIfPossible() OVERRIDE; | |
100 virtual ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapForced() | |
101 OVERRIDE; | 101 OVERRIDE; |
| 102 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() OVERRIDE; |
| 103 virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() OVERRIDE; |
102 virtual void ScheduledActionCommit() OVERRIDE; | 104 virtual void ScheduledActionCommit() OVERRIDE; |
103 virtual void ScheduledActionUpdateVisibleTiles() OVERRIDE; | 105 virtual void ScheduledActionUpdateVisibleTiles() OVERRIDE; |
104 virtual void ScheduledActionActivatePendingTreeIfNeeded() OVERRIDE; | 106 virtual void ScheduledActionActivatePendingTree() OVERRIDE; |
105 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE; | 107 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE; |
106 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; | 108 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
107 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; | 109 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; |
108 virtual base::TimeDelta DrawDurationEstimate() OVERRIDE; | 110 virtual base::TimeDelta DrawDurationEstimate() OVERRIDE; |
109 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() OVERRIDE; | 111 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() OVERRIDE; |
110 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE; | 112 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE; |
| 113 virtual void PostBeginFrameDeadline(const base::Closure& closure, |
| 114 base::TimeTicks deadline) OVERRIDE; |
111 | 115 |
112 // ResourceUpdateControllerClient implementation | 116 // ResourceUpdateControllerClient implementation |
113 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE; | 117 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE; |
114 | 118 |
115 private: | 119 private: |
116 ThreadProxy(LayerTreeHost* layer_tree_host, | 120 ThreadProxy(LayerTreeHost* layer_tree_host, |
117 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 121 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
118 | 122 |
119 struct BeginFrameAndCommitState { | 123 struct BeginFrameAndCommitState { |
120 BeginFrameAndCommitState(); | 124 BeginFrameAndCommitState(); |
(...skipping 16 matching lines...) Expand all Loading... |
137 void OnOutputSurfaceInitializeAttempted( | 141 void OnOutputSurfaceInitializeAttempted( |
138 bool success, | 142 bool success, |
139 const RendererCapabilities& capabilities); | 143 const RendererCapabilities& capabilities); |
140 void SendCommitRequestToImplThreadIfNeeded(); | 144 void SendCommitRequestToImplThreadIfNeeded(); |
141 | 145 |
142 // Called on impl thread. | 146 // Called on impl thread. |
143 struct ReadbackRequest; | 147 struct ReadbackRequest; |
144 struct CommitPendingRequest; | 148 struct CommitPendingRequest; |
145 struct SchedulerStateRequest; | 149 struct SchedulerStateRequest; |
146 | 150 |
147 void ForceCommitOnImplThread(CompletionEvent* completion); | 151 void ForceCommitForReadbackOnImplThread(CompletionEvent* completion, |
| 152 ReadbackRequest* request); |
148 void StartCommitOnImplThread( | 153 void StartCommitOnImplThread( |
149 CompletionEvent* completion, | 154 CompletionEvent* completion, |
150 ResourceUpdateQueue* queue, | 155 ResourceUpdateQueue* queue, |
151 scoped_refptr<cc::ContextProvider> offscreen_context_provider); | 156 scoped_refptr<cc::ContextProvider> offscreen_context_provider); |
152 void BeginFrameAbortedByMainThreadOnImplThread(bool did_handle); | 157 void BeginFrameAbortedByMainThreadOnImplThread(bool did_handle); |
153 void RequestReadbackOnImplThread(ReadbackRequest* request); | |
154 void FinishAllRenderingOnImplThread(CompletionEvent* completion); | 158 void FinishAllRenderingOnImplThread(CompletionEvent* completion); |
155 void InitializeImplOnImplThread(CompletionEvent* completion); | 159 void InitializeImplOnImplThread(CompletionEvent* completion); |
156 void SetLayerTreeHostClientReadyOnImplThread(); | 160 void SetLayerTreeHostClientReadyOnImplThread(); |
157 void SetVisibleOnImplThread(CompletionEvent* completion, bool visible); | 161 void SetVisibleOnImplThread(CompletionEvent* completion, bool visible); |
158 void HasInitializedOutputSurfaceOnImplThread( | 162 void HasInitializedOutputSurfaceOnImplThread( |
159 CompletionEvent* completion, | 163 CompletionEvent* completion, |
160 bool* has_initialized_output_surface); | 164 bool* has_initialized_output_surface); |
161 void InitializeOutputSurfaceOnImplThread( | 165 void InitializeOutputSurfaceOnImplThread( |
162 CompletionEvent* completion, | 166 CompletionEvent* completion, |
163 scoped_ptr<OutputSurface> output_surface, | 167 scoped_ptr<OutputSurface> output_surface, |
164 scoped_refptr<ContextProvider> offscreen_context_provider, | 168 scoped_refptr<ContextProvider> offscreen_context_provider, |
165 bool* success, | 169 bool* success, |
166 RendererCapabilities* capabilities); | 170 RendererCapabilities* capabilities); |
167 void FinishGLOnImplThread(CompletionEvent* completion); | 171 void FinishGLOnImplThread(CompletionEvent* completion); |
168 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); | 172 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); |
169 void AcquireLayerTexturesForMainThreadOnImplThread( | 173 void AcquireLayerTexturesForMainThreadOnImplThread( |
170 CompletionEvent* completion); | 174 CompletionEvent* completion); |
171 ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapInternal( | 175 DrawSwapReadbackResult ScheduledActionDrawSwapReadbackInternal( |
172 bool forced_draw); | 176 bool forced_draw, |
| 177 bool swap_requested, |
| 178 bool readback_requested); |
173 void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion); | 179 void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion); |
174 void CheckOutputSurfaceStatusOnImplThread(); | 180 void CheckOutputSurfaceStatusOnImplThread(); |
175 void CommitPendingOnImplThreadForTesting(CommitPendingRequest* request); | 181 void CommitPendingOnImplThreadForTesting(CommitPendingRequest* request); |
176 void SchedulerStateAsStringOnImplThreadForTesting( | 182 void SchedulerStateAsStringOnImplThreadForTesting( |
177 SchedulerStateRequest* request); | 183 SchedulerStateRequest* request); |
178 void AsValueOnImplThread(CompletionEvent* completion, | 184 void AsValueOnImplThread(CompletionEvent* completion, |
179 base::DictionaryValue* state) const; | 185 base::DictionaryValue* state) const; |
180 void RenewTreePriorityOnImplThread(); | 186 void RenewTreePriorityOnImplThread(); |
181 void DidSwapUseIncompleteTileOnImplThread(); | 187 void DidSwapUseIncompleteTileOnImplThread(); |
182 void StartScrollbarAnimationOnImplThread(); | 188 void StartScrollbarAnimationOnImplThread(); |
(...skipping 24 matching lines...) Expand all Loading... |
207 scoped_ptr<OutputSurface> first_output_surface_; | 213 scoped_ptr<OutputSurface> first_output_surface_; |
208 | 214 |
209 base::WeakPtrFactory<ThreadProxy> weak_factory_on_impl_thread_; | 215 base::WeakPtrFactory<ThreadProxy> weak_factory_on_impl_thread_; |
210 | 216 |
211 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; | 217 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; |
212 base::WeakPtrFactory<ThreadProxy> weak_factory_; | 218 base::WeakPtrFactory<ThreadProxy> weak_factory_; |
213 | 219 |
214 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 220 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
215 | 221 |
216 scoped_ptr<Scheduler> scheduler_on_impl_thread_; | 222 scoped_ptr<Scheduler> scheduler_on_impl_thread_; |
| 223 bool frame_did_draw_; |
217 | 224 |
218 // Set when the main thread is waiting on a | 225 // Set when the main thread is waiting on a |
219 // ScheduledActionSendBeginFrameToMainThread to be issued. | 226 // ScheduledActionSendBeginFrameToMainThread to be issued. |
220 CompletionEvent* | 227 CompletionEvent* |
221 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_; | 228 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_; |
222 | 229 |
223 // Set when the main thread is waiting on a readback. | 230 // Set when the main thread is waiting on a readback. |
224 ReadbackRequest* readback_request_on_impl_thread_; | 231 ReadbackRequest* readback_request_on_impl_thread_; |
225 | 232 |
226 // Set when the main thread is waiting on a commit to complete. | 233 // Set when the main thread is waiting on a commit to complete. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // activation_duration_history_. | 270 // activation_duration_history_. |
264 base::TimeTicks begin_frame_sent_to_main_thread_time_; | 271 base::TimeTicks begin_frame_sent_to_main_thread_time_; |
265 base::TimeTicks commit_complete_time_; | 272 base::TimeTicks commit_complete_time_; |
266 | 273 |
267 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); | 274 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); |
268 }; | 275 }; |
269 | 276 |
270 } // namespace cc | 277 } // namespace cc |
271 | 278 |
272 #endif // CC_TREES_THREAD_PROXY_H_ | 279 #endif // CC_TREES_THREAD_PROXY_H_ |
OLD | NEW |