| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 433 } |
| 434 | 434 |
| 435 LayerListIterator<LayerImpl> LayerTreeImpl::begin() { | 435 LayerListIterator<LayerImpl> LayerTreeImpl::begin() { |
| 436 return LayerListIterator<LayerImpl>(root_layer_); | 436 return LayerListIterator<LayerImpl>(root_layer_); |
| 437 } | 437 } |
| 438 | 438 |
| 439 LayerListIterator<LayerImpl> LayerTreeImpl::end() { | 439 LayerListIterator<LayerImpl> LayerTreeImpl::end() { |
| 440 return LayerListIterator<LayerImpl>(nullptr); | 440 return LayerListIterator<LayerImpl>(nullptr); |
| 441 } | 441 } |
| 442 | 442 |
| 443 const LayerListIterator<LayerImpl> LayerTreeImpl::begin() const { |
| 444 return LayerListIterator<LayerImpl>(root_layer_); |
| 445 } |
| 446 |
| 447 const LayerListIterator<LayerImpl> LayerTreeImpl::end() const { |
| 448 return LayerListIterator<LayerImpl>(nullptr); |
| 449 } |
| 450 |
| 443 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rbegin() { | 451 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rbegin() { |
| 444 return LayerListReverseIterator<LayerImpl>(root_layer_); | 452 return LayerListReverseIterator<LayerImpl>(root_layer_); |
| 445 } | 453 } |
| 446 | 454 |
| 447 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rend() { | 455 LayerListReverseIterator<LayerImpl> LayerTreeImpl::rend() { |
| 448 return LayerListReverseIterator<LayerImpl>(nullptr); | 456 return LayerListReverseIterator<LayerImpl>(nullptr); |
| 449 } | 457 } |
| 450 | 458 |
| 451 void LayerTreeImpl::AddToElementMap(LayerImpl* layer) { | 459 void LayerTreeImpl::AddToElementMap(LayerImpl* layer) { |
| 452 if (!layer->element_id() || !layer->mutable_properties()) | 460 if (!layer->element_id() || !layer->mutable_properties()) |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 continue; | 1268 continue; |
| 1261 LayerImpl* layer_impl = *it; | 1269 LayerImpl* layer_impl = *it; |
| 1262 layer_impl->GetAllPrioritizedTilesForTracing(prioritized_tiles); | 1270 layer_impl->GetAllPrioritizedTilesForTracing(prioritized_tiles); |
| 1263 } | 1271 } |
| 1264 } | 1272 } |
| 1265 | 1273 |
| 1266 void LayerTreeImpl::AsValueInto(base::trace_event::TracedValue* state) const { | 1274 void LayerTreeImpl::AsValueInto(base::trace_event::TracedValue* state) const { |
| 1267 TracedValue::MakeDictIntoImplicitSnapshot(state, "cc::LayerTreeImpl", this); | 1275 TracedValue::MakeDictIntoImplicitSnapshot(state, "cc::LayerTreeImpl", this); |
| 1268 state->SetInteger("source_frame_number", source_frame_number_); | 1276 state->SetInteger("source_frame_number", source_frame_number_); |
| 1269 | 1277 |
| 1270 state->BeginDictionary("root_layer"); | |
| 1271 root_layer_->AsValueInto(state); | |
| 1272 state->EndDictionary(); | |
| 1273 | |
| 1274 state->BeginArray("render_surface_layer_list"); | 1278 state->BeginArray("render_surface_layer_list"); |
| 1275 LayerIterator end = LayerIterator::End(&render_surface_layer_list_); | 1279 LayerIterator end = LayerIterator::End(&render_surface_layer_list_); |
| 1276 for (LayerIterator it = LayerIterator::Begin(&render_surface_layer_list_); | 1280 for (LayerIterator it = LayerIterator::Begin(&render_surface_layer_list_); |
| 1277 it != end; ++it) { | 1281 it != end; ++it) { |
| 1278 if (!it.represents_itself()) | 1282 if (!it.represents_itself()) |
| 1279 continue; | 1283 continue; |
| 1280 TracedValue::AppendIDRef(*it, state); | 1284 TracedValue::AppendIDRef(*it, state); |
| 1281 } | 1285 } |
| 1282 state->EndArray(); | 1286 state->EndArray(); |
| 1283 | 1287 |
| 1284 state->BeginArray("swap_promise_trace_ids"); | 1288 state->BeginArray("swap_promise_trace_ids"); |
| 1285 for (const auto& swap_promise : swap_promise_list_) | 1289 for (const auto& swap_promise : swap_promise_list_) |
| 1286 state->AppendDouble(swap_promise->TraceId()); | 1290 state->AppendDouble(swap_promise->TraceId()); |
| 1287 state->EndArray(); | 1291 state->EndArray(); |
| 1288 | 1292 |
| 1289 state->BeginArray("pinned_swap_promise_trace_ids"); | 1293 state->BeginArray("pinned_swap_promise_trace_ids"); |
| 1290 for (const auto& swap_promise : pinned_swap_promise_list_) | 1294 for (const auto& swap_promise : pinned_swap_promise_list_) |
| 1291 state->AppendDouble(swap_promise->TraceId()); | 1295 state->AppendDouble(swap_promise->TraceId()); |
| 1292 state->EndArray(); | 1296 state->EndArray(); |
| 1297 |
| 1298 state->BeginArray("layers"); |
| 1299 for (auto* layer : *this) { |
| 1300 state->BeginDictionary(); |
| 1301 layer->AsValueInto(state); |
| 1302 state->EndDictionary(); |
| 1303 } |
| 1304 state->EndArray(); |
| 1293 } | 1305 } |
| 1294 | 1306 |
| 1295 bool LayerTreeImpl::DistributeRootScrollOffset( | 1307 bool LayerTreeImpl::DistributeRootScrollOffset( |
| 1296 const gfx::ScrollOffset& root_offset) { | 1308 const gfx::ScrollOffset& root_offset) { |
| 1297 if (!InnerViewportScrollLayer()) | 1309 if (!InnerViewportScrollLayer()) |
| 1298 return false; | 1310 return false; |
| 1299 | 1311 |
| 1300 DCHECK(OuterViewportScrollLayer()); | 1312 DCHECK(OuterViewportScrollLayer()); |
| 1301 | 1313 |
| 1302 // If we get here, we have both inner/outer viewports, and need to distribute | 1314 // If we get here, we have both inner/outer viewports, and need to distribute |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 } | 2101 } |
| 2090 | 2102 |
| 2091 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { | 2103 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { |
| 2092 layers_that_should_push_properties_.clear(); | 2104 layers_that_should_push_properties_.clear(); |
| 2093 for (auto* layer : *this) | 2105 for (auto* layer : *this) |
| 2094 layer->ResetChangeTracking(); | 2106 layer->ResetChangeTracking(); |
| 2095 property_trees_.ResetAllChangeTracking(flag); | 2107 property_trees_.ResetAllChangeTracking(flag); |
| 2096 } | 2108 } |
| 2097 | 2109 |
| 2098 } // namespace cc | 2110 } // namespace cc |
| OLD | NEW |