OLD | NEW |
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/trees/tree_synchronizer.h" | 5 #include "cc/trees/tree_synchronizer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "cc/animation/layer_animation_controller.h" | 15 #include "cc/animation/layer_animation_controller.h" |
16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
17 #include "cc/layers/layer_impl.h" | 17 #include "cc/layers/layer_impl.h" |
18 #include "cc/layers/layer_settings.h" | |
19 #include "cc/test/animation_test_common.h" | 18 #include "cc/test/animation_test_common.h" |
20 #include "cc/test/fake_impl_task_runner_provider.h" | 19 #include "cc/test/fake_impl_task_runner_provider.h" |
21 #include "cc/test/fake_layer_tree_host.h" | 20 #include "cc/test/fake_layer_tree_host.h" |
22 #include "cc/test/fake_rendering_stats_instrumentation.h" | 21 #include "cc/test/fake_rendering_stats_instrumentation.h" |
23 #include "cc/test/test_shared_bitmap_manager.h" | 22 #include "cc/test/test_shared_bitmap_manager.h" |
24 #include "cc/test/test_task_graph_runner.h" | 23 #include "cc/test/test_task_graph_runner.h" |
25 #include "cc/trees/single_thread_proxy.h" | 24 #include "cc/trees/single_thread_proxy.h" |
26 #include "cc/trees/task_runner_provider.h" | 25 #include "cc/trees/task_runner_provider.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
28 | 27 |
(...skipping 19 matching lines...) Expand all Loading... |
48 MockLayerImpl(LayerTreeImpl* tree_impl, int layer_id) | 47 MockLayerImpl(LayerTreeImpl* tree_impl, int layer_id) |
49 : LayerImpl(tree_impl, layer_id), | 48 : LayerImpl(tree_impl, layer_id), |
50 layer_impl_destruction_list_(NULL) {} | 49 layer_impl_destruction_list_(NULL) {} |
51 | 50 |
52 std::vector<int>* layer_impl_destruction_list_; | 51 std::vector<int>* layer_impl_destruction_list_; |
53 }; | 52 }; |
54 | 53 |
55 class MockLayer : public Layer { | 54 class MockLayer : public Layer { |
56 public: | 55 public: |
57 static scoped_refptr<MockLayer> Create( | 56 static scoped_refptr<MockLayer> Create( |
58 const LayerSettings& settings, | |
59 std::vector<int>* layer_impl_destruction_list) { | 57 std::vector<int>* layer_impl_destruction_list) { |
60 return make_scoped_refptr( | 58 return make_scoped_refptr(new MockLayer(layer_impl_destruction_list)); |
61 new MockLayer(settings, layer_impl_destruction_list)); | |
62 } | 59 } |
63 | 60 |
64 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { | 61 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { |
65 return MockLayerImpl::Create(tree_impl, layer_id_); | 62 return MockLayerImpl::Create(tree_impl, layer_id_); |
66 } | 63 } |
67 | 64 |
68 void PushPropertiesTo(LayerImpl* layer_impl) override { | 65 void PushPropertiesTo(LayerImpl* layer_impl) override { |
69 Layer::PushPropertiesTo(layer_impl); | 66 Layer::PushPropertiesTo(layer_impl); |
70 | 67 |
71 MockLayerImpl* mock_layer_impl = static_cast<MockLayerImpl*>(layer_impl); | 68 MockLayerImpl* mock_layer_impl = static_cast<MockLayerImpl*>(layer_impl); |
72 mock_layer_impl->SetLayerImplDestructionList(layer_impl_destruction_list_); | 69 mock_layer_impl->SetLayerImplDestructionList(layer_impl_destruction_list_); |
73 } | 70 } |
74 | 71 |
75 private: | 72 private: |
76 explicit MockLayer(const LayerSettings& settings, | 73 explicit MockLayer(std::vector<int>* layer_impl_destruction_list) |
77 std::vector<int>* layer_impl_destruction_list) | 74 : Layer(), layer_impl_destruction_list_(layer_impl_destruction_list) {} |
78 : Layer(settings), | |
79 layer_impl_destruction_list_(layer_impl_destruction_list) {} | |
80 ~MockLayer() override {} | 75 ~MockLayer() override {} |
81 | 76 |
82 std::vector<int>* layer_impl_destruction_list_; | 77 std::vector<int>* layer_impl_destruction_list_; |
83 }; | 78 }; |
84 | 79 |
85 void ExpectTreesAreIdentical(Layer* layer, | 80 void ExpectTreesAreIdentical(Layer* layer, |
86 LayerImpl* layer_impl, | 81 LayerImpl* layer_impl, |
87 LayerTreeImpl* tree_impl) { | 82 LayerTreeImpl* tree_impl) { |
88 ASSERT_TRUE(layer); | 83 ASSERT_TRUE(layer); |
89 ASSERT_TRUE(layer_impl); | 84 ASSERT_TRUE(layer_impl); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 for (size_t i = 0; i < layer_children.size(); ++i) { | 161 for (size_t i = 0; i < layer_children.size(); ++i) { |
167 SCOPED_TRACE(base::StringPrintf("child layer %" PRIuS, i).c_str()); | 162 SCOPED_TRACE(base::StringPrintf("child layer %" PRIuS, i).c_str()); |
168 ExpectTreesAreIdentical(layer_children[i].get(), | 163 ExpectTreesAreIdentical(layer_children[i].get(), |
169 layer_impl_children[i].get(), tree_impl); | 164 layer_impl_children[i].get(), tree_impl); |
170 } | 165 } |
171 } | 166 } |
172 | 167 |
173 class LayerTreeSettingsForTreeSynchronizerTest : public LayerTreeSettings { | 168 class LayerTreeSettingsForTreeSynchronizerTest : public LayerTreeSettings { |
174 public: | 169 public: |
175 LayerTreeSettingsForTreeSynchronizerTest() { | 170 LayerTreeSettingsForTreeSynchronizerTest() { |
176 use_compositor_animation_timelines = true; | |
177 } | 171 } |
178 }; | 172 }; |
179 | 173 |
180 class TreeSynchronizerTest : public testing::Test { | 174 class TreeSynchronizerTest : public testing::Test { |
181 public: | 175 public: |
182 TreeSynchronizerTest() | 176 TreeSynchronizerTest() |
183 : client_(FakeLayerTreeHostClient::DIRECT_3D), | 177 : client_(FakeLayerTreeHostClient::DIRECT_3D), |
184 host_(FakeLayerTreeHost::Create( | 178 host_(FakeLayerTreeHost::Create( |
185 &client_, | 179 &client_, |
186 &task_graph_runner_, | 180 &task_graph_runner_, |
187 LayerTreeSettingsForTreeSynchronizerTest())) { | 181 LayerTreeSettingsForTreeSynchronizerTest())) { |
188 layer_settings_.use_compositor_animation_timelines = | |
189 host_->settings().use_compositor_animation_timelines; | |
190 } | 182 } |
191 | 183 |
192 protected: | 184 protected: |
193 FakeLayerTreeHostClient client_; | 185 FakeLayerTreeHostClient client_; |
194 TestTaskGraphRunner task_graph_runner_; | 186 TestTaskGraphRunner task_graph_runner_; |
195 scoped_ptr<FakeLayerTreeHost> host_; | 187 scoped_ptr<FakeLayerTreeHost> host_; |
196 LayerSettings layer_settings_; | |
197 | 188 |
198 bool is_equal(ScrollTree::ScrollOffsetMap map, | 189 bool is_equal(ScrollTree::ScrollOffsetMap map, |
199 ScrollTree::ScrollOffsetMap other) { | 190 ScrollTree::ScrollOffsetMap other) { |
200 if (map.size() != other.size()) | 191 if (map.size() != other.size()) |
201 return false; | 192 return false; |
202 for (auto& map_entry : map) { | 193 for (auto& map_entry : map) { |
203 if (other.find(map_entry.first) == other.end()) | 194 if (other.find(map_entry.first) == other.end()) |
204 return false; | 195 return false; |
205 SyncedScrollOffset& from_map = *map_entry.second.get(); | 196 SyncedScrollOffset& from_map = *map_entry.second.get(); |
206 SyncedScrollOffset& from_other = *other[map_entry.first].get(); | 197 SyncedScrollOffset& from_other = *other[map_entry.first].get(); |
(...skipping 13 matching lines...) Expand all Loading... |
220 scoped_ptr<LayerImpl> layer_impl_tree_root = | 211 scoped_ptr<LayerImpl> layer_impl_tree_root = |
221 TreeSynchronizer::SynchronizeTrees( | 212 TreeSynchronizer::SynchronizeTrees( |
222 static_cast<Layer*>(NULL), nullptr, host_->active_tree()); | 213 static_cast<Layer*>(NULL), nullptr, host_->active_tree()); |
223 | 214 |
224 EXPECT_TRUE(!layer_impl_tree_root.get()); | 215 EXPECT_TRUE(!layer_impl_tree_root.get()); |
225 } | 216 } |
226 | 217 |
227 // Constructs a very simple tree and synchronizes it without trying to reuse any | 218 // Constructs a very simple tree and synchronizes it without trying to reuse any |
228 // preexisting layers. | 219 // preexisting layers. |
229 TEST_F(TreeSynchronizerTest, SyncSimpleTreeFromEmpty) { | 220 TEST_F(TreeSynchronizerTest, SyncSimpleTreeFromEmpty) { |
230 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); | 221 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
231 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 222 layer_tree_root->AddChild(Layer::Create()); |
232 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 223 layer_tree_root->AddChild(Layer::Create()); |
233 | 224 |
234 host_->SetRootLayer(layer_tree_root); | 225 host_->SetRootLayer(layer_tree_root); |
235 | 226 |
236 scoped_ptr<LayerImpl> layer_impl_tree_root = | 227 scoped_ptr<LayerImpl> layer_impl_tree_root = |
237 TreeSynchronizer::SynchronizeTrees( | 228 TreeSynchronizer::SynchronizeTrees( |
238 layer_tree_root.get(), nullptr, host_->active_tree()); | 229 layer_tree_root.get(), nullptr, host_->active_tree()); |
239 | 230 |
240 ExpectTreesAreIdentical(layer_tree_root.get(), | 231 ExpectTreesAreIdentical(layer_tree_root.get(), |
241 layer_impl_tree_root.get(), | 232 layer_impl_tree_root.get(), |
242 host_->active_tree()); | 233 host_->active_tree()); |
243 } | 234 } |
244 | 235 |
245 // Constructs a very simple tree and synchronizes it attempting to reuse some | 236 // Constructs a very simple tree and synchronizes it attempting to reuse some |
246 // layers | 237 // layers |
247 TEST_F(TreeSynchronizerTest, SyncSimpleTreeReusingLayers) { | 238 TEST_F(TreeSynchronizerTest, SyncSimpleTreeReusingLayers) { |
248 std::vector<int> layer_impl_destruction_list; | 239 std::vector<int> layer_impl_destruction_list; |
249 | 240 |
250 scoped_refptr<Layer> layer_tree_root = | 241 scoped_refptr<Layer> layer_tree_root = |
251 MockLayer::Create(layer_settings_, &layer_impl_destruction_list); | 242 MockLayer::Create(&layer_impl_destruction_list); |
252 layer_tree_root->AddChild( | 243 layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); |
253 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | 244 layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); |
254 layer_tree_root->AddChild( | |
255 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | |
256 | 245 |
257 host_->SetRootLayer(layer_tree_root); | 246 host_->SetRootLayer(layer_tree_root); |
258 | 247 |
259 scoped_ptr<LayerImpl> layer_impl_tree_root = | 248 scoped_ptr<LayerImpl> layer_impl_tree_root = |
260 TreeSynchronizer::SynchronizeTrees( | 249 TreeSynchronizer::SynchronizeTrees( |
261 layer_tree_root.get(), nullptr, host_->active_tree()); | 250 layer_tree_root.get(), nullptr, host_->active_tree()); |
262 ExpectTreesAreIdentical(layer_tree_root.get(), | 251 ExpectTreesAreIdentical(layer_tree_root.get(), |
263 layer_impl_tree_root.get(), | 252 layer_impl_tree_root.get(), |
264 host_->active_tree()); | 253 host_->active_tree()); |
265 | 254 |
266 // We have to push properties to pick up the destruction list pointer. | 255 // We have to push properties to pick up the destruction list pointer. |
267 TreeSynchronizer::PushProperties(layer_tree_root.get(), | 256 TreeSynchronizer::PushProperties(layer_tree_root.get(), |
268 layer_impl_tree_root.get()); | 257 layer_impl_tree_root.get()); |
269 | 258 |
270 // Add a new layer to the Layer side | 259 // Add a new layer to the Layer side |
271 layer_tree_root->children()[0]->AddChild( | 260 layer_tree_root->children()[0]->AddChild( |
272 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | 261 MockLayer::Create(&layer_impl_destruction_list)); |
273 // Remove one. | 262 // Remove one. |
274 layer_tree_root->children()[1]->RemoveFromParent(); | 263 layer_tree_root->children()[1]->RemoveFromParent(); |
275 int second_layer_impl_id = layer_impl_tree_root->children()[1]->id(); | 264 int second_layer_impl_id = layer_impl_tree_root->children()[1]->id(); |
276 | 265 |
277 // Synchronize again. After the sync the trees should be equivalent and we | 266 // Synchronize again. After the sync the trees should be equivalent and we |
278 // should have created and destroyed one LayerImpl. | 267 // should have created and destroyed one LayerImpl. |
279 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( | 268 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( |
280 layer_tree_root.get(), std::move(layer_impl_tree_root), | 269 layer_tree_root.get(), std::move(layer_impl_tree_root), |
281 host_->active_tree()); | 270 host_->active_tree()); |
282 ExpectTreesAreIdentical(layer_tree_root.get(), | 271 ExpectTreesAreIdentical(layer_tree_root.get(), |
283 layer_impl_tree_root.get(), | 272 layer_impl_tree_root.get(), |
284 host_->active_tree()); | 273 host_->active_tree()); |
285 | 274 |
286 ASSERT_EQ(1u, layer_impl_destruction_list.size()); | 275 ASSERT_EQ(1u, layer_impl_destruction_list.size()); |
287 EXPECT_EQ(second_layer_impl_id, layer_impl_destruction_list[0]); | 276 EXPECT_EQ(second_layer_impl_id, layer_impl_destruction_list[0]); |
288 } | 277 } |
289 | 278 |
290 // Constructs a very simple tree and checks that a stacking-order change is | 279 // Constructs a very simple tree and checks that a stacking-order change is |
291 // tracked properly. | 280 // tracked properly. |
292 TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndTrackStackingOrderChange) { | 281 TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndTrackStackingOrderChange) { |
293 std::vector<int> layer_impl_destruction_list; | 282 std::vector<int> layer_impl_destruction_list; |
294 | 283 |
295 // Set up the tree and sync once. child2 needs to be synced here, too, even | 284 // Set up the tree and sync once. child2 needs to be synced here, too, even |
296 // though we remove it to set up the intended scenario. | 285 // though we remove it to set up the intended scenario. |
297 scoped_refptr<Layer> layer_tree_root = | 286 scoped_refptr<Layer> layer_tree_root = |
298 MockLayer::Create(layer_settings_, &layer_impl_destruction_list); | 287 MockLayer::Create(&layer_impl_destruction_list); |
299 scoped_refptr<Layer> child2 = | 288 scoped_refptr<Layer> child2 = MockLayer::Create(&layer_impl_destruction_list); |
300 MockLayer::Create(layer_settings_, &layer_impl_destruction_list); | 289 layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); |
301 layer_tree_root->AddChild( | |
302 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | |
303 layer_tree_root->AddChild(child2); | 290 layer_tree_root->AddChild(child2); |
304 | 291 |
305 host_->SetRootLayer(layer_tree_root); | 292 host_->SetRootLayer(layer_tree_root); |
306 | 293 |
307 scoped_ptr<LayerImpl> layer_impl_tree_root = | 294 scoped_ptr<LayerImpl> layer_impl_tree_root = |
308 TreeSynchronizer::SynchronizeTrees( | 295 TreeSynchronizer::SynchronizeTrees( |
309 layer_tree_root.get(), nullptr, host_->active_tree()); | 296 layer_tree_root.get(), nullptr, host_->active_tree()); |
310 ExpectTreesAreIdentical(layer_tree_root.get(), | 297 ExpectTreesAreIdentical(layer_tree_root.get(), |
311 layer_impl_tree_root.get(), | 298 layer_impl_tree_root.get(), |
312 host_->active_tree()); | 299 host_->active_tree()); |
(...skipping 17 matching lines...) Expand all Loading... |
330 TreeSynchronizer::PushProperties(layer_tree_root.get(), | 317 TreeSynchronizer::PushProperties(layer_tree_root.get(), |
331 layer_impl_tree_root.get()); | 318 layer_impl_tree_root.get()); |
332 | 319 |
333 // Check that the impl thread properly tracked the change. | 320 // Check that the impl thread properly tracked the change. |
334 EXPECT_FALSE(layer_impl_tree_root->LayerPropertyChanged()); | 321 EXPECT_FALSE(layer_impl_tree_root->LayerPropertyChanged()); |
335 EXPECT_FALSE(layer_impl_tree_root->children()[0]->LayerPropertyChanged()); | 322 EXPECT_FALSE(layer_impl_tree_root->children()[0]->LayerPropertyChanged()); |
336 EXPECT_TRUE(layer_impl_tree_root->children()[1]->LayerPropertyChanged()); | 323 EXPECT_TRUE(layer_impl_tree_root->children()[1]->LayerPropertyChanged()); |
337 } | 324 } |
338 | 325 |
339 TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndProperties) { | 326 TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndProperties) { |
340 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); | 327 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
341 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 328 layer_tree_root->AddChild(Layer::Create()); |
342 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 329 layer_tree_root->AddChild(Layer::Create()); |
343 | 330 |
344 host_->SetRootLayer(layer_tree_root); | 331 host_->SetRootLayer(layer_tree_root); |
345 | 332 |
346 // Pick some random properties to set. The values are not important, we're | 333 // Pick some random properties to set. The values are not important, we're |
347 // just testing that at least some properties are making it through. | 334 // just testing that at least some properties are making it through. |
348 gfx::PointF root_position = gfx::PointF(2.3f, 7.4f); | 335 gfx::PointF root_position = gfx::PointF(2.3f, 7.4f); |
349 layer_tree_root->SetPosition(root_position); | 336 layer_tree_root->SetPosition(root_position); |
350 | 337 |
351 float first_child_opacity = 0.25f; | 338 float first_child_opacity = 0.25f; |
352 layer_tree_root->children()[0]->SetOpacity(first_child_opacity); | 339 layer_tree_root->children()[0]->SetOpacity(first_child_opacity); |
(...skipping 30 matching lines...) Expand all Loading... |
383 } | 370 } |
384 | 371 |
385 TEST_F(TreeSynchronizerTest, ReuseLayerImplsAfterStructuralChange) { | 372 TEST_F(TreeSynchronizerTest, ReuseLayerImplsAfterStructuralChange) { |
386 std::vector<int> layer_impl_destruction_list; | 373 std::vector<int> layer_impl_destruction_list; |
387 | 374 |
388 // Set up a tree with this sort of structure: | 375 // Set up a tree with this sort of structure: |
389 // root --- A --- B ---+--- C | 376 // root --- A --- B ---+--- C |
390 // | | 377 // | |
391 // +--- D | 378 // +--- D |
392 scoped_refptr<Layer> layer_tree_root = | 379 scoped_refptr<Layer> layer_tree_root = |
393 MockLayer::Create(layer_settings_, &layer_impl_destruction_list); | 380 MockLayer::Create(&layer_impl_destruction_list); |
394 layer_tree_root->AddChild( | 381 layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); |
395 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | |
396 | 382 |
397 scoped_refptr<Layer> layer_a = layer_tree_root->children()[0].get(); | 383 scoped_refptr<Layer> layer_a = layer_tree_root->children()[0].get(); |
398 layer_a->AddChild( | 384 layer_a->AddChild(MockLayer::Create(&layer_impl_destruction_list)); |
399 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | |
400 | 385 |
401 scoped_refptr<Layer> layer_b = layer_a->children()[0].get(); | 386 scoped_refptr<Layer> layer_b = layer_a->children()[0].get(); |
402 layer_b->AddChild( | 387 layer_b->AddChild(MockLayer::Create(&layer_impl_destruction_list)); |
403 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | |
404 | 388 |
405 scoped_refptr<Layer> layer_c = layer_b->children()[0].get(); | 389 scoped_refptr<Layer> layer_c = layer_b->children()[0].get(); |
406 layer_b->AddChild( | 390 layer_b->AddChild(MockLayer::Create(&layer_impl_destruction_list)); |
407 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | |
408 scoped_refptr<Layer> layer_d = layer_b->children()[1].get(); | 391 scoped_refptr<Layer> layer_d = layer_b->children()[1].get(); |
409 | 392 |
410 host_->SetRootLayer(layer_tree_root); | 393 host_->SetRootLayer(layer_tree_root); |
411 | 394 |
412 scoped_ptr<LayerImpl> layer_impl_tree_root = | 395 scoped_ptr<LayerImpl> layer_impl_tree_root = |
413 TreeSynchronizer::SynchronizeTrees( | 396 TreeSynchronizer::SynchronizeTrees( |
414 layer_tree_root.get(), nullptr, host_->active_tree()); | 397 layer_tree_root.get(), nullptr, host_->active_tree()); |
415 ExpectTreesAreIdentical(layer_tree_root.get(), | 398 ExpectTreesAreIdentical(layer_tree_root.get(), |
416 layer_impl_tree_root.get(), | 399 layer_impl_tree_root.get(), |
417 host_->active_tree()); | 400 host_->active_tree()); |
(...skipping 27 matching lines...) Expand all Loading... |
445 | 428 |
446 EXPECT_EQ(0u, layer_impl_destruction_list.size()); | 429 EXPECT_EQ(0u, layer_impl_destruction_list.size()); |
447 } | 430 } |
448 | 431 |
449 // Constructs a very simple tree, synchronizes it, then synchronizes to a | 432 // Constructs a very simple tree, synchronizes it, then synchronizes to a |
450 // totally new tree. All layers from the old tree should be deleted. | 433 // totally new tree. All layers from the old tree should be deleted. |
451 TEST_F(TreeSynchronizerTest, SyncSimpleTreeThenDestroy) { | 434 TEST_F(TreeSynchronizerTest, SyncSimpleTreeThenDestroy) { |
452 std::vector<int> layer_impl_destruction_list; | 435 std::vector<int> layer_impl_destruction_list; |
453 | 436 |
454 scoped_refptr<Layer> old_layer_tree_root = | 437 scoped_refptr<Layer> old_layer_tree_root = |
455 MockLayer::Create(layer_settings_, &layer_impl_destruction_list); | 438 MockLayer::Create(&layer_impl_destruction_list); |
456 old_layer_tree_root->AddChild( | 439 old_layer_tree_root->AddChild( |
457 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | 440 MockLayer::Create(&layer_impl_destruction_list)); |
458 old_layer_tree_root->AddChild( | 441 old_layer_tree_root->AddChild( |
459 MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); | 442 MockLayer::Create(&layer_impl_destruction_list)); |
460 | 443 |
461 host_->SetRootLayer(old_layer_tree_root); | 444 host_->SetRootLayer(old_layer_tree_root); |
462 | 445 |
463 int old_tree_root_layer_id = old_layer_tree_root->id(); | 446 int old_tree_root_layer_id = old_layer_tree_root->id(); |
464 int old_tree_first_child_layer_id = old_layer_tree_root->children()[0]->id(); | 447 int old_tree_first_child_layer_id = old_layer_tree_root->children()[0]->id(); |
465 int old_tree_second_child_layer_id = old_layer_tree_root->children()[1]->id(); | 448 int old_tree_second_child_layer_id = old_layer_tree_root->children()[1]->id(); |
466 | 449 |
467 scoped_ptr<LayerImpl> layer_impl_tree_root = | 450 scoped_ptr<LayerImpl> layer_impl_tree_root = |
468 TreeSynchronizer::SynchronizeTrees( | 451 TreeSynchronizer::SynchronizeTrees( |
469 old_layer_tree_root.get(), nullptr, host_->active_tree()); | 452 old_layer_tree_root.get(), nullptr, host_->active_tree()); |
470 ExpectTreesAreIdentical(old_layer_tree_root.get(), | 453 ExpectTreesAreIdentical(old_layer_tree_root.get(), |
471 layer_impl_tree_root.get(), | 454 layer_impl_tree_root.get(), |
472 host_->active_tree()); | 455 host_->active_tree()); |
473 | 456 |
474 // We have to push properties to pick up the destruction list pointer. | 457 // We have to push properties to pick up the destruction list pointer. |
475 TreeSynchronizer::PushProperties(old_layer_tree_root.get(), | 458 TreeSynchronizer::PushProperties(old_layer_tree_root.get(), |
476 layer_impl_tree_root.get()); | 459 layer_impl_tree_root.get()); |
477 | 460 |
478 // Remove all children on the Layer side. | 461 // Remove all children on the Layer side. |
479 old_layer_tree_root->RemoveAllChildren(); | 462 old_layer_tree_root->RemoveAllChildren(); |
480 | 463 |
481 // Synchronize again. After the sync all LayerImpls from the old tree should | 464 // Synchronize again. After the sync all LayerImpls from the old tree should |
482 // be deleted. | 465 // be deleted. |
483 scoped_refptr<Layer> new_layer_tree_root = Layer::Create(layer_settings_); | 466 scoped_refptr<Layer> new_layer_tree_root = Layer::Create(); |
484 host_->SetRootLayer(new_layer_tree_root); | 467 host_->SetRootLayer(new_layer_tree_root); |
485 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( | 468 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( |
486 new_layer_tree_root.get(), std::move(layer_impl_tree_root), | 469 new_layer_tree_root.get(), std::move(layer_impl_tree_root), |
487 host_->active_tree()); | 470 host_->active_tree()); |
488 ExpectTreesAreIdentical(new_layer_tree_root.get(), | 471 ExpectTreesAreIdentical(new_layer_tree_root.get(), |
489 layer_impl_tree_root.get(), | 472 layer_impl_tree_root.get(), |
490 host_->active_tree()); | 473 host_->active_tree()); |
491 | 474 |
492 ASSERT_EQ(3u, layer_impl_destruction_list.size()); | 475 ASSERT_EQ(3u, layer_impl_destruction_list.size()); |
493 | 476 |
494 EXPECT_TRUE(std::find(layer_impl_destruction_list.begin(), | 477 EXPECT_TRUE(std::find(layer_impl_destruction_list.begin(), |
495 layer_impl_destruction_list.end(), | 478 layer_impl_destruction_list.end(), |
496 old_tree_root_layer_id) != | 479 old_tree_root_layer_id) != |
497 layer_impl_destruction_list.end()); | 480 layer_impl_destruction_list.end()); |
498 EXPECT_TRUE(std::find(layer_impl_destruction_list.begin(), | 481 EXPECT_TRUE(std::find(layer_impl_destruction_list.begin(), |
499 layer_impl_destruction_list.end(), | 482 layer_impl_destruction_list.end(), |
500 old_tree_first_child_layer_id) != | 483 old_tree_first_child_layer_id) != |
501 layer_impl_destruction_list.end()); | 484 layer_impl_destruction_list.end()); |
502 EXPECT_TRUE(std::find(layer_impl_destruction_list.begin(), | 485 EXPECT_TRUE(std::find(layer_impl_destruction_list.begin(), |
503 layer_impl_destruction_list.end(), | 486 layer_impl_destruction_list.end(), |
504 old_tree_second_child_layer_id) != | 487 old_tree_second_child_layer_id) != |
505 layer_impl_destruction_list.end()); | 488 layer_impl_destruction_list.end()); |
506 } | 489 } |
507 | 490 |
508 // Constructs+syncs a tree with mask, replica, and replica mask layers. | 491 // Constructs+syncs a tree with mask, replica, and replica mask layers. |
509 TEST_F(TreeSynchronizerTest, SyncMaskReplicaAndReplicaMaskLayers) { | 492 TEST_F(TreeSynchronizerTest, SyncMaskReplicaAndReplicaMaskLayers) { |
510 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); | 493 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
511 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 494 layer_tree_root->AddChild(Layer::Create()); |
512 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 495 layer_tree_root->AddChild(Layer::Create()); |
513 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 496 layer_tree_root->AddChild(Layer::Create()); |
514 | 497 |
515 // First child gets a mask layer. | 498 // First child gets a mask layer. |
516 scoped_refptr<Layer> mask_layer = Layer::Create(layer_settings_); | 499 scoped_refptr<Layer> mask_layer = Layer::Create(); |
517 layer_tree_root->children()[0]->SetMaskLayer(mask_layer.get()); | 500 layer_tree_root->children()[0]->SetMaskLayer(mask_layer.get()); |
518 | 501 |
519 // Second child gets a replica layer. | 502 // Second child gets a replica layer. |
520 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings_); | 503 scoped_refptr<Layer> replica_layer = Layer::Create(); |
521 layer_tree_root->children()[1]->SetReplicaLayer(replica_layer.get()); | 504 layer_tree_root->children()[1]->SetReplicaLayer(replica_layer.get()); |
522 | 505 |
523 // Third child gets a replica layer with a mask layer. | 506 // Third child gets a replica layer with a mask layer. |
524 scoped_refptr<Layer> replica_layer_with_mask = Layer::Create(layer_settings_); | 507 scoped_refptr<Layer> replica_layer_with_mask = Layer::Create(); |
525 scoped_refptr<Layer> replica_mask_layer = Layer::Create(layer_settings_); | 508 scoped_refptr<Layer> replica_mask_layer = Layer::Create(); |
526 replica_layer_with_mask->SetMaskLayer(replica_mask_layer.get()); | 509 replica_layer_with_mask->SetMaskLayer(replica_mask_layer.get()); |
527 layer_tree_root->children()[2]-> | 510 layer_tree_root->children()[2]-> |
528 SetReplicaLayer(replica_layer_with_mask.get()); | 511 SetReplicaLayer(replica_layer_with_mask.get()); |
529 | 512 |
530 host_->SetRootLayer(layer_tree_root); | 513 host_->SetRootLayer(layer_tree_root); |
531 | 514 |
532 scoped_ptr<LayerImpl> layer_impl_tree_root = | 515 scoped_ptr<LayerImpl> layer_impl_tree_root = |
533 TreeSynchronizer::SynchronizeTrees( | 516 TreeSynchronizer::SynchronizeTrees( |
534 layer_tree_root.get(), nullptr, host_->active_tree()); | 517 layer_tree_root.get(), nullptr, host_->active_tree()); |
535 | 518 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { | 551 TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { |
569 LayerTreeSettings settings; | 552 LayerTreeSettings settings; |
570 FakeImplTaskRunnerProvider task_runner_provider; | 553 FakeImplTaskRunnerProvider task_runner_provider; |
571 FakeRenderingStatsInstrumentation stats_instrumentation; | 554 FakeRenderingStatsInstrumentation stats_instrumentation; |
572 TestSharedBitmapManager shared_bitmap_manager; | 555 TestSharedBitmapManager shared_bitmap_manager; |
573 TestTaskGraphRunner task_graph_runner; | 556 TestTaskGraphRunner task_graph_runner; |
574 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( | 557 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( |
575 settings, nullptr, &task_runner_provider, &stats_instrumentation, | 558 settings, nullptr, &task_runner_provider, &stats_instrumentation, |
576 &shared_bitmap_manager, nullptr, &task_graph_runner, 0); | 559 &shared_bitmap_manager, nullptr, &task_graph_runner, 0); |
577 | 560 |
578 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); | 561 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
579 scoped_refptr<Layer> scroll_parent = Layer::Create(layer_settings_); | 562 scoped_refptr<Layer> scroll_parent = Layer::Create(); |
580 layer_tree_root->AddChild(scroll_parent); | 563 layer_tree_root->AddChild(scroll_parent); |
581 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 564 layer_tree_root->AddChild(Layer::Create()); |
582 layer_tree_root->AddChild(Layer::Create(layer_settings_)); | 565 layer_tree_root->AddChild(Layer::Create()); |
583 | 566 |
584 host_->SetRootLayer(layer_tree_root); | 567 host_->SetRootLayer(layer_tree_root); |
585 | 568 |
586 // First child is the second and third child's scroll parent. | 569 // First child is the second and third child's scroll parent. |
587 layer_tree_root->children()[1]->SetScrollParent(scroll_parent.get()); | 570 layer_tree_root->children()[1]->SetScrollParent(scroll_parent.get()); |
588 layer_tree_root->children()[2]->SetScrollParent(scroll_parent.get()); | 571 layer_tree_root->children()[2]->SetScrollParent(scroll_parent.get()); |
589 | 572 |
590 scoped_ptr<LayerImpl> layer_impl_tree_root = | 573 scoped_ptr<LayerImpl> layer_impl_tree_root = |
591 TreeSynchronizer::SynchronizeTrees( | 574 TreeSynchronizer::SynchronizeTrees( |
592 layer_tree_root.get(), nullptr, host_impl->active_tree()); | 575 layer_tree_root.get(), nullptr, host_impl->active_tree()); |
(...skipping 14 matching lines...) Expand all Loading... |
607 TreeSynchronizer::PushProperties(layer_tree_root.get(), | 590 TreeSynchronizer::PushProperties(layer_tree_root.get(), |
608 layer_impl_tree_root.get()); | 591 layer_impl_tree_root.get()); |
609 { | 592 { |
610 SCOPED_TRACE("case two"); | 593 SCOPED_TRACE("case two"); |
611 ExpectTreesAreIdentical(layer_tree_root.get(), | 594 ExpectTreesAreIdentical(layer_tree_root.get(), |
612 layer_impl_tree_root.get(), | 595 layer_impl_tree_root.get(), |
613 host_impl->active_tree()); | 596 host_impl->active_tree()); |
614 } | 597 } |
615 | 598 |
616 // Add an additional scroll layer. | 599 // Add an additional scroll layer. |
617 scoped_refptr<Layer> additional_scroll_child = Layer::Create(layer_settings_); | 600 scoped_refptr<Layer> additional_scroll_child = Layer::Create(); |
618 layer_tree_root->AddChild(additional_scroll_child); | 601 layer_tree_root->AddChild(additional_scroll_child); |
619 additional_scroll_child->SetScrollParent(scroll_parent.get()); | 602 additional_scroll_child->SetScrollParent(scroll_parent.get()); |
620 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( | 603 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( |
621 layer_tree_root.get(), std::move(layer_impl_tree_root), | 604 layer_tree_root.get(), std::move(layer_impl_tree_root), |
622 host_impl->active_tree()); | 605 host_impl->active_tree()); |
623 TreeSynchronizer::PushProperties(layer_tree_root.get(), | 606 TreeSynchronizer::PushProperties(layer_tree_root.get(), |
624 layer_impl_tree_root.get()); | 607 layer_impl_tree_root.get()); |
625 { | 608 { |
626 SCOPED_TRACE("case three"); | 609 SCOPED_TRACE("case three"); |
627 ExpectTreesAreIdentical(layer_tree_root.get(), | 610 ExpectTreesAreIdentical(layer_tree_root.get(), |
628 layer_impl_tree_root.get(), | 611 layer_impl_tree_root.get(), |
629 host_impl->active_tree()); | 612 host_impl->active_tree()); |
630 } | 613 } |
631 } | 614 } |
632 | 615 |
633 TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { | 616 TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { |
634 LayerTreeSettings settings; | 617 LayerTreeSettings settings; |
635 FakeImplTaskRunnerProvider task_runner_provider; | 618 FakeImplTaskRunnerProvider task_runner_provider; |
636 FakeRenderingStatsInstrumentation stats_instrumentation; | 619 FakeRenderingStatsInstrumentation stats_instrumentation; |
637 TestSharedBitmapManager shared_bitmap_manager; | 620 TestSharedBitmapManager shared_bitmap_manager; |
638 TestTaskGraphRunner task_graph_runner; | 621 TestTaskGraphRunner task_graph_runner; |
639 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( | 622 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( |
640 settings, nullptr, &task_runner_provider, &stats_instrumentation, | 623 settings, nullptr, &task_runner_provider, &stats_instrumentation, |
641 &shared_bitmap_manager, nullptr, &task_graph_runner, 0); | 624 &shared_bitmap_manager, nullptr, &task_graph_runner, 0); |
642 | 625 |
643 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); | 626 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
644 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings_); | 627 scoped_refptr<Layer> clip_parent = Layer::Create(); |
645 scoped_refptr<Layer> intervening = Layer::Create(layer_settings_); | 628 scoped_refptr<Layer> intervening = Layer::Create(); |
646 scoped_refptr<Layer> clip_child1 = Layer::Create(layer_settings_); | 629 scoped_refptr<Layer> clip_child1 = Layer::Create(); |
647 scoped_refptr<Layer> clip_child2 = Layer::Create(layer_settings_); | 630 scoped_refptr<Layer> clip_child2 = Layer::Create(); |
648 layer_tree_root->AddChild(clip_parent); | 631 layer_tree_root->AddChild(clip_parent); |
649 clip_parent->AddChild(intervening); | 632 clip_parent->AddChild(intervening); |
650 intervening->AddChild(clip_child1); | 633 intervening->AddChild(clip_child1); |
651 intervening->AddChild(clip_child2); | 634 intervening->AddChild(clip_child2); |
652 | 635 |
653 host_->SetRootLayer(layer_tree_root); | 636 host_->SetRootLayer(layer_tree_root); |
654 | 637 |
655 // First child is the second and third child's scroll parent. | 638 // First child is the second and third child's scroll parent. |
656 clip_child1->SetClipParent(clip_parent.get()); | 639 clip_child1->SetClipParent(clip_parent.get()); |
657 clip_child2->SetClipParent(clip_parent.get()); | 640 clip_child2->SetClipParent(clip_parent.get()); |
(...skipping 14 matching lines...) Expand all Loading... |
672 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( | 655 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( |
673 layer_tree_root.get(), std::move(layer_impl_tree_root), | 656 layer_tree_root.get(), std::move(layer_impl_tree_root), |
674 host_impl->active_tree()); | 657 host_impl->active_tree()); |
675 TreeSynchronizer::PushProperties(layer_tree_root.get(), | 658 TreeSynchronizer::PushProperties(layer_tree_root.get(), |
676 layer_impl_tree_root.get()); | 659 layer_impl_tree_root.get()); |
677 ExpectTreesAreIdentical(layer_tree_root.get(), | 660 ExpectTreesAreIdentical(layer_tree_root.get(), |
678 layer_impl_tree_root.get(), | 661 layer_impl_tree_root.get(), |
679 host_impl->active_tree()); | 662 host_impl->active_tree()); |
680 | 663 |
681 // Add an additional clip child. | 664 // Add an additional clip child. |
682 scoped_refptr<Layer> additional_clip_child = Layer::Create(layer_settings_); | 665 scoped_refptr<Layer> additional_clip_child = Layer::Create(); |
683 intervening->AddChild(additional_clip_child); | 666 intervening->AddChild(additional_clip_child); |
684 additional_clip_child->SetClipParent(clip_parent.get()); | 667 additional_clip_child->SetClipParent(clip_parent.get()); |
685 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( | 668 layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( |
686 layer_tree_root.get(), std::move(layer_impl_tree_root), | 669 layer_tree_root.get(), std::move(layer_impl_tree_root), |
687 host_impl->active_tree()); | 670 host_impl->active_tree()); |
688 TreeSynchronizer::PushProperties(layer_tree_root.get(), | 671 TreeSynchronizer::PushProperties(layer_tree_root.get(), |
689 layer_impl_tree_root.get()); | 672 layer_impl_tree_root.get()); |
690 ExpectTreesAreIdentical(layer_tree_root.get(), | 673 ExpectTreesAreIdentical(layer_tree_root.get(), |
691 layer_impl_tree_root.get(), | 674 layer_impl_tree_root.get(), |
692 host_impl->active_tree()); | 675 host_impl->active_tree()); |
(...skipping 19 matching lines...) Expand all Loading... |
712 TEST_F(TreeSynchronizerTest, SynchronizeCurrentlyScrollingNode) { | 695 TEST_F(TreeSynchronizerTest, SynchronizeCurrentlyScrollingNode) { |
713 LayerTreeSettings settings; | 696 LayerTreeSettings settings; |
714 FakeLayerTreeHostImplClient client; | 697 FakeLayerTreeHostImplClient client; |
715 FakeImplTaskRunnerProvider task_runner_provider; | 698 FakeImplTaskRunnerProvider task_runner_provider; |
716 FakeRenderingStatsInstrumentation stats_instrumentation; | 699 FakeRenderingStatsInstrumentation stats_instrumentation; |
717 TestSharedBitmapManager shared_bitmap_manager; | 700 TestSharedBitmapManager shared_bitmap_manager; |
718 TestTaskGraphRunner task_graph_runner; | 701 TestTaskGraphRunner task_graph_runner; |
719 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); | 702 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); |
720 host_impl->CreatePendingTree(); | 703 host_impl->CreatePendingTree(); |
721 | 704 |
722 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); | 705 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
723 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(layer_settings_); | 706 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); |
724 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings_); | 707 scoped_refptr<Layer> scroll_layer = Layer::Create(); |
725 scoped_refptr<Layer> transient_scroll_clip_layer = | 708 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); |
726 Layer::Create(layer_settings_); | 709 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); |
727 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(layer_settings_); | |
728 | 710 |
729 layer_tree_root->AddChild(transient_scroll_clip_layer); | 711 layer_tree_root->AddChild(transient_scroll_clip_layer); |
730 transient_scroll_clip_layer->AddChild(transient_scroll_layer); | 712 transient_scroll_clip_layer->AddChild(transient_scroll_layer); |
731 transient_scroll_layer->AddChild(scroll_clip_layer); | 713 transient_scroll_layer->AddChild(scroll_clip_layer); |
732 scroll_clip_layer->AddChild(scroll_layer); | 714 scroll_clip_layer->AddChild(scroll_layer); |
733 | 715 |
734 transient_scroll_layer->SetScrollClipLayerId( | 716 transient_scroll_layer->SetScrollClipLayerId( |
735 transient_scroll_clip_layer->id()); | 717 transient_scroll_clip_layer->id()); |
736 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id()); | 718 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id()); |
737 host_->SetRootLayer(layer_tree_root); | 719 host_->SetRootLayer(layer_tree_root); |
(...skipping 23 matching lines...) Expand all Loading... |
761 nullptr); | 743 nullptr); |
762 LayerTreeSettings settings; | 744 LayerTreeSettings settings; |
763 FakeLayerTreeHostImplClient client; | 745 FakeLayerTreeHostImplClient client; |
764 FakeImplTaskRunnerProvider task_runner_provider; | 746 FakeImplTaskRunnerProvider task_runner_provider; |
765 FakeRenderingStatsInstrumentation stats_instrumentation; | 747 FakeRenderingStatsInstrumentation stats_instrumentation; |
766 TestSharedBitmapManager shared_bitmap_manager; | 748 TestSharedBitmapManager shared_bitmap_manager; |
767 TestTaskGraphRunner task_graph_runner; | 749 TestTaskGraphRunner task_graph_runner; |
768 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); | 750 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); |
769 host_impl->CreatePendingTree(); | 751 host_impl->CreatePendingTree(); |
770 | 752 |
771 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); | 753 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
772 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(layer_settings_); | 754 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); |
773 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings_); | 755 scoped_refptr<Layer> scroll_layer = Layer::Create(); |
774 scoped_refptr<Layer> transient_scroll_clip_layer = | 756 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); |
775 Layer::Create(layer_settings_); | 757 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); |
776 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(layer_settings_); | |
777 | 758 |
778 layer_tree_root->AddChild(transient_scroll_clip_layer); | 759 layer_tree_root->AddChild(transient_scroll_clip_layer); |
779 transient_scroll_clip_layer->AddChild(transient_scroll_layer); | 760 transient_scroll_clip_layer->AddChild(transient_scroll_layer); |
780 transient_scroll_layer->AddChild(scroll_clip_layer); | 761 transient_scroll_layer->AddChild(scroll_clip_layer); |
781 scroll_clip_layer->AddChild(scroll_layer); | 762 scroll_clip_layer->AddChild(scroll_layer); |
782 | 763 |
783 transient_scroll_layer->SetScrollClipLayerId( | 764 transient_scroll_layer->SetScrollClipLayerId( |
784 transient_scroll_clip_layer->id()); | 765 transient_scroll_clip_layer->id()); |
785 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id()); | 766 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id()); |
786 transient_scroll_layer->SetScrollOffset(gfx::ScrollOffset(1, 2)); | 767 transient_scroll_layer->SetScrollOffset(gfx::ScrollOffset(1, 2)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 scroll_offset_map[scroll_layer->id()]->PullDeltaForMainThread(); | 829 scroll_offset_map[scroll_layer->id()]->PullDeltaForMainThread(); |
849 scroll_offset_map[scroll_layer->id()]->SetCurrent(gfx::ScrollOffset(40, 50)); | 830 scroll_offset_map[scroll_layer->id()]->SetCurrent(gfx::ScrollOffset(40, 50)); |
850 scroll_offset_map[scroll_layer->id()]->PushFromMainThread( | 831 scroll_offset_map[scroll_layer->id()]->PushFromMainThread( |
851 gfx::ScrollOffset(100, 100)); | 832 gfx::ScrollOffset(100, 100)); |
852 scroll_offset_map[scroll_layer->id()]->PushPendingToActive(); | 833 scroll_offset_map[scroll_layer->id()]->PushPendingToActive(); |
853 EXPECT_TRUE(is_equal(scroll_offset_map, scroll_tree.scroll_offset_map())); | 834 EXPECT_TRUE(is_equal(scroll_offset_map, scroll_tree.scroll_offset_map())); |
854 } | 835 } |
855 | 836 |
856 } // namespace | 837 } // namespace |
857 } // namespace cc | 838 } // namespace cc |
OLD | NEW |