Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: cc/trees/layer_tree_host_unittest_serialization.cc

Issue 1846043002: cc : Make CallFunctionForSubtree on impl use layer iterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/layers/heads_up_display_layer.h" 7 #include "cc/layers/heads_up_display_layer.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/proto/layer.pb.h" 9 #include "cc/proto/layer.pb.h"
10 #include "cc/proto/layer_tree_host.pb.h" 10 #include "cc/proto/layer_tree_host.pb.h"
(...skipping 28 matching lines...) Expand all
39 // Need to reset |in_paint_layer_contents_| to tear down. 39 // Need to reset |in_paint_layer_contents_| to tear down.
40 layer_tree_host_src_->in_paint_layer_contents_ = false; 40 layer_tree_host_src_->in_paint_layer_contents_ = false;
41 layer_tree_host_dst_->in_paint_layer_contents_ = false; 41 layer_tree_host_dst_->in_paint_layer_contents_ = false;
42 42
43 // Need to reset LayerTreeHost pointers before tear down. 43 // Need to reset LayerTreeHost pointers before tear down.
44 layer_tree_host_src_ = nullptr; 44 layer_tree_host_src_ = nullptr;
45 layer_tree_host_dst_ = nullptr; 45 layer_tree_host_dst_ = nullptr;
46 } 46 }
47 47
48 void VerifyHostHasAllExpectedLayersInTree(Layer* root_layer) { 48 void VerifyHostHasAllExpectedLayersInTree(Layer* root_layer) {
49 LayerTreeHostCommon::CallFunctionForSubtree( 49 LayerTreeHostCommon::CallFunctionForEveryLayer(
50 root_layer, [root_layer](Layer* layer) { 50 root_layer->layer_tree_host(), [root_layer](Layer* layer) {
51 DCHECK(layer->layer_tree_host()); 51 DCHECK(layer->layer_tree_host());
52 EXPECT_EQ(layer, layer->layer_tree_host()->LayerById(layer->id())); 52 EXPECT_EQ(layer, layer->layer_tree_host()->LayerById(layer->id()));
53 }); 53 });
54 } 54 }
55 55
56 void VerifySerializationAndDeserialization() { 56 void VerifySerializationAndDeserialization() {
57 proto::LayerTreeHost proto; 57 proto::LayerTreeHost proto;
58 58
59 std::unordered_set<Layer*> layers_that_should_push_properties_src = 59 std::unordered_set<Layer*> layers_that_should_push_properties_src =
60 layer_tree_host_src_->LayersThatShouldPushProperties(); 60 layer_tree_host_src_->LayersThatShouldPushProperties();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 EXPECT_EQ(layer_tree_host_src_->property_trees_, 164 EXPECT_EQ(layer_tree_host_src_->property_trees_,
165 layer_tree_host_dst_->property_trees_); 165 layer_tree_host_dst_->property_trees_);
166 EXPECT_EQ(layer_tree_host_src_->surface_id_namespace_, 166 EXPECT_EQ(layer_tree_host_src_->surface_id_namespace_,
167 layer_tree_host_dst_->surface_id_namespace_); 167 layer_tree_host_dst_->surface_id_namespace_);
168 EXPECT_EQ(layer_tree_host_src_->next_surface_sequence_, 168 EXPECT_EQ(layer_tree_host_src_->next_surface_sequence_,
169 layer_tree_host_dst_->next_surface_sequence_); 169 layer_tree_host_dst_->next_surface_sequence_);
170 170
171 // All layers must have a property tree index that matches PropertyTrees. 171 // All layers must have a property tree index that matches PropertyTrees.
172 if (layer_tree_host_dst_->property_trees_.sequence_number) { 172 if (layer_tree_host_dst_->property_trees_.sequence_number) {
173 int seq_num = layer_tree_host_dst_->property_trees_.sequence_number; 173 int seq_num = layer_tree_host_dst_->property_trees_.sequence_number;
174 LayerTreeHostCommon::CallFunctionForSubtree( 174 LayerTreeHostCommon::CallFunctionForEveryLayer(
175 layer_tree_host_dst_->root_layer_.get(), [seq_num](Layer* layer) { 175 layer_tree_host_dst_.get(), [seq_num](Layer* layer) {
176 EXPECT_EQ(seq_num, layer->property_tree_sequence_number()); 176 EXPECT_EQ(seq_num, layer->property_tree_sequence_number());
177 }); 177 });
178 } 178 }
179 } 179 }
180 180
181 void RunAllMembersChangedTest() { 181 void RunAllMembersChangedTest() {
182 layer_tree_host_src_->needs_full_tree_sync_ = 182 layer_tree_host_src_->needs_full_tree_sync_ =
183 !layer_tree_host_src_->needs_full_tree_sync_; 183 !layer_tree_host_src_->needs_full_tree_sync_;
184 layer_tree_host_src_->needs_meta_info_recomputation_ = 184 layer_tree_host_src_->needs_meta_info_recomputation_ =
185 !layer_tree_host_src_->needs_meta_info_recomputation_; 185 !layer_tree_host_src_->needs_meta_info_recomputation_;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) { 367 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) {
368 RunLayersChangedMultipleSerializations(); 368 RunLayersChangedMultipleSerializations();
369 } 369 }
370 370
371 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) { 371 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) {
372 RunAddAndRemoveNodeFromLayerTree(); 372 RunAddAndRemoveNodeFromLayerTree();
373 } 373 }
374 374
375 } // namespace cc 375 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698