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