Chromium Code Reviews| 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, UINT32_MAX, 1, frame_begin_time, base::TimeTicks(), |
|
brianderson
2017/02/24 01:08:38
Can you make this a BeginFrameArgs constant with a
Eric Seckler
2017/02/27 11:50:32
Done.
| |
| 451 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL)); | 451 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL)); |
| 452 | 452 |
| 453 // Start the impl frame. | 453 // Start the impl frame. |
| 454 { | 454 { |
| 455 DebugScopedSetImplThread impl(task_runner_provider_); | 455 DebugScopedSetImplThread impl(task_runner_provider_); |
| 456 WillBeginImplFrame(begin_frame_args); | 456 WillBeginImplFrame(begin_frame_args); |
| 457 } | 457 } |
| 458 | 458 |
| 459 // Run the "main thread" and get it to commit. | 459 // Run the "main thread" and get it to commit. |
| 460 { | 460 { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 476 layer_tree_host_impl_->ActivateSyncTree(); | 476 layer_tree_host_impl_->ActivateSyncTree(); |
| 477 DCHECK( | 477 DCHECK( |
| 478 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); | 478 !layer_tree_host_impl_->active_tree()->needs_update_draw_properties()); |
| 479 layer_tree_host_impl_->PrepareTiles(); | 479 layer_tree_host_impl_->PrepareTiles(); |
| 480 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); | 480 layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
| 481 | 481 |
| 482 // TODO(danakj): Don't do this last... we prepared the wrong things. D: | 482 // TODO(danakj): Don't do this last... we prepared the wrong things. D: |
| 483 layer_tree_host_impl_->Animate(); | 483 layer_tree_host_impl_->Animate(); |
| 484 | 484 |
| 485 LayerTreeHostImpl::FrameData frame; | 485 LayerTreeHostImpl::FrameData frame; |
| 486 frame.begin_frame_source_id = begin_frame_args.source_id; | |
| 487 frame.begin_frame_sequence_number = begin_frame_args.sequence_number; | |
| 488 frame.latest_confirmed_begin_frame_sequence_number = | |
| 489 begin_frame_args.sequence_number; | |
| 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_source_id = | |
| 697 scheduler_on_impl_thread_->CurrentBeginFrameSourceId(); | |
| 698 frame.begin_frame_sequence_number = | |
| 699 scheduler_on_impl_thread_->CurrentBeginFrameSequenceNumber(); | |
| 700 frame.latest_confirmed_begin_frame_sequence_number = | |
| 701 scheduler_on_impl_thread_ | |
| 702 ->LatestConfirmedBeginFrameSequenceNumberForActiveTree(); | |
| 692 return DoComposite(&frame); | 703 return DoComposite(&frame); |
| 693 } | 704 } |
| 694 | 705 |
| 695 DrawResult SingleThreadProxy::ScheduledActionDrawForced() { | 706 DrawResult SingleThreadProxy::ScheduledActionDrawForced() { |
| 696 NOTREACHED(); | 707 NOTREACHED(); |
| 697 return INVALID_RESULT; | 708 return INVALID_RESULT; |
| 698 } | 709 } |
| 699 | 710 |
| 700 void SingleThreadProxy::ScheduledActionCommit() { | 711 void SingleThreadProxy::ScheduledActionCommit() { |
| 701 DebugScopedSetMainThread main(task_runner_provider_); | 712 DebugScopedSetMainThread main(task_runner_provider_); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 void SingleThreadProxy::DidFinishImplFrame() { | 752 void SingleThreadProxy::DidFinishImplFrame() { |
| 742 layer_tree_host_impl_->DidFinishImplFrame(); | 753 layer_tree_host_impl_->DidFinishImplFrame(); |
| 743 #if DCHECK_IS_ON() | 754 #if DCHECK_IS_ON() |
| 744 DCHECK(inside_impl_frame_) | 755 DCHECK(inside_impl_frame_) |
| 745 << "DidFinishImplFrame called while not inside an impl frame!"; | 756 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 746 inside_impl_frame_ = false; | 757 inside_impl_frame_ = false; |
| 747 #endif | 758 #endif |
| 748 } | 759 } |
| 749 | 760 |
| 750 } // namespace cc | 761 } // namespace cc |
| OLD | NEW |