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