Chromium Code Reviews| Index: cc/trees/layer_tree_impl.cc |
| diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc |
| index ff5da70a7e7ec633092d56de8cc7282b1316b21e..d3bb71896ee419289e06694ae27735f0994a0387 100644 |
| --- a/cc/trees/layer_tree_impl.cc |
| +++ b/cc/trees/layer_tree_impl.cc |
| @@ -1483,11 +1483,17 @@ void LayerTreeImpl::QueuePinnedSwapPromise( |
| } |
| void LayerTreeImpl::PassSwapPromises( |
| - std::vector<std::unique_ptr<SwapPromise>>* new_swap_promise) { |
| - for (const auto& swap_promise : swap_promise_list_) |
| - swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS); |
| + std::vector<std::unique_ptr<SwapPromise>>* new_swap_promises) { |
| + for (auto& swap_promise : swap_promise_list_) { |
| + if (swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS) == |
| + SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { |
| + // |swap_promise| must remain active, so place it to |new_swap_promises| |
|
danakj
2016/08/10 01:04:15
"place it in"
svartmetal
2016/08/10 17:38:22
Done.
|
| + // in order to keep it alive and active. |
| + new_swap_promises->push_back(std::move(swap_promise)); |
| + } |
| + } |
| swap_promise_list_.clear(); |
| - swap_promise_list_.swap(*new_swap_promise); |
| + swap_promise_list_.swap(*new_swap_promises); |
| } |
| void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { |
| @@ -1500,12 +1506,30 @@ void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { |
| } |
| void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| - for (const auto& swap_promise : swap_promise_list_) |
| - swap_promise->DidNotSwap(reason); |
| - swap_promise_list_.clear(); |
| - for (const auto& swap_promise : pinned_swap_promise_list_) |
| - swap_promise->DidNotSwap(reason); |
| - pinned_swap_promise_list_.clear(); |
| + { |
| + std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises; |
| + for (auto& swap_promise : swap_promise_list_) { |
| + if (swap_promise->DidNotSwap(reason) == |
| + SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { |
| + persistent_swap_promises.push_back(std::move(swap_promise)); |
| + } |
| + } |
| + // |persistent_swap_promises| must remain active even when swap fails. |
| + swap_promise_list_.swap(persistent_swap_promises); |
|
danakj
2016/08/10 01:04:15
nit: swap_promise_list_ = std::move(persistent_swa
svartmetal
2016/08/10 17:38:22
Done.
|
| + } |
| + |
| + { |
| + std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises; |
| + for (auto& swap_promise : pinned_swap_promise_list_) { |
| + if (swap_promise->DidNotSwap(reason) == |
| + SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { |
| + persistent_swap_promises.push_back(std::move(swap_promise)); |
| + } |
| + } |
| + |
| + // |persistent_swap_promises| must remain active even when swap fails. |
| + pinned_swap_promise_list_.swap(persistent_swap_promises); |
|
danakj
2016/08/10 01:04:15
ditto
svartmetal
2016/08/10 17:38:21
Done.
|
| + } |
| } |
| void LayerTreeImpl::DidModifyTilePriorities() { |