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/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 impl_thread_weak_ptr_, | 507 impl_thread_weak_ptr_, |
508 damage_rect)); | 508 damage_rect)); |
509 } | 509 } |
510 | 510 |
511 void ThreadProxy::SetNextCommitWaitsForActivation() { | 511 void ThreadProxy::SetNextCommitWaitsForActivation() { |
512 DCHECK(IsMainThread()); | 512 DCHECK(IsMainThread()); |
513 DCHECK(!inside_commit_); | 513 DCHECK(!inside_commit_); |
514 commit_waits_for_activation_ = true; | 514 commit_waits_for_activation_ = true; |
515 } | 515 } |
516 | 516 |
517 void ThreadProxy::SetNextCommitForcesRedraw() { | |
enne (OOO)
2013/09/11 17:42:43
This isn't going to work. This function is "SetNe
| |
518 DCHECK(IsMainThread()); | |
519 DCHECK(!inside_commit_); | |
520 Proxy::ImplThreadTaskRunner()->PostTask( | |
521 FROM_HERE, | |
522 base::Bind(&ThreadProxy::SetFullRootLayerDamageOnImplThread, | |
523 impl_thread_weak_ptr_)); | |
524 } | |
525 | |
517 void ThreadProxy::SetDeferCommits(bool defer_commits) { | 526 void ThreadProxy::SetDeferCommits(bool defer_commits) { |
518 DCHECK(IsMainThread()); | 527 DCHECK(IsMainThread()); |
519 DCHECK_NE(defer_commits_, defer_commits); | 528 DCHECK_NE(defer_commits_, defer_commits); |
520 defer_commits_ = defer_commits; | 529 defer_commits_ = defer_commits; |
521 | 530 |
522 if (defer_commits_) | 531 if (defer_commits_) |
523 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); | 532 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); |
524 else | 533 else |
525 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); | 534 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); |
526 | 535 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 | 594 |
586 void ThreadProxy::SetInputThrottledUntilCommitOnImplThread( | 595 void ThreadProxy::SetInputThrottledUntilCommitOnImplThread( |
587 bool is_throttled) { | 596 bool is_throttled) { |
588 DCHECK(IsImplThread()); | 597 DCHECK(IsImplThread()); |
589 if (is_throttled == input_throttled_until_commit_) | 598 if (is_throttled == input_throttled_until_commit_) |
590 return; | 599 return; |
591 input_throttled_until_commit_ = is_throttled; | 600 input_throttled_until_commit_ = is_throttled; |
592 RenewTreePriority(); | 601 RenewTreePriority(); |
593 } | 602 } |
594 | 603 |
604 void ThreadProxy::SetFullRootLayerDamageOnImplThread() { | |
605 DCHECK(IsImplThread()); | |
606 layer_tree_host_impl_->SetFullRootLayerDamage(); | |
607 LOG(INFO) << "ThreadProxy::SetFullRootLayerDamageOnImplThread"; | |
608 } | |
609 | |
595 void ThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) { | 610 void ThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) { |
596 DCHECK(IsMainThread()); | 611 DCHECK(IsMainThread()); |
597 DCHECK(Proxy::HasImplThread()); | 612 DCHECK(Proxy::HasImplThread()); |
598 DCHECK(first_output_surface); | 613 DCHECK(first_output_surface); |
599 | 614 |
600 // Create LayerTreeHostImpl. | 615 // Create LayerTreeHostImpl. |
601 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 616 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
602 CompletionEvent completion; | 617 CompletionEvent completion; |
603 Proxy::ImplThreadTaskRunner()->PostTask( | 618 Proxy::ImplThreadTaskRunner()->PostTask( |
604 FROM_HERE, | 619 FROM_HERE, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 | 721 |
707 void ThreadProxy::BeginFrameOnMainThread( | 722 void ThreadProxy::BeginFrameOnMainThread( |
708 scoped_ptr<BeginFrameAndCommitState> begin_frame_state) { | 723 scoped_ptr<BeginFrameAndCommitState> begin_frame_state) { |
709 TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnMainThread"); | 724 TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnMainThread"); |
710 DCHECK(IsMainThread()); | 725 DCHECK(IsMainThread()); |
711 | 726 |
712 if (!layer_tree_host_) | 727 if (!layer_tree_host_) |
713 return; | 728 return; |
714 | 729 |
715 if (defer_commits_) { | 730 if (defer_commits_) { |
731 LOG(INFO) << "EarlyOut_DeferCommits"; | |
716 pending_deferred_commit_ = begin_frame_state.Pass(); | 732 pending_deferred_commit_ = begin_frame_state.Pass(); |
717 layer_tree_host_->DidDeferCommit(); | 733 layer_tree_host_->DidDeferCommit(); |
718 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); | 734 TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); |
719 return; | 735 return; |
720 } | 736 } |
721 | 737 |
722 // Do not notify the impl thread of commit requests that occur during | 738 // Do not notify the impl thread of commit requests that occur during |
723 // the apply/animate/layout part of the BeginFrameAndCommit process since | 739 // the apply/animate/layout part of the BeginFrameAndCommit process since |
724 // those commit requests will get painted immediately. Once we have done | 740 // those commit requests will get painted immediately. Once we have done |
725 // the paint, commit_requested_ will be set to false to allow new commit | 741 // the paint, commit_requested_ will be set to false to allow new commit |
726 // requests to be scheduled. | 742 // requests to be scheduled. |
727 commit_requested_ = true; | 743 commit_requested_ = true; |
728 commit_request_sent_to_impl_thread_ = true; | 744 commit_request_sent_to_impl_thread_ = true; |
729 | 745 |
730 // On the other hand, the AnimationRequested flag needs to be cleared | 746 // On the other hand, the AnimationRequested flag needs to be cleared |
731 // here so that any animation requests generated by the apply or animate | 747 // here so that any animation requests generated by the apply or animate |
732 // callbacks will trigger another frame. | 748 // callbacks will trigger another frame. |
733 animate_requested_ = false; | 749 animate_requested_ = false; |
734 | 750 |
735 if (!in_composite_and_readback_ && !layer_tree_host_->visible()) { | 751 if (!in_composite_and_readback_ && !layer_tree_host_->visible()) { |
736 commit_requested_ = false; | 752 commit_requested_ = false; |
737 commit_request_sent_to_impl_thread_ = false; | 753 commit_request_sent_to_impl_thread_ = false; |
738 | 754 |
755 LOG(INFO) << "EarlyOut_NotVisible"; | |
739 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); | 756 TRACE_EVENT0("cc", "EarlyOut_NotVisible"); |
740 bool did_handle = false; | 757 bool did_handle = false; |
741 Proxy::ImplThreadTaskRunner()->PostTask( | 758 Proxy::ImplThreadTaskRunner()->PostTask( |
742 FROM_HERE, | 759 FROM_HERE, |
743 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, | 760 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, |
744 impl_thread_weak_ptr_, | 761 impl_thread_weak_ptr_, |
745 did_handle)); | 762 did_handle)); |
746 return; | 763 return; |
747 } | 764 } |
748 | 765 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
783 begin_frame_state ? begin_frame_state->memory_allocation_limit_bytes | 800 begin_frame_state ? begin_frame_state->memory_allocation_limit_bytes |
784 : 0u); | 801 : 0u); |
785 | 802 |
786 // Once single buffered layers are committed, they cannot be modified until | 803 // Once single buffered layers are committed, they cannot be modified until |
787 // they are drawn by the impl thread. | 804 // they are drawn by the impl thread. |
788 textures_acquired_ = false; | 805 textures_acquired_ = false; |
789 | 806 |
790 layer_tree_host_->WillCommit(); | 807 layer_tree_host_->WillCommit(); |
791 | 808 |
792 if (!updated && can_cancel_this_commit) { | 809 if (!updated && can_cancel_this_commit) { |
810 LOG(INFO) << "EarlyOut_NoUpdates"; | |
793 TRACE_EVENT0("cc", "EarlyOut_NoUpdates"); | 811 TRACE_EVENT0("cc", "EarlyOut_NoUpdates"); |
794 bool did_handle = true; | 812 bool did_handle = true; |
795 Proxy::ImplThreadTaskRunner()->PostTask( | 813 Proxy::ImplThreadTaskRunner()->PostTask( |
796 FROM_HERE, | 814 FROM_HERE, |
797 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, | 815 base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, |
798 impl_thread_weak_ptr_, | 816 impl_thread_weak_ptr_, |
799 did_handle)); | 817 did_handle)); |
800 | 818 |
801 // Although the commit is internally aborted, this is because it has been | 819 // Although the commit is internally aborted, this is because it has been |
802 // detected to be a no-op. From the perspective of an embedder, this commit | 820 // detected to be a no-op. From the perspective of an embedder, this commit |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
869 scoped_refptr<cc::ContextProvider> offscreen_context_provider) { | 887 scoped_refptr<cc::ContextProvider> offscreen_context_provider) { |
870 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); | 888 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); |
871 | 889 |
872 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); | 890 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); |
873 DCHECK(!commit_completion_event_on_impl_thread_); | 891 DCHECK(!commit_completion_event_on_impl_thread_); |
874 DCHECK(IsImplThread() && IsMainThreadBlocked()); | 892 DCHECK(IsImplThread() && IsMainThreadBlocked()); |
875 DCHECK(scheduler_on_impl_thread_); | 893 DCHECK(scheduler_on_impl_thread_); |
876 DCHECK(scheduler_on_impl_thread_->CommitPending()); | 894 DCHECK(scheduler_on_impl_thread_->CommitPending()); |
877 | 895 |
878 if (!layer_tree_host_impl_) { | 896 if (!layer_tree_host_impl_) { |
897 LOG(INFO) << "EarlyOut_NoLayerTree"; | |
879 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); | 898 TRACE_EVENT0("cc", "EarlyOut_NoLayerTree"); |
880 completion->Signal(); | 899 completion->Signal(); |
881 return; | 900 return; |
882 } | 901 } |
883 | 902 |
884 if (offscreen_context_provider.get()) | 903 if (offscreen_context_provider.get()) |
885 offscreen_context_provider->BindToCurrentThread(); | 904 offscreen_context_provider->BindToCurrentThread(); |
886 layer_tree_host_impl_->SetOffscreenContextProvider( | 905 layer_tree_host_impl_->SetOffscreenContextProvider( |
887 offscreen_context_provider); | 906 offscreen_context_provider); |
888 | 907 |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1521 completion_event_for_commit_held_on_tree_activation_ = NULL; | 1540 completion_event_for_commit_held_on_tree_activation_ = NULL; |
1522 } | 1541 } |
1523 | 1542 |
1524 UpdateBackgroundAnimateTicking(); | 1543 UpdateBackgroundAnimateTicking(); |
1525 | 1544 |
1526 commit_to_activate_duration_history_.InsertSample( | 1545 commit_to_activate_duration_history_.InsertSample( |
1527 base::TimeTicks::HighResNow() - commit_complete_time_); | 1546 base::TimeTicks::HighResNow() - commit_complete_time_); |
1528 } | 1547 } |
1529 | 1548 |
1530 } // namespace cc | 1549 } // namespace cc |
OLD | NEW |