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

Unified Diff: cc/trees/proxy_main.cc

Issue 2769213006: cc: If SetDeferCommits(true) happens inside the main frame, abort it. (Closed)
Patch Set: defer-inside-mainframe: comments Created 3 years, 9 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
Index: cc/trees/proxy_main.cc
diff --git a/cc/trees/proxy_main.cc b/cc/trees/proxy_main.cc
index 5b9e7f0e576ca59ba5e35ad962e65c5e0d805468..de79051d4b38e3395e219f1054e431150859bd37 100644
--- a/cc/trees/proxy_main.cc
+++ b/cc/trees/proxy_main.cc
@@ -187,6 +187,26 @@ void ProxyMain::BeginMainFrame(
layer_tree_host_->GetUIResourceManager()->RecreateUIResources();
layer_tree_host_->RequestMainFrameUpdate();
+
+ // At this point the main frame may have deferred commits to avoid committing
+ // right now.
+ if (defer_commits_) {
+ TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit_InsideBeginMainFrame",
+ TRACE_EVENT_SCOPE_THREAD);
+ std::vector<std::unique_ptr<SwapPromise>> empty_swap_promises;
+ ImplThreadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&ProxyImpl::BeginMainFrameAbortedOnImpl,
+ base::Unretained(proxy_impl_.get()),
+ CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT,
+ begin_main_frame_start_time,
+ base::Passed(&empty_swap_promises)));
+ current_pipeline_stage_ = NO_PIPELINE_STAGE;
+ // We intentionally don't report CommitComplete() here since it was aborted
+ // prematurely and we're waiting to do another commit in the future.
+ layer_tree_host_->DidBeginMainFrame();
+ return;
+ }
+
TRACE_EVENT_SYNTHETIC_DELAY_END("cc.BeginMainFrame");
bool can_cancel_this_commit = final_pipeline_stage_ < COMMIT_PIPELINE_STAGE &&

Powered by Google App Engine
This is Rietveld 408576698