Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: cc/trees/single_thread_proxy.cc

Issue 1110183004: cc: Get BeginFrameArgs for STP::BeginMainFrame while inside an impl frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto master. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 SingleThreadProxy::SingleThreadProxy( 38 SingleThreadProxy::SingleThreadProxy(
39 LayerTreeHost* layer_tree_host, 39 LayerTreeHost* layer_tree_host,
40 LayerTreeHostSingleThreadClient* client, 40 LayerTreeHostSingleThreadClient* client,
41 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 41 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
42 scoped_ptr<BeginFrameSource> external_begin_frame_source) 42 scoped_ptr<BeginFrameSource> external_begin_frame_source)
43 : Proxy(main_task_runner, NULL), 43 : Proxy(main_task_runner, NULL),
44 layer_tree_host_(layer_tree_host), 44 layer_tree_host_(layer_tree_host),
45 client_(client), 45 client_(client),
46 timing_history_(layer_tree_host->rendering_stats_instrumentation()), 46 timing_history_(layer_tree_host->rendering_stats_instrumentation()),
47 next_frame_is_newly_committed_frame_(false), 47 next_frame_is_newly_committed_frame_(false),
48 inside_impl_frame_(false),
48 inside_draw_(false), 49 inside_draw_(false),
49 defer_commits_(false), 50 defer_commits_(false),
50 animate_requested_(false), 51 animate_requested_(false),
51 commit_requested_(false), 52 commit_requested_(false),
52 inside_synchronous_composite_(false), 53 inside_synchronous_composite_(false),
53 output_surface_creation_requested_(false), 54 output_surface_creation_requested_(false),
54 weak_factory_(this) { 55 weak_factory_(this) {
55 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); 56 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
56 DCHECK(Proxy::IsMainThread()); 57 DCHECK(Proxy::IsMainThread());
57 DCHECK(layer_tree_host); 58 DCHECK(layer_tree_host);
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 scheduler_on_impl_thread_->SetChildrenNeedBeginFrames( 785 scheduler_on_impl_thread_->SetChildrenNeedBeginFrames(
785 children_need_begin_frames); 786 children_need_begin_frames);
786 } 787 }
787 788
788 void SingleThreadProxy::SetAuthoritativeVSyncInterval( 789 void SingleThreadProxy::SetAuthoritativeVSyncInterval(
789 const base::TimeDelta& interval) { 790 const base::TimeDelta& interval) {
790 scheduler_on_impl_thread_->SetAuthoritativeVSyncInterval(interval); 791 scheduler_on_impl_thread_->SetAuthoritativeVSyncInterval(interval);
791 } 792 }
792 793
793 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { 794 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
795 DCHECK(!inside_impl_frame_)
796 << "WillBeginImplFrame called while already inside an impl frame!";
797 inside_impl_frame_ = true;
794 layer_tree_host_impl_->WillBeginImplFrame(args); 798 layer_tree_host_impl_->WillBeginImplFrame(args);
795 } 799 }
796 800
797 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() { 801 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() {
798 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); 802 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame");
799 // Although this proxy is single-threaded, it's problematic to synchronously 803 // Although this proxy is single-threaded, it's problematic to synchronously
800 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This 804 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This
801 // could cause a commit to occur in between a series of SetNeedsCommit calls 805 // could cause a commit to occur in between a series of SetNeedsCommit calls
802 // (i.e. property modifications) causing some to fall on one frame and some to 806 // (i.e. property modifications) causing some to fall on one frame and some to
803 // fall on the next. Doing it asynchronously instead matches the semantics of 807 // fall on the next. Doing it asynchronously instead matches the semantics of
804 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a 808 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a
805 // synchronous commit. 809 // synchronous commit.
810 DCHECK(inside_impl_frame_)
811 << "BeginMainFrame should only be sent inside a BeginImplFrame";
812 const BeginFrameArgs& begin_frame_args =
813 layer_tree_host_impl_->CurrentBeginFrameArgs();
814
806 MainThreadTaskRunner()->PostTask( 815 MainThreadTaskRunner()->PostTask(
807 FROM_HERE, 816 FROM_HERE, base::Bind(&SingleThreadProxy::BeginMainFrame,
808 base::Bind(&SingleThreadProxy::BeginMainFrame, 817 weak_factory_.GetWeakPtr(), begin_frame_args));
809 weak_factory_.GetWeakPtr()));
810 } 818 }
811 819
812 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { 820 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() {
813 layer_tree_host_->BeginMainFrameNotExpectedSoon(); 821 layer_tree_host_->BeginMainFrameNotExpectedSoon();
814 } 822 }
815 823
816 void SingleThreadProxy::BeginMainFrame() { 824 void SingleThreadProxy::BeginMainFrame(const BeginFrameArgs& begin_frame_args) {
817 commit_requested_ = false; 825 commit_requested_ = false;
818 animate_requested_ = false; 826 animate_requested_ = false;
819 827
820 if (defer_commits_) { 828 if (defer_commits_) {
821 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", 829 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
822 TRACE_EVENT_SCOPE_THREAD); 830 TRACE_EVENT_SCOPE_THREAD);
823 BeginMainFrameAbortedOnImplThread( 831 BeginMainFrameAbortedOnImplThread(
824 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); 832 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT);
825 return; 833 return;
826 } 834 }
(...skipping 15 matching lines...) Expand all
842 BeginMainFrameAbortedOnImplThread( 850 BeginMainFrameAbortedOnImplThread(
843 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST); 851 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST);
844 return; 852 return;
845 } 853 }
846 854
847 // Prevent new commits from being requested inside DoBeginMainFrame. 855 // Prevent new commits from being requested inside DoBeginMainFrame.
848 // Note: We do not want to prevent SetNeedsAnimate from requesting 856 // Note: We do not want to prevent SetNeedsAnimate from requesting
849 // a commit here. 857 // a commit here.
850 commit_requested_ = true; 858 commit_requested_ = true;
851 859
852 const BeginFrameArgs& begin_frame_args =
853 layer_tree_host_impl_->CurrentBeginFrameArgs();
854 DoBeginMainFrame(begin_frame_args); 860 DoBeginMainFrame(begin_frame_args);
855 } 861 }
856 862
857 void SingleThreadProxy::DoBeginMainFrame( 863 void SingleThreadProxy::DoBeginMainFrame(
858 const BeginFrameArgs& begin_frame_args) { 864 const BeginFrameArgs& begin_frame_args) {
859 layer_tree_host_->WillBeginMainFrame(); 865 layer_tree_host_->WillBeginMainFrame();
860 layer_tree_host_->BeginMainFrame(begin_frame_args); 866 layer_tree_host_->BeginMainFrame(begin_frame_args);
861 layer_tree_host_->AnimateLayers(begin_frame_args.frame_time); 867 layer_tree_host_->AnimateLayers(begin_frame_args.frame_time);
862 layer_tree_host_->Layout(); 868 layer_tree_host_->Layout();
863 869
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { 968 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() {
963 return timing_history_.BeginMainFrameToCommitDurationEstimate(); 969 return timing_history_.BeginMainFrameToCommitDurationEstimate();
964 } 970 }
965 971
966 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { 972 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() {
967 return timing_history_.CommitToActivateDurationEstimate(); 973 return timing_history_.CommitToActivateDurationEstimate();
968 } 974 }
969 975
970 void SingleThreadProxy::DidBeginImplFrameDeadline() { 976 void SingleThreadProxy::DidBeginImplFrameDeadline() {
971 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 977 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
978 DCHECK(inside_impl_frame_)
979 << "DidBeginImplFrameDeadline called while not inside an impl frame!";
980 inside_impl_frame_ = false;
972 } 981 }
973 982
974 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 983 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
975 layer_tree_host_->SendBeginFramesToChildren(args); 984 layer_tree_host_->SendBeginFramesToChildren(args);
976 } 985 }
977 986
978 } // namespace cc 987 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698