| 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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 if (compositor_frame_sink_lost_) { | 443 if (compositor_frame_sink_lost_) { |
| 444 RequestNewCompositorFrameSink(); | 444 RequestNewCompositorFrameSink(); |
| 445 // RequestNewCompositorFrameSink could have synchronously created an output | 445 // RequestNewCompositorFrameSink could have synchronously created an output |
| 446 // surface, so check again before returning. | 446 // surface, so check again before returning. |
| 447 if (compositor_frame_sink_lost_) | 447 if (compositor_frame_sink_lost_) |
| 448 return; | 448 return; |
| 449 } | 449 } |
| 450 | 450 |
| 451 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( | 451 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( |
| 452 BEGINFRAME_FROM_HERE, 0, 1, frame_begin_time, base::TimeTicks(), | 452 BEGINFRAME_FROM_HERE, BeginFrameArgs::kManualSourceId, 1, |
| 453 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL)); | 453 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval(), |
| 454 BeginFrameArgs::NORMAL)); |
| 454 | 455 |
| 455 // Start the impl frame. | 456 // Start the impl frame. |
| 456 { | 457 { |
| 457 DebugScopedSetImplThread impl(task_runner_provider_); | 458 DebugScopedSetImplThread impl(task_runner_provider_); |
| 458 WillBeginImplFrame(begin_frame_args); | 459 WillBeginImplFrame(begin_frame_args); |
| 459 } | 460 } |
| 460 | 461 |
| 461 // Run the "main thread" and get it to commit. | 462 // Run the "main thread" and get it to commit. |
| 462 { | 463 { |
| 463 #if DCHECK_IS_ON() | 464 #if DCHECK_IS_ON() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 478 layer_tree_host_impl_->ActivateSyncTree(); | 479 layer_tree_host_impl_->ActivateSyncTree(); |
| 479 DCHECK( | 480 DCHECK( |
| 480 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); | 481 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); |
| 481 layer_tree_host_impl_->PrepareTiles(); | 482 layer_tree_host_impl_->PrepareTiles(); |
| 482 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); | 483 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
| 483 | 484 |
| 484 // TODO(danakj): Don't do this last... we prepared the wrong things. D: | 485 // TODO(danakj): Don't do this last... we prepared the wrong things. D: |
| 485 layer_tree_host_impl_->Animate(); | 486 layer_tree_host_impl_->Animate(); |
| 486 | 487 |
| 487 LayerTreeHostImpl::FrameData frame; | 488 LayerTreeHostImpl::FrameData frame; |
| 489 frame.begin_frame_ack = BeginFrameAck( |
| 490 begin_frame_args.source_id, begin_frame_args.sequence_number, |
| 491 begin_frame_args.sequence_number, 0, true); |
| 488 DoComposite(&frame); | 492 DoComposite(&frame); |
| 489 | 493 |
| 490 // DoComposite could abort, but because this is a synchronous composite | 494 // DoComposite could abort, but because this is a synchronous composite |
| 491 // another draw will never be scheduled, so break remaining promises. | 495 // another draw will never be scheduled, so break remaining promises. |
| 492 layer_tree_host_impl_->active_tree()->BreakSwapPromises( | 496 layer_tree_host_impl_->active_tree()->BreakSwapPromises( |
| 493 SwapPromise::SWAP_FAILS); | 497 SwapPromise::SWAP_FAILS); |
| 494 | 498 |
| 495 DidFinishImplFrame(); | 499 DidFinishImplFrame(); |
| 496 } | 500 } |
| 497 } | 501 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 | 689 |
| 686 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; | 690 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; |
| 687 layer_tree_host_impl_->BeginMainFrameAborted(reason, | 691 layer_tree_host_impl_->BeginMainFrameAborted(reason, |
| 688 std::move(empty_swap_promises)); | 692 std::move(empty_swap_promises)); |
| 689 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); | 693 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
| 690 } | 694 } |
| 691 | 695 |
| 692 DrawResult SingleThreadProxy::ScheduledActionDrawIfPossible() { | 696 DrawResult SingleThreadProxy::ScheduledActionDrawIfPossible() { |
| 693 DebugScopedSetImplThread impl(task_runner_provider_); | 697 DebugScopedSetImplThread impl(task_runner_provider_); |
| 694 LayerTreeHostImpl::FrameData frame; | 698 LayerTreeHostImpl::FrameData frame; |
| 699 frame.begin_frame_ack = |
| 700 scheduler_on_impl_thread_->CurrentBeginFrameAckForActiveTree(); |
| 695 return DoComposite(&frame); | 701 return DoComposite(&frame); |
| 696 } | 702 } |
| 697 | 703 |
| 698 DrawResult SingleThreadProxy::ScheduledActionDrawForced() { | 704 DrawResult SingleThreadProxy::ScheduledActionDrawForced() { |
| 699 NOTREACHED(); | 705 NOTREACHED(); |
| 700 return INVALID_RESULT; | 706 return INVALID_RESULT; |
| 701 } | 707 } |
| 702 | 708 |
| 703 void SingleThreadProxy::ScheduledActionCommit() { | 709 void SingleThreadProxy::ScheduledActionCommit() { |
| 704 DebugScopedSetMainThread main(task_runner_provider_); | 710 DebugScopedSetMainThread main(task_runner_provider_); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 void SingleThreadProxy::DidFinishImplFrame() { | 766 void SingleThreadProxy::DidFinishImplFrame() { |
| 761 layer_tree_host_impl_->DidFinishImplFrame(); | 767 layer_tree_host_impl_->DidFinishImplFrame(); |
| 762 #if DCHECK_IS_ON() | 768 #if DCHECK_IS_ON() |
| 763 DCHECK(inside_impl_frame_) | 769 DCHECK(inside_impl_frame_) |
| 764 << "DidFinishImplFrame called while not inside an impl frame!"; | 770 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 765 inside_impl_frame_ = false; | 771 inside_impl_frame_ = false; |
| 766 #endif | 772 #endif |
| 767 } | 773 } |
| 768 | 774 |
| 769 } // namespace cc | 775 } // namespace cc |
| OLD | NEW |