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

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, 6 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 side-by-side diff with in-line comments
Download patch
« cc/scheduler/scheduler_state_machine.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 1eed641f22a3179e8f18a1f209b28a204831081a..55411fe9aac568d0ec1a3a61721a01308dad7236 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -481,12 +481,16 @@ 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));
+}
+
+void ThreadProxy::SetDeferCommitsOnImplThread(bool defer_commits) const {
+ DCHECK(IsImplThread());
+ impl().scheduler->SetDeferCommits(defer_commits);
}
bool ThreadProxy::CommitRequested() const {
@@ -736,14 +740,6 @@ void ThreadProxy::BeginMainFrame(
TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.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);
- return;
- }
-
// If the commit finishes, LayerTreeHost will transfer its swap promises to
// LayerTreeImpl. The destructor of SwapPromiseChecker checks LayerTressHost's
// swap promises.
@@ -753,6 +749,19 @@ void ThreadProxy::BeginMainFrame(
main().commit_request_sent_to_impl_thread = false;
main().animate_requested = false;
+ if (main().defer_commits) {
+ layer_tree_host()->DidDeferCommit();
+ TRACE_EVENT_INSTANT0(
+ "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD);
+ bool did_handle = false;
+ Proxy::ImplThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread,
brianderson 2014/06/17 15:57:01 Would it make sense to reorganize the BeginMainFra
simonhong 2014/06/18 21:52:05 Done.
+ impl_thread_weak_ptr_,
+ did_handle));
+ return;
+ }
+
if (!layer_tree_host()->visible()) {
TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD);
bool did_handle = false;
« cc/scheduler/scheduler_state_machine.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