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 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 | 1478 |
1479 void LayerTreeImpl::QueuePinnedSwapPromise( | 1479 void LayerTreeImpl::QueuePinnedSwapPromise( |
1480 std::unique_ptr<SwapPromise> swap_promise) { | 1480 std::unique_ptr<SwapPromise> swap_promise) { |
1481 DCHECK(IsActiveTree()); | 1481 DCHECK(IsActiveTree()); |
1482 DCHECK(swap_promise); | 1482 DCHECK(swap_promise); |
1483 pinned_swap_promise_list_.push_back(std::move(swap_promise)); | 1483 pinned_swap_promise_list_.push_back(std::move(swap_promise)); |
1484 } | 1484 } |
1485 | 1485 |
1486 void LayerTreeImpl::PassSwapPromises( | 1486 void LayerTreeImpl::PassSwapPromises( |
1487 std::vector<std::unique_ptr<SwapPromise>> new_swap_promises) { | 1487 std::vector<std::unique_ptr<SwapPromise>> new_swap_promises) { |
1488 for (const auto& swap_promise : swap_promise_list_) | 1488 for (auto& swap_promise : swap_promise_list_) { |
1489 swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS); | 1489 if (swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS) == |
| 1490 SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { |
| 1491 // |swap_promise| must remain active, so place it in |new_swap_promises| |
| 1492 // in order to keep it alive and active. |
| 1493 new_swap_promises.push_back(std::move(swap_promise)); |
| 1494 } |
| 1495 } |
1490 swap_promise_list_.clear(); | 1496 swap_promise_list_.clear(); |
1491 swap_promise_list_.swap(new_swap_promises); | 1497 swap_promise_list_.swap(new_swap_promises); |
1492 } | 1498 } |
1493 | 1499 |
1494 void LayerTreeImpl::AppendSwapPromises( | 1500 void LayerTreeImpl::AppendSwapPromises( |
1495 std::vector<std::unique_ptr<SwapPromise>> new_swap_promises) { | 1501 std::vector<std::unique_ptr<SwapPromise>> new_swap_promises) { |
1496 std::move(new_swap_promises.begin(), new_swap_promises.end(), | 1502 std::move(new_swap_promises.begin(), new_swap_promises.end(), |
1497 std::back_inserter(swap_promise_list_)); | 1503 std::back_inserter(swap_promise_list_)); |
1498 new_swap_promises.clear(); | 1504 new_swap_promises.clear(); |
1499 } | 1505 } |
1500 | 1506 |
1501 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { | 1507 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { |
1502 for (const auto& swap_promise : swap_promise_list_) | 1508 for (const auto& swap_promise : swap_promise_list_) |
1503 swap_promise->DidSwap(metadata); | 1509 swap_promise->DidSwap(metadata); |
1504 swap_promise_list_.clear(); | 1510 swap_promise_list_.clear(); |
1505 for (const auto& swap_promise : pinned_swap_promise_list_) | 1511 for (const auto& swap_promise : pinned_swap_promise_list_) |
1506 swap_promise->DidSwap(metadata); | 1512 swap_promise->DidSwap(metadata); |
1507 pinned_swap_promise_list_.clear(); | 1513 pinned_swap_promise_list_.clear(); |
1508 } | 1514 } |
1509 | 1515 |
1510 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1516 void LayerTreeImpl::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1511 for (const auto& swap_promise : swap_promise_list_) | 1517 { |
1512 swap_promise->DidNotSwap(reason); | 1518 std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises; |
1513 swap_promise_list_.clear(); | 1519 for (auto& swap_promise : swap_promise_list_) { |
1514 for (const auto& swap_promise : pinned_swap_promise_list_) | 1520 if (swap_promise->DidNotSwap(reason) == |
1515 swap_promise->DidNotSwap(reason); | 1521 SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { |
1516 pinned_swap_promise_list_.clear(); | 1522 persistent_swap_promises.push_back(std::move(swap_promise)); |
| 1523 } |
| 1524 } |
| 1525 // |persistent_swap_promises| must remain active even when swap fails. |
| 1526 swap_promise_list_ = std::move(persistent_swap_promises); |
| 1527 } |
| 1528 |
| 1529 { |
| 1530 std::vector<std::unique_ptr<SwapPromise>> persistent_swap_promises; |
| 1531 for (auto& swap_promise : pinned_swap_promise_list_) { |
| 1532 if (swap_promise->DidNotSwap(reason) == |
| 1533 SwapPromise::DidNotSwapAction::KEEP_ACTIVE) { |
| 1534 persistent_swap_promises.push_back(std::move(swap_promise)); |
| 1535 } |
| 1536 } |
| 1537 |
| 1538 // |persistent_swap_promises| must remain active even when swap fails. |
| 1539 pinned_swap_promise_list_ = std::move(persistent_swap_promises); |
| 1540 } |
1517 } | 1541 } |
1518 | 1542 |
1519 void LayerTreeImpl::DidModifyTilePriorities() { | 1543 void LayerTreeImpl::DidModifyTilePriorities() { |
1520 layer_tree_host_impl_->DidModifyTilePriorities(); | 1544 layer_tree_host_impl_->DidModifyTilePriorities(); |
1521 } | 1545 } |
1522 | 1546 |
1523 void LayerTreeImpl::set_ui_resource_request_queue( | 1547 void LayerTreeImpl::set_ui_resource_request_queue( |
1524 const UIResourceRequestQueue& queue) { | 1548 const UIResourceRequestQueue& queue) { |
1525 ui_resource_request_queue_ = queue; | 1549 ui_resource_request_queue_ = queue; |
1526 } | 1550 } |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 | 2065 |
2042 void LayerTreeImpl::ResetAllChangeTracking() { | 2066 void LayerTreeImpl::ResetAllChangeTracking() { |
2043 layers_that_should_push_properties_.clear(); | 2067 layers_that_should_push_properties_.clear(); |
2044 // Iterate over all layers, including masks and replicas. | 2068 // Iterate over all layers, including masks and replicas. |
2045 for (auto& layer : *layers_) | 2069 for (auto& layer : *layers_) |
2046 layer->ResetChangeTracking(); | 2070 layer->ResetChangeTracking(); |
2047 property_trees_.ResetAllChangeTracking(); | 2071 property_trees_.ResetAllChangeTracking(); |
2048 } | 2072 } |
2049 | 2073 |
2050 } // namespace cc | 2074 } // namespace cc |
OLD | NEW |