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 <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 contents_textures_purged_(false), | 85 contents_textures_purged_(false), |
86 requires_high_res_to_draw_(false), | 86 requires_high_res_to_draw_(false), |
87 viewport_size_invalid_(false), | 87 viewport_size_invalid_(false), |
88 needs_update_draw_properties_(true), | 88 needs_update_draw_properties_(true), |
89 needs_full_tree_sync_(true), | 89 needs_full_tree_sync_(true), |
90 next_activation_forces_redraw_(false), | 90 next_activation_forces_redraw_(false), |
91 render_surface_layer_list_id_(0) { | 91 render_surface_layer_list_id_(0) { |
92 } | 92 } |
93 | 93 |
94 LayerTreeImpl::~LayerTreeImpl() { | 94 LayerTreeImpl::~LayerTreeImpl() { |
| 95 BreakSwapPromises(SwapPromise::DID_NOT_SWAP_UNKNOWN); |
| 96 |
95 // Need to explicitly clear the tree prior to destroying this so that | 97 // Need to explicitly clear the tree prior to destroying this so that |
96 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 98 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
97 DCHECK(!root_layer_); | 99 DCHECK(!root_layer_); |
98 DCHECK(layers_with_copy_output_request_.empty()); | 100 DCHECK(layers_with_copy_output_request_.empty()); |
99 } | 101 } |
100 | 102 |
101 void LayerTreeImpl::Shutdown() { root_layer_.reset(); } | 103 void LayerTreeImpl::Shutdown() { root_layer_.reset(); } |
102 | 104 |
103 void LayerTreeImpl::ReleaseResources() { | 105 void LayerTreeImpl::ReleaseResources() { |
104 if (root_layer_) | 106 if (root_layer_) |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 if (layer == OuterViewportScrollLayer()) | 891 if (layer == OuterViewportScrollLayer()) |
890 return outer_viewport_offset; | 892 return outer_viewport_offset; |
891 | 893 |
892 inner_viewport_offset = delegate_offset - outer_viewport_offset; | 894 inner_viewport_offset = delegate_offset - outer_viewport_offset; |
893 | 895 |
894 return inner_viewport_offset; | 896 return inner_viewport_offset; |
895 } | 897 } |
896 | 898 |
897 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 899 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
898 DCHECK(swap_promise); | 900 DCHECK(swap_promise); |
899 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
900 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
901 swap_promise_list_.push_back(swap_promise.Pass()); | 901 swap_promise_list_.push_back(swap_promise.Pass()); |
902 } | 902 } |
903 | 903 |
904 void LayerTreeImpl::PassSwapPromises( | 904 void LayerTreeImpl::PassSwapPromises( |
905 ScopedPtrVector<SwapPromise>* new_swap_promise) { | 905 ScopedPtrVector<SwapPromise>* new_swap_promise) { |
906 swap_promise_list_.insert_and_take(swap_promise_list_.end(), | 906 swap_promise_list_.insert_and_take(swap_promise_list_.end(), |
907 *new_swap_promise); | 907 *new_swap_promise); |
908 new_swap_promise->clear(); | 908 new_swap_promise->clear(); |
909 } | 909 } |
910 | 910 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPointInTouchHandlerRegion( | 1269 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPointInTouchHandlerRegion( |
1270 const gfx::PointF& screen_space_point) { | 1270 const gfx::PointF& screen_space_point) { |
1271 FindTouchEventLayerFunctor func = {screen_space_point}; | 1271 FindTouchEventLayerFunctor func = {screen_space_point}; |
1272 FindClosestMatchingLayerDataForRecursion data_for_recursion; | 1272 FindClosestMatchingLayerDataForRecursion data_for_recursion; |
1273 FindClosestMatchingLayer( | 1273 FindClosestMatchingLayer( |
1274 screen_space_point, root_layer(), func, &data_for_recursion); | 1274 screen_space_point, root_layer(), func, &data_for_recursion); |
1275 return data_for_recursion.closest_match; | 1275 return data_for_recursion.closest_match; |
1276 } | 1276 } |
1277 | 1277 |
1278 } // namespace cc | 1278 } // namespace cc |
OLD | NEW |