| 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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 layer_tree_host_impl_->ActivateSyncTree(); | 625 layer_tree_host_impl_->ActivateSyncTree(); |
| 626 DCHECK(!layer_tree_host_impl_->active_tree() | 626 DCHECK(!layer_tree_host_impl_->active_tree() |
| 627 ->needs_update_draw_properties()); | 627 ->needs_update_draw_properties()); |
| 628 layer_tree_host_impl_->PrepareTiles(); | 628 layer_tree_host_impl_->PrepareTiles(); |
| 629 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); | 629 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
| 630 } | 630 } |
| 631 | 631 |
| 632 DoAnimate(); | 632 DoAnimate(); |
| 633 | 633 |
| 634 LayerTreeHostImpl::FrameData frame; | 634 LayerTreeHostImpl::FrameData frame; |
| 635 DoComposite(frame_begin_time, &frame); | 635 DoComposite(&frame); |
| 636 | 636 |
| 637 // DoComposite could abort, but because this is a synchronous composite | 637 // DoComposite could abort, but because this is a synchronous composite |
| 638 // another draw will never be scheduled, so break remaining promises. | 638 // another draw will never be scheduled, so break remaining promises. |
| 639 layer_tree_host_impl_->active_tree()->BreakSwapPromises( | 639 layer_tree_host_impl_->active_tree()->BreakSwapPromises( |
| 640 SwapPromise::SWAP_FAILS); | 640 SwapPromise::SWAP_FAILS); |
| 641 | 641 |
| 642 DidBeginImplFrameDeadline(); | 642 DidBeginImplFrameDeadline(); |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 | 645 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 667 if (output_surface_creation_callback_.IsCancelled() && | 667 if (output_surface_creation_callback_.IsCancelled() && |
| 668 !output_surface_creation_requested_) { | 668 !output_surface_creation_requested_) { |
| 669 output_surface_creation_callback_.Reset( | 669 output_surface_creation_callback_.Reset( |
| 670 base::Bind(&SingleThreadProxy::RequestNewOutputSurface, | 670 base::Bind(&SingleThreadProxy::RequestNewOutputSurface, |
| 671 weak_factory_.GetWeakPtr())); | 671 weak_factory_.GetWeakPtr())); |
| 672 MainThreadTaskRunner()->PostTask( | 672 MainThreadTaskRunner()->PostTask( |
| 673 FROM_HERE, output_surface_creation_callback_.callback()); | 673 FROM_HERE, output_surface_creation_callback_.callback()); |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 | 676 |
| 677 DrawResult SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time, | 677 DrawResult SingleThreadProxy::DoComposite(LayerTreeHostImpl::FrameData* frame) { |
| 678 LayerTreeHostImpl::FrameData* frame) { | |
| 679 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); | 678 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); |
| 680 DCHECK(!layer_tree_host_->output_surface_lost()); | 679 DCHECK(!layer_tree_host_->output_surface_lost()); |
| 681 | 680 |
| 682 DrawResult draw_result; | 681 DrawResult draw_result; |
| 683 bool draw_frame; | 682 bool draw_frame; |
| 684 { | 683 { |
| 685 DebugScopedSetImplThread impl(this); | 684 DebugScopedSetImplThread impl(this); |
| 686 base::AutoReset<bool> mark_inside(&inside_draw_, true); | 685 base::AutoReset<bool> mark_inside(&inside_draw_, true); |
| 687 | 686 |
| 688 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 687 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 707 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 706 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 708 "461509 SingleThreadProxy::DoComposite2")); | 707 "461509 SingleThreadProxy::DoComposite2")); |
| 709 draw_result = layer_tree_host_impl_->PrepareToDraw(frame); | 708 draw_result = layer_tree_host_impl_->PrepareToDraw(frame); |
| 710 draw_frame = draw_result == DRAW_SUCCESS; | 709 draw_frame = draw_result == DRAW_SUCCESS; |
| 711 if (draw_frame) { | 710 if (draw_frame) { |
| 712 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 711 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
| 713 // is fixed. | 712 // is fixed. |
| 714 tracked_objects::ScopedTracker tracking_profile3( | 713 tracked_objects::ScopedTracker tracking_profile3( |
| 715 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 714 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 716 "461509 SingleThreadProxy::DoComposite3")); | 715 "461509 SingleThreadProxy::DoComposite3")); |
| 717 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); | 716 layer_tree_host_impl_->DrawLayers(frame); |
| 718 } | 717 } |
| 719 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 718 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
| 720 // is fixed. | 719 // is fixed. |
| 721 tracked_objects::ScopedTracker tracking_profile4( | 720 tracked_objects::ScopedTracker tracking_profile4( |
| 722 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 721 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 723 "461509 SingleThreadProxy::DoComposite4")); | 722 "461509 SingleThreadProxy::DoComposite4")); |
| 724 layer_tree_host_impl_->DidDrawAllLayers(*frame); | 723 layer_tree_host_impl_->DidDrawAllLayers(*frame); |
| 725 | 724 |
| 726 bool start_ready_animations = draw_frame; | 725 bool start_ready_animations = draw_frame; |
| 727 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 726 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 DCHECK(scheduler_on_impl_thread_->CommitPending()); | 907 DCHECK(scheduler_on_impl_thread_->CommitPending()); |
| 909 DCHECK(!layer_tree_host_impl_->pending_tree()); | 908 DCHECK(!layer_tree_host_impl_->pending_tree()); |
| 910 | 909 |
| 911 layer_tree_host_impl_->BeginMainFrameAborted(reason); | 910 layer_tree_host_impl_->BeginMainFrameAborted(reason); |
| 912 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); | 911 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
| 913 } | 912 } |
| 914 | 913 |
| 915 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { | 914 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { |
| 916 DebugScopedSetImplThread impl(this); | 915 DebugScopedSetImplThread impl(this); |
| 917 LayerTreeHostImpl::FrameData frame; | 916 LayerTreeHostImpl::FrameData frame; |
| 918 return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time, | 917 return DoComposite(&frame); |
| 919 &frame); | |
| 920 } | 918 } |
| 921 | 919 |
| 922 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { | 920 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { |
| 923 NOTREACHED(); | 921 NOTREACHED(); |
| 924 return INVALID_RESULT; | 922 return INVALID_RESULT; |
| 925 } | 923 } |
| 926 | 924 |
| 927 void SingleThreadProxy::ScheduledActionCommit() { | 925 void SingleThreadProxy::ScheduledActionCommit() { |
| 928 DebugScopedSetMainThread main(this); | 926 DebugScopedSetMainThread main(this); |
| 929 DoCommit(); | 927 DoCommit(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 DCHECK(inside_impl_frame_) | 983 DCHECK(inside_impl_frame_) |
| 986 << "DidBeginImplFrameDeadline called while not inside an impl frame!"; | 984 << "DidBeginImplFrameDeadline called while not inside an impl frame!"; |
| 987 inside_impl_frame_ = false; | 985 inside_impl_frame_ = false; |
| 988 } | 986 } |
| 989 | 987 |
| 990 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 988 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 991 layer_tree_host_->SendBeginFramesToChildren(args); | 989 layer_tree_host_->SendBeginFramesToChildren(args); |
| 992 } | 990 } |
| 993 | 991 |
| 994 } // namespace cc | 992 } // namespace cc |
| OLD | NEW |