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

Side by Side Diff: cc/layers/layer_impl_unittest.cc

Issue 1688563002: cc :: Move some tracking of layer_property_changed to main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.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 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "cc/animation/mutable_properties.h" 7 #include "cc/animation/mutable_properties.h"
8 #include "cc/layers/painted_scrollbar_layer_impl.h" 8 #include "cc/layers/painted_scrollbar_layer_impl.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 #include "cc/output/filter_operation.h" 10 #include "cc/output/filter_operation.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // they are used. 157 // they are used.
158 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 158 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
159 root->SetUpdateRect(arbitrary_rect)); 159 root->SetUpdateRect(arbitrary_rect));
160 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(arbitrary_size)); 160 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(arbitrary_size));
161 161
162 // Changing these properties affects the entire subtree of layers. 162 // Changing these properties affects the entire subtree of layers.
163 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( 163 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
164 root->SetTransformOrigin(arbitrary_point_3f)); 164 root->SetTransformOrigin(arbitrary_point_3f));
165 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters)); 165 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters));
166 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(FilterOperations())); 166 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(FilterOperations()));
167 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
168 root->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 9)));
169 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMasksToBounds(true));
170 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetContentsOpaque(true));
171 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
172 root->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 10)));
173 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitrary_point_f)); 167 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitrary_point_f));
174 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetShouldFlattenTransform(false));
175 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->Set3dSortingContextId(1));
176 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
177 root->SetDoubleSided(false)); // constructor initializes it to "true".
178 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d)); 168 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d));
179 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollDelta(gfx::Vector2d())); 169 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollDelta(gfx::Vector2d()));
180 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->PushScrollOffsetFromMainThread( 170 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->PushScrollOffsetFromMainThread(
181 gfx::ScrollOffset(arbitrary_vector2d))); 171 gfx::ScrollOffset(arbitrary_vector2d)));
182 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true));
183 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetOpacity(arbitrary_number)); 172 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetOpacity(arbitrary_number));
184 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBlendMode(arbitrary_blend_mode));
185 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTransform(arbitrary_transform)); 173 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTransform(arbitrary_transform));
186 174
187 // Changing these properties only affects the layer itself. 175 // Changing these properties only affects the layer itself.
188 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true)); 176 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true));
189 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 177 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
190 root->SetBackgroundColor(arbitrary_color)); 178 root->SetBackgroundColor(arbitrary_color));
191 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 179 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
192 root->SetBackgroundFilters(arbitrary_filters)); 180 root->SetBackgroundFilters(arbitrary_filters));
193 181
194 // Special case: check that SetBounds changes behavior depending on 182 // Special case: check that SetBounds changes behavior depending on
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 layer->SetScrollDelta(arbitrary_vector2d)); 319 layer->SetScrollDelta(arbitrary_vector2d));
332 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 320 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
333 layer->SetScrollDelta(arbitrary_vector2d)); 321 layer->SetScrollDelta(arbitrary_vector2d));
334 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->PushScrollOffsetFromMainThread( 322 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->PushScrollOffsetFromMainThread(
335 gfx::ScrollOffset(arbitrary_vector2d))); 323 gfx::ScrollOffset(arbitrary_vector2d)));
336 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->PushScrollOffsetFromMainThread( 324 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->PushScrollOffsetFromMainThread(
337 gfx::ScrollOffset(arbitrary_vector2d))); 325 gfx::ScrollOffset(arbitrary_vector2d)));
338 326
339 // Unrelated functions, always set to new values, always set needs update. 327 // Unrelated functions, always set to new values, always set needs update.
340 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 328 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
341 layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4))); 329 layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4));
330 layer->NoteLayerPropertyChanged());
342 host_impl.active_tree()->BuildPropertyTreesForTesting(); 331 host_impl.active_tree()->BuildPropertyTreesForTesting();
343 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); 332 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true);
344 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); 333 layer->NoteLayerPropertyChanged());
334 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true);
335 layer->NoteLayerPropertyChanged());
345 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 336 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
346 layer->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5))); 337 layer->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5));
338 layer->NoteLayerPropertyChanged());
347 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f)); 339 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f));
348 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetShouldFlattenTransform(false)); 340 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetShouldFlattenTransform(false);
349 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); 341 layer->NoteLayerPropertyChanged());
342 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1);
343 layer->NoteLayerPropertyChanged());
350 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 344 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
351 layer->SetDoubleSided(false)); // constructor initializes it to "true". 345 layer->SetDoubleSided(false); // constructor initializes it to "true".
346 layer->NoteLayerPropertyChanged());
352 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 347 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
353 layer->SetBackgroundColor(arbitrary_color)); 348 layer->SetBackgroundColor(arbitrary_color));
354 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 349 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
355 layer->SetBackgroundFilters(arbitrary_filters)); 350 layer->SetBackgroundFilters(arbitrary_filters));
356 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number)); 351 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number));
357 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 352 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBlendMode(arbitrary_blend_mode);
358 layer->SetBlendMode(arbitrary_blend_mode)); 353 layer->NoteLayerPropertyChanged());
359 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetTransform(arbitrary_transform)); 354 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetTransform(arbitrary_transform));
360 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 355 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
361 356
362 // Unrelated functions, set to the same values, no needs update. 357 // Unrelated functions, set to the same values, no needs update.
363 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 358 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
364 layer->SetIsRootForIsolatedGroup(true)); 359 layer->SetIsRootForIsolatedGroup(true));
365 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetFilters(arbitrary_filters)); 360 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetFilters(arbitrary_filters));
366 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); 361 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true));
367 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); 362 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true));
368 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 363 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 596
602 pending_layer->PushPropertiesTo(layer()); 597 pending_layer->PushPropertiesTo(layer());
603 598
604 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 599 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
605 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 600 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
606 pending_layer->CurrentScrollOffset()); 601 pending_layer->CurrentScrollOffset());
607 } 602 }
608 603
609 } // namespace 604 } // namespace
610 } // namespace cc 605 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698