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 #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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/debug/benchmark_instrumentation.h" | 10 #include "cc/debug/benchmark_instrumentation.h" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 layer_tree_host_impl_->ActivateSyncTree(); | 607 layer_tree_host_impl_->ActivateSyncTree(); |
608 DCHECK(!layer_tree_host_impl_->active_tree() | 608 DCHECK(!layer_tree_host_impl_->active_tree() |
609 ->needs_update_draw_properties()); | 609 ->needs_update_draw_properties()); |
610 layer_tree_host_impl_->PrepareTiles(); | 610 layer_tree_host_impl_->PrepareTiles(); |
611 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); | 611 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
612 } | 612 } |
613 | 613 |
614 DoAnimate(); | 614 DoAnimate(); |
615 | 615 |
616 LayerTreeHostImpl::FrameData frame; | 616 LayerTreeHostImpl::FrameData frame; |
617 DoComposite(frame_begin_time, &frame); | 617 DoComposite(&frame); |
618 | 618 |
619 // DoComposite could abort, but because this is a synchronous composite | 619 // DoComposite could abort, but because this is a synchronous composite |
620 // another draw will never be scheduled, so break remaining promises. | 620 // another draw will never be scheduled, so break remaining promises. |
621 layer_tree_host_impl_->active_tree()->BreakSwapPromises( | 621 layer_tree_host_impl_->active_tree()->BreakSwapPromises( |
622 SwapPromise::SWAP_FAILS); | 622 SwapPromise::SWAP_FAILS); |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 void SingleThreadProxy::ForceSerializeOnSwapBuffers() { | 626 void SingleThreadProxy::ForceSerializeOnSwapBuffers() { |
627 { | 627 { |
(...skipping 19 matching lines...) Expand all Loading... |
647 if (output_surface_creation_callback_.IsCancelled() && | 647 if (output_surface_creation_callback_.IsCancelled() && |
648 !output_surface_creation_requested_) { | 648 !output_surface_creation_requested_) { |
649 output_surface_creation_callback_.Reset( | 649 output_surface_creation_callback_.Reset( |
650 base::Bind(&SingleThreadProxy::RequestNewOutputSurface, | 650 base::Bind(&SingleThreadProxy::RequestNewOutputSurface, |
651 weak_factory_.GetWeakPtr())); | 651 weak_factory_.GetWeakPtr())); |
652 MainThreadTaskRunner()->PostTask( | 652 MainThreadTaskRunner()->PostTask( |
653 FROM_HERE, output_surface_creation_callback_.callback()); | 653 FROM_HERE, output_surface_creation_callback_.callback()); |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 DrawResult SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time, | 657 DrawResult SingleThreadProxy::DoComposite(LayerTreeHostImpl::FrameData* frame) { |
658 LayerTreeHostImpl::FrameData* frame) { | |
659 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); | 658 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); |
660 DCHECK(!layer_tree_host_->output_surface_lost()); | 659 DCHECK(!layer_tree_host_->output_surface_lost()); |
661 | 660 |
662 DrawResult draw_result; | 661 DrawResult draw_result; |
663 bool draw_frame; | 662 bool draw_frame; |
664 { | 663 { |
665 DebugScopedSetImplThread impl(this); | 664 DebugScopedSetImplThread impl(this); |
666 base::AutoReset<bool> mark_inside(&inside_draw_, true); | 665 base::AutoReset<bool> mark_inside(&inside_draw_, true); |
667 | 666 |
668 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 667 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
(...skipping 18 matching lines...) Expand all Loading... |
687 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 686 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
688 "461509 SingleThreadProxy::DoComposite2")); | 687 "461509 SingleThreadProxy::DoComposite2")); |
689 draw_result = layer_tree_host_impl_->PrepareToDraw(frame); | 688 draw_result = layer_tree_host_impl_->PrepareToDraw(frame); |
690 draw_frame = draw_result == DRAW_SUCCESS; | 689 draw_frame = draw_result == DRAW_SUCCESS; |
691 if (draw_frame) { | 690 if (draw_frame) { |
692 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 691 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
693 // is fixed. | 692 // is fixed. |
694 tracked_objects::ScopedTracker tracking_profile3( | 693 tracked_objects::ScopedTracker tracking_profile3( |
695 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 694 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
696 "461509 SingleThreadProxy::DoComposite3")); | 695 "461509 SingleThreadProxy::DoComposite3")); |
697 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); | 696 layer_tree_host_impl_->DrawLayers(frame); |
698 } | 697 } |
699 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 698 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
700 // is fixed. | 699 // is fixed. |
701 tracked_objects::ScopedTracker tracking_profile4( | 700 tracked_objects::ScopedTracker tracking_profile4( |
702 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 701 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
703 "461509 SingleThreadProxy::DoComposite4")); | 702 "461509 SingleThreadProxy::DoComposite4")); |
704 layer_tree_host_impl_->DidDrawAllLayers(*frame); | 703 layer_tree_host_impl_->DidDrawAllLayers(*frame); |
705 | 704 |
706 bool start_ready_animations = draw_frame; | 705 bool start_ready_animations = draw_frame; |
707 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 706 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 DCHECK(scheduler_on_impl_thread_->CommitPending()); | 873 DCHECK(scheduler_on_impl_thread_->CommitPending()); |
875 DCHECK(!layer_tree_host_impl_->pending_tree()); | 874 DCHECK(!layer_tree_host_impl_->pending_tree()); |
876 | 875 |
877 layer_tree_host_impl_->BeginMainFrameAborted(reason); | 876 layer_tree_host_impl_->BeginMainFrameAborted(reason); |
878 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); | 877 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
879 } | 878 } |
880 | 879 |
881 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { | 880 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { |
882 DebugScopedSetImplThread impl(this); | 881 DebugScopedSetImplThread impl(this); |
883 LayerTreeHostImpl::FrameData frame; | 882 LayerTreeHostImpl::FrameData frame; |
884 return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time, | 883 return DoComposite(&frame); |
885 &frame); | |
886 } | 884 } |
887 | 885 |
888 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { | 886 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { |
889 NOTREACHED(); | 887 NOTREACHED(); |
890 return INVALID_RESULT; | 888 return INVALID_RESULT; |
891 } | 889 } |
892 | 890 |
893 void SingleThreadProxy::ScheduledActionCommit() { | 891 void SingleThreadProxy::ScheduledActionCommit() { |
894 DebugScopedSetMainThread main(this); | 892 DebugScopedSetMainThread main(this); |
895 DoCommit(); | 893 DoCommit(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 | 946 |
949 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 947 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
950 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 948 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
951 } | 949 } |
952 | 950 |
953 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 951 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
954 layer_tree_host_->SendBeginFramesToChildren(args); | 952 layer_tree_host_->SendBeginFramesToChildren(args); |
955 } | 953 } |
956 | 954 |
957 } // namespace cc | 955 } // namespace cc |
OLD | NEW |