| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 440 |
| 441 if (compositor_frame_sink_lost_) { | 441 if (compositor_frame_sink_lost_) { |
| 442 RequestNewCompositorFrameSink(); | 442 RequestNewCompositorFrameSink(); |
| 443 // RequestNewCompositorFrameSink could have synchronously created an output | 443 // RequestNewCompositorFrameSink could have synchronously created an output |
| 444 // surface, so check again before returning. | 444 // surface, so check again before returning. |
| 445 if (compositor_frame_sink_lost_) | 445 if (compositor_frame_sink_lost_) |
| 446 return; | 446 return; |
| 447 } | 447 } |
| 448 | 448 |
| 449 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( | 449 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( |
| 450 BEGINFRAME_FROM_HERE, 0, 1, frame_begin_time, base::TimeTicks(), | 450 BEGINFRAME_FROM_HERE, BeginFrameArgs::kManualSourceId, 1, |
| 451 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL)); | 451 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval(), |
| 452 BeginFrameArgs::NORMAL)); |
| 452 | 453 |
| 453 // Start the impl frame. | 454 // Start the impl frame. |
| 454 { | 455 { |
| 455 DebugScopedSetImplThread impl(task_runner_provider_); | 456 DebugScopedSetImplThread impl(task_runner_provider_); |
| 456 WillBeginImplFrame(begin_frame_args); | 457 WillBeginImplFrame(begin_frame_args); |
| 457 } | 458 } |
| 458 | 459 |
| 459 // Run the "main thread" and get it to commit. | 460 // Run the "main thread" and get it to commit. |
| 460 { | 461 { |
| 461 #if DCHECK_IS_ON() | 462 #if DCHECK_IS_ON() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 476 layer_tree_host_impl_->ActivateSyncTree(); | 477 layer_tree_host_impl_->ActivateSyncTree(); |
| 477 DCHECK( | 478 DCHECK( |
| 478 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); | 479 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); |
| 479 layer_tree_host_impl_->PrepareTiles(); | 480 layer_tree_host_impl_->PrepareTiles(); |
| 480 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); | 481 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
| 481 | 482 |
| 482 // TODO(danakj): Don't do this last... we prepared the wrong things. D: | 483 // TODO(danakj): Don't do this last... we prepared the wrong things. D: |
| 483 layer_tree_host_impl_->Animate(); | 484 layer_tree_host_impl_->Animate(); |
| 484 | 485 |
| 485 LayerTreeHostImpl::FrameData frame; | 486 LayerTreeHostImpl::FrameData frame; |
| 487 frame.begin_frame_ack = BeginFrameAck( |
| 488 begin_frame_args.source_id, begin_frame_args.sequence_number, |
| 489 begin_frame_args.sequence_number, 0, true); |
| 486 DoComposite(&frame); | 490 DoComposite(&frame); |
| 487 | 491 |
| 488 // DoComposite could abort, but because this is a synchronous composite | 492 // DoComposite could abort, but because this is a synchronous composite |
| 489 // another draw will never be scheduled, so break remaining promises. | 493 // another draw will never be scheduled, so break remaining promises. |
| 490 layer_tree_host_impl_->active_tree()->BreakSwapPromises( | 494 layer_tree_host_impl_->active_tree()->BreakSwapPromises( |
| 491 SwapPromise::SWAP_FAILS); | 495 SwapPromise::SWAP_FAILS); |
| 492 | 496 |
| 493 DidFinishImplFrame(); | 497 DidFinishImplFrame(); |
| 494 } | 498 } |
| 495 } | 499 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 686 |
| 683 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; | 687 std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises; |
| 684 layer_tree_host_impl_->BeginMainFrameAborted(reason, | 688 layer_tree_host_impl_->BeginMainFrameAborted(reason, |
| 685 std::move(empty_swap_promises)); | 689 std::move(empty_swap_promises)); |
| 686 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); | 690 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
| 687 } | 691 } |
| 688 | 692 |
| 689 DrawResult SingleThreadProxy::ScheduledActionDrawIfPossible() { | 693 DrawResult SingleThreadProxy::ScheduledActionDrawIfPossible() { |
| 690 DebugScopedSetImplThread impl(task_runner_provider_); | 694 DebugScopedSetImplThread impl(task_runner_provider_); |
| 691 LayerTreeHostImpl::FrameData frame; | 695 LayerTreeHostImpl::FrameData frame; |
| 696 frame.begin_frame_ack = |
| 697 scheduler_on_impl_thread_->CurrentBeginFrameAckForActiveTree(); |
| 692 return DoComposite(&frame); | 698 return DoComposite(&frame); |
| 693 } | 699 } |
| 694 | 700 |
| 695 DrawResult SingleThreadProxy::ScheduledActionDrawForced() { | 701 DrawResult SingleThreadProxy::ScheduledActionDrawForced() { |
| 696 NOTREACHED(); | 702 NOTREACHED(); |
| 697 return INVALID_RESULT; | 703 return INVALID_RESULT; |
| 698 } | 704 } |
| 699 | 705 |
| 700 void SingleThreadProxy::ScheduledActionCommit() { | 706 void SingleThreadProxy::ScheduledActionCommit() { |
| 701 DebugScopedSetMainThread main(task_runner_provider_); | 707 DebugScopedSetMainThread main(task_runner_provider_); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 void SingleThreadProxy::DidFinishImplFrame() { | 751 void SingleThreadProxy::DidFinishImplFrame() { |
| 746 layer_tree_host_impl_->DidFinishImplFrame(); | 752 layer_tree_host_impl_->DidFinishImplFrame(); |
| 747 #if DCHECK_IS_ON() | 753 #if DCHECK_IS_ON() |
| 748 DCHECK(inside_impl_frame_) | 754 DCHECK(inside_impl_frame_) |
| 749 << "DidFinishImplFrame called while not inside an impl frame!"; | 755 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 750 inside_impl_frame_ = false; | 756 inside_impl_frame_ = false; |
| 751 #endif | 757 #endif |
| 752 } | 758 } |
| 753 | 759 |
| 754 } // namespace cc | 760 } // namespace cc |
| OLD | NEW |