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 SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { | |
1490 // |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.
| |
1491 // in order to keep it alive and active. | |
1492 new_swap_promises->push_back(std::move(swap_promise)); | |
1493 } | |
1494 } | |
1489 swap_promise_list_.clear(); | 1495 swap_promise_list_.clear(); |
1490 swap_promise_list_.swap(*new_swap_promise); | 1496 swap_promise_list_.swap(*new_swap_promises); |
1491 } | 1497 } |
1492 | 1498 |
1493 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { | 1499 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { |
1494 for (const auto& swap_promise : swap_promise_list_) | 1500 for (const auto& swap_promise : swap_promise_list_) |
1495 swap_promise->DidSwap(metadata); | 1501 swap_promise->DidSwap(metadata); |
1496 swap_promise_list_.clear(); | 1502 swap_promise_list_.clear(); |
1497 for (const auto& swap_promise : pinned_swap_promise_list_) | 1503 for (const auto& swap_promise : pinned_swap_promise_list_) |
1498 swap_promise->DidSwap(metadata); | 1504 swap_promise->DidSwap(metadata); |
1499 pinned_swap_promise_list_.clear(); | 1505 pinned_swap_promise_list_.clear(); |
1500 } | 1506 } |
1501 | 1507 |
1502 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1508 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1503 for (const auto& swap_promise : swap_promise_list_) | 1509 { |
1504 swap_promise->DidNotSwap(reason); | 1510 std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises; |
1505 swap_promise_list_.clear(); | 1511 for (auto& swap_promise : swap_promise_list_) { |
1506 for (const auto& swap_promise : pinned_swap_promise_list_) | 1512 if (swap_promise->DidNotSwap(reason) == |
1507 swap_promise->DidNotSwap(reason); | 1513 SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { |
1508 pinned_swap_promise_list_.clear(); | 1514 persistent_swap_promises.push_back(std::move(swap_promise)); |
1515 } | |
1516 } | |
1517 // |persistent_swap_promises| must remain active even when swap fails. | |
1518 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.
| |
1519 } | |
1520 | |
1521 { | |
1522 std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises; | |
1523 for (auto& swap_promise : pinned_swap_promise_list_) { | |
1524 if (swap_promise->DidNotSwap(reason) == | |
1525 SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { | |
1526 persistent_swap_promises.push_back(std::move(swap_promise)); | |
1527 } | |
1528 } | |
1529 | |
1530 // |persistent_swap_promises| must remain active even when swap fails. | |
1531 pinned_swap_promise_list_.swap(persistent_swap_promises); | |
danakj
2016/08/10 01:04:15
ditto
svartmetal
2016/08/10 17:38:21
Done.
| |
1532 } | |
1509 } | 1533 } |
1510 | 1534 |
1511 void LayerTreeImpl::DidModifyTilePriorities() { | 1535 void LayerTreeImpl::DidModifyTilePriorities() { |
1512 layer_tree_host_impl_->DidModifyTilePriorities(); | 1536 layer_tree_host_impl_->DidModifyTilePriorities(); |
1513 } | 1537 } |
1514 | 1538 |
1515 void LayerTreeImpl::set_ui_resource_request_queue( | 1539 void LayerTreeImpl::set_ui_resource_request_queue( |
1516 const UIResourceRequestQueue& queue) { | 1540 const UIResourceRequestQueue& queue) { |
1517 ui_resource_request_queue_ = queue; | 1541 ui_resource_request_queue_ = queue; |
1518 } | 1542 } |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2033 | 2057 |
2034 void LayerTreeImpl::ResetAllChangeTracking() { | 2058 void LayerTreeImpl::ResetAllChangeTracking() { |
2035 layers_that_should_push_properties_.clear(); | 2059 layers_that_should_push_properties_.clear(); |
2036 // Iterate over all layers, including masks and replicas. | 2060 // Iterate over all layers, including masks and replicas. |
2037 for (auto& layer : *layers_) | 2061 for (auto& layer : *layers_) |
2038 layer->ResetChangeTracking(); | 2062 layer->ResetChangeTracking(); |
2039 property_trees_.ResetAllChangeTracking(); | 2063 property_trees_.ResetAllChangeTracking(); |
2040 } | 2064 } |
2041 | 2065 |
2042 } // namespace cc | 2066 } // namespace cc |
OLD | NEW |