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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 60513007: Add SwapPromise support to LayerTreeHost and LayerTreeImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: DCHECK(swap_promise_list_[i]) before dereference Created 7 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
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index df82093bd91fe977a23dbef3f69241721ea482fe..01dbe49f4d48151f84488a9ec51375b58de152db 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -385,6 +385,8 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
sync_tree->SetLatencyInfo(latency_info_);
latency_info_.Clear();
+ sync_tree->PassSwapPromises(&swap_promise_list_);
+
host_impl->SetViewportSize(device_viewport_size_);
host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_);
host_impl->SetDeviceScaleFactor(device_scale_factor_);
@@ -1268,4 +1270,21 @@ bool LayerTreeHost::ScheduleMicroBenchmark(
benchmark_name, value.Pass(), callback);
}
+void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) {
+ if (proxy_->HasImplThread()) {
+ DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested());
+ }
+ if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber)
+ BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW);
+ swap_promise_list_.push_back(swap_promise.Pass());
+}
+
+void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
+ for (size_t i = 0; i < swap_promise_list_.size(); i++) {
+ DCHECK(swap_promise_list_[i]);
danakj 2013/11/26 16:24:37 Can you DCHECK this when they are added (QueueSwap
Yufeng Shen (Slow to review) 2013/11/26 17:30:34 Done.
+ swap_promise_list_[i]->DidNotSwap(reason);
+ }
+ swap_promise_list_.clear();
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698