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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 contents_textures_purged_(false), | 87 contents_textures_purged_(false), |
88 requires_high_res_to_draw_(false), | 88 requires_high_res_to_draw_(false), |
89 viewport_size_invalid_(false), | 89 viewport_size_invalid_(false), |
90 needs_update_draw_properties_(true), | 90 needs_update_draw_properties_(true), |
91 needs_full_tree_sync_(true), | 91 needs_full_tree_sync_(true), |
92 next_activation_forces_redraw_(false), | 92 next_activation_forces_redraw_(false), |
93 render_surface_layer_list_id_(0) { | 93 render_surface_layer_list_id_(0) { |
94 } | 94 } |
95 | 95 |
96 LayerTreeImpl::~LayerTreeImpl() { | 96 LayerTreeImpl::~LayerTreeImpl() { |
| 97 BreakSwapPromises(SwapPromise::SWAP_FAILS); |
| 98 |
97 // Need to explicitly clear the tree prior to destroying this so that | 99 // Need to explicitly clear the tree prior to destroying this so that |
98 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 100 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
99 DCHECK(!root_layer_); | 101 DCHECK(!root_layer_); |
100 DCHECK(layers_with_copy_output_request_.empty()); | 102 DCHECK(layers_with_copy_output_request_.empty()); |
101 } | 103 } |
102 | 104 |
103 void LayerTreeImpl::Shutdown() { root_layer_.reset(); } | 105 void LayerTreeImpl::Shutdown() { root_layer_.reset(); } |
104 | 106 |
105 void LayerTreeImpl::ReleaseResources() { | 107 void LayerTreeImpl::ReleaseResources() { |
106 if (root_layer_) | 108 if (root_layer_) |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 if (layer == OuterViewportScrollLayer()) | 918 if (layer == OuterViewportScrollLayer()) |
917 return outer_viewport_offset; | 919 return outer_viewport_offset; |
918 | 920 |
919 inner_viewport_offset = delegate_offset - outer_viewport_offset; | 921 inner_viewport_offset = delegate_offset - outer_viewport_offset; |
920 | 922 |
921 return inner_viewport_offset; | 923 return inner_viewport_offset; |
922 } | 924 } |
923 | 925 |
924 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { | 926 void LayerTreeImpl::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { |
925 DCHECK(swap_promise); | 927 DCHECK(swap_promise); |
926 if (swap_promise_list_.size() > kMaxQueuedSwapPromiseNumber) | |
927 BreakSwapPromises(SwapPromise::SWAP_PROMISE_LIST_OVERFLOW); | |
928 swap_promise_list_.push_back(swap_promise.Pass()); | 928 swap_promise_list_.push_back(swap_promise.Pass()); |
929 } | 929 } |
930 | 930 |
931 void LayerTreeImpl::PassSwapPromises( | 931 void LayerTreeImpl::PassSwapPromises( |
932 ScopedPtrVector<SwapPromise>* new_swap_promise) { | 932 ScopedPtrVector<SwapPromise>* new_swap_promise) { |
933 swap_promise_list_.insert_and_take(swap_promise_list_.end(), | 933 swap_promise_list_.insert_and_take(swap_promise_list_.end(), |
934 *new_swap_promise); | 934 *new_swap_promise); |
935 new_swap_promise->clear(); | 935 new_swap_promise->clear(); |
936 } | 936 } |
937 | 937 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 | 1310 |
1311 void LayerTreeImpl::RegisterPictureLayerImpl(PictureLayerImpl* layer) { | 1311 void LayerTreeImpl::RegisterPictureLayerImpl(PictureLayerImpl* layer) { |
1312 layer_tree_host_impl_->RegisterPictureLayerImpl(layer); | 1312 layer_tree_host_impl_->RegisterPictureLayerImpl(layer); |
1313 } | 1313 } |
1314 | 1314 |
1315 void LayerTreeImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 1315 void LayerTreeImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
1316 layer_tree_host_impl_->UnregisterPictureLayerImpl(layer); | 1316 layer_tree_host_impl_->UnregisterPictureLayerImpl(layer); |
1317 } | 1317 } |
1318 | 1318 |
1319 } // namespace cc | 1319 } // namespace cc |
OLD | NEW |