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

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

Issue 505713004: Remove cc:LayerTreeHostImpl::IsContextLost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 UpdateBackgroundAnimateTicking(); 502 UpdateBackgroundAnimateTicking();
503 return DRAW_ABORTED_CANT_DRAW; 503 return DRAW_ABORTED_CANT_DRAW;
504 } 504 }
505 505
506 timing_history_.DidStartDrawing(); 506 timing_history_.DidStartDrawing();
507 507
508 layer_tree_host_impl_->Animate( 508 layer_tree_host_impl_->Animate(
509 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); 509 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
510 UpdateBackgroundAnimateTicking(); 510 UpdateBackgroundAnimateTicking();
511 511
512 if (!layer_tree_host_impl_->IsContextLost()) { 512 layer_tree_host_impl_->PrepareToDraw(frame);
513 layer_tree_host_impl_->PrepareToDraw(frame); 513 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
514 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); 514 layer_tree_host_impl_->DidDrawAllLayers(*frame);
515 layer_tree_host_impl_->DidDrawAllLayers(*frame);
516 }
517 515
518 bool start_ready_animations = true; 516 bool start_ready_animations = true;
519 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); 517 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
520 518
521 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 519 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
522 520
523 timing_history_.DidFinishDrawing(); 521 timing_history_.DidFinishDrawing();
524 } 522 }
525 523
526 { 524 {
527 DebugScopedSetImplThread impl(this); 525 DebugScopedSetImplThread impl(this);
528 526
529 if (layer_tree_host_impl_->IsContextLost()) { 527 // This CapturePostTasks should be destroyed before
530 DidLoseOutputSurfaceOnImplThread(); 528 // DidCommitAndDrawFrame() is called since that goes out to the
531 } else { 529 // embedder,
532 // This CapturePostTasks should be destroyed before 530 // and we want the embedder to receive its callbacks before that.
533 // DidCommitAndDrawFrame() is called since that goes out to the 531 // NOTE: This maintains consistent ordering with the ThreadProxy since
534 // embedder, 532 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread
535 // and we want the embedder to receive its callbacks before that. 533 // there as the main thread is not blocked, so any posted tasks inside
536 // NOTE: This maintains consistent ordering with the ThreadProxy since 534 // the swap buffers will execute first.
537 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread 535 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
538 // there as the main thread is not blocked, so any posted tasks inside
539 // the swap buffers will execute first.
540 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
541 536
542 BlockingTaskRunner::CapturePostTasks blocked; 537 BlockingTaskRunner::CapturePostTasks blocked;
543 layer_tree_host_impl_->SwapBuffers(*frame); 538 layer_tree_host_impl_->SwapBuffers(*frame);
544 }
545 } 539 }
546 DidCommitAndDrawFrame(); 540 DidCommitAndDrawFrame();
547 541
548 return DRAW_SUCCESS; 542 return DRAW_SUCCESS;
549 } 543 }
550 544
551 void SingleThreadProxy::DidCommitAndDrawFrame() { 545 void SingleThreadProxy::DidCommitAndDrawFrame() {
552 if (next_frame_is_newly_committed_frame_) { 546 if (next_frame_is_newly_committed_frame_) {
553 DebugScopedSetMainThread main(this); 547 DebugScopedSetMainThread main(this);
554 next_frame_is_newly_committed_frame_ = false; 548 next_frame_is_newly_committed_frame_ = false;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 615
622 // TODO(enne): SingleThreadProxy does not support cancelling commits yet so 616 // TODO(enne): SingleThreadProxy does not support cancelling commits yet so
623 // did_handle is always false. 617 // did_handle is always false.
624 bool did_handle = false; 618 bool did_handle = false;
625 layer_tree_host_impl_->BeginMainFrameAborted(did_handle); 619 layer_tree_host_impl_->BeginMainFrameAborted(did_handle);
626 scheduler_on_impl_thread_->BeginMainFrameAborted(did_handle); 620 scheduler_on_impl_thread_->BeginMainFrameAborted(did_handle);
627 } 621 }
628 622
629 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { 623 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
630 DebugScopedSetImplThread impl(this); 624 DebugScopedSetImplThread impl(this);
631 if (layer_tree_host_impl_->IsContextLost()) {
632 DidCommitAndDrawFrame();
633 return DRAW_SUCCESS;
634 }
635
636 LayerTreeHostImpl::FrameData frame; 625 LayerTreeHostImpl::FrameData frame;
637 return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time, 626 return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time,
638 &frame); 627 &frame);
639 } 628 }
640 629
641 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { 630 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() {
642 NOTREACHED(); 631 NOTREACHED();
643 return INVALID_RESULT; 632 return INVALID_RESULT;
644 } 633 }
645 634
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 686
698 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { 687 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() {
699 return timing_history_.CommitToActivateDurationEstimate(); 688 return timing_history_.CommitToActivateDurationEstimate();
700 } 689 }
701 690
702 void SingleThreadProxy::DidBeginImplFrameDeadline() { 691 void SingleThreadProxy::DidBeginImplFrameDeadline() {
703 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 692 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
704 } 693 }
705 694
706 } // namespace cc 695 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698