Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1476 } | 1476 } |
| 1477 | 1477 |
| 1478 void LayerTreeImpl::QueuePinnedSwapPromise( | 1478 void LayerTreeImpl::QueuePinnedSwapPromise( |
| 1479 std::unique_ptr<SwapPromise> swap_promise) { | 1479 std::unique_ptr<SwapPromise> swap_promise) { |
| 1480 DCHECK(IsActiveTree()); | 1480 DCHECK(IsActiveTree()); |
| 1481 DCHECK(swap_promise); | 1481 DCHECK(swap_promise); |
| 1482 pinned_swap_promise_list_.push_back(std::move(swap_promise)); | 1482 pinned_swap_promise_list_.push_back(std::move(swap_promise)); |
| 1483 } | 1483 } |
| 1484 | 1484 |
| 1485 void LayerTreeImpl::PassSwapPromises( | 1485 void LayerTreeImpl::PassSwapPromises( |
| 1486 std::vector<std::unique_ptr<SwapPromise>>* new_swap_promise) { | 1486 std::vector<std::unique_ptr<SwapPromise>>* new_swap_promises) { |
| 1487 for (const auto& swap_promise : swap_promise_list_) | 1487 for (auto& swap_promise : swap_promise_list_) { |
| 1488 swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS); | 1488 if (swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS)) { |
| 1489 // |swap_promise| must remain active, so place it to |new_swap_promises| | |
| 1490 // in order to keep it alive. | |
| 1491 new_swap_promises->push_back(std::move(swap_promise)); | |
| 1492 } | |
| 1493 } | |
| 1489 swap_promise_list_.clear(); | 1494 swap_promise_list_.clear(); |
| 1490 swap_promise_list_.swap(*new_swap_promise); | 1495 swap_promise_list_.swap(*new_swap_promises); |
| 1491 } | 1496 } |
| 1492 | 1497 |
| 1493 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { | 1498 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { |
| 1494 for (const auto& swap_promise : swap_promise_list_) | 1499 for (const auto& swap_promise : swap_promise_list_) |
| 1495 swap_promise->DidSwap(metadata); | 1500 swap_promise->DidSwap(metadata); |
| 1496 swap_promise_list_.clear(); | 1501 swap_promise_list_.clear(); |
| 1497 for (const auto& swap_promise : pinned_swap_promise_list_) | 1502 for (const auto& swap_promise : pinned_swap_promise_list_) |
| 1498 swap_promise->DidSwap(metadata); | 1503 swap_promise->DidSwap(metadata); |
| 1499 pinned_swap_promise_list_.clear(); | 1504 pinned_swap_promise_list_.clear(); |
| 1500 } | 1505 } |
| 1501 | 1506 |
| 1502 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1507 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1503 for (const auto& swap_promise : swap_promise_list_) | 1508 { |
| 1504 swap_promise->DidNotSwap(reason); | 1509 std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises; |
| 1505 swap_promise_list_.clear(); | 1510 for (auto& swap_promise : swap_promise_list_) { |
| 1511 if (swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS)) { | |
|
piman
2016/08/03 16:38:55
this should be |reason| instead of |SWAP_FAILS|
svartmetal
2016/08/04 14:58:49
Fixed.
| |
| 1512 persistent_swap_promises.push_back(std::move(swap_promise)); | |
| 1513 } | |
| 1514 } | |
| 1515 // |persistent_swap_promises| will remain active even when swap fails. | |
| 1516 swap_promise_list_.swap(persistent_swap_promises); | |
| 1517 } | |
| 1506 for (const auto& swap_promise : pinned_swap_promise_list_) | 1518 for (const auto& swap_promise : pinned_swap_promise_list_) |
| 1507 swap_promise->DidNotSwap(reason); | 1519 swap_promise->DidNotSwap(reason); |
|
piman
2016/08/03 16:38:55
Should the logic apply here too?
svartmetal
2016/08/04 14:58:48
I think, it should (to be consistent). But maybe w
| |
| 1508 pinned_swap_promise_list_.clear(); | 1520 pinned_swap_promise_list_.clear(); |
| 1509 } | 1521 } |
| 1510 | 1522 |
| 1511 void LayerTreeImpl::DidModifyTilePriorities() { | 1523 void LayerTreeImpl::DidModifyTilePriorities() { |
| 1512 layer_tree_host_impl_->DidModifyTilePriorities(); | 1524 layer_tree_host_impl_->DidModifyTilePriorities(); |
| 1513 } | 1525 } |
| 1514 | 1526 |
| 1515 void LayerTreeImpl::set_ui_resource_request_queue( | 1527 void LayerTreeImpl::set_ui_resource_request_queue( |
| 1516 const UIResourceRequestQueue& queue) { | 1528 const UIResourceRequestQueue& queue) { |
| 1517 ui_resource_request_queue_ = queue; | 1529 ui_resource_request_queue_ = queue; |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2033 | 2045 |
| 2034 void LayerTreeImpl::ResetAllChangeTracking() { | 2046 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2035 layers_that_should_push_properties_.clear(); | 2047 layers_that_should_push_properties_.clear(); |
| 2036 // Iterate over all layers, including masks and replicas. | 2048 // Iterate over all layers, including masks and replicas. |
| 2037 for (auto& layer : *layers_) | 2049 for (auto& layer : *layers_) |
| 2038 layer->ResetChangeTracking(); | 2050 layer->ResetChangeTracking(); |
| 2039 property_trees_.ResetAllChangeTracking(); | 2051 property_trees_.ResetAllChangeTracking(); |
| 2040 } | 2052 } |
| 2041 | 2053 |
| 2042 } // namespace cc | 2054 } // namespace cc |
| OLD | NEW |