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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/debug/benchmark_instrumentation.h" | 10 #include "cc/debug/benchmark_instrumentation.h" |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 MainThreadTaskRunner()->PostTask( | 745 MainThreadTaskRunner()->PostTask( |
746 FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame, | 746 FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame, |
747 weak_factory_.GetWeakPtr(), begin_frame_args)); | 747 weak_factory_.GetWeakPtr(), begin_frame_args)); |
748 } | 748 } |
749 | 749 |
750 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { | 750 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { |
751 layer_tree_host_->BeginMainFrameNotExpectedSoon(); | 751 layer_tree_host_->BeginMainFrameNotExpectedSoon(); |
752 } | 752 } |
753 | 753 |
754 void SingleThreadProxy::BeginMainFrame(const BeginFrameArgs& begin_frame_args) { | 754 void SingleThreadProxy::BeginMainFrame(const BeginFrameArgs& begin_frame_args) { |
| 755 if (scheduler_on_impl_thread_) { |
| 756 scheduler_on_impl_thread_->NotifyBeginMainFrameStarted( |
| 757 base::TimeTicks::Now()); |
| 758 } |
| 759 |
755 commit_requested_ = false; | 760 commit_requested_ = false; |
756 animate_requested_ = false; | 761 animate_requested_ = false; |
757 | 762 |
758 if (defer_commits_) { | 763 if (defer_commits_) { |
759 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", | 764 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", |
760 TRACE_EVENT_SCOPE_THREAD); | 765 TRACE_EVENT_SCOPE_THREAD); |
761 BeginMainFrameAbortedOnImplThread( | 766 BeginMainFrameAbortedOnImplThread( |
762 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); | 767 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); |
763 return; | 768 return; |
764 } | 769 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 layer_tree_host_->RequestMainFrameUpdate(); | 803 layer_tree_host_->RequestMainFrameUpdate(); |
799 | 804 |
800 // New commits requested inside UpdateLayers should be respected. | 805 // New commits requested inside UpdateLayers should be respected. |
801 commit_requested_ = false; | 806 commit_requested_ = false; |
802 | 807 |
803 layer_tree_host_->UpdateLayers(); | 808 layer_tree_host_->UpdateLayers(); |
804 | 809 |
805 // TODO(enne): SingleThreadProxy does not support cancelling commits yet, | 810 // TODO(enne): SingleThreadProxy does not support cancelling commits yet, |
806 // search for CommitEarlyOutReason::FINISHED_NO_UPDATES inside | 811 // search for CommitEarlyOutReason::FINISHED_NO_UPDATES inside |
807 // thread_proxy.cc | 812 // thread_proxy.cc |
808 if (scheduler_on_impl_thread_) { | 813 if (scheduler_on_impl_thread_) |
809 scheduler_on_impl_thread_->NotifyBeginMainFrameStarted(); | |
810 scheduler_on_impl_thread_->NotifyReadyToCommit(); | 814 scheduler_on_impl_thread_->NotifyReadyToCommit(); |
811 } | |
812 } | 815 } |
813 | 816 |
814 void SingleThreadProxy::BeginMainFrameAbortedOnImplThread( | 817 void SingleThreadProxy::BeginMainFrameAbortedOnImplThread( |
815 CommitEarlyOutReason reason) { | 818 CommitEarlyOutReason reason) { |
816 DebugScopedSetImplThread impl(this); | 819 DebugScopedSetImplThread impl(this); |
817 DCHECK(scheduler_on_impl_thread_->CommitPending()); | 820 DCHECK(scheduler_on_impl_thread_->CommitPending()); |
818 DCHECK(!layer_tree_host_impl_->pending_tree()); | 821 DCHECK(!layer_tree_host_impl_->pending_tree()); |
819 | 822 |
820 layer_tree_host_impl_->BeginMainFrameAborted(reason); | 823 layer_tree_host_impl_->BeginMainFrameAborted(reason); |
821 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); | 824 scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 << "DidFinishImplFrame called while not inside an impl frame!"; | 888 << "DidFinishImplFrame called while not inside an impl frame!"; |
886 inside_impl_frame_ = false; | 889 inside_impl_frame_ = false; |
887 #endif | 890 #endif |
888 } | 891 } |
889 | 892 |
890 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 893 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
891 layer_tree_host_->SendBeginFramesToChildren(args); | 894 layer_tree_host_->SendBeginFramesToChildren(args); |
892 } | 895 } |
893 | 896 |
894 } // namespace cc | 897 } // namespace cc |
OLD | NEW |