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

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

Issue 1113493007: Allow cc::STP::SetNeedsAnimate to request another commit from a commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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 29 matching lines...) Expand all
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_draw_(false), 48 inside_draw_(false),
49 defer_commits_(false), 49 defer_commits_(false),
50 animate_requested_(false),
50 commit_requested_(false), 51 commit_requested_(false),
51 inside_synchronous_composite_(false), 52 inside_synchronous_composite_(false),
52 output_surface_creation_requested_(false), 53 output_surface_creation_requested_(false),
53 weak_factory_(this) { 54 weak_factory_(this) {
54 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); 55 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
55 DCHECK(Proxy::IsMainThread()); 56 DCHECK(Proxy::IsMainThread());
56 DCHECK(layer_tree_host); 57 DCHECK(layer_tree_host);
57 58
58 if (layer_tree_host->settings().single_thread_proxy_scheduler && 59 if (layer_tree_host->settings().single_thread_proxy_scheduler &&
59 !scheduler_on_impl_thread_) { 60 !scheduler_on_impl_thread_) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { 172 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
172 DCHECK(Proxy::IsMainThread()); 173 DCHECK(Proxy::IsMainThread());
173 DCHECK(!layer_tree_host_->output_surface_lost()); 174 DCHECK(!layer_tree_host_->output_surface_lost());
174 return renderer_capabilities_for_main_thread_; 175 return renderer_capabilities_for_main_thread_;
175 } 176 }
176 177
177 void SingleThreadProxy::SetNeedsAnimate() { 178 void SingleThreadProxy::SetNeedsAnimate() {
178 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate"); 179 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate");
179 DCHECK(Proxy::IsMainThread()); 180 DCHECK(Proxy::IsMainThread());
180 client_->ScheduleAnimation(); 181 client_->ScheduleAnimation();
181 SetNeedsCommit(); 182 if (animate_requested_) {
danakj 2015/04/28 21:47:49 nit: no {}
183 return;
184 }
185 animate_requested_ = true;
186 DebugScopedSetImplThread impl(this);
187 if (scheduler_on_impl_thread_)
188 scheduler_on_impl_thread_->SetNeedsCommit();
182 } 189 }
183 190
184 void SingleThreadProxy::SetNeedsUpdateLayers() { 191 void SingleThreadProxy::SetNeedsUpdateLayers() {
185 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers"); 192 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers");
186 DCHECK(Proxy::IsMainThread()); 193 DCHECK(Proxy::IsMainThread());
187 SetNeedsCommit(); 194 SetNeedsCommit();
188 } 195 }
189 196
190 void SingleThreadProxy::DoAnimate() { 197 void SingleThreadProxy::DoAnimate() {
191 // Don't animate if there is no root layer. 198 // Don't animate if there is no root layer.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 timing_history_.DidCommit(); 335 timing_history_.DidCommit();
329 336
330 next_frame_is_newly_committed_frame_ = true; 337 next_frame_is_newly_committed_frame_ = true;
331 } 338 }
332 339
333 void SingleThreadProxy::SetNeedsCommit() { 340 void SingleThreadProxy::SetNeedsCommit() {
334 DCHECK(Proxy::IsMainThread()); 341 DCHECK(Proxy::IsMainThread());
335 client_->ScheduleComposite(); 342 client_->ScheduleComposite();
336 if (commit_requested_) 343 if (commit_requested_)
337 return; 344 return;
345 commit_requested_ = true;
338 DebugScopedSetImplThread impl(this); 346 DebugScopedSetImplThread impl(this);
339 if (scheduler_on_impl_thread_) 347 if (scheduler_on_impl_thread_)
340 scheduler_on_impl_thread_->SetNeedsCommit(); 348 scheduler_on_impl_thread_->SetNeedsCommit();
341 commit_requested_ = true;
342 } 349 }
343 350
344 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { 351 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
345 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); 352 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw");
346 DCHECK(Proxy::IsMainThread()); 353 DCHECK(Proxy::IsMainThread());
347 DebugScopedSetImplThread impl(this); 354 DebugScopedSetImplThread impl(this);
348 client_->ScheduleComposite(); 355 client_->ScheduleComposite();
349 SetNeedsRedrawRectOnImplThread(damage_rect); 356 SetNeedsRedrawRectOnImplThread(damage_rect);
350 } 357 }
351 358
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 base::Bind(&SingleThreadProxy::BeginMainFrame, 809 base::Bind(&SingleThreadProxy::BeginMainFrame,
803 weak_factory_.GetWeakPtr())); 810 weak_factory_.GetWeakPtr()));
804 } 811 }
805 812
806 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { 813 void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() {
807 layer_tree_host_->BeginMainFrameNotExpectedSoon(); 814 layer_tree_host_->BeginMainFrameNotExpectedSoon();
808 } 815 }
809 816
810 void SingleThreadProxy::BeginMainFrame() { 817 void SingleThreadProxy::BeginMainFrame() {
811 commit_requested_ = false; 818 commit_requested_ = false;
819 animate_requested_ = false;
812 820
813 if (defer_commits_) { 821 if (defer_commits_) {
814 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", 822 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
815 TRACE_EVENT_SCOPE_THREAD); 823 TRACE_EVENT_SCOPE_THREAD);
816 BeginMainFrameAbortedOnImplThread( 824 BeginMainFrameAbortedOnImplThread(
817 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); 825 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT);
818 return; 826 return;
819 } 827 }
820 828
821 // This checker assumes NotifyReadyToCommit in this stack causes a synchronous 829 // This checker assumes NotifyReadyToCommit in this stack causes a synchronous
822 // commit. 830 // commit.
823 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); 831 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_);
824 832
825 if (!layer_tree_host_->visible()) { 833 if (!layer_tree_host_->visible()) {
826 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); 834 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD);
827 BeginMainFrameAbortedOnImplThread( 835 BeginMainFrameAbortedOnImplThread(
828 CommitEarlyOutReason::ABORTED_NOT_VISIBLE); 836 CommitEarlyOutReason::ABORTED_NOT_VISIBLE);
829 return; 837 return;
830 } 838 }
831 839
832 if (layer_tree_host_->output_surface_lost()) { 840 if (layer_tree_host_->output_surface_lost()) {
833 TRACE_EVENT_INSTANT0( 841 TRACE_EVENT_INSTANT0(
834 "cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD); 842 "cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD);
835 BeginMainFrameAbortedOnImplThread( 843 BeginMainFrameAbortedOnImplThread(
836 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST); 844 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST);
837 return; 845 return;
838 } 846 }
839 847
840 // Prevent new commits from being requested inside DoBeginMainFrame. 848 // Prevent new commits from being requested inside DoBeginMainFrame.
849 // Note: We do not want to prevent SetNeedsAnimate from requesting
850 // a commit here.
841 commit_requested_ = true; 851 commit_requested_ = true;
842 852
843 const BeginFrameArgs& begin_frame_args = 853 const BeginFrameArgs& begin_frame_args =
844 layer_tree_host_impl_->CurrentBeginFrameArgs(); 854 layer_tree_host_impl_->CurrentBeginFrameArgs();
845 DoBeginMainFrame(begin_frame_args); 855 DoBeginMainFrame(begin_frame_args);
846 } 856 }
847 857
848 void SingleThreadProxy::DoBeginMainFrame( 858 void SingleThreadProxy::DoBeginMainFrame(
849 const BeginFrameArgs& begin_frame_args) { 859 const BeginFrameArgs& begin_frame_args) {
850 layer_tree_host_->WillBeginMainFrame(); 860 layer_tree_host_->WillBeginMainFrame();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 970
961 void SingleThreadProxy::DidBeginImplFrameDeadline() { 971 void SingleThreadProxy::DidBeginImplFrameDeadline() {
962 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 972 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
963 } 973 }
964 974
965 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 975 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
966 layer_tree_host_->SendBeginFramesToChildren(args); 976 layer_tree_host_->SendBeginFramesToChildren(args);
967 } 977 }
968 978
969 } // namespace cc 979 } // 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