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

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/single_thread_proxy.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 0f7a2a3dee6baae9dd219c6d3c02f36c4025af2e..246c52afdedfd9e8ef93d4cd65b7ad3264ebe2c8 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -437,13 +437,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 {
@@ -702,14 +705,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 ScopedSwapPromiseChecker aborts the
// remaining swap promises.
@@ -719,20 +714,22 @@ void ThreadProxy::BeginMainFrame(
main().commit_request_sent_to_impl_thread = false;
main().animate_requested = false;
- if (!layer_tree_host()->visible()) {
+ bool need_to_abort_begin_main_frame = true;
+ if (main().defer_commits) {
+ layer_tree_host()->DidDeferCommit();
+ TRACE_EVENT_INSTANT0("cc",
+ "EarlyOut_DeferCommits",
+ TRACE_EVENT_SCOPE_THREAD);
brianderson 2014/11/19 19:55:07 If we abort a commit because we are deferring comm
simonhong 2014/11/26 15:52:53 SetNeedsCommit() is added when SetDeferCommits(fal
+ } else if (!layer_tree_host()->visible()) {
TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD);
- bool did_handle = false;
- Proxy::ImplThreadTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread,
- impl_thread_weak_ptr_,
- did_handle));
- return;
- }
-
- if (layer_tree_host()->output_surface_lost()) {
+ } else if (layer_tree_host()->output_surface_lost()) {
TRACE_EVENT_INSTANT0(
"cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD);
+ } else {
+ need_to_abort_begin_main_frame = false;
+ }
+
+ if (need_to_abort_begin_main_frame) {
bool did_handle = false;
Proxy::ImplThreadTaskRunner()->PostTask(
FROM_HERE,
« cc/trees/single_thread_proxy.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