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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 layer_tree_host_dst_->GetLayerTree()->in_paint_layer_contents_ = false; | 86 layer_tree_host_dst_->GetLayerTree()->in_paint_layer_contents_ = false; |
87 | 87 |
88 // Need to reset LayerTreeHost pointers before tear down. | 88 // Need to reset LayerTreeHost pointers before tear down. |
89 layer_tree_host_src_ = nullptr; | 89 layer_tree_host_src_ = nullptr; |
90 layer_tree_host_dst_ = nullptr; | 90 layer_tree_host_dst_ = nullptr; |
91 } | 91 } |
92 | 92 |
93 void VerifyHostHasAllExpectedLayersInTree(Layer* root_layer) { | 93 void VerifyHostHasAllExpectedLayersInTree(Layer* root_layer) { |
94 LayerTreeHostCommon::CallFunctionForEveryLayer( | 94 LayerTreeHostCommon::CallFunctionForEveryLayer( |
95 root_layer->GetLayerTree(), [root_layer](Layer* layer) { | 95 root_layer->GetLayerTree(), [root_layer](Layer* layer) { |
96 DCHECK(layer->layer_tree_host()); | 96 DCHECK(layer->GetLayerTreeHostForTesting()); |
97 EXPECT_EQ(layer, layer->GetLayerTree()->LayerById(layer->id())); | 97 EXPECT_EQ(layer, layer->GetLayerTree()->LayerById(layer->id())); |
98 }); | 98 }); |
99 } | 99 } |
100 | 100 |
101 void VerifySerializationAndDeserialization() { | 101 void VerifySerializationAndDeserialization() { |
102 proto::LayerTreeHost proto; | 102 proto::LayerTreeHost proto; |
103 LayerTree* layer_tree_src = layer_tree_host_src_->GetLayerTree(); | 103 LayerTree* layer_tree_src = layer_tree_host_src_->GetLayerTree(); |
104 LayerTree* layer_tree_dst = layer_tree_host_dst_->GetLayerTree(); | 104 LayerTree* layer_tree_dst = layer_tree_host_dst_->GetLayerTree(); |
105 | 105 |
106 std::unordered_set<Layer*> layers_that_should_push_properties_src = | 106 std::unordered_set<Layer*> layers_that_should_push_properties_src = |
107 layer_tree_src->LayersThatShouldPushProperties(); | 107 layer_tree_src->LayersThatShouldPushProperties(); |
108 std::vector<std::unique_ptr<SwapPromise>> swap_promises; | 108 std::vector<std::unique_ptr<SwapPromise>> swap_promises; |
109 layer_tree_host_src_->ToProtobufForCommit(&proto, &swap_promises); | 109 layer_tree_host_src_->ToProtobufForCommit(&proto, &swap_promises); |
110 layer_tree_host_dst_->FromProtobufForCommit(proto); | 110 layer_tree_host_dst_->FromProtobufForCommit(proto); |
111 | 111 |
112 EXPECT_EQ(layer_tree_src->needs_full_tree_sync_, | 112 EXPECT_EQ(layer_tree_src->needs_full_tree_sync_, |
113 layer_tree_dst->needs_full_tree_sync_); | 113 layer_tree_dst->needs_full_tree_sync_); |
114 EXPECT_EQ(layer_tree_src->needs_meta_info_recomputation_, | 114 EXPECT_EQ(layer_tree_src->needs_meta_info_recomputation_, |
115 layer_tree_dst->needs_meta_info_recomputation_); | 115 layer_tree_dst->needs_meta_info_recomputation_); |
116 EXPECT_EQ(layer_tree_host_src_->source_frame_number_, | 116 EXPECT_EQ(layer_tree_host_src_->source_frame_number_, |
117 layer_tree_host_dst_->source_frame_number_); | 117 layer_tree_host_dst_->source_frame_number_); |
118 EXPECT_EQ(layer_tree_host_src_->root_layer()->id(), | 118 EXPECT_EQ(layer_tree_host_src_->root_layer()->id(), |
119 layer_tree_host_dst_->root_layer()->id()); | 119 layer_tree_host_dst_->root_layer()->id()); |
120 EXPECT_EQ(layer_tree_host_dst_.get(), | 120 EXPECT_EQ(layer_tree_host_dst_.get(), |
121 layer_tree_dst->inputs_.root_layer->layer_tree_host()); | 121 layer_tree_dst->inputs_.root_layer->GetLayerTreeHostForTesting()); |
122 EXPECT_EQ(layer_tree_src->inputs_.root_layer->double_sided(), | 122 EXPECT_EQ(layer_tree_src->inputs_.root_layer->double_sided(), |
123 layer_tree_dst->inputs_.root_layer->double_sided()); | 123 layer_tree_dst->inputs_.root_layer->double_sided()); |
124 EXPECT_EQ( | 124 EXPECT_EQ( |
125 layer_tree_host_src_->debug_state_.show_replica_screen_space_rects, | 125 layer_tree_host_src_->debug_state_.show_replica_screen_space_rects, |
126 layer_tree_host_dst_->debug_state_.show_replica_screen_space_rects); | 126 layer_tree_host_dst_->debug_state_.show_replica_screen_space_rects); |
127 EXPECT_EQ(layer_tree_src->inputs_.device_viewport_size, | 127 EXPECT_EQ(layer_tree_src->inputs_.device_viewport_size, |
128 layer_tree_dst->inputs_.device_viewport_size); | 128 layer_tree_dst->inputs_.device_viewport_size); |
129 EXPECT_EQ(layer_tree_src->inputs_.top_controls_shrink_blink_size, | 129 EXPECT_EQ(layer_tree_src->inputs_.top_controls_shrink_blink_size, |
130 layer_tree_dst->inputs_.top_controls_shrink_blink_size); | 130 layer_tree_dst->inputs_.top_controls_shrink_blink_size); |
131 EXPECT_EQ(layer_tree_src->inputs_.top_controls_height, | 131 EXPECT_EQ(layer_tree_src->inputs_.top_controls_height, |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 454 |
455 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) { | 455 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) { |
456 RunAddAndRemoveNodeFromLayerTree(); | 456 RunAddAndRemoveNodeFromLayerTree(); |
457 } | 457 } |
458 | 458 |
459 TEST_F(LayerTreeHostSerializationTest, PictureLayerMultipleSerializations) { | 459 TEST_F(LayerTreeHostSerializationTest, PictureLayerMultipleSerializations) { |
460 RunPictureLayerMultipleSerializationsTest(); | 460 RunPictureLayerMultipleSerializationsTest(); |
461 } | 461 } |
462 | 462 |
463 } // namespace cc | 463 } // namespace cc |
OLD | NEW |