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