| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 root_ = FakePictureLayer::Create(&client_); | 345 root_ = FakePictureLayer::Create(&client_); |
| 346 root_->SetBounds(gfx::Size(20, 20)); | 346 root_->SetBounds(gfx::Size(20, 20)); |
| 347 | 347 |
| 348 grand_parent_layer_ = FakePictureLayer::Create(&client_); | 348 grand_parent_layer_ = FakePictureLayer::Create(&client_); |
| 349 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); | 349 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 350 root_->AddChild(grand_parent_layer_); | 350 root_->AddChild(grand_parent_layer_); |
| 351 | 351 |
| 352 // parent_layer_ owns a render surface. | 352 // parent_layer_ owns a render surface. |
| 353 parent_layer_ = FakePictureLayer::Create(&client_); | 353 parent_layer_ = FakePictureLayer::Create(&client_); |
| 354 parent_layer_->SetBounds(gfx::Size(15, 15)); | 354 parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 355 parent_layer_->SetForceRenderSurfaceForTesting(true); | 355 parent_layer_->SetForceRenderSurface(true); |
| 356 grand_parent_layer_->AddChild(parent_layer_); | 356 grand_parent_layer_->AddChild(parent_layer_); |
| 357 | 357 |
| 358 copy_layer_ = FakePictureLayer::Create(&client_); | 358 copy_layer_ = FakePictureLayer::Create(&client_); |
| 359 copy_layer_->SetBounds(gfx::Size(10, 10)); | 359 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 360 parent_layer_->AddChild(copy_layer_); | 360 parent_layer_->AddChild(copy_layer_); |
| 361 | 361 |
| 362 layer_tree_host()->SetRootLayer(root_); | 362 layer_tree_host()->SetRootLayer(root_); |
| 363 LayerTreeHostCopyRequestTest::SetupTree(); | 363 LayerTreeHostCopyRequestTest::SetupTree(); |
| 364 client_.set_bounds(root_->bounds()); | 364 client_.set_bounds(root_->bounds()); |
| 365 } | 365 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 root_->SetBounds(gfx::Size(20, 20)); | 445 root_->SetBounds(gfx::Size(20, 20)); |
| 446 | 446 |
| 447 grand_parent_layer_ = FakePictureLayer::Create(&client_); | 447 grand_parent_layer_ = FakePictureLayer::Create(&client_); |
| 448 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); | 448 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 449 grand_parent_layer_->SetHideLayerAndSubtree(true); | 449 grand_parent_layer_->SetHideLayerAndSubtree(true); |
| 450 root_->AddChild(grand_parent_layer_); | 450 root_->AddChild(grand_parent_layer_); |
| 451 | 451 |
| 452 // parent_layer_ owns a render surface. | 452 // parent_layer_ owns a render surface. |
| 453 parent_layer_ = FakePictureLayer::Create(&client_); | 453 parent_layer_ = FakePictureLayer::Create(&client_); |
| 454 parent_layer_->SetBounds(gfx::Size(15, 15)); | 454 parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 455 parent_layer_->SetForceRenderSurfaceForTesting(true); | 455 parent_layer_->SetForceRenderSurface(true); |
| 456 grand_parent_layer_->AddChild(parent_layer_); | 456 grand_parent_layer_->AddChild(parent_layer_); |
| 457 | 457 |
| 458 copy_layer_ = FakePictureLayer::Create(&client_); | 458 copy_layer_ = FakePictureLayer::Create(&client_); |
| 459 copy_layer_->SetBounds(gfx::Size(10, 10)); | 459 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 460 parent_layer_->AddChild(copy_layer_); | 460 parent_layer_->AddChild(copy_layer_); |
| 461 | 461 |
| 462 layer_tree_host()->SetRootLayer(root_); | 462 layer_tree_host()->SetRootLayer(root_); |
| 463 LayerTreeHostCopyRequestTest::SetupTree(); | 463 LayerTreeHostCopyRequestTest::SetupTree(); |
| 464 client_.set_bounds(root_->bounds()); | 464 client_.set_bounds(root_->bounds()); |
| 465 } | 465 } |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 copy_layer_->SetBounds(gfx::Size(10, 10)); | 886 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 887 copy_client_.set_bounds(copy_layer_->bounds()); | 887 copy_client_.set_bounds(copy_layer_->bounds()); |
| 888 PaintFlags flags; | 888 PaintFlags flags; |
| 889 flags.setColor(SK_ColorRED); | 889 flags.setColor(SK_ColorRED); |
| 890 // Ensure the layer isn't completely transparent so the RenderPass isn't | 890 // Ensure the layer isn't completely transparent so the RenderPass isn't |
| 891 // optimized away. | 891 // optimized away. |
| 892 copy_client_.add_draw_rect(gfx::Rect(0, 0, 10, 10), flags); | 892 copy_client_.add_draw_rect(gfx::Rect(0, 0, 10, 10), flags); |
| 893 // Doing a copy makes the layer have a render surface which can cause | 893 // Doing a copy makes the layer have a render surface which can cause |
| 894 // texture allocations. So get those allocations out of the way in the | 894 // texture allocations. So get those allocations out of the way in the |
| 895 // first frame by forcing it to have a render surface. | 895 // first frame by forcing it to have a render surface. |
| 896 copy_layer_->SetForceRenderSurfaceForTesting(true); | 896 copy_layer_->SetForceRenderSurface(true); |
| 897 root_->AddChild(copy_layer_); | 897 root_->AddChild(copy_layer_); |
| 898 | 898 |
| 899 layer_tree_host()->SetRootLayer(root_); | 899 layer_tree_host()->SetRootLayer(root_); |
| 900 LayerTreeHostCopyRequestTest::SetupTree(); | 900 LayerTreeHostCopyRequestTest::SetupTree(); |
| 901 } | 901 } |
| 902 | 902 |
| 903 void BeginTest() override { | 903 void BeginTest() override { |
| 904 waited_sync_token_after_readback_.Clear(); | 904 waited_sync_token_after_readback_.Clear(); |
| 905 PostSetNeedsCommitToMainThread(); | 905 PostSetNeedsCommitToMainThread(); |
| 906 } | 906 } |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 int num_draws_; | 1319 int num_draws_; |
| 1320 bool copy_happened_; | 1320 bool copy_happened_; |
| 1321 bool draw_happened_; | 1321 bool draw_happened_; |
| 1322 }; | 1322 }; |
| 1323 | 1323 |
| 1324 SINGLE_AND_MULTI_THREAD_TEST_F( | 1324 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1325 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); | 1325 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); |
| 1326 | 1326 |
| 1327 } // namespace | 1327 } // namespace |
| 1328 } // namespace cc | 1328 } // namespace cc |
| OLD | NEW |