| 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 "cc/layers/layer_iterator.h" | 7 #include "cc/layers/layer_iterator.h" |
| 8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
| 9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
| 10 #include "cc/test/fake_content_layer_client.h" | 10 #include "cc/test/fake_content_layer_client.h" |
| 11 #include "cc/test/fake_output_surface.h" | 11 #include "cc/test/fake_output_surface.h" |
| 12 #include "cc/test/fake_picture_layer.h" | 12 #include "cc/test/fake_picture_layer.h" |
| 13 #include "cc/test/layer_tree_test.h" | 13 #include "cc/test/layer_tree_test.h" |
| 14 #include "cc/trees/layer_tree_impl.h" | 14 #include "cc/trees/layer_tree_impl.h" |
| 15 #include "gpu/GLES2/gl2extchromium.h" | 15 #include "gpu/GLES2/gl2extchromium.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // These tests only use direct rendering, as there is no output to copy for | 20 // These tests only use direct rendering, as there is no output to copy for |
| 21 // delegated renderers. | 21 // delegated renderers. |
| 22 class LayerTreeHostCopyRequestTest : public LayerTreeTest {}; | 22 class LayerTreeHostCopyRequestTest : public LayerTreeTest {}; |
| 23 | 23 |
| 24 class LayerTreeHostCopyRequestTestMultipleRequests | 24 class LayerTreeHostCopyRequestTestMultipleRequests |
| 25 : public LayerTreeHostCopyRequestTest { | 25 : public LayerTreeHostCopyRequestTest { |
| 26 protected: | 26 protected: |
| 27 void SetupTree() override { | 27 void SetupTree() override { |
| 28 root = FakePictureLayer::Create(layer_settings(), &client_); | 28 root = FakePictureLayer::Create(&client_); |
| 29 root->SetBounds(gfx::Size(20, 20)); | 29 root->SetBounds(gfx::Size(20, 20)); |
| 30 | 30 |
| 31 child = FakePictureLayer::Create(layer_settings(), &client_); | 31 child = FakePictureLayer::Create(&client_); |
| 32 child->SetBounds(gfx::Size(10, 10)); | 32 child->SetBounds(gfx::Size(10, 10)); |
| 33 root->AddChild(child); | 33 root->AddChild(child); |
| 34 | 34 |
| 35 grand_child = FakePictureLayer::Create(layer_settings(), &client_); | 35 grand_child = FakePictureLayer::Create(&client_); |
| 36 grand_child->SetBounds(gfx::Size(5, 5)); | 36 grand_child->SetBounds(gfx::Size(5, 5)); |
| 37 child->AddChild(grand_child); | 37 child->AddChild(grand_child); |
| 38 | 38 |
| 39 layer_tree_host()->SetRootLayer(root); | 39 layer_tree_host()->SetRootLayer(root); |
| 40 LayerTreeHostCopyRequestTest::SetupTree(); | 40 LayerTreeHostCopyRequestTest::SetupTree(); |
| 41 client_.set_bounds(root->bounds()); | 41 client_.set_bounds(root->bounds()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 44 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 45 | 45 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 use_gl_renderer_ = false; | 182 use_gl_renderer_ = false; |
| 183 RunTest(CompositorMode::THREADED, false); | 183 RunTest(CompositorMode::THREADED, false); |
| 184 } | 184 } |
| 185 | 185 |
| 186 // TODO(crbug.com/564832): Remove this test when the workaround it tests is no | 186 // TODO(crbug.com/564832): Remove this test when the workaround it tests is no |
| 187 // longer needed. | 187 // longer needed. |
| 188 class LayerTreeHostCopyRequestCompletionCausesCommit | 188 class LayerTreeHostCopyRequestCompletionCausesCommit |
| 189 : public LayerTreeHostCopyRequestTest { | 189 : public LayerTreeHostCopyRequestTest { |
| 190 protected: | 190 protected: |
| 191 void SetupTree() override { | 191 void SetupTree() override { |
| 192 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 192 root_ = FakePictureLayer::Create(&client_); |
| 193 root_->SetBounds(gfx::Size(20, 20)); | 193 root_->SetBounds(gfx::Size(20, 20)); |
| 194 | 194 |
| 195 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 195 layer_ = FakePictureLayer::Create(&client_); |
| 196 layer_->SetBounds(gfx::Size(15, 15)); | 196 layer_->SetBounds(gfx::Size(15, 15)); |
| 197 root_->AddChild(layer_); | 197 root_->AddChild(layer_); |
| 198 | 198 |
| 199 layer_tree_host()->SetRootLayer(root_); | 199 layer_tree_host()->SetRootLayer(root_); |
| 200 LayerTreeHostCopyRequestTest::SetupTree(); | 200 LayerTreeHostCopyRequestTest::SetupTree(); |
| 201 client_.set_bounds(root_->bounds()); | 201 client_.set_bounds(root_->bounds()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void BeginTest() override { | 204 void BeginTest() override { |
| 205 PostSetNeedsCommitToMainThread(); | 205 PostSetNeedsCommitToMainThread(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 234 scoped_refptr<FakePictureLayer> layer_; | 234 scoped_refptr<FakePictureLayer> layer_; |
| 235 }; | 235 }; |
| 236 | 236 |
| 237 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 237 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 238 LayerTreeHostCopyRequestCompletionCausesCommit); | 238 LayerTreeHostCopyRequestCompletionCausesCommit); |
| 239 | 239 |
| 240 class LayerTreeHostCopyRequestTestLayerDestroyed | 240 class LayerTreeHostCopyRequestTestLayerDestroyed |
| 241 : public LayerTreeHostCopyRequestTest { | 241 : public LayerTreeHostCopyRequestTest { |
| 242 protected: | 242 protected: |
| 243 void SetupTree() override { | 243 void SetupTree() override { |
| 244 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 244 root_ = FakePictureLayer::Create(&client_); |
| 245 root_->SetBounds(gfx::Size(20, 20)); | 245 root_->SetBounds(gfx::Size(20, 20)); |
| 246 | 246 |
| 247 main_destroyed_ = FakePictureLayer::Create(layer_settings(), &client_); | 247 main_destroyed_ = FakePictureLayer::Create(&client_); |
| 248 main_destroyed_->SetBounds(gfx::Size(15, 15)); | 248 main_destroyed_->SetBounds(gfx::Size(15, 15)); |
| 249 root_->AddChild(main_destroyed_); | 249 root_->AddChild(main_destroyed_); |
| 250 | 250 |
| 251 impl_destroyed_ = FakePictureLayer::Create(layer_settings(), &client_); | 251 impl_destroyed_ = FakePictureLayer::Create(&client_); |
| 252 impl_destroyed_->SetBounds(gfx::Size(10, 10)); | 252 impl_destroyed_->SetBounds(gfx::Size(10, 10)); |
| 253 root_->AddChild(impl_destroyed_); | 253 root_->AddChild(impl_destroyed_); |
| 254 | 254 |
| 255 layer_tree_host()->SetRootLayer(root_); | 255 layer_tree_host()->SetRootLayer(root_); |
| 256 LayerTreeHostCopyRequestTest::SetupTree(); | 256 LayerTreeHostCopyRequestTest::SetupTree(); |
| 257 client_.set_bounds(root_->bounds()); | 257 client_.set_bounds(root_->bounds()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void BeginTest() override { | 260 void BeginTest() override { |
| 261 callback_count_ = 0; | 261 callback_count_ = 0; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 scoped_refptr<FakePictureLayer> main_destroyed_; | 327 scoped_refptr<FakePictureLayer> main_destroyed_; |
| 328 scoped_refptr<FakePictureLayer> impl_destroyed_; | 328 scoped_refptr<FakePictureLayer> impl_destroyed_; |
| 329 }; | 329 }; |
| 330 | 330 |
| 331 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostCopyRequestTestLayerDestroyed); | 331 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostCopyRequestTestLayerDestroyed); |
| 332 | 332 |
| 333 class LayerTreeHostCopyRequestTestInHiddenSubtree | 333 class LayerTreeHostCopyRequestTestInHiddenSubtree |
| 334 : public LayerTreeHostCopyRequestTest { | 334 : public LayerTreeHostCopyRequestTest { |
| 335 protected: | 335 protected: |
| 336 void SetupTree() override { | 336 void SetupTree() override { |
| 337 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 337 root_ = FakePictureLayer::Create(&client_); |
| 338 root_->SetBounds(gfx::Size(20, 20)); | 338 root_->SetBounds(gfx::Size(20, 20)); |
| 339 | 339 |
| 340 grand_parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 340 grand_parent_layer_ = FakePictureLayer::Create(&client_); |
| 341 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); | 341 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 342 root_->AddChild(grand_parent_layer_); | 342 root_->AddChild(grand_parent_layer_); |
| 343 | 343 |
| 344 // parent_layer_ owns a render surface. | 344 // parent_layer_ owns a render surface. |
| 345 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 345 parent_layer_ = FakePictureLayer::Create(&client_); |
| 346 parent_layer_->SetBounds(gfx::Size(15, 15)); | 346 parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 347 parent_layer_->SetForceRenderSurface(true); | 347 parent_layer_->SetForceRenderSurface(true); |
| 348 grand_parent_layer_->AddChild(parent_layer_); | 348 grand_parent_layer_->AddChild(parent_layer_); |
| 349 | 349 |
| 350 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 350 copy_layer_ = FakePictureLayer::Create(&client_); |
| 351 copy_layer_->SetBounds(gfx::Size(10, 10)); | 351 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 352 parent_layer_->AddChild(copy_layer_); | 352 parent_layer_->AddChild(copy_layer_); |
| 353 | 353 |
| 354 layer_tree_host()->SetRootLayer(root_); | 354 layer_tree_host()->SetRootLayer(root_); |
| 355 LayerTreeHostCopyRequestTest::SetupTree(); | 355 LayerTreeHostCopyRequestTest::SetupTree(); |
| 356 client_.set_bounds(root_->bounds()); | 356 client_.set_bounds(root_->bounds()); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void AddCopyRequest(Layer* layer) { | 359 void AddCopyRequest(Layer* layer) { |
| 360 layer->RequestCopyOfOutput( | 360 layer->RequestCopyOfOutput( |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 scoped_refptr<FakePictureLayer> copy_layer_; | 427 scoped_refptr<FakePictureLayer> copy_layer_; |
| 428 }; | 428 }; |
| 429 | 429 |
| 430 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 430 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 431 LayerTreeHostCopyRequestTestInHiddenSubtree); | 431 LayerTreeHostCopyRequestTestInHiddenSubtree); |
| 432 | 432 |
| 433 class LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest | 433 class LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest |
| 434 : public LayerTreeHostCopyRequestTest { | 434 : public LayerTreeHostCopyRequestTest { |
| 435 protected: | 435 protected: |
| 436 void SetupTree() override { | 436 void SetupTree() override { |
| 437 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 437 root_ = FakePictureLayer::Create(&client_); |
| 438 root_->SetBounds(gfx::Size(20, 20)); | 438 root_->SetBounds(gfx::Size(20, 20)); |
| 439 | 439 |
| 440 grand_parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 440 grand_parent_layer_ = FakePictureLayer::Create(&client_); |
| 441 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); | 441 grand_parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 442 grand_parent_layer_->SetHideLayerAndSubtree(true); | 442 grand_parent_layer_->SetHideLayerAndSubtree(true); |
| 443 root_->AddChild(grand_parent_layer_); | 443 root_->AddChild(grand_parent_layer_); |
| 444 | 444 |
| 445 // parent_layer_ owns a render surface. | 445 // parent_layer_ owns a render surface. |
| 446 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 446 parent_layer_ = FakePictureLayer::Create(&client_); |
| 447 parent_layer_->SetBounds(gfx::Size(15, 15)); | 447 parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 448 parent_layer_->SetForceRenderSurface(true); | 448 parent_layer_->SetForceRenderSurface(true); |
| 449 grand_parent_layer_->AddChild(parent_layer_); | 449 grand_parent_layer_->AddChild(parent_layer_); |
| 450 | 450 |
| 451 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 451 copy_layer_ = FakePictureLayer::Create(&client_); |
| 452 copy_layer_->SetBounds(gfx::Size(10, 10)); | 452 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 453 parent_layer_->AddChild(copy_layer_); | 453 parent_layer_->AddChild(copy_layer_); |
| 454 | 454 |
| 455 layer_tree_host()->SetRootLayer(root_); | 455 layer_tree_host()->SetRootLayer(root_); |
| 456 LayerTreeHostCopyRequestTest::SetupTree(); | 456 LayerTreeHostCopyRequestTest::SetupTree(); |
| 457 client_.set_bounds(root_->bounds()); | 457 client_.set_bounds(root_->bounds()); |
| 458 } | 458 } |
| 459 | 459 |
| 460 void BeginTest() override { | 460 void BeginTest() override { |
| 461 did_draw_ = false; | 461 did_draw_ = false; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 }; | 512 }; |
| 513 | 513 |
| 514 // No output to copy for delegated renderers. | 514 // No output to copy for delegated renderers. |
| 515 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 515 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 516 LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest); | 516 LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest); |
| 517 | 517 |
| 518 class LayerTreeHostCopyRequestTestClippedOut | 518 class LayerTreeHostCopyRequestTestClippedOut |
| 519 : public LayerTreeHostCopyRequestTest { | 519 : public LayerTreeHostCopyRequestTest { |
| 520 protected: | 520 protected: |
| 521 void SetupTree() override { | 521 void SetupTree() override { |
| 522 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 522 root_ = FakePictureLayer::Create(&client_); |
| 523 root_->SetBounds(gfx::Size(20, 20)); | 523 root_->SetBounds(gfx::Size(20, 20)); |
| 524 | 524 |
| 525 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 525 parent_layer_ = FakePictureLayer::Create(&client_); |
| 526 parent_layer_->SetBounds(gfx::Size(15, 15)); | 526 parent_layer_->SetBounds(gfx::Size(15, 15)); |
| 527 parent_layer_->SetMasksToBounds(true); | 527 parent_layer_->SetMasksToBounds(true); |
| 528 root_->AddChild(parent_layer_); | 528 root_->AddChild(parent_layer_); |
| 529 | 529 |
| 530 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 530 copy_layer_ = FakePictureLayer::Create(&client_); |
| 531 copy_layer_->SetPosition(gfx::PointF(15.f, 15.f)); | 531 copy_layer_->SetPosition(gfx::PointF(15.f, 15.f)); |
| 532 copy_layer_->SetBounds(gfx::Size(10, 10)); | 532 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 533 parent_layer_->AddChild(copy_layer_); | 533 parent_layer_->AddChild(copy_layer_); |
| 534 | 534 |
| 535 layer_tree_host()->SetRootLayer(root_); | 535 layer_tree_host()->SetRootLayer(root_); |
| 536 LayerTreeHostCopyRequestTest::SetupTree(); | 536 LayerTreeHostCopyRequestTest::SetupTree(); |
| 537 client_.set_bounds(root_->bounds()); | 537 client_.set_bounds(root_->bounds()); |
| 538 } | 538 } |
| 539 | 539 |
| 540 void BeginTest() override { | 540 void BeginTest() override { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 561 scoped_refptr<FakePictureLayer> copy_layer_; | 561 scoped_refptr<FakePictureLayer> copy_layer_; |
| 562 }; | 562 }; |
| 563 | 563 |
| 564 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 564 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 565 LayerTreeHostCopyRequestTestClippedOut); | 565 LayerTreeHostCopyRequestTestClippedOut); |
| 566 | 566 |
| 567 class LayerTreeHostCopyRequestTestScaledLayer | 567 class LayerTreeHostCopyRequestTestScaledLayer |
| 568 : public LayerTreeHostCopyRequestTest { | 568 : public LayerTreeHostCopyRequestTest { |
| 569 protected: | 569 protected: |
| 570 void SetupTree() override { | 570 void SetupTree() override { |
| 571 root_ = Layer::Create(layer_settings()); | 571 root_ = Layer::Create(); |
| 572 root_->SetBounds(gfx::Size(20, 20)); | 572 root_->SetBounds(gfx::Size(20, 20)); |
| 573 | 573 |
| 574 gfx::Transform scale; | 574 gfx::Transform scale; |
| 575 scale.Scale(2, 2); | 575 scale.Scale(2, 2); |
| 576 | 576 |
| 577 copy_layer_ = Layer::Create(layer_settings()); | 577 copy_layer_ = Layer::Create(); |
| 578 copy_layer_->SetBounds(gfx::Size(10, 10)); | 578 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 579 copy_layer_->SetTransform(scale); | 579 copy_layer_->SetTransform(scale); |
| 580 root_->AddChild(copy_layer_); | 580 root_->AddChild(copy_layer_); |
| 581 | 581 |
| 582 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 582 child_layer_ = FakePictureLayer::Create(&client_); |
| 583 child_layer_->SetBounds(gfx::Size(10, 10)); | 583 child_layer_->SetBounds(gfx::Size(10, 10)); |
| 584 copy_layer_->AddChild(child_layer_); | 584 copy_layer_->AddChild(child_layer_); |
| 585 | 585 |
| 586 layer_tree_host()->SetRootLayer(root_); | 586 layer_tree_host()->SetRootLayer(root_); |
| 587 LayerTreeHostCopyRequestTest::SetupTree(); | 587 LayerTreeHostCopyRequestTest::SetupTree(); |
| 588 client_.set_bounds(root_->bounds()); | 588 client_.set_bounds(root_->bounds()); |
| 589 } | 589 } |
| 590 | 590 |
| 591 void BeginTest() override { | 591 void BeginTest() override { |
| 592 PostSetNeedsCommitToMainThread(); | 592 PostSetNeedsCommitToMainThread(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 614 scoped_refptr<FakePictureLayer> child_layer_; | 614 scoped_refptr<FakePictureLayer> child_layer_; |
| 615 }; | 615 }; |
| 616 | 616 |
| 617 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 617 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 618 LayerTreeHostCopyRequestTestScaledLayer); | 618 LayerTreeHostCopyRequestTestScaledLayer); |
| 619 | 619 |
| 620 class LayerTreeHostTestAsyncTwoReadbacksWithoutDraw | 620 class LayerTreeHostTestAsyncTwoReadbacksWithoutDraw |
| 621 : public LayerTreeHostCopyRequestTest { | 621 : public LayerTreeHostCopyRequestTest { |
| 622 protected: | 622 protected: |
| 623 void SetupTree() override { | 623 void SetupTree() override { |
| 624 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 624 root_ = FakePictureLayer::Create(&client_); |
| 625 root_->SetBounds(gfx::Size(20, 20)); | 625 root_->SetBounds(gfx::Size(20, 20)); |
| 626 | 626 |
| 627 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 627 copy_layer_ = FakePictureLayer::Create(&client_); |
| 628 copy_layer_->SetBounds(gfx::Size(10, 10)); | 628 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 629 root_->AddChild(copy_layer_); | 629 root_->AddChild(copy_layer_); |
| 630 | 630 |
| 631 layer_tree_host()->SetRootLayer(root_); | 631 layer_tree_host()->SetRootLayer(root_); |
| 632 LayerTreeHostCopyRequestTest::SetupTree(); | 632 LayerTreeHostCopyRequestTest::SetupTree(); |
| 633 client_.set_bounds(root_->bounds()); | 633 client_.set_bounds(root_->bounds()); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void AddCopyRequest(Layer* layer) { | 636 void AddCopyRequest(Layer* layer) { |
| 637 layer->RequestCopyOfOutput( | 637 layer->RequestCopyOfOutput( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 first_context_provider_ = TestContextProvider::Create(); | 710 first_context_provider_ = TestContextProvider::Create(); |
| 711 return FakeOutputSurface::Create3d(first_context_provider_); | 711 return FakeOutputSurface::Create3d(first_context_provider_); |
| 712 } | 712 } |
| 713 | 713 |
| 714 EXPECT_FALSE(second_context_provider_); | 714 EXPECT_FALSE(second_context_provider_); |
| 715 second_context_provider_ = TestContextProvider::Create(); | 715 second_context_provider_ = TestContextProvider::Create(); |
| 716 return FakeOutputSurface::Create3d(second_context_provider_); | 716 return FakeOutputSurface::Create3d(second_context_provider_); |
| 717 } | 717 } |
| 718 | 718 |
| 719 void SetupTree() override { | 719 void SetupTree() override { |
| 720 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 720 root_ = FakePictureLayer::Create(&client_); |
| 721 root_->SetBounds(gfx::Size(20, 20)); | 721 root_->SetBounds(gfx::Size(20, 20)); |
| 722 | 722 |
| 723 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 723 copy_layer_ = FakePictureLayer::Create(&client_); |
| 724 copy_layer_->SetBounds(gfx::Size(10, 10)); | 724 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 725 root_->AddChild(copy_layer_); | 725 root_->AddChild(copy_layer_); |
| 726 | 726 |
| 727 layer_tree_host()->SetRootLayer(root_); | 727 layer_tree_host()->SetRootLayer(root_); |
| 728 LayerTreeHostCopyRequestTest::SetupTree(); | 728 LayerTreeHostCopyRequestTest::SetupTree(); |
| 729 client_.set_bounds(root_->bounds()); | 729 client_.set_bounds(root_->bounds()); |
| 730 } | 730 } |
| 731 | 731 |
| 732 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 732 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 733 | 733 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 : public LayerTreeHostCopyRequestTest { | 840 : public LayerTreeHostCopyRequestTest { |
| 841 protected: | 841 protected: |
| 842 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 842 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
| 843 context_provider_ = TestContextProvider::Create(); | 843 context_provider_ = TestContextProvider::Create(); |
| 844 return FakeOutputSurface::Create3d(context_provider_); | 844 return FakeOutputSurface::Create3d(context_provider_); |
| 845 } | 845 } |
| 846 | 846 |
| 847 void SetupTree() override { | 847 void SetupTree() override { |
| 848 client_.set_fill_with_nonsolid_color(true); | 848 client_.set_fill_with_nonsolid_color(true); |
| 849 | 849 |
| 850 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 850 root_ = FakePictureLayer::Create(&client_); |
| 851 root_->SetBounds(gfx::Size(20, 20)); | 851 root_->SetBounds(gfx::Size(20, 20)); |
| 852 | 852 |
| 853 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 853 copy_layer_ = FakePictureLayer::Create(&client_); |
| 854 copy_layer_->SetBounds(gfx::Size(10, 10)); | 854 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 855 root_->AddChild(copy_layer_); | 855 root_->AddChild(copy_layer_); |
| 856 | 856 |
| 857 layer_tree_host()->SetRootLayer(root_); | 857 layer_tree_host()->SetRootLayer(root_); |
| 858 LayerTreeHostCopyRequestTest::SetupTree(); | 858 LayerTreeHostCopyRequestTest::SetupTree(); |
| 859 client_.set_bounds(root_->bounds()); | 859 client_.set_bounds(root_->bounds()); |
| 860 } | 860 } |
| 861 | 861 |
| 862 void BeginTest() override { | 862 void BeginTest() override { |
| 863 num_textures_without_readback_ = 0; | 863 num_textures_without_readback_ = 0; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 gpu::SyncToken sync_token_; | 999 gpu::SyncToken sync_token_; |
| 1000 }; | 1000 }; |
| 1001 | 1001 |
| 1002 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1002 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1003 LayerTreeHostCopyRequestTestProvideTexture); | 1003 LayerTreeHostCopyRequestTestProvideTexture); |
| 1004 | 1004 |
| 1005 class LayerTreeHostCopyRequestTestDestroyBeforeCopy | 1005 class LayerTreeHostCopyRequestTestDestroyBeforeCopy |
| 1006 : public LayerTreeHostCopyRequestTest { | 1006 : public LayerTreeHostCopyRequestTest { |
| 1007 protected: | 1007 protected: |
| 1008 void SetupTree() override { | 1008 void SetupTree() override { |
| 1009 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 1009 root_ = FakePictureLayer::Create(&client_); |
| 1010 root_->SetBounds(gfx::Size(20, 20)); | 1010 root_->SetBounds(gfx::Size(20, 20)); |
| 1011 | 1011 |
| 1012 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1012 copy_layer_ = FakePictureLayer::Create(&client_); |
| 1013 copy_layer_->SetBounds(gfx::Size(10, 10)); | 1013 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 1014 root_->AddChild(copy_layer_); | 1014 root_->AddChild(copy_layer_); |
| 1015 | 1015 |
| 1016 layer_tree_host()->SetRootLayer(root_); | 1016 layer_tree_host()->SetRootLayer(root_); |
| 1017 LayerTreeHostCopyRequestTest::SetupTree(); | 1017 LayerTreeHostCopyRequestTest::SetupTree(); |
| 1018 client_.set_bounds(root_->bounds()); | 1018 client_.set_bounds(root_->bounds()); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 void BeginTest() override { | 1021 void BeginTest() override { |
| 1022 callback_count_ = 0; | 1022 callback_count_ = 0; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 scoped_refptr<FakePictureLayer> copy_layer_; | 1077 scoped_refptr<FakePictureLayer> copy_layer_; |
| 1078 }; | 1078 }; |
| 1079 | 1079 |
| 1080 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1080 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1081 LayerTreeHostCopyRequestTestDestroyBeforeCopy); | 1081 LayerTreeHostCopyRequestTestDestroyBeforeCopy); |
| 1082 | 1082 |
| 1083 class LayerTreeHostCopyRequestTestShutdownBeforeCopy | 1083 class LayerTreeHostCopyRequestTestShutdownBeforeCopy |
| 1084 : public LayerTreeHostCopyRequestTest { | 1084 : public LayerTreeHostCopyRequestTest { |
| 1085 protected: | 1085 protected: |
| 1086 void SetupTree() override { | 1086 void SetupTree() override { |
| 1087 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 1087 root_ = FakePictureLayer::Create(&client_); |
| 1088 root_->SetBounds(gfx::Size(20, 20)); | 1088 root_->SetBounds(gfx::Size(20, 20)); |
| 1089 | 1089 |
| 1090 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1090 copy_layer_ = FakePictureLayer::Create(&client_); |
| 1091 copy_layer_->SetBounds(gfx::Size(10, 10)); | 1091 copy_layer_->SetBounds(gfx::Size(10, 10)); |
| 1092 root_->AddChild(copy_layer_); | 1092 root_->AddChild(copy_layer_); |
| 1093 | 1093 |
| 1094 layer_tree_host()->SetRootLayer(root_); | 1094 layer_tree_host()->SetRootLayer(root_); |
| 1095 LayerTreeHostCopyRequestTest::SetupTree(); | 1095 LayerTreeHostCopyRequestTest::SetupTree(); |
| 1096 client_.set_bounds(root_->bounds()); | 1096 client_.set_bounds(root_->bounds()); |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 void BeginTest() override { | 1099 void BeginTest() override { |
| 1100 callback_count_ = 0; | 1100 callback_count_ = 0; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 scoped_refptr<FakePictureLayer> copy_layer_; | 1149 scoped_refptr<FakePictureLayer> copy_layer_; |
| 1150 }; | 1150 }; |
| 1151 | 1151 |
| 1152 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1152 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1153 LayerTreeHostCopyRequestTestShutdownBeforeCopy); | 1153 LayerTreeHostCopyRequestTestShutdownBeforeCopy); |
| 1154 | 1154 |
| 1155 class LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest | 1155 class LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest |
| 1156 : public LayerTreeHostCopyRequestTest { | 1156 : public LayerTreeHostCopyRequestTest { |
| 1157 protected: | 1157 protected: |
| 1158 void SetupTree() override { | 1158 void SetupTree() override { |
| 1159 scoped_refptr<FakePictureLayer> root = | 1159 scoped_refptr<FakePictureLayer> root = FakePictureLayer::Create(&client_); |
| 1160 FakePictureLayer::Create(layer_settings(), &client_); | |
| 1161 root->SetBounds(gfx::Size(20, 20)); | 1160 root->SetBounds(gfx::Size(20, 20)); |
| 1162 | 1161 |
| 1163 child_ = FakePictureLayer::Create(layer_settings(), &client_); | 1162 child_ = FakePictureLayer::Create(&client_); |
| 1164 child_->SetBounds(gfx::Size(10, 10)); | 1163 child_->SetBounds(gfx::Size(10, 10)); |
| 1165 root->AddChild(child_); | 1164 root->AddChild(child_); |
| 1166 child_->SetHideLayerAndSubtree(true); | 1165 child_->SetHideLayerAndSubtree(true); |
| 1167 | 1166 |
| 1168 layer_tree_host()->SetRootLayer(root); | 1167 layer_tree_host()->SetRootLayer(root); |
| 1169 LayerTreeHostCopyRequestTest::SetupTree(); | 1168 LayerTreeHostCopyRequestTest::SetupTree(); |
| 1170 client_.set_bounds(root->bounds()); | 1169 client_.set_bounds(root->bounds()); |
| 1171 } | 1170 } |
| 1172 | 1171 |
| 1173 void BeginTest() override { | 1172 void BeginTest() override { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 int num_draws_; | 1263 int num_draws_; |
| 1265 bool copy_happened_; | 1264 bool copy_happened_; |
| 1266 bool draw_happened_; | 1265 bool draw_happened_; |
| 1267 }; | 1266 }; |
| 1268 | 1267 |
| 1269 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1268 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1270 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); | 1269 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); |
| 1271 | 1270 |
| 1272 } // namespace | 1271 } // namespace |
| 1273 } // namespace cc | 1272 } // namespace cc |
| OLD | NEW |