Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "cc/test/fake_content_layer_client.h" | 7 #include "cc/test/fake_content_layer_client.h" |
| 8 #include "cc/test/fake_picture_layer.h" | 8 #include "cc/test/fake_picture_layer.h" |
| 9 #include "cc/test/fake_picture_layer_impl.h" | 9 #include "cc/test/fake_picture_layer_impl.h" |
| 10 #include "cc/test/layer_tree_test.h" | 10 #include "cc/test/layer_tree_test.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 } | 29 } |
| 30 | 30 |
| 31 scoped_refptr<FakePictureLayer> root_picture_layer_; | 31 scoped_refptr<FakePictureLayer> root_picture_layer_; |
| 32 FakeContentLayerClient client_; | 32 FakeContentLayerClient client_; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class LayerTreeHostPictureTestTwinLayer | 35 class LayerTreeHostPictureTestTwinLayer |
| 36 : public LayerTreeHostPictureTest { | 36 : public LayerTreeHostPictureTest { |
| 37 void SetupTree() override { | 37 void SetupTree() override { |
| 38 SetupTreeWithSinglePictureLayer(gfx::Size(1, 1)); | 38 SetupTreeWithSinglePictureLayer(gfx::Size(1, 1)); |
| 39 picture_id = root_picture_layer_->id(); | |
| 39 } | 40 } |
| 40 | 41 |
| 41 void BeginTest() override { | 42 void BeginTest() override { |
| 42 activates_ = 0; | 43 activates_ = 0; |
| 43 PostSetNeedsCommitToMainThread(); | 44 PostSetNeedsCommitToMainThread(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 void DidCommit() override { | 47 void DidCommit() override { |
| 47 switch (layer_tree_host()->source_frame_number()) { | 48 switch (layer_tree_host()->source_frame_number()) { |
| 48 case 1: | 49 case 1: |
| 49 // Activate while there are pending and active twins in place. | 50 // Activate while there are pending and active twins in place. |
| 50 layer_tree_host()->SetNeedsCommit(); | 51 layer_tree_host()->SetNeedsCommit(); |
| 51 break; | 52 break; |
| 52 case 2: | 53 case 2: |
| 53 // Drop the picture layer from the tree so the activate will have an | 54 // Drop the picture layer from the tree so the activate will have an |
| 54 // active layer without a pending twin. | 55 // active layer without a pending twin. |
| 55 layer_tree_host()->root_layer()->children()[0]->RemoveFromParent(); | 56 root_picture_layer_->RemoveFromParent(); |
| 56 break; | 57 break; |
| 57 case 3: { | 58 case 3: { |
| 58 // Add a new picture layer so the activate will have a pending layer | 59 // Add a new picture layer so the activate will have a pending layer |
| 59 // without an active twin. | 60 // without an active twin. |
| 60 scoped_refptr<FakePictureLayer> picture = | 61 scoped_refptr<FakePictureLayer> picture = |
| 61 FakePictureLayer::Create(&client_); | 62 FakePictureLayer::Create(&client_); |
| 63 picture_id = picture->id(); | |
|
ajuma
2016/04/20 21:40:52
Changing picture_id on the main thread will access
sunxd
2016/04/21 17:31:16
Done.
| |
| 62 layer_tree_host()->root_layer()->AddChild(picture); | 64 layer_tree_host()->root_layer()->AddChild(picture); |
| 63 break; | 65 break; |
| 64 } | 66 } |
| 65 case 4: | 67 case 4: |
| 66 // Active while there are pending and active twins again. | 68 // Active while there are pending and active twins again. |
| 67 layer_tree_host()->SetNeedsCommit(); | 69 layer_tree_host()->SetNeedsCommit(); |
| 68 break; | 70 break; |
| 69 case 5: | 71 case 5: |
| 70 EndTest(); | 72 EndTest(); |
| 71 break; | 73 break; |
| 72 } | 74 } |
| 73 } | 75 } |
| 74 | 76 |
| 75 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 77 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 76 LayerImpl* pending_root_impl = impl->pending_tree()->root_layer(); | |
| 77 LayerImpl* active_root_impl = impl->active_tree()->root_layer(); | 78 LayerImpl* active_root_impl = impl->active_tree()->root_layer(); |
| 78 | 79 |
| 79 if (pending_root_impl->children().empty()) { | 80 if (!impl->pending_tree()->LayerById(picture_id)) { |
| 80 EXPECT_EQ(2, activates_); | 81 EXPECT_EQ(2, activates_); |
| 81 return; | 82 return; |
| 82 } | 83 } |
| 83 | 84 |
| 84 FakePictureLayerImpl* pending_picture_impl = | 85 FakePictureLayerImpl* pending_picture_impl = |
| 85 static_cast<FakePictureLayerImpl*>(pending_root_impl->children()[0]); | 86 static_cast<FakePictureLayerImpl*>( |
| 87 impl->pending_tree()->LayerById(picture_id)); | |
| 86 | 88 |
| 87 if (!active_root_impl) { | 89 if (!active_root_impl) { |
| 88 EXPECT_EQ(0, activates_); | 90 EXPECT_EQ(0, activates_); |
| 89 EXPECT_EQ(nullptr, pending_picture_impl->GetPendingOrActiveTwinLayer()); | 91 EXPECT_EQ(nullptr, pending_picture_impl->GetPendingOrActiveTwinLayer()); |
| 90 return; | 92 return; |
| 91 } | 93 } |
| 92 | 94 |
| 93 if (active_root_impl->children().empty()) { | 95 if (!impl->active_tree()->LayerById(picture_id)) { |
| 94 EXPECT_EQ(3, activates_); | 96 EXPECT_EQ(3, activates_); |
| 95 EXPECT_EQ(nullptr, pending_picture_impl->GetPendingOrActiveTwinLayer()); | 97 EXPECT_EQ(nullptr, pending_picture_impl->GetPendingOrActiveTwinLayer()); |
| 96 return; | 98 return; |
| 97 } | 99 } |
| 98 | 100 |
| 99 FakePictureLayerImpl* active_picture_impl = | 101 FakePictureLayerImpl* active_picture_impl = |
| 100 static_cast<FakePictureLayerImpl*>(active_root_impl->children()[0]); | 102 static_cast<FakePictureLayerImpl*>( |
| 103 impl->active_tree()->LayerById(picture_id)); | |
| 101 | 104 |
| 102 // After the first activation, when we commit again, we'll have a pending | 105 // After the first activation, when we commit again, we'll have a pending |
| 103 // and active layer. Then we recreate a picture layer in the 4th activate | 106 // and active layer. Then we recreate a picture layer in the 4th activate |
| 104 // and the next commit will have a pending and active twin again. | 107 // and the next commit will have a pending and active twin again. |
| 105 EXPECT_TRUE(activates_ == 1 || activates_ == 4) << activates_; | 108 EXPECT_TRUE(activates_ == 1 || activates_ == 4) << activates_; |
| 106 | 109 |
| 107 EXPECT_EQ(pending_picture_impl, | 110 EXPECT_EQ(pending_picture_impl, |
| 108 active_picture_impl->GetPendingOrActiveTwinLayer()); | 111 active_picture_impl->GetPendingOrActiveTwinLayer()); |
| 109 EXPECT_EQ(active_picture_impl, | 112 EXPECT_EQ(active_picture_impl, |
| 110 pending_picture_impl->GetPendingOrActiveTwinLayer()); | 113 pending_picture_impl->GetPendingOrActiveTwinLayer()); |
| 111 } | 114 } |
| 112 | 115 |
| 113 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 116 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 114 LayerImpl* active_root_impl = impl->active_tree()->root_layer(); | 117 if (!impl->active_tree()->LayerById(picture_id)) { |
| 115 if (active_root_impl->children().empty()) { | |
| 116 EXPECT_EQ(2, activates_); | 118 EXPECT_EQ(2, activates_); |
| 117 } else { | 119 } else { |
| 118 FakePictureLayerImpl* active_picture_impl = | 120 FakePictureLayerImpl* active_picture_impl = |
| 119 static_cast<FakePictureLayerImpl*>(active_root_impl->children()[0]); | 121 static_cast<FakePictureLayerImpl*>( |
| 122 impl->active_tree()->LayerById(picture_id)); | |
| 120 EXPECT_EQ(nullptr, active_picture_impl->GetPendingOrActiveTwinLayer()); | 123 EXPECT_EQ(nullptr, active_picture_impl->GetPendingOrActiveTwinLayer()); |
| 121 } | 124 } |
| 122 | 125 |
| 123 ++activates_; | 126 ++activates_; |
| 124 } | 127 } |
| 125 | 128 |
| 126 void AfterTest() override { EXPECT_EQ(5, activates_); } | 129 void AfterTest() override { EXPECT_EQ(5, activates_); } |
| 127 | 130 |
| 128 int activates_; | 131 int activates_; |
| 132 int picture_id; | |
|
ajuma
2016/04/20 21:40:52
nit: picture_id_
sunxd
2016/04/21 17:31:16
Done.
| |
| 129 }; | 133 }; |
| 130 | 134 |
| 131 // There is no pending layers in single thread mode. | 135 // There is no pending layers in single thread mode. |
| 132 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestTwinLayer); | 136 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestTwinLayer); |
| 133 | 137 |
| 134 class LayerTreeHostPictureTestResizeViewportWithGpuRaster | 138 class LayerTreeHostPictureTestResizeViewportWithGpuRaster |
| 135 : public LayerTreeHostPictureTest { | 139 : public LayerTreeHostPictureTest { |
| 136 void InitializeSettings(LayerTreeSettings* settings) override { | 140 void InitializeSettings(LayerTreeSettings* settings) override { |
| 137 settings->gpu_rasterization_forced = true; | 141 settings->gpu_rasterization_forced = true; |
| 138 } | 142 } |
| 139 | 143 |
| 140 void SetupTree() override { | 144 void SetupTree() override { |
| 141 scoped_refptr<Layer> root = Layer::Create(); | 145 scoped_refptr<Layer> root = Layer::Create(); |
| 142 root->SetBounds(gfx::Size(768, 960)); | 146 root->SetBounds(gfx::Size(768, 960)); |
| 143 client_.set_bounds(root->bounds()); | 147 client_.set_bounds(root->bounds()); |
| 144 client_.set_fill_with_nonsolid_color(true); | 148 client_.set_fill_with_nonsolid_color(true); |
| 145 picture_ = FakePictureLayer::Create(&client_); | 149 picture_ = FakePictureLayer::Create(&client_); |
| 146 picture_->SetBounds(gfx::Size(768, 960)); | 150 picture_->SetBounds(gfx::Size(768, 960)); |
| 147 root->AddChild(picture_); | 151 root->AddChild(picture_); |
| 148 | 152 |
| 149 layer_tree_host()->SetRootLayer(root); | 153 layer_tree_host()->SetRootLayer(root); |
| 150 LayerTreeHostPictureTest::SetupTree(); | 154 LayerTreeHostPictureTest::SetupTree(); |
| 151 } | 155 } |
| 152 | 156 |
| 153 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 157 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 154 | 158 |
| 155 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 159 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 156 LayerImpl* child = impl->sync_tree()->root_layer()->children()[0]; | 160 LayerImpl* child = impl->sync_tree()->LayerById(picture_->id()); |
| 157 FakePictureLayerImpl* picture_impl = | 161 FakePictureLayerImpl* picture_impl = |
| 158 static_cast<FakePictureLayerImpl*>(child); | 162 static_cast<FakePictureLayerImpl*>(child); |
| 159 gfx::Size tile_size = | 163 gfx::Size tile_size = |
| 160 picture_impl->HighResTiling()->TileAt(0, 0)->content_rect().size(); | 164 picture_impl->HighResTiling()->TileAt(0, 0)->content_rect().size(); |
| 161 | 165 |
| 162 switch (impl->sync_tree()->source_frame_number()) { | 166 switch (impl->sync_tree()->source_frame_number()) { |
| 163 case 0: | 167 case 0: |
| 164 tile_size_ = tile_size; | 168 tile_size_ = tile_size; |
| 165 // GPU Raster picks a tile size based on the viewport size. | 169 // GPU Raster picks a tile size based on the viewport size. |
| 166 EXPECT_EQ(gfx::Size(768, 256), tile_size); | 170 EXPECT_EQ(gfx::Size(768, 256), tile_size); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 picture_->SetScrollClipLayerId(root->id()); | 219 picture_->SetScrollClipLayerId(root->id()); |
| 216 | 220 |
| 217 layer_tree_host()->SetRootLayer(root); | 221 layer_tree_host()->SetRootLayer(root); |
| 218 LayerTreeHostPictureTest::SetupTree(); | 222 LayerTreeHostPictureTest::SetupTree(); |
| 219 client_.set_bounds(picture_->bounds()); | 223 client_.set_bounds(picture_->bounds()); |
| 220 } | 224 } |
| 221 | 225 |
| 222 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 226 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 223 | 227 |
| 224 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 228 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 225 LayerImpl* child = impl->active_tree()->root_layer()->children()[0]; | 229 LayerImpl* child = impl->active_tree()->LayerById(picture_->id()); |
| 226 FakePictureLayerImpl* picture_impl = | 230 FakePictureLayerImpl* picture_impl = |
| 227 static_cast<FakePictureLayerImpl*>(child); | 231 static_cast<FakePictureLayerImpl*>(child); |
| 228 switch (++frame_) { | 232 switch (++frame_) { |
| 229 case 1: { | 233 case 1: { |
| 230 PictureLayerTiling* tiling = picture_impl->HighResTiling(); | 234 PictureLayerTiling* tiling = picture_impl->HighResTiling(); |
| 231 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); | 235 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); |
| 232 | 236 |
| 233 // There should be tiles at the top of the picture layer but not at the | 237 // There should be tiles at the top of the picture layer but not at the |
| 234 // bottom. | 238 // bottom. |
| 235 EXPECT_TRUE(tiling->TileAt(0, 0)); | 239 EXPECT_TRUE(tiling->TileAt(0, 0)); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 264 // Make a new main frame without changing the picture layer at all, so | 268 // Make a new main frame without changing the picture layer at all, so |
| 265 // it won't need to update or push properties. | 269 // it won't need to update or push properties. |
| 266 did_post_commit_ = true; | 270 did_post_commit_ = true; |
| 267 PostSetNeedsCommitToMainThread(); | 271 PostSetNeedsCommitToMainThread(); |
| 268 break; | 272 break; |
| 269 } | 273 } |
| 270 } | 274 } |
| 271 } | 275 } |
| 272 | 276 |
| 273 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 277 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 274 LayerImpl* child = impl->sync_tree()->root_layer()->children()[0]; | 278 LayerImpl* child = impl->sync_tree()->LayerById(picture_->id()); |
| 275 FakePictureLayerImpl* picture_impl = | 279 FakePictureLayerImpl* picture_impl = |
| 276 static_cast<FakePictureLayerImpl*>(child); | 280 static_cast<FakePictureLayerImpl*>(child); |
| 277 PictureLayerTiling* tiling = picture_impl->HighResTiling(); | 281 PictureLayerTiling* tiling = picture_impl->HighResTiling(); |
| 278 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); | 282 int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y(); |
| 279 | 283 |
| 280 if (!impl->active_tree()->root_layer()) { | 284 if (!impl->active_tree()->root_layer()) { |
| 281 // If active tree doesn't have the layer, then pending tree should have | 285 // If active tree doesn't have the layer, then pending tree should have |
| 282 // all needed tiles. | 286 // all needed tiles. |
| 283 EXPECT_TRUE(tiling->TileAt(0, 0)); | 287 EXPECT_TRUE(tiling->TileAt(0, 0)); |
| 284 } else { | 288 } else { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 picture_->SetBounds(gfx::Size(100, 100)); | 322 picture_->SetBounds(gfx::Size(100, 100)); |
| 319 child_->AddChild(picture_); | 323 child_->AddChild(picture_); |
| 320 | 324 |
| 321 layer_tree_host()->SetRootLayer(root); | 325 layer_tree_host()->SetRootLayer(root); |
| 322 LayerTreeHostPictureTest::SetupTree(); | 326 LayerTreeHostPictureTest::SetupTree(); |
| 323 } | 327 } |
| 324 | 328 |
| 325 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 329 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 326 | 330 |
| 327 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { | 331 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { |
| 328 LayerImpl* root = impl->sync_tree()->root_layer(); | 332 LayerImpl* gchild = impl->sync_tree()->LayerById(picture_->id()); |
| 329 LayerImpl* child = root->children()[0]; | |
| 330 LayerImpl* gchild = child->children()[0]; | |
| 331 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); | 333 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); |
| 332 | 334 |
| 333 switch (impl->sync_tree()->source_frame_number()) { | 335 switch (impl->sync_tree()->source_frame_number()) { |
| 334 case 0: | 336 case 0: |
| 335 // On 1st commit the layer has tilings. | 337 // On 1st commit the layer has tilings. |
| 336 EXPECT_GT(picture->tilings()->num_tilings(), 0u); | 338 EXPECT_GT(picture->tilings()->num_tilings(), 0u); |
| 337 break; | 339 break; |
| 338 case 1: | 340 case 1: |
| 339 // On 2nd commit, the layer is transparent, but its tilings are left | 341 // On 2nd commit, the layer is transparent, but its tilings are left |
| 340 // there. | 342 // there. |
| 341 EXPECT_GT(picture->tilings()->num_tilings(), 0u); | 343 EXPECT_GT(picture->tilings()->num_tilings(), 0u); |
| 342 break; | 344 break; |
| 343 case 2: | 345 case 2: |
| 344 // On 3rd commit, the layer is visible again, so has tilings. | 346 // On 3rd commit, the layer is visible again, so has tilings. |
| 345 EXPECT_GT(picture->tilings()->num_tilings(), 0u); | 347 EXPECT_GT(picture->tilings()->num_tilings(), 0u); |
| 346 } | 348 } |
| 347 } | 349 } |
| 348 | 350 |
| 349 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 351 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 350 LayerImpl* root = impl->active_tree()->root_layer(); | 352 LayerImpl* gchild = impl->sync_tree()->LayerById(picture_->id()); |
| 351 LayerImpl* child = root->children()[0]; | |
| 352 LayerImpl* gchild = child->children()[0]; | |
| 353 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); | 353 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); |
| 354 | 354 |
| 355 switch (impl->active_tree()->source_frame_number()) { | 355 switch (impl->active_tree()->source_frame_number()) { |
| 356 case 0: | 356 case 0: |
| 357 // On 1st commit the layer has tilings. | 357 // On 1st commit the layer has tilings. |
| 358 EXPECT_GT(picture->tilings()->num_tilings(), 0u); | 358 EXPECT_GT(picture->tilings()->num_tilings(), 0u); |
| 359 break; | 359 break; |
| 360 case 1: | 360 case 1: |
| 361 // On 2nd commit, the layer is transparent, but its tilings are left | 361 // On 2nd commit, the layer is transparent, but its tilings are left |
| 362 // there. | 362 // there. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 | 427 |
| 428 void BeginTest() override { | 428 void BeginTest() override { |
| 429 frame_ = 0; | 429 frame_ = 0; |
| 430 draws_in_frame_ = 0; | 430 draws_in_frame_ = 0; |
| 431 last_frame_drawn_ = -1; | 431 last_frame_drawn_ = -1; |
| 432 ready_to_draw_ = false; | 432 ready_to_draw_ = false; |
| 433 PostSetNeedsCommitToMainThread(); | 433 PostSetNeedsCommitToMainThread(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 436 void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 437 LayerImpl* root = impl->sync_tree()->root_layer(); | 437 LayerImpl* gchild = impl->sync_tree()->LayerById(picture_->id()); |
| 438 LayerImpl* pinch = root->children()[0]->children()[0]; | |
| 439 LayerImpl* gchild = pinch->children()[0]; | |
| 440 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); | 438 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); |
| 441 ready_to_draw_ = false; | 439 ready_to_draw_ = false; |
| 442 | 440 |
| 443 switch (frame_) { | 441 switch (frame_) { |
| 444 case 0: | 442 case 0: |
| 445 // On 1st commit the pending layer has tilings. | 443 // On 1st commit the pending layer has tilings. |
| 446 ASSERT_EQ(1u, picture->tilings()->num_tilings()); | 444 ASSERT_EQ(1u, picture->tilings()->num_tilings()); |
| 447 EXPECT_EQ(1.f, picture->tilings()->tiling_at(0)->contents_scale()); | 445 EXPECT_EQ(1.f, picture->tilings()->tiling_at(0)->contents_scale()); |
| 448 break; | 446 break; |
| 449 case 1: | 447 case 1: |
| 450 // On 2nd commit, the pending layer is transparent, so has a stale | 448 // On 2nd commit, the pending layer is transparent, so has a stale |
| 451 // value. | 449 // value. |
| 452 ASSERT_EQ(1u, picture->tilings()->num_tilings()); | 450 ASSERT_EQ(1u, picture->tilings()->num_tilings()); |
| 453 EXPECT_EQ(1.f, picture->tilings()->tiling_at(0)->contents_scale()); | 451 EXPECT_EQ(1.f, picture->tilings()->tiling_at(0)->contents_scale()); |
| 454 break; | 452 break; |
| 455 case 2: | 453 case 2: |
| 456 // On 3rd commit, the pending layer is visible again, so has tilings and | 454 // On 3rd commit, the pending layer is visible again, so has tilings and |
| 457 // is updated for the pinch. | 455 // is updated for the pinch. |
| 458 ASSERT_EQ(1u, picture->tilings()->num_tilings()); | 456 ASSERT_EQ(1u, picture->tilings()->num_tilings()); |
| 459 EXPECT_EQ(2.f, picture->tilings()->tiling_at(0)->contents_scale()); | 457 EXPECT_EQ(2.f, picture->tilings()->tiling_at(0)->contents_scale()); |
| 460 } | 458 } |
| 461 } | 459 } |
| 462 | 460 |
| 463 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 461 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 464 LayerImpl* root = impl->active_tree()->root_layer(); | 462 LayerImpl* gchild = impl->active_tree()->LayerById(picture_->id()); |
| 465 LayerImpl* pinch = root->children()[0]->children()[0]; | |
| 466 LayerImpl* gchild = pinch->children()[0]; | |
| 467 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); | 463 FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); |
| 468 | 464 |
| 469 if (frame_ != last_frame_drawn_) | 465 if (frame_ != last_frame_drawn_) |
| 470 draws_in_frame_ = 0; | 466 draws_in_frame_ = 0; |
| 471 ++draws_in_frame_; | 467 ++draws_in_frame_; |
| 472 last_frame_drawn_ = frame_; | 468 last_frame_drawn_ = frame_; |
| 473 | 469 |
| 474 switch (frame_) { | 470 switch (frame_) { |
| 475 case 0: | 471 case 0: |
| 476 if (draws_in_frame_ == 1) { | 472 if (draws_in_frame_ == 1) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 int last_frame_drawn_; | 555 int last_frame_drawn_; |
| 560 bool ready_to_draw_; | 556 bool ready_to_draw_; |
| 561 }; | 557 }; |
| 562 | 558 |
| 563 // Multi-thread only because in single thread you can't pinch zoom on the | 559 // Multi-thread only because in single thread you can't pinch zoom on the |
| 564 // compositor thread. | 560 // compositor thread. |
| 565 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale); | 561 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale); |
| 566 | 562 |
| 567 } // namespace | 563 } // namespace |
| 568 } // namespace cc | 564 } // namespace cc |
| OLD | NEW |