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

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

Issue 1864183002: cc: Main thread skip single layers instead of subtrees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Format the comments 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 29 matching lines...) Expand all
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::CallFunctionForEveryLayer( 49 LayerTreeHostCommon::CallFunctionForEveryLayer(
50 root_layer->layer_tree_host(), [root_layer](Layer* layer) { 50 root_layer->layer_tree_host(),
51 [root_layer](Layer* layer) {
51 DCHECK(layer->layer_tree_host()); 52 DCHECK(layer->layer_tree_host());
52 EXPECT_EQ(layer, layer->layer_tree_host()->LayerById(layer->id())); 53 EXPECT_EQ(layer, layer->layer_tree_host()->LayerById(layer->id()));
53 }); 54 },
55 CallFunctionLayerType::ALL_LAYERS);
54 } 56 }
55 57
56 void VerifySerializationAndDeserialization() { 58 void VerifySerializationAndDeserialization() {
57 proto::LayerTreeHost proto; 59 proto::LayerTreeHost proto;
58 60
59 std::unordered_set<Layer*> layers_that_should_push_properties_src = 61 std::unordered_set<Layer*> layers_that_should_push_properties_src =
60 layer_tree_host_src_->LayersThatShouldPushProperties(); 62 layer_tree_host_src_->LayersThatShouldPushProperties();
61 layer_tree_host_src_->ToProtobufForCommit(&proto); 63 layer_tree_host_src_->ToProtobufForCommit(&proto);
62 layer_tree_host_dst_->FromProtobufForCommit(proto); 64 layer_tree_host_dst_->FromProtobufForCommit(proto);
63 65
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 layer_tree_host_dst_->property_trees_); 167 layer_tree_host_dst_->property_trees_);
166 EXPECT_EQ(layer_tree_host_src_->surface_id_namespace_, 168 EXPECT_EQ(layer_tree_host_src_->surface_id_namespace_,
167 layer_tree_host_dst_->surface_id_namespace_); 169 layer_tree_host_dst_->surface_id_namespace_);
168 EXPECT_EQ(layer_tree_host_src_->next_surface_sequence_, 170 EXPECT_EQ(layer_tree_host_src_->next_surface_sequence_,
169 layer_tree_host_dst_->next_surface_sequence_); 171 layer_tree_host_dst_->next_surface_sequence_);
170 172
171 // All layers must have a property tree index that matches PropertyTrees. 173 // All layers must have a property tree index that matches PropertyTrees.
172 if (layer_tree_host_dst_->property_trees_.sequence_number) { 174 if (layer_tree_host_dst_->property_trees_.sequence_number) {
173 int seq_num = layer_tree_host_dst_->property_trees_.sequence_number; 175 int seq_num = layer_tree_host_dst_->property_trees_.sequence_number;
174 LayerTreeHostCommon::CallFunctionForEveryLayer( 176 LayerTreeHostCommon::CallFunctionForEveryLayer(
175 layer_tree_host_dst_.get(), [seq_num](Layer* layer) { 177 layer_tree_host_dst_.get(),
178 [seq_num](Layer* layer) {
176 EXPECT_EQ(seq_num, layer->property_tree_sequence_number()); 179 EXPECT_EQ(seq_num, layer->property_tree_sequence_number());
177 }); 180 },
181 CallFunctionLayerType::ALL_LAYERS);
178 } 182 }
179 } 183 }
180 184
181 void RunAllMembersChangedTest() { 185 void RunAllMembersChangedTest() {
182 layer_tree_host_src_->needs_full_tree_sync_ = 186 layer_tree_host_src_->needs_full_tree_sync_ =
183 !layer_tree_host_src_->needs_full_tree_sync_; 187 !layer_tree_host_src_->needs_full_tree_sync_;
184 layer_tree_host_src_->needs_meta_info_recomputation_ = 188 layer_tree_host_src_->needs_meta_info_recomputation_ =
185 !layer_tree_host_src_->needs_meta_info_recomputation_; 189 !layer_tree_host_src_->needs_meta_info_recomputation_;
186 layer_tree_host_src_->source_frame_number_ *= 3; 190 layer_tree_host_src_->source_frame_number_ *= 3;
187 layer_tree_host_src_->meta_information_sequence_number_ *= 3; 191 layer_tree_host_src_->meta_information_sequence_number_ *= 3;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 370
367 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) { 371 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) {
368 RunLayersChangedMultipleSerializations(); 372 RunLayersChangedMultipleSerializations();
369 } 373 }
370 374
371 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) { 375 TEST_F(LayerTreeHostSerializationTest, AddAndRemoveNodeFromLayerTree) {
372 RunAddAndRemoveNodeFromLayerTree(); 376 RunAddAndRemoveNodeFromLayerTree();
373 } 377 }
374 378
375 } // namespace cc 379 } // 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