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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 contents_textures_purged_(false), | 86 contents_textures_purged_(false), |
87 requires_high_res_to_draw_(false), | 87 requires_high_res_to_draw_(false), |
88 viewport_size_invalid_(false), | 88 viewport_size_invalid_(false), |
89 needs_update_draw_properties_(true), | 89 needs_update_draw_properties_(true), |
90 needs_full_tree_sync_(true), | 90 needs_full_tree_sync_(true), |
91 next_activation_forces_redraw_(false), | 91 next_activation_forces_redraw_(false), |
92 render_surface_layer_list_id_(0) { | 92 render_surface_layer_list_id_(0) { |
93 } | 93 } |
94 | 94 |
95 LayerTreeImpl::~LayerTreeImpl() { | 95 LayerTreeImpl::~LayerTreeImpl() { |
| 96 BreakSwapPromises(SwapPromise::SWAP_FAILS); |
| 97 |
96 // Need to explicitly clear the tree prior to destroying this so that | 98 // Need to explicitly clear the tree prior to destroying this so that |
97 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 99 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
98 DCHECK(!root_layer_); | 100 DCHECK(!root_layer_); |
99 DCHECK(layers_with_copy_output_request_.empty()); | 101 DCHECK(layers_with_copy_output_request_.empty()); |
100 } | 102 } |
101 | 103 |
102 void LayerTreeImpl::Shutdown() { root_layer_.reset(); } | 104 void LayerTreeImpl::Shutdown() { root_layer_.reset(); } |
103 | 105 |
104 void LayerTreeImpl::ReleaseResources() { | 106 void LayerTreeImpl::ReleaseResources() { |
105 if (root_layer_) | 107 if (root_layer_) |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 if (layer == OuterViewportScrollLayer()) | 900 if (layer == OuterViewportScrollLayer()) |
899 return outer_viewport_offset; | 901 return outer_viewport_offset; |
900 | 902 |
901 inner_viewport_offset = delegate_offset - outer_viewport_offset; | 903 inner_viewport_offset = delegate_offset - outer_viewport_offset; |
902 | 904 |
903 return inner_viewport_offset; | 905 return inner_viewport_offset; |
904 } | 906 } |
905 | 907 |
906 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 908 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
907 DCHECK(swap_promise); | 909 DCHECK(swap_promise); |
908 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
909 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
910 swap_promise_list_.push_back(swap_promise.Pass()); | 910 swap_promise_list_.push_back(swap_promise.Pass()); |
911 } | 911 } |
912 | 912 |
913 void LayerTreeImpl::PassSwapPromises( | 913 void LayerTreeImpl::PassSwapPromises( |
914 ScopedPtrVector<SwapPromise>* new_swap_promise) { | 914 ScopedPtrVector<SwapPromise>* new_swap_promise) { |
915 swap_promise_list_.insert_and_take(swap_promise_list_.end(), | 915 swap_promise_list_.insert_and_take(swap_promise_list_.end(), |
916 *new_swap_promise); | 916 *new_swap_promise); |
917 new_swap_promise->clear(); | 917 new_swap_promise->clear(); |
918 } | 918 } |
919 | 919 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 | 1292 |
1293 void LayerTreeImpl::RegisterPictureLayerImpl(PictureLayerImpl* layer) { | 1293 void LayerTreeImpl::RegisterPictureLayerImpl(PictureLayerImpl* layer) { |
1294 layer_tree_host_impl_->RegisterPictureLayerImpl(layer); | 1294 layer_tree_host_impl_->RegisterPictureLayerImpl(layer); |
1295 } | 1295 } |
1296 | 1296 |
1297 void LayerTreeImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 1297 void LayerTreeImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
1298 layer_tree_host_impl_->UnregisterPictureLayerImpl(layer); | 1298 layer_tree_host_impl_->UnregisterPictureLayerImpl(layer); |
1299 } | 1299 } |
1300 | 1300 |
1301 } // namespace cc | 1301 } // namespace cc |
OLD | NEW |