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

Side by Side Diff: cc/trees/single_thread_proxy.cc

Issue 19106007: cc: Allow the main thread to cancel commits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add more comments Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "cc/trees/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/output/context_provider.h" 9 #include "cc/output/context_provider.h"
10 #include "cc/output/output_surface.h" 10 #include "cc/output/output_surface.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 DCHECK(Proxy::IsMainThread()); 164 DCHECK(Proxy::IsMainThread());
165 DCHECK(!layer_tree_host_->output_surface_lost()); 165 DCHECK(!layer_tree_host_->output_surface_lost());
166 return renderer_capabilities_for_main_thread_; 166 return renderer_capabilities_for_main_thread_;
167 } 167 }
168 168
169 void SingleThreadProxy::SetNeedsAnimate() { 169 void SingleThreadProxy::SetNeedsAnimate() {
170 // Thread-only feature. 170 // Thread-only feature.
171 NOTREACHED(); 171 NOTREACHED();
172 } 172 }
173 173
174 void SingleThreadProxy::SetNeedsUpdateLayers() {
175 DCHECK(Proxy::IsMainThread());
176 layer_tree_host_->ScheduleComposite();
177 }
178
174 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { 179 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
175 DCHECK(Proxy::IsMainThread()); 180 DCHECK(Proxy::IsMainThread());
176 // Commit immediately. 181 // Commit immediately.
177 { 182 {
178 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); 183 DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
179 DebugScopedSetImplThread impl(this); 184 DebugScopedSetImplThread impl(this);
180 185
181 RenderingStatsInstrumentation* stats_instrumentation = 186 RenderingStatsInstrumentation* stats_instrumentation =
182 layer_tree_host_->rendering_stats_instrumentation(); 187 layer_tree_host_->rendering_stats_instrumentation();
183 base::TimeTicks start_time = stats_instrumentation->StartRecording(); 188 base::TimeTicks start_time = stats_instrumentation->StartRecording();
(...skipping 12 matching lines...) Expand all
196 Proxy::MainThreadTaskRunner(), 201 Proxy::MainThreadTaskRunner(),
197 queue.Pass(), 202 queue.Pass(),
198 layer_tree_host_impl_->resource_provider()); 203 layer_tree_host_impl_->resource_provider());
199 update_controller->Finalize(); 204 update_controller->Finalize();
200 205
201 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); 206 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get());
202 207
203 layer_tree_host_impl_->CommitComplete(); 208 layer_tree_host_impl_->CommitComplete();
204 209
205 #ifndef NDEBUG 210 #ifndef NDEBUG
206 // In the single-threaded case, the scroll deltas should never be 211 // In the single-threaded case, the scale and scroll deltas should never be
207 // touched on the impl layer tree. 212 // touched on the impl layer tree.
208 scoped_ptr<ScrollAndScaleSet> scroll_info = 213 scoped_ptr<ScrollAndScaleSet> scroll_info =
209 layer_tree_host_impl_->ProcessScrollDeltas(); 214 layer_tree_host_impl_->ProcessScrollDeltas();
210 DCHECK(!scroll_info->scrolls.size()); 215 DCHECK(!scroll_info->scrolls.size());
216 DCHECK_EQ(1.f, scroll_info->page_scale_delta);
211 #endif 217 #endif
212 218
213 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); 219 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
214 stats_instrumentation->AddCommit(duration); 220 stats_instrumentation->AddCommit(duration);
215 } 221 }
216 layer_tree_host_->CommitComplete(); 222 layer_tree_host_->CommitComplete();
217 next_frame_is_newly_committed_frame_ = true; 223 next_frame_is_newly_committed_frame_ = true;
218 } 224 }
219 225
220 void SingleThreadProxy::SetNeedsCommit() { 226 void SingleThreadProxy::SetNeedsCommit() {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 void SingleThreadProxy::DidSwapFrame() { 486 void SingleThreadProxy::DidSwapFrame() {
481 if (next_frame_is_newly_committed_frame_) { 487 if (next_frame_is_newly_committed_frame_) {
482 next_frame_is_newly_committed_frame_ = false; 488 next_frame_is_newly_committed_frame_ = false;
483 layer_tree_host_->DidCommitAndDrawFrame(); 489 layer_tree_host_->DidCommitAndDrawFrame();
484 } 490 }
485 } 491 }
486 492
487 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 493 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
488 494
489 } // namespace cc 495 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698