Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: cc/trees/thread_proxy.h

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: Fixed all existing tests! New tests pending... Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 virtual bool CommitPendingForTesting() OVERRIDE; 63 virtual bool CommitPendingForTesting() OVERRIDE;
64 virtual std::string SchedulerStateAsStringForTesting() OVERRIDE; 64 virtual std::string SchedulerStateAsStringForTesting() OVERRIDE;
65 65
66 // LayerTreeHostImplClient implementation 66 // LayerTreeHostImplClient implementation
67 virtual void DidTryInitializeRendererOnImplThread( 67 virtual void DidTryInitializeRendererOnImplThread(
68 bool success, 68 bool success,
69 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; 69 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE;
70 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; 70 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE;
71 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; 71 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE;
72 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) OVERRIDE; 72 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) OVERRIDE;
73 virtual void DidBeginFrameDeadlineOnImplThread() OVERRIDE;
73 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; 74 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE;
74 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE; 75 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE;
75 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; 76 virtual void SetNeedsRedrawOnImplThread() OVERRIDE;
76 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; 77 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE;
77 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; 78 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE;
78 virtual void SetNeedsCommitOnImplThread() OVERRIDE; 79 virtual void SetNeedsCommitOnImplThread() OVERRIDE;
79 virtual void PostAnimationEventsToMainThreadOnImplThread( 80 virtual void PostAnimationEventsToMainThreadOnImplThread(
80 scoped_ptr<AnimationEventsVector> queue, 81 scoped_ptr<AnimationEventsVector> queue,
81 base::Time wall_clock_time) OVERRIDE; 82 base::Time wall_clock_time) OVERRIDE;
82 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, 83 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes,
83 int priority_cutoff) 84 int priority_cutoff)
84 OVERRIDE; 85 OVERRIDE;
85 virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE; 86 virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE;
86 virtual void SendManagedMemoryStats() OVERRIDE; 87 virtual void SendManagedMemoryStats() OVERRIDE;
87 virtual bool IsInsideDraw() OVERRIDE; 88 virtual bool IsInsideDraw() OVERRIDE;
88 virtual void RenewTreePriority() OVERRIDE; 89 virtual void RenewTreePriority() OVERRIDE;
89 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) 90 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay)
90 OVERRIDE; 91 OVERRIDE;
91 virtual void DidActivatePendingTree() OVERRIDE; 92 virtual void DidActivatePendingTree() OVERRIDE;
92 93
93 // SchedulerClient implementation 94 // SchedulerClient implementation
94 virtual void SetNeedsBeginFrameOnImplThread(bool enable) OVERRIDE; 95 virtual void SetNeedsBeginFrameOnImplThread(bool enable) OVERRIDE;
95 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE; 96 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE;
96 virtual ScheduledActionDrawAndSwapResult 97 virtual DrawSwapReadbackResult
97 ScheduledActionDrawAndSwapIfPossible() OVERRIDE; 98 ScheduledActionDrawAndSwapIfPossible() OVERRIDE;
98 virtual ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapForced() 99 virtual DrawSwapReadbackResult
99 OVERRIDE; 100 ScheduledActionDrawAndSwapForced() OVERRIDE;
101 virtual DrawSwapReadbackResult
102 ScheduledActionDrawAndReadback() OVERRIDE;
100 virtual void ScheduledActionCommit() OVERRIDE; 103 virtual void ScheduledActionCommit() OVERRIDE;
101 virtual void ScheduledActionCheckForCompletedTileUploads() OVERRIDE; 104 virtual void ScheduledActionCheckForCompletedTileUploads() OVERRIDE;
102 virtual void ScheduledActionActivatePendingTreeIfNeeded() OVERRIDE; 105 virtual void ScheduledActionActivatePendingTreeIfNeeded() OVERRIDE;
103 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE; 106 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE;
104 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; 107 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE;
105 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; 108 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE;
106 virtual base::TimeDelta DrawDurationEstimate() OVERRIDE; 109 virtual base::TimeDelta DrawDurationEstimate() OVERRIDE;
107 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() OVERRIDE; 110 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() OVERRIDE;
108 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE; 111 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE;
112 virtual void PostBeginFrameDeadline(const base::Closure& closure,
113 base::TimeTicks deadline) OVERRIDE;
109 114
110 // ResourceUpdateControllerClient implementation 115 // ResourceUpdateControllerClient implementation
111 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE; 116 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE;
112 117
113 private: 118 private:
114 ThreadProxy(LayerTreeHost* layer_tree_host, 119 ThreadProxy(LayerTreeHost* layer_tree_host,
115 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 120 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
116 121
117 struct BeginFrameAndCommitState { 122 struct BeginFrameAndCommitState {
118 BeginFrameAndCommitState(); 123 BeginFrameAndCommitState();
(...skipping 15 matching lines...) Expand all
134 // |capabilities| is set only when |success| is true. 139 // |capabilities| is set only when |success| is true.
135 void OnOutputSurfaceInitializeAttempted( 140 void OnOutputSurfaceInitializeAttempted(
136 bool success, 141 bool success,
137 const RendererCapabilities& capabilities); 142 const RendererCapabilities& capabilities);
138 143
139 // Called on impl thread. 144 // Called on impl thread.
140 struct ReadbackRequest; 145 struct ReadbackRequest;
141 struct CommitPendingRequest; 146 struct CommitPendingRequest;
142 struct SchedulerStateRequest; 147 struct SchedulerStateRequest;
143 148
144 void ForceCommitOnImplThread(CompletionEvent* completion); 149 void ForceCommitForReadbackOnImplThread(
150 CompletionEvent* completion,
151 ReadbackRequest *request);
145 void StartCommitOnImplThread( 152 void StartCommitOnImplThread(
146 CompletionEvent* completion, 153 CompletionEvent* completion,
147 ResourceUpdateQueue* queue, 154 ResourceUpdateQueue* queue,
148 scoped_refptr<cc::ContextProvider> offscreen_context_provider); 155 scoped_refptr<cc::ContextProvider> offscreen_context_provider);
149 void BeginFrameAbortedByMainThreadOnImplThread(); 156 void BeginFrameAbortedByMainThreadOnImplThread();
150 void RequestReadbackOnImplThread(ReadbackRequest* request);
151 void FinishAllRenderingOnImplThread(CompletionEvent* completion); 157 void FinishAllRenderingOnImplThread(CompletionEvent* completion);
152 void InitializeImplOnImplThread(CompletionEvent* completion); 158 void InitializeImplOnImplThread(CompletionEvent* completion);
153 void SetLayerTreeHostClientReadyOnImplThread(); 159 void SetLayerTreeHostClientReadyOnImplThread();
154 void SetVisibleOnImplThread(CompletionEvent* completion, bool visible); 160 void SetVisibleOnImplThread(CompletionEvent* completion, bool visible);
155 void HasInitializedOutputSurfaceOnImplThread( 161 void HasInitializedOutputSurfaceOnImplThread(
156 CompletionEvent* completion, 162 CompletionEvent* completion,
157 bool* has_initialized_output_surface); 163 bool* has_initialized_output_surface);
158 void InitializeOutputSurfaceOnImplThread( 164 void InitializeOutputSurfaceOnImplThread(
159 CompletionEvent* completion, 165 CompletionEvent* completion,
160 scoped_ptr<OutputSurface> output_surface, 166 scoped_ptr<OutputSurface> output_surface,
161 scoped_refptr<ContextProvider> offscreen_context_provider, 167 scoped_refptr<ContextProvider> offscreen_context_provider,
162 bool* success, 168 bool* success,
163 RendererCapabilities* capabilities); 169 RendererCapabilities* capabilities);
164 void FinishGLOnImplThread(CompletionEvent* completion); 170 void FinishGLOnImplThread(CompletionEvent* completion);
165 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); 171 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion);
166 void AcquireLayerTexturesForMainThreadOnImplThread( 172 void AcquireLayerTexturesForMainThreadOnImplThread(
167 CompletionEvent* completion); 173 CompletionEvent* completion);
168 ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapInternal( 174 DrawSwapReadbackResult ScheduledActionDrawSwapReadbackInternal(
169 bool forced_draw); 175 bool forced_draw, bool swap_requested, bool readback_requested);
170 void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion); 176 void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion);
171 void CheckOutputSurfaceStatusOnImplThread(); 177 void CheckOutputSurfaceStatusOnImplThread();
172 void CommitPendingOnImplThreadForTesting(CommitPendingRequest* request); 178 void CommitPendingOnImplThreadForTesting(CommitPendingRequest* request);
173 void SchedulerStateAsStringOnImplThreadForTesting( 179 void SchedulerStateAsStringOnImplThreadForTesting(
174 SchedulerStateRequest* request); 180 SchedulerStateRequest* request);
175 void AsValueOnImplThread(CompletionEvent* completion, 181 void AsValueOnImplThread(CompletionEvent* completion,
176 base::DictionaryValue* state) const; 182 base::DictionaryValue* state) const;
177 void RenewTreePriorityOnImplThread(); 183 void RenewTreePriorityOnImplThread();
178 void DidSwapUseIncompleteTileOnImplThread(); 184 void DidSwapUseIncompleteTileOnImplThread();
179 void StartScrollbarAnimationOnImplThread(); 185 void StartScrollbarAnimationOnImplThread();
(...skipping 23 matching lines...) Expand all
203 scoped_ptr<OutputSurface> first_output_surface_; 209 scoped_ptr<OutputSurface> first_output_surface_;
204 210
205 base::WeakPtrFactory<ThreadProxy> weak_factory_on_impl_thread_; 211 base::WeakPtrFactory<ThreadProxy> weak_factory_on_impl_thread_;
206 212
207 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; 213 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_;
208 base::WeakPtrFactory<ThreadProxy> weak_factory_; 214 base::WeakPtrFactory<ThreadProxy> weak_factory_;
209 215
210 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; 216 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_;
211 217
212 scoped_ptr<Scheduler> scheduler_on_impl_thread_; 218 scoped_ptr<Scheduler> scheduler_on_impl_thread_;
219 bool frame_did_draw_;
213 220
214 // Set when the main thread is waiting on a 221 // Set when the main thread is waiting on a
215 // ScheduledActionSendBeginFrameToMainThread to be issued. 222 // ScheduledActionSendBeginFrameToMainThread to be issued.
216 CompletionEvent* 223 CompletionEvent*
217 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_; 224 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_;
218 225
226 // Set when there is a pending tree on a commit.
227 base::Closure deferred_start_commit_on_impl_thread_;
228
219 // Set when the main thread is waiting on a readback. 229 // Set when the main thread is waiting on a readback.
220 ReadbackRequest* readback_request_on_impl_thread_; 230 ReadbackRequest* readback_request_on_impl_thread_;
221 231
222 // Set when the main thread is waiting on a commit to complete. 232 // Set when the main thread is waiting on a commit to complete.
223 CompletionEvent* commit_completion_event_on_impl_thread_; 233 CompletionEvent* commit_completion_event_on_impl_thread_;
224 234
225 // Set when the main thread is waiting on a pending tree activation. 235 // Set when the main thread is waiting on a pending tree activation.
226 CompletionEvent* completion_event_for_commit_held_on_tree_activation_; 236 CompletionEvent* completion_event_for_commit_held_on_tree_activation_;
227 237
228 // Set when the main thread is waiting on layers to be drawn. 238 // Set when the main thread is waiting on layers to be drawn.
(...skipping 27 matching lines...) Expand all
256 // activation_duration_history_. 266 // activation_duration_history_.
257 base::TimeTicks begin_frame_sent_to_main_thread_time_; 267 base::TimeTicks begin_frame_sent_to_main_thread_time_;
258 base::TimeTicks commit_complete_time_; 268 base::TimeTicks commit_complete_time_;
259 269
260 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); 270 DISALLOW_COPY_AND_ASSIGN(ThreadProxy);
261 }; 271 };
262 272
263 } // namespace cc 273 } // namespace cc
264 274
265 #endif // CC_TREES_THREAD_PROXY_H_ 275 #endif // CC_TREES_THREAD_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698