| 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/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
| 10 #include "cc/debug/devtools_instrumentation.h" | 10 #include "cc/debug/devtools_instrumentation.h" |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 if (layer_tree_host_impl_->settings().impl_side_painting) { | 537 if (layer_tree_host_impl_->settings().impl_side_painting) { |
| 538 layer_tree_host_impl_->ActivateSyncTree(); | 538 layer_tree_host_impl_->ActivateSyncTree(); |
| 539 DCHECK(!layer_tree_host_impl_->active_tree() | 539 DCHECK(!layer_tree_host_impl_->active_tree() |
| 540 ->needs_update_draw_properties()); | 540 ->needs_update_draw_properties()); |
| 541 layer_tree_host_impl_->PrepareTiles(); | 541 layer_tree_host_impl_->PrepareTiles(); |
| 542 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); | 542 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
| 543 } | 543 } |
| 544 | 544 |
| 545 DoAnimate(); | 545 DoAnimate(); |
| 546 | 546 |
| 547 LayerTreeHostImpl::FrameData frame; | 547 FrameData frame; |
| 548 DoComposite(frame_begin_time, &frame); | 548 DoComposite(frame_begin_time, &frame); |
| 549 | 549 |
| 550 // DoComposite could abort, but because this is a synchronous composite | 550 // DoComposite could abort, but because this is a synchronous composite |
| 551 // another draw will never be scheduled, so break remaining promises. | 551 // another draw will never be scheduled, so break remaining promises. |
| 552 layer_tree_host_impl_->active_tree()->BreakSwapPromises( | 552 layer_tree_host_impl_->active_tree()->BreakSwapPromises( |
| 553 SwapPromise::SWAP_FAILS); | 553 SwapPromise::SWAP_FAILS); |
| 554 } | 554 } |
| 555 } | 555 } |
| 556 | 556 |
| 557 void SingleThreadProxy::ForceSerializeOnSwapBuffers() { | 557 void SingleThreadProxy::ForceSerializeOnSwapBuffers() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 579 !output_surface_creation_requested_) { | 579 !output_surface_creation_requested_) { |
| 580 output_surface_creation_callback_.Reset( | 580 output_surface_creation_callback_.Reset( |
| 581 base::Bind(&SingleThreadProxy::RequestNewOutputSurface, | 581 base::Bind(&SingleThreadProxy::RequestNewOutputSurface, |
| 582 weak_factory_.GetWeakPtr())); | 582 weak_factory_.GetWeakPtr())); |
| 583 MainThreadTaskRunner()->PostTask( | 583 MainThreadTaskRunner()->PostTask( |
| 584 FROM_HERE, output_surface_creation_callback_.callback()); | 584 FROM_HERE, output_surface_creation_callback_.callback()); |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 | 587 |
| 588 DrawResult SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time, | 588 DrawResult SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time, |
| 589 LayerTreeHostImpl::FrameData* frame) { | 589 FrameData* frame) { |
| 590 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); | 590 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); |
| 591 DCHECK(!layer_tree_host_->output_surface_lost()); | 591 DCHECK(!layer_tree_host_->output_surface_lost()); |
| 592 | 592 |
| 593 DrawResult draw_result; | 593 DrawResult draw_result; |
| 594 bool draw_frame; | 594 bool draw_frame; |
| 595 { | 595 { |
| 596 DebugScopedSetImplThread impl(this); | 596 DebugScopedSetImplThread impl(this); |
| 597 base::AutoReset<bool> mark_inside(&inside_draw_, true); | 597 base::AutoReset<bool> mark_inside(&inside_draw_, true); |
| 598 | 598 |
| 599 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 599 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 DebugScopedSetImplThread impl(this); | 752 DebugScopedSetImplThread impl(this); |
| 753 DCHECK(scheduler_on_impl_thread_->CommitPending()); | 753 DCHECK(scheduler_on_impl_thread_->CommitPending()); |
| 754 DCHECK(!layer_tree_host_impl_->pending_tree()); | 754 DCHECK(!layer_tree_host_impl_->pending_tree()); |
| 755 | 755 |
| 756 layer_tree_host_impl_->BeginMainFrameAborted(reason); | 756 layer_tree_host_impl_->BeginMainFrameAborted(reason); |
| 757 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); | 757 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
| 758 } | 758 } |
| 759 | 759 |
| 760 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { | 760 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { |
| 761 DebugScopedSetImplThread impl(this); | 761 DebugScopedSetImplThread impl(this); |
| 762 LayerTreeHostImpl::FrameData frame; | 762 FrameData frame; |
| 763 return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time, | 763 return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time, |
| 764 &frame); | 764 &frame); |
| 765 } | 765 } |
| 766 | 766 |
| 767 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { | 767 DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { |
| 768 NOTREACHED(); | 768 NOTREACHED(); |
| 769 return INVALID_RESULT; | 769 return INVALID_RESULT; |
| 770 } | 770 } |
| 771 | 771 |
| 772 void SingleThreadProxy::ScheduledActionCommit() { | 772 void SingleThreadProxy::ScheduledActionCommit() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 823 |
| 824 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 824 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 825 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 825 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 826 } | 826 } |
| 827 | 827 |
| 828 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 828 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 829 layer_tree_host_->SendBeginFramesToChildren(args); | 829 layer_tree_host_->SendBeginFramesToChildren(args); |
| 830 } | 830 } |
| 831 | 831 |
| 832 } // namespace cc | 832 } // namespace cc |
| OLD | NEW |