OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/layers/empty_content_layer_client.h" | 10 #include "cc/layers/empty_content_layer_client.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 if (layer_tree_src->outer_viewport_scroll_layer()) { | 203 if (layer_tree_src->outer_viewport_scroll_layer()) { |
204 EXPECT_EQ(layer_tree_src->outer_viewport_scroll_layer()->id(), | 204 EXPECT_EQ(layer_tree_src->outer_viewport_scroll_layer()->id(), |
205 layer_tree_dst->outer_viewport_scroll_layer()->id()); | 205 layer_tree_dst->outer_viewport_scroll_layer()->id()); |
206 } else { | 206 } else { |
207 EXPECT_FALSE(layer_tree_dst->outer_viewport_scroll_layer()); | 207 EXPECT_FALSE(layer_tree_dst->outer_viewport_scroll_layer()); |
208 } | 208 } |
209 EXPECT_EQ(layer_tree_src->inputs_.selection, | 209 EXPECT_EQ(layer_tree_src->inputs_.selection, |
210 layer_tree_dst->inputs_.selection); | 210 layer_tree_dst->inputs_.selection); |
211 EXPECT_EQ(layer_tree_src->property_trees_, layer_tree_dst->property_trees_); | 211 EXPECT_EQ(layer_tree_src->property_trees_, layer_tree_dst->property_trees_); |
212 EXPECT_EQ(layer_tree_host_src_->surface_client_id_, | |
213 layer_tree_host_dst_->surface_client_id_); | |
214 EXPECT_EQ(layer_tree_host_src_->next_surface_sequence_, | |
215 layer_tree_host_dst_->next_surface_sequence_); | |
216 | 212 |
217 // All layers must have a property tree index that matches PropertyTrees. | 213 // All layers must have a property tree index that matches PropertyTrees. |
218 if (layer_tree_dst->property_trees_.sequence_number) { | 214 if (layer_tree_dst->property_trees_.sequence_number) { |
219 int seq_num = layer_tree_dst->property_trees_.sequence_number; | 215 int seq_num = layer_tree_dst->property_trees_.sequence_number; |
220 LayerTreeHostCommon::CallFunctionForEveryLayer( | 216 LayerTreeHostCommon::CallFunctionForEveryLayer( |
221 layer_tree_host_dst_->GetLayerTree(), [seq_num](Layer* layer) { | 217 layer_tree_host_dst_->GetLayerTree(), [seq_num](Layer* layer) { |
222 EXPECT_EQ(seq_num, layer->property_tree_sequence_number()); | 218 EXPECT_EQ(seq_num, layer->property_tree_sequence_number()); |
223 }); | 219 }); |
224 } | 220 } |
225 } | 221 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 290 |
295 LayerSelectionBound sel_bound; | 291 LayerSelectionBound sel_bound; |
296 sel_bound.edge_top = gfx::Point(14, 3); | 292 sel_bound.edge_top = gfx::Point(14, 3); |
297 LayerSelection selection; | 293 LayerSelection selection; |
298 selection.start = sel_bound; | 294 selection.start = sel_bound; |
299 layer_tree_src->inputs_.selection = selection; | 295 layer_tree_src->inputs_.selection = selection; |
300 | 296 |
301 layer_tree_src->property_trees_.sequence_number = | 297 layer_tree_src->property_trees_.sequence_number = |
302 layer_tree_src->property_trees_.sequence_number * 3 + 1; | 298 layer_tree_src->property_trees_.sequence_number * 3 + 1; |
303 | 299 |
304 layer_tree_host_src_->surface_client_id_ = | |
305 layer_tree_host_src_->surface_client_id_ * 3 + 1; | |
306 layer_tree_host_src_->next_surface_sequence_ = | |
307 layer_tree_host_src_->next_surface_sequence_ * 3 + 1; | |
308 | |
309 VerifySerializationAndDeserialization(); | 300 VerifySerializationAndDeserialization(); |
310 } | 301 } |
311 | 302 |
312 void RunLayersChangedTest() { | 303 void RunLayersChangedTest() { |
313 // Just fake setup a layer for both source and dest. | 304 // Just fake setup a layer for both source and dest. |
314 scoped_refptr<Layer> root_layer_src = Layer::Create(); | 305 scoped_refptr<Layer> root_layer_src = Layer::Create(); |
315 layer_tree_host_src_->SetRootLayer(root_layer_src); | 306 layer_tree_host_src_->SetRootLayer(root_layer_src); |
316 layer_tree_host_dst_->SetRootLayer(Layer::Create()); | 307 layer_tree_host_dst_->SetRootLayer(Layer::Create()); |
317 root_layer_src->SetDoubleSided(!root_layer_src->double_sided()); | 308 root_layer_src->SetDoubleSided(!root_layer_src->double_sided()); |
318 | 309 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 454 |
464 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) { | 455 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) { |
465 RunAddAndRemoveNodeFromLayerTree(); | 456 RunAddAndRemoveNodeFromLayerTree(); |
466 } | 457 } |
467 | 458 |
468 TEST_F(LayerTreeHostSerializationTest, PictureLayerMultipleSerializations) { | 459 TEST_F(LayerTreeHostSerializationTest, PictureLayerMultipleSerializations) { |
469 RunPictureLayerMultipleSerializationsTest(); | 460 RunPictureLayerMultipleSerializationsTest(); |
470 } | 461 } |
471 | 462 |
472 } // namespace cc | 463 } // namespace cc |
OLD | NEW |