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

Unified Diff: cc/trees/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 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« cc/trees/layer_tree_host_unittest.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 4793cc5ecf5c27d3458a870230af7569bea5d5c0..8110cbba6a1d38eecb997b030d4d596f656a54f8 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -437,13 +437,21 @@ void ThreadProxy::SetDeferCommits(bool defer_commits) {
else
TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this);
- if (!main().defer_commits && main().pending_deferred_commit) {
- Proxy::MainThreadTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&ThreadProxy::BeginMainFrame,
- main_thread_weak_ptr_,
- base::Passed(&main().pending_deferred_commit)));
- }
+ Proxy::ImplThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&ThreadProxy::SetDeferCommitsOnImplThread,
+ impl_thread_weak_ptr_,
+ defer_commits));
+
+ // When defer commit is turned off, we should start new BeginMainFrame to
+ // handle previous deferred BeginMainFrame.
+ if (!main().defer_commits)
+ SetNeedsCommit();
+}
+
+void ThreadProxy::SetDeferCommitsOnImplThread(bool defer_commits) const {
+ DCHECK(IsImplThread());
+ impl().scheduler->SetDeferCommits(defer_commits);
}
bool ThreadProxy::CommitRequested() const {
@@ -686,10 +694,16 @@ void ThreadProxy::BeginMainFrame(
DCHECK(IsMainThread());
if (main().defer_commits) {
- main().pending_deferred_commit = begin_main_frame_state.Pass();
- layer_tree_host()->DidDeferCommit();
- TRACE_EVENT_INSTANT0(
- "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cc",
+ "EarlyOut_DeferCommits",
+ TRACE_EVENT_SCOPE_THREAD);
+
+ bool did_handle = false;
+ Proxy::ImplThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread,
+ impl_thread_weak_ptr_,
+ did_handle));
return;
}
« cc/trees/layer_tree_host_unittest.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698