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> |
| 11 #include <iterator> | |
| 11 #include <limits> | 12 #include <limits> |
| 12 #include <set> | 13 #include <set> |
| 13 | 14 |
| 14 #include "base/containers/adapters.h" | 15 #include "base/containers/adapters.h" |
| 15 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/timer/elapsed_timer.h" | 17 #include "base/timer/elapsed_timer.h" |
| 17 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 18 #include "base/trace_event/trace_event_argument.h" | 19 #include "base/trace_event/trace_event_argument.h" |
| 19 #include "cc/animation/animation_host.h" | 20 #include "cc/animation/animation_host.h" |
| 20 #include "cc/base/histograms.h" | 21 #include "cc/base/histograms.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 // This needs to be called early so that we don't clamp with incorrect max | 418 // This needs to be called early so that we don't clamp with incorrect max |
| 418 // offsets when UpdateViewportContainerSizes is called from e.g. | 419 // offsets when UpdateViewportContainerSizes is called from e.g. |
| 419 // PushTopControls | 420 // PushTopControls |
| 420 target_tree->UpdatePropertyTreesForBoundsDelta(); | 421 target_tree->UpdatePropertyTreesForBoundsDelta(); |
| 421 | 422 |
| 422 if (next_activation_forces_redraw_) { | 423 if (next_activation_forces_redraw_) { |
| 423 target_tree->ForceRedrawNextActivation(); | 424 target_tree->ForceRedrawNextActivation(); |
| 424 next_activation_forces_redraw_ = false; | 425 next_activation_forces_redraw_ = false; |
| 425 } | 426 } |
| 426 | 427 |
| 427 target_tree->PassSwapPromises(&swap_promise_list_); | 428 target_tree->PassSwapPromises(std::move(swap_promise_list_)); |
| 428 | 429 |
| 429 target_tree->set_top_controls_shrink_blink_size( | 430 target_tree->set_top_controls_shrink_blink_size( |
| 430 top_controls_shrink_blink_size_); | 431 top_controls_shrink_blink_size_); |
| 431 target_tree->set_top_controls_height(top_controls_height_); | 432 target_tree->set_top_controls_height(top_controls_height_); |
| 432 target_tree->PushTopControls(nullptr); | 433 target_tree->PushTopControls(nullptr); |
| 433 | 434 |
| 434 // Active tree already shares the page_scale_factor object with pending | 435 // Active tree already shares the page_scale_factor object with pending |
| 435 // tree so only the limits need to be provided. | 436 // tree so only the limits need to be provided. |
| 436 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), | 437 target_tree->PushPageScaleFactorAndLimits(nullptr, min_page_scale_factor(), |
| 437 max_page_scale_factor()); | 438 max_page_scale_factor()); |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1476 } | 1477 } |
| 1477 | 1478 |
| 1478 void LayerTreeImpl::QueuePinnedSwapPromise( | 1479 void LayerTreeImpl::QueuePinnedSwapPromise( |
| 1479 std::unique_ptr<SwapPromise> swap_promise) { | 1480 std::unique_ptr<SwapPromise> swap_promise) { |
| 1480 DCHECK(IsActiveTree()); | 1481 DCHECK(IsActiveTree()); |
| 1481 DCHECK(swap_promise); | 1482 DCHECK(swap_promise); |
| 1482 pinned_swap_promise_list_.push_back(std::move(swap_promise)); | 1483 pinned_swap_promise_list_.push_back(std::move(swap_promise)); |
| 1483 } | 1484 } |
| 1484 | 1485 |
| 1485 void LayerTreeImpl::PassSwapPromises( | 1486 void LayerTreeImpl::PassSwapPromises( |
| 1486 std::vector<std::unique_ptr<SwapPromise>>* new_swap_promise) { | 1487 std::vector<std::unique_ptr<SwapPromise>> new_swap_promises) { |
| 1487 for (const auto& swap_promise : swap_promise_list_) | 1488 for (const auto& swap_promise : swap_promise_list_) |
| 1488 swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS); | 1489 swap_promise->DidNotSwap(SwapPromise::SWAP_FAILS); |
| 1489 swap_promise_list_.clear(); | 1490 swap_promise_list_.clear(); |
| 1490 swap_promise_list_.swap(*new_swap_promise); | 1491 swap_promise_list_.swap(new_swap_promises); |
| 1492 } | |
| 1493 | |
| 1494 void LayerTreeImpl::AppendSwapPromises( | |
| 1495 std::vector<std::unique_ptr<SwapPromise>> new_swap_promises) { | |
| 1496 std::move(new_swap_promises.begin(), new_swap_promises.end(), | |
| 1497 std::back_inserter(swap_promise_list_)); | |
| 1498 new_swap_promises.clear(); | |
|
brianderson
2016/07/28 18:10:53
Is this call to clear needed?
sunnyps
2016/08/02 02:55:09
I believe so because we're moving the individual u
| |
| 1491 } | 1499 } |
| 1492 | 1500 |
| 1493 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { | 1501 void LayerTreeImpl::FinishSwapPromises(CompositorFrameMetadata* metadata) { |
| 1494 for (const auto& swap_promise : swap_promise_list_) | 1502 for (const auto& swap_promise : swap_promise_list_) |
| 1495 swap_promise->DidSwap(metadata); | 1503 swap_promise->DidSwap(metadata); |
| 1496 swap_promise_list_.clear(); | 1504 swap_promise_list_.clear(); |
| 1497 for (const auto& swap_promise : pinned_swap_promise_list_) | 1505 for (const auto& swap_promise : pinned_swap_promise_list_) |
| 1498 swap_promise->DidSwap(metadata); | 1506 swap_promise->DidSwap(metadata); |
| 1499 pinned_swap_promise_list_.clear(); | 1507 pinned_swap_promise_list_.clear(); |
| 1500 } | 1508 } |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2033 | 2041 |
| 2034 void LayerTreeImpl::ResetAllChangeTracking() { | 2042 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2035 layers_that_should_push_properties_.clear(); | 2043 layers_that_should_push_properties_.clear(); |
| 2036 // Iterate over all layers, including masks and replicas. | 2044 // Iterate over all layers, including masks and replicas. |
| 2037 for (auto& layer : *layers_) | 2045 for (auto& layer : *layers_) |
| 2038 layer->ResetChangeTracking(); | 2046 layer->ResetChangeTracking(); |
| 2039 property_trees_.ResetAllChangeTracking(); | 2047 property_trees_.ResetAllChangeTracking(); |
| 2040 } | 2048 } |
| 2041 | 2049 |
| 2042 } // namespace cc | 2050 } // namespace cc |
| OLD | NEW |