| Index: cc/trees/layer_tree_host.cc
|
| diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
|
| index 6c9ee0534528bc3867dc5895c2062124224300da..7c0a42e334f3e646ce39d94f69524bd5c356c858 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->TakeSwapPromises(&swap_promise_list_);
|
| +
|
| host_impl->SetViewportSize(device_viewport_size_);
|
| host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_);
|
| host_impl->SetDeviceScaleFactor(device_scale_factor_);
|
| @@ -1264,4 +1266,27 @@ 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::FinishSwapPromises() {
|
| + for (size_t i = 0; i < swap_promise_list_.size(); i++) {
|
| + swap_promise_list_[i]->DidSwap();
|
| + }
|
| + swap_promise_list_.clear();
|
| +}
|
| +
|
| +void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
|
| + for (size_t i = 0; i < swap_promise_list_.size(); i++) {
|
| + swap_promise_list_[i]->DidNotSwap(reason);
|
| + }
|
| + swap_promise_list_.clear();
|
| +}
|
| +
|
| } // namespace cc
|
|
|