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

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

Issue 478703002: Remove cc::LayerTreeHostImpl::IsContextLost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ctx4
Patch Set: Include all changes. Prev patchset was second stage only Created 6 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
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/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { 308 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
309 DCHECK(IsImplThread()); 309 DCHECK(IsImplThread());
310 renderer_capabilities_for_main_thread_ = 310 renderer_capabilities_for_main_thread_ =
311 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); 311 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities();
312 } 312 }
313 313
314 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { 314 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
315 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); 315 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread");
316 // Cause a commit so we can notice the lost context. 316 // Cause a commit so we can notice the lost context.
317 SetNeedsCommitOnImplThread(); 317 SetNeedsCommitOnImplThread();
danakj 2014/08/15 17:45:15 Should this move to STP::DidLoseOutputSurface (ie
dneto 2014/08/15 18:17:17 Actually we might just remove this, since LTH::Did
danakj 2014/08/15 18:18:10 Oh good SGTM
318 client_->DidAbortSwapBuffers(); 318 client_->DidAbortSwapBuffers();
319 // Tell the LayerTreeHost, but not right away.
320 Proxy::MainThreadTaskRunner()->PostTask(
321 FROM_HERE,
322 base::Bind(&LayerTreeHost::DidLoseOutputSurface,
danakj 2014/08/15 17:45:15 Can you add a SingleThreadProxy::DidLoseOutputSurf
dneto 2014/08/15 17:58:20 Good point. Yes, I can do this.
323 base::Unretained(layer_tree_host_)));
319 } 324 }
320 325
321 void SingleThreadProxy::DidSwapBuffersOnImplThread() { 326 void SingleThreadProxy::DidSwapBuffersOnImplThread() {
322 client_->DidPostSwapBuffers(); 327 client_->DidPostSwapBuffers();
323 } 328 }
324 329
325 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { 330 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() {
326 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); 331 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread");
327 client_->DidCompleteSwapBuffers(); 332 client_->DidCompleteSwapBuffers();
328 } 333 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 // CanDraw() as well. 431 // CanDraw() as well.
427 if (!ShouldComposite()) { 432 if (!ShouldComposite()) {
428 UpdateBackgroundAnimateTicking(); 433 UpdateBackgroundAnimateTicking();
429 return false; 434 return false;
430 } 435 }
431 436
432 layer_tree_host_impl_->Animate( 437 layer_tree_host_impl_->Animate(
433 layer_tree_host_impl_->CurrentFrameTimeTicks()); 438 layer_tree_host_impl_->CurrentFrameTimeTicks());
434 UpdateBackgroundAnimateTicking(); 439 UpdateBackgroundAnimateTicking();
435 440
436 if (!layer_tree_host_impl_->IsContextLost()) { 441 DrawResult draw_result = layer_tree_host_impl_->PrepareToDraw(frame);
437 layer_tree_host_impl_->PrepareToDraw(frame); 442 if (draw_result == DRAW_ABORTED_CONTEXT_LOST) {
443 lost_output_surface = true;
444 } else {
438 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); 445 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
439 layer_tree_host_impl_->DidDrawAllLayers(*frame); 446 layer_tree_host_impl_->DidDrawAllLayers(*frame);
440 } 447 }
441 lost_output_surface = layer_tree_host_impl_->IsContextLost();
442 448
443 bool start_ready_animations = true; 449 bool start_ready_animations = true;
444 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); 450 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
445 451
446 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); 452 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame();
447 } 453 }
448 454
449 if (lost_output_surface) { 455 if (lost_output_surface) {
450 layer_tree_host_->DidLoseOutputSurface();
451 return false; 456 return false;
452 } 457 }
453 458
454 return true; 459 return true;
455 } 460 }
456 461
457 void SingleThreadProxy::DidSwapFrame() { 462 void SingleThreadProxy::DidSwapFrame() {
458 if (next_frame_is_newly_committed_frame_) { 463 if (next_frame_is_newly_committed_frame_) {
459 next_frame_is_newly_committed_frame_ = false; 464 next_frame_is_newly_committed_frame_ = false;
460 layer_tree_host_->DidCommitAndDrawFrame(); 465 layer_tree_host_->DidCommitAndDrawFrame();
461 } 466 }
462 } 467 }
463 468
464 bool SingleThreadProxy::MainFrameWillHappenForTesting() { 469 bool SingleThreadProxy::MainFrameWillHappenForTesting() {
465 return false; 470 return false;
466 } 471 }
467 472
468 } // namespace cc 473 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698