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

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

Issue 337693005: cc: Control defer_commits logic by Scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | 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/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 27 matching lines...) Expand all
38 LayerTreeHostSingleThreadClient* client, 38 LayerTreeHostSingleThreadClient* client,
39 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 39 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
40 scoped_ptr<BeginFrameSource> external_begin_frame_source) 40 scoped_ptr<BeginFrameSource> external_begin_frame_source)
41 : Proxy(main_task_runner, NULL), 41 : Proxy(main_task_runner, NULL),
42 layer_tree_host_(layer_tree_host), 42 layer_tree_host_(layer_tree_host),
43 client_(client), 43 client_(client),
44 timing_history_(layer_tree_host->rendering_stats_instrumentation()), 44 timing_history_(layer_tree_host->rendering_stats_instrumentation()),
45 next_frame_is_newly_committed_frame_(false), 45 next_frame_is_newly_committed_frame_(false),
46 inside_draw_(false), 46 inside_draw_(false),
47 defer_commits_(false), 47 defer_commits_(false),
48 commit_was_deferred_(false),
49 commit_requested_(false), 48 commit_requested_(false),
50 inside_synchronous_composite_(false), 49 inside_synchronous_composite_(false),
51 output_surface_creation_requested_(false), 50 output_surface_creation_requested_(false),
52 external_begin_frame_source_(external_begin_frame_source.Pass()), 51 external_begin_frame_source_(external_begin_frame_source.Pass()),
53 weak_factory_(this) { 52 weak_factory_(this) {
54 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); 53 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
55 DCHECK(Proxy::IsMainThread()); 54 DCHECK(Proxy::IsMainThread());
56 DCHECK(layer_tree_host); 55 DCHECK(layer_tree_host);
57 } 56 }
58 57
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return; 305 return;
307 if (defer_commits_ == defer_commits) 306 if (defer_commits_ == defer_commits)
308 return; 307 return;
309 308
310 if (defer_commits) 309 if (defer_commits)
311 TRACE_EVENT_ASYNC_BEGIN0("cc", "SingleThreadProxy::SetDeferCommits", this); 310 TRACE_EVENT_ASYNC_BEGIN0("cc", "SingleThreadProxy::SetDeferCommits", this);
312 else 311 else
313 TRACE_EVENT_ASYNC_END0("cc", "SingleThreadProxy::SetDeferCommits", this); 312 TRACE_EVENT_ASYNC_END0("cc", "SingleThreadProxy::SetDeferCommits", this);
314 313
315 defer_commits_ = defer_commits; 314 defer_commits_ = defer_commits;
316 if (!defer_commits_ && commit_was_deferred_) { 315 scheduler_on_impl_thread_->SetDeferCommits(defer_commits);
317 commit_was_deferred_ = false;
318 BeginMainFrame();
319 }
320 } 316 }
321 317
322 bool SingleThreadProxy::CommitRequested() const { 318 bool SingleThreadProxy::CommitRequested() const {
323 DCHECK(Proxy::IsMainThread()); 319 DCHECK(Proxy::IsMainThread());
324 return commit_requested_; 320 return commit_requested_;
325 } 321 }
326 322
327 bool SingleThreadProxy::BeginMainFrameRequested() const { 323 bool SingleThreadProxy::BeginMainFrameRequested() const {
328 DCHECK(Proxy::IsMainThread()); 324 DCHECK(Proxy::IsMainThread());
329 // If there is no scheduler, then there can be no pending begin frame, 325 // If there is no scheduler, then there can be no pending begin frame,
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a 669 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a
674 // synchronous commit. 670 // synchronous commit.
675 MainThreadTaskRunner()->PostTask( 671 MainThreadTaskRunner()->PostTask(
676 FROM_HERE, 672 FROM_HERE,
677 base::Bind(&SingleThreadProxy::BeginMainFrame, 673 base::Bind(&SingleThreadProxy::BeginMainFrame,
678 weak_factory_.GetWeakPtr())); 674 weak_factory_.GetWeakPtr()));
679 } 675 }
680 676
681 void SingleThreadProxy::BeginMainFrame() { 677 void SingleThreadProxy::BeginMainFrame() {
682 if (defer_commits_) { 678 if (defer_commits_) {
683 DCHECK(!commit_was_deferred_); 679 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
684 commit_was_deferred_ = true; 680 TRACE_EVENT_SCOPE_THREAD);
685 layer_tree_host_->DidDeferCommit(); 681 BeginMainFrameAbortedOnImplThread(
682 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT);
686 return; 683 return;
687 } 684 }
688 685
689 // This checker assumes NotifyReadyToCommit in this stack causes a synchronous 686 // This checker assumes NotifyReadyToCommit in this stack causes a synchronous
690 // commit. 687 // commit.
691 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); 688 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_);
692 689
693 if (!layer_tree_host_->visible()) { 690 if (!layer_tree_host_->visible()) {
694 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); 691 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD);
695 BeginMainFrameAbortedOnImplThread( 692 BeginMainFrameAbortedOnImplThread(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 815
819 void SingleThreadProxy::DidBeginImplFrameDeadline() { 816 void SingleThreadProxy::DidBeginImplFrameDeadline() {
820 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 817 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
821 } 818 }
822 819
823 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 820 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
824 layer_tree_host_->SendBeginFramesToChildren(args); 821 layer_tree_host_->SendBeginFramesToChildren(args);
825 } 822 }
826 823
827 } // namespace cc 824 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698