Chromium Code Reviews| 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..ca99d42fe02853791527bd97e8001d9f6d15d2dc 100644 |
| --- a/cc/trees/layer_tree_host.cc |
| +++ b/cc/trees/layer_tree_host.cc |
| @@ -51,7 +51,9 @@ inline int GetNextTreeId() { |
| base::AutoLock lock(s_next_tree_id_lock.Get()); |
| return s_next_tree_id++; |
| } |
| -} |
| + |
| +const size_t kMaxQueuedSwapPromiseSize = 100; |
| +} // namespace |
| namespace cc { |
| @@ -385,6 +387,8 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { |
| sync_tree->SetLatencyInfo(latency_info_); |
| latency_info_.Clear(); |
| + sync_tree->TakeSwapPromise(&swap_promise_list_); |
|
danakj
2013/11/13 23:22:09
This sounds like we're taking the swap promises fr
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
hmmm, "take" reads more correctly to me than "pass
danakj
2013/11/20 03:00:55
I think insert_and_take() says "insert these thing
Yufeng Shen (Slow to review)
2013/11/20 19:15:41
Done.
|
| + |
| host_impl->SetViewportSize(device_viewport_size_); |
| host_impl->SetOverdrawBottomHeight(overdraw_bottom_height_); |
| host_impl->SetDeviceScaleFactor(device_scale_factor_); |
| @@ -1264,4 +1268,33 @@ bool LayerTreeHost::ScheduleMicroBenchmark( |
| benchmark_name, value.Pass(), callback); |
| } |
| +void LayerTreeHost::QueueSwapPromise(SwapPromise* swap_promise) { |
| + if (proxy_->HasImplThread()) { |
| + DCHECK(proxy_->CommitRequested() || proxy_->BeginMainFrameRequested()); |
| + } |
| + if (swap_promise_list_.size() > kMaxQueuedSwapPromiseSize) { |
| + NOTREACHED() << "LayerTreeHost::swap_promise_list overflows"; |
|
danakj
2013/11/13 23:22:09
If you expect this to be hit validly, then don't N
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
|
| + BreakSwapPromise(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); |
| + } |
| + swap_promise_list_.push_back(swap_promise); |
| +} |
| + |
| +bool LayerTreeHost::HasQueuedSwapPromise() { |
| + return !swap_promise_list_.empty(); |
| +} |
| + |
| +void LayerTreeHost::FinishSwapPromise() { |
|
danakj
2013/11/13 23:22:09
FinishSwapPromises?
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
|
| + for (size_t i = 0; i < swap_promise_list_.size(); i++) { |
| + swap_promise_list_[i]->DidSwap(); |
| + } |
| + swap_promise_list_.clear(); |
| +} |
| + |
| +void LayerTreeHost::BreakSwapPromise(SwapPromise::DidNotSwapReason reason) { |
|
danakj
2013/11/13 23:22:09
BreakSwapPromises?
Yufeng Shen (Slow to review)
2013/11/14 22:09:55
Done.
|
| + for (size_t i = 0; i < swap_promise_list_.size(); i++) { |
| + swap_promise_list_[i]->DidNotSwap(reason); |
| + } |
| + swap_promise_list_.clear(); |
| +} |
| + |
| } // namespace cc |