Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2193293004: cc: Make LayerTreeTests use a DelegatingRenderer and Display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display-layertreetest: withperftestsfix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 29 matching lines...) Expand all
40 #include "cc/test/fake_picture_layer.h" 40 #include "cc/test/fake_picture_layer.h"
41 #include "cc/test/fake_picture_layer_impl.h" 41 #include "cc/test/fake_picture_layer_impl.h"
42 #include "cc/test/fake_proxy.h" 42 #include "cc/test/fake_proxy.h"
43 #include "cc/test/fake_recording_source.h" 43 #include "cc/test/fake_recording_source.h"
44 #include "cc/test/fake_scoped_ui_resource.h" 44 #include "cc/test/fake_scoped_ui_resource.h"
45 #include "cc/test/fake_video_frame_provider.h" 45 #include "cc/test/fake_video_frame_provider.h"
46 #include "cc/test/geometry_test_utils.h" 46 #include "cc/test/geometry_test_utils.h"
47 #include "cc/test/layer_internals_for_test.h" 47 #include "cc/test/layer_internals_for_test.h"
48 #include "cc/test/layer_tree_test.h" 48 #include "cc/test/layer_tree_test.h"
49 #include "cc/test/skia_common.h" 49 #include "cc/test/skia_common.h"
50 #include "cc/test/test_delegating_output_surface.h"
50 #include "cc/test/test_shared_bitmap_manager.h" 51 #include "cc/test/test_shared_bitmap_manager.h"
51 #include "cc/test/test_web_graphics_context_3d.h" 52 #include "cc/test/test_web_graphics_context_3d.h"
52 #include "cc/trees/effect_node.h" 53 #include "cc/trees/effect_node.h"
53 #include "cc/trees/layer_tree_host_common.h" 54 #include "cc/trees/layer_tree_host_common.h"
54 #include "cc/trees/layer_tree_host_impl.h" 55 #include "cc/trees/layer_tree_host_impl.h"
55 #include "cc/trees/layer_tree_impl.h" 56 #include "cc/trees/layer_tree_impl.h"
56 #include "cc/trees/single_thread_proxy.h" 57 #include "cc/trees/single_thread_proxy.h"
57 #include "cc/trees/transform_node.h" 58 #include "cc/trees/transform_node.h"
58 #include "gpu/GLES2/gl2extchromium.h" 59 #include "gpu/GLES2/gl2extchromium.h"
59 #include "testing/gmock/include/gmock/gmock.h" 60 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 bool did_notify_ready_to_draw_; 426 bool did_notify_ready_to_draw_;
426 bool did_draw_; 427 bool did_draw_;
427 }; 428 };
428 429
429 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in 430 // Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in
430 // single threaded mode. 431 // single threaded mode.
431 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility); 432 SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility);
432 433
433 class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest { 434 class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest {
434 public: 435 public:
435 std::unique_ptr<OutputSurface> CreateOutputSurface() override { 436 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface(
436 auto output_surface = base::WrapUnique( 437 scoped_refptr<ContextProvider> compositor_context_provider,
437 new testing::StrictMock< 438 scoped_refptr<ContextProvider> worker_context_provider) override {
438 MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface>( 439 auto mock_worker_context_support_owned =
439 delegating_renderer())); 440 base::MakeUnique<MockContextSupport>();
441 auto* mock_worker_context_support = mock_worker_context_support_owned.get();
442
443 auto mock_worker_context_provider = make_scoped_refptr(
444 new MockContextProvider(std::move(mock_worker_context_support_owned)));
445
446 // Workers are bound on the main thread.
447 mock_worker_context_provider->BindToCurrentThread();
440 448
441 // At init, we expect one call to set visibility to true. 449 // At init, we expect one call to set visibility to true.
442 testing::Expectation visibility_true = 450 testing::Expectation visibility_true =
443 EXPECT_CALL(*output_surface, 451 EXPECT_CALL(*mock_worker_context_support,
444 SetWorkerContextShouldAggressivelyFreeResources(false)) 452 SetAggressivelyFreeResources(false))
445 .Times(1); 453 .Times(1);
446 454
447 // After running, we should get exactly one call to 455 // After running, we should get exactly one call to
448 // FreeWorkerContextGpuResources. 456 // DeleteCachedResources, along with SetAggressivelyFreeResources.
449 EXPECT_CALL(*output_surface, 457 EXPECT_CALL(*mock_worker_context_provider, DeleteCachedResources())
450 SetWorkerContextShouldAggressivelyFreeResources(true)) 458 .After(visibility_true);
459 EXPECT_CALL(*mock_worker_context_support,
460 SetAggressivelyFreeResources(true))
451 .After(visibility_true) 461 .After(visibility_true)
452 .WillOnce(testing::Invoke([this](bool is_visible) { EndTest(); })); 462 .WillOnce(testing::Invoke([this](bool is_visible) { EndTest(); }));
453 return std::move(output_surface); 463
464 return LayerTreeHostTest::CreateDelegatingOutputSurface(
465 std::move(compositor_context_provider),
466 std::move(mock_worker_context_provider));
454 } 467 }
455 468
456 void InitializeSettings(LayerTreeSettings* settings) override { 469 void InitializeSettings(LayerTreeSettings* settings) override {
457 settings->gpu_rasterization_enabled = true; 470 settings->gpu_rasterization_enabled = true;
458 settings->gpu_rasterization_forced = true; 471 settings->gpu_rasterization_forced = true;
459 } 472 }
460 473
461 void BeginTest() override { 474 void BeginTest() override {}
462 // Logic is handled in InitializedRendererOnThread to ensure that our 475 void AfterTest() override {}
463 // LTHI is fully set up.
464 }
465
466 void AfterTest() override {
467 // Expectations handled via mock.
468 }
469 476
470 private: 477 private:
471 class MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface 478 class MockContextProvider : public TestContextProvider {
472 : public FakeOutputSurface {
473 public: 479 public:
474 ~MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface() {} 480 explicit MockContextProvider(std::unique_ptr<TestContextSupport> support)
475 explicit MockSetWorkerContextShouldAggressivelyFreeResourcesOutputSurface( 481 : TestContextProvider(std::move(support),
476 bool delegated_rendering) 482 base::MakeUnique<TestGLES2Interface>(),
477 : FakeOutputSurface(TestContextProvider::Create(), 483 TestWebGraphicsContext3D::Create()) {}
478 TestContextProvider::CreateWorker(), 484
479 delegated_rendering) {} 485 MOCK_METHOD0(DeleteCachedResources, void());
480 MOCK_METHOD1(SetWorkerContextShouldAggressivelyFreeResources, 486
481 void(bool is_visible)); 487 private:
488 ~MockContextProvider() = default;
489 };
490
491 class MockContextSupport : public TestContextSupport {
492 public:
493 MOCK_METHOD1(SetAggressivelyFreeResources,
494 void(bool aggressively_free_resources));
482 }; 495 };
483 }; 496 };
484 497
485 // Test if the LTH successfully frees resources on the worker context when 498 // Test if the LTH successfully frees resources on the worker context when
486 // visibility is set to false. 499 // visibility is set to false.
487 class LayerTreeHostFreeWorkerContextResourcesOnInvisible 500 class LayerTreeHostFreeWorkerContextResourcesOnInvisible
488 : public LayerTreeHostFreeWorkerContextResourcesTest { 501 : public LayerTreeHostFreeWorkerContextResourcesTest {
489 public: 502 public:
490 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, 503 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
491 bool success) override { 504 bool success) override {
(...skipping 21 matching lines...) Expand all
513 LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimit); 526 LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimit);
514 527
515 // Test if the LTH successfully frees resources on the worker context when 528 // Test if the LTH successfully frees resources on the worker context when
516 // hard memory limit is set to zero while using a synchronous compositor (like 529 // hard memory limit is set to zero while using a synchronous compositor (like
517 // Android WebView). 530 // Android WebView).
518 class LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimitSynchronous 531 class LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimitSynchronous
519 : public LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimit { 532 : public LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimit {
520 public: 533 public:
521 void InitializeSettings(LayerTreeSettings* settings) override { 534 void InitializeSettings(LayerTreeSettings* settings) override {
522 LayerTreeHostFreeWorkerContextResourcesTest::InitializeSettings(settings); 535 LayerTreeHostFreeWorkerContextResourcesTest::InitializeSettings(settings);
523 settings->use_external_begin_frame_source = true;
524 settings->using_synchronous_renderer_compositor = true; 536 settings->using_synchronous_renderer_compositor = true;
525 } 537 }
526 }; 538 };
527 539
528 SINGLE_AND_MULTI_THREAD_TEST_F( 540 SINGLE_AND_MULTI_THREAD_TEST_F(
529 LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimitSynchronous); 541 LayerTreeHostFreeWorkerContextResourcesOnZeroMemoryLimitSynchronous);
530 542
531 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 543 // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
532 // draw with frame 0. 544 // draw with frame 0.
533 class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest { 545 class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest {
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 2567
2556 void AfterTest() override {} 2568 void AfterTest() override {}
2557 2569
2558 private: 2570 private:
2559 FakeContentLayerClient client_; 2571 FakeContentLayerClient client_;
2560 int num_tiles_rastered_; 2572 int num_tiles_rastered_;
2561 }; 2573 };
2562 2574
2563 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDChange); 2575 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDChange);
2564 2576
2565 // Verify that the BeginFrame notification is used to initiate rendering.
2566 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest {
2567 public:
2568 void InitializeSettings(LayerTreeSettings* settings) override {
2569 settings->use_external_begin_frame_source = true;
2570 }
2571
2572 void BeginTest() override {
2573 // This will trigger a SetNeedsBeginFrame which will trigger a
2574 // BeginFrame.
2575 PostSetNeedsCommitToMainThread();
2576 }
2577
2578 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
2579 LayerTreeHostImpl::FrameData* frame,
2580 DrawResult draw_result) override {
2581 EndTest();
2582 return DRAW_SUCCESS;
2583 }
2584
2585 void AfterTest() override {}
2586
2587 private:
2588 base::TimeTicks frame_time_;
2589 };
2590
2591 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification);
2592
2593 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled 2577 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled
2594 : public LayerTreeHostTest { 2578 : public LayerTreeHostTest {
2595 public: 2579 public:
2596 void InitializeSettings(LayerTreeSettings* settings) override { 2580 void InitializeSettings(LayerTreeSettings* settings) override {
2597 settings->use_external_begin_frame_source = true;
2598 settings->using_synchronous_renderer_compositor = true; 2581 settings->using_synchronous_renderer_compositor = true;
2599 } 2582 }
2600 2583
2601 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2584 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2602 2585
2603 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 2586 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
2604 // The BeginFrame notification is turned off now but will get enabled 2587 // The BeginFrame notification is turned off now but will get enabled
2605 // once we return. End test while it's enabled. 2588 // once we return. End test while it's enabled.
2606 ImplThreadTaskRunner()->PostTask( 2589 ImplThreadTaskRunner()->PostTask(
2607 FROM_HERE, 2590 FROM_HERE,
2608 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, 2591 base::Bind(&LayerTreeHostTest::EndTest, base::Unretained(this)));
2609 base::Unretained(this)));
2610 } 2592 }
2611 2593
2612 void AfterTest() override {} 2594 void AfterTest() override {}
2613 }; 2595 };
2614 2596
2615 MULTI_THREAD_TEST_F( 2597 MULTI_THREAD_TEST_F(
2616 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); 2598 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled);
2617 2599
2618 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { 2600 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest {
2619 protected: 2601 protected:
2620 LayerTreeHostTestAbortedCommitDoesntStall() 2602 LayerTreeHostTestAbortedCommitDoesntStall()
2621 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} 2603 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {}
2622 2604
2623 void InitializeSettings(LayerTreeSettings* settings) override {
2624 settings->use_external_begin_frame_source = true;
2625 }
2626
2627 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2605 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2628 2606
2629 void DidCommit() override { 2607 void DidCommit() override {
2630 commit_count_++; 2608 commit_count_++;
2631 if (commit_count_ == 4) { 2609 if (commit_count_ == 4) {
2632 // After two aborted commits, request a real commit now to make sure a 2610 // After two aborted commits, request a real commit now to make sure a
2633 // real commit following an aborted commit will still complete and 2611 // real commit following an aborted commit will still complete and
2634 // end the test even when the Impl thread is idle. 2612 // end the test even when the Impl thread is idle.
2635 layer_tree_host()->SetNeedsCommit(); 2613 layer_tree_host()->SetNeedsCommit();
2636 } 2614 }
(...skipping 20 matching lines...) Expand all
2657 EXPECT_EQ(commit_count_, 5); 2635 EXPECT_EQ(commit_count_, 5);
2658 EXPECT_EQ(commit_abort_count_, 3); 2636 EXPECT_EQ(commit_abort_count_, 3);
2659 EXPECT_EQ(commit_complete_count_, 2); 2637 EXPECT_EQ(commit_complete_count_, 2);
2660 } 2638 }
2661 2639
2662 int commit_count_; 2640 int commit_count_;
2663 int commit_abort_count_; 2641 int commit_abort_count_;
2664 int commit_complete_count_; 2642 int commit_complete_count_;
2665 }; 2643 };
2666 2644
2667 class OnDrawOutputSurface : public OutputSurface { 2645 class OnDrawOutputSurface : public TestDelegatingOutputSurface {
2668 public: 2646 public:
2669 explicit OnDrawOutputSurface(base::Closure invalidate_callback) 2647 explicit OnDrawOutputSurface(
2670 : OutputSurface(TestContextProvider::Create(), 2648 scoped_refptr<ContextProvider> compositor_context_provider,
2671 TestContextProvider::CreateWorker(), 2649 scoped_refptr<ContextProvider> worker_context_provider,
2672 nullptr), 2650 std::unique_ptr<OutputSurface> display_output_surface,
2673 invalidate_callback_(std::move(invalidate_callback)) { 2651 SharedBitmapManager* shared_bitmap_manager,
2674 capabilities_.delegated_rendering = true; 2652 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
2675 } 2653 const RendererSettings& renderer_settings,
2654 base::SingleThreadTaskRunner* task_runner,
2655 bool synchronous_composite,
2656 bool force_disable_reclaim_resources,
2657 base::Closure invalidate_callback)
2658 : TestDelegatingOutputSurface(std::move(compositor_context_provider),
2659 std::move(worker_context_provider),
2660 std::move(display_output_surface),
2661 shared_bitmap_manager,
2662 gpu_memory_buffer_manager,
2663 renderer_settings,
2664 task_runner,
2665 synchronous_composite,
2666 force_disable_reclaim_resources),
2667 invalidate_callback_(std::move(invalidate_callback)) {}
2676 2668
2677 // OutputSurface implementation. 2669 // TestDelegatingOutputSurface overrides.
2678 void SwapBuffers(CompositorFrame frame) override { did_swap_ = true; }
2679 uint32_t GetFramebufferCopyTextureFormat() override { return 0; }
2680 void Invalidate() override { invalidate_callback_.Run(); } 2670 void Invalidate() override { invalidate_callback_.Run(); }
2681 2671
2682 void OnDraw(bool resourceless_software_draw) { 2672 void OnDraw(bool resourceless_software_draw) {
2683 gfx::Transform identity; 2673 gfx::Transform identity;
2684 gfx::Rect empty_rect; 2674 gfx::Rect empty_rect;
2685 // SwapBuffers happens inside of OnDraw.
2686 client_->OnDraw(identity, empty_rect, resourceless_software_draw); 2675 client_->OnDraw(identity, empty_rect, resourceless_software_draw);
2687 if (did_swap_) {
2688 did_swap_ = false;
2689 client_->DidSwapBuffersComplete();
2690 }
2691 } 2676 }
2692 2677
2693 private: 2678 private:
2694 bool did_swap_ = false; 2679 const base::Closure invalidate_callback_;
2695 base::Closure invalidate_callback_;
2696 }; 2680 };
2697 2681
2698 class LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor 2682 class LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor
2699 : public LayerTreeHostTestAbortedCommitDoesntStall { 2683 : public LayerTreeHostTestAbortedCommitDoesntStall {
2700 protected: 2684 protected:
2701 void InitializeSettings(LayerTreeSettings* settings) override { 2685 void InitializeSettings(LayerTreeSettings* settings) override {
2702 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings); 2686 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings);
2703 settings->using_synchronous_renderer_compositor = true; 2687 settings->using_synchronous_renderer_compositor = true;
2704 } 2688 }
2705 2689
2706 std::unique_ptr<OutputSurface> CreateOutputSurface() override { 2690 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface(
2707 auto output_surface = base::MakeUnique<OnDrawOutputSurface>(base::Bind( 2691 scoped_refptr<ContextProvider> compositor_context_provider,
2692 scoped_refptr<ContextProvider> worker_context_provider) override {
2693 auto on_draw_callback = base::Bind(
2708 &LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor:: 2694 &LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor::
2709 CallOnDraw, 2695 CallOnDraw,
2710 base::Unretained(this))); 2696 base::Unretained(this));
2697 auto output_surface = base::MakeUnique<OnDrawOutputSurface>(
2698 compositor_context_provider, std::move(worker_context_provider),
2699 CreateDisplayOutputSurface(compositor_context_provider),
2700 shared_bitmap_manager(), gpu_memory_buffer_manager(),
2701 layer_tree_host()->settings().renderer_settings, ImplThreadTaskRunner(),
2702 false /* synchronous_composite */,
2703 false /* force_disable_reclaim_resources */,
2704 std::move(on_draw_callback));
2711 output_surface_ = output_surface.get(); 2705 output_surface_ = output_surface.get();
2712 return std::move(output_surface); 2706 return std::move(output_surface);
2713 } 2707 }
2714 2708
2715 void CallOnDraw() { 2709 void CallOnDraw() {
2716 if (!TestEnded()) { 2710 if (!TestEnded()) {
2717 // Synchronous compositor does not draw unless told to do so by the output 2711 // Synchronous compositor does not draw unless told to do so by the output
2718 // surface. But it needs to be done on a new stack frame. 2712 // surface. But it needs to be done on a new stack frame.
2719 bool resourceless_software_draw = false; 2713 bool resourceless_software_draw = false;
2720 ImplThreadTaskRunner()->PostTask( 2714 ImplThreadTaskRunner()->PostTask(
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 child_layer_->SetBounds(gfx::Size(50, 50)); 2830 child_layer_->SetBounds(gfx::Size(50, 50));
2837 2831
2838 root_layer_->AddChild(parent_layer_); 2832 root_layer_->AddChild(parent_layer_);
2839 parent_layer_->AddChild(child_layer_); 2833 parent_layer_->AddChild(child_layer_);
2840 layer_tree_host()->SetRootLayer(root_layer_); 2834 layer_tree_host()->SetRootLayer(root_layer_);
2841 2835
2842 LayerTreeHostTest::SetupTree(); 2836 LayerTreeHostTest::SetupTree();
2843 client_.set_bounds(root_layer_->bounds()); 2837 client_.set_bounds(root_layer_->bounds());
2844 } 2838 }
2845 2839
2846 std::unique_ptr<OutputSurface> CreateOutputSurface() override { 2840 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface(
2841 scoped_refptr<ContextProvider> compositor_context_provider,
2842 scoped_refptr<ContextProvider> worker_context_provider) override {
2843 auto on_draw_callback =
2844 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw,
2845 base::Unretained(this));
2847 auto output_surface = base::MakeUnique<OnDrawOutputSurface>( 2846 auto output_surface = base::MakeUnique<OnDrawOutputSurface>(
2848 base::Bind(&LayerTreeHostTestResourcelessSoftwareDraw::CallOnDraw, 2847 compositor_context_provider, std::move(worker_context_provider),
2849 base::Unretained(this))); 2848 CreateDisplayOutputSurface(compositor_context_provider),
2849 shared_bitmap_manager(), gpu_memory_buffer_manager(),
2850 layer_tree_host()->settings().renderer_settings, ImplThreadTaskRunner(),
2851 false /* synchronous_composite */,
2852 false /* force_disable_reclaim_resources */,
2853 std::move(on_draw_callback));
2850 output_surface_ = output_surface.get(); 2854 output_surface_ = output_surface.get();
2851 return std::move(output_surface); 2855 return std::move(output_surface);
2852 } 2856 }
2853 2857
2854 void BeginTest() override { 2858 void BeginTest() override {
2855 PostSetNeedsCommitToMainThread(); 2859 PostSetNeedsCommitToMainThread();
2856 } 2860 }
2857 2861
2858 void CallOnDraw() { 2862 void CallOnDraw() {
2859 if (!TestEnded()) { 2863 if (!TestEnded()) {
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
4369 4373
4370 MULTI_THREAD_TEST_F(LayerTreeHostTestElasticOverscroll); 4374 MULTI_THREAD_TEST_F(LayerTreeHostTestElasticOverscroll);
4371 4375
4372 class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface 4376 class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
4373 : public LayerTreeHostTest { 4377 : public LayerTreeHostTest {
4374 protected: 4378 protected:
4375 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface() 4379 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface()
4376 : first_output_surface_memory_limit_(4321234), 4380 : first_output_surface_memory_limit_(4321234),
4377 second_output_surface_memory_limit_(1234321) {} 4381 second_output_surface_memory_limit_(1234321) {}
4378 4382
4379 std::unique_ptr<OutputSurface> CreateOutputSurface() override { 4383 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface(
4380 if (!first_context_provider_.get()) { 4384 scoped_refptr<ContextProvider> compositor_context_provider) override {
4385 if (!first_context_provider_) {
4381 first_context_provider_ = TestContextProvider::Create(); 4386 first_context_provider_ = TestContextProvider::Create();
4387 compositor_context_provider = first_context_provider_;
4382 } else { 4388 } else {
4383 EXPECT_FALSE(second_context_provider_.get()); 4389 EXPECT_FALSE(second_context_provider_);
4384 second_context_provider_ = TestContextProvider::Create(); 4390 second_context_provider_ = TestContextProvider::Create();
4391 compositor_context_provider = second_context_provider_;
4385 } 4392 }
4386 4393
4387 scoped_refptr<TestContextProvider> provider(second_context_provider_.get() 4394 auto output_surface =
4388 ? second_context_provider_ 4395 FakeOutputSurface::Create3d(std::move(compositor_context_provider));
4389 : first_context_provider_);
4390 std::unique_ptr<FakeOutputSurface> output_surface;
4391 if (delegating_renderer())
4392 output_surface = FakeOutputSurface::CreateDelegating3d(provider);
4393 else
4394 output_surface = FakeOutputSurface::Create3d(provider);
4395 output_surface->SetMemoryPolicyToSetAtBind( 4396 output_surface->SetMemoryPolicyToSetAtBind(
4396 base::WrapUnique(new ManagedMemoryPolicy( 4397 base::WrapUnique(new ManagedMemoryPolicy(
4397 second_context_provider_.get() ? second_output_surface_memory_limit_ 4398 second_context_provider_.get() ? second_output_surface_memory_limit_
4398 : first_output_surface_memory_limit_, 4399 : first_output_surface_memory_limit_,
4399 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 4400 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
4400 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); 4401 ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
4401 return std::move(output_surface); 4402 return std::move(output_surface);
4402 } 4403 }
4403 4404
4404 void SetupTree() override { 4405 void SetupTree() override {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4520 if (frame == -1) { 4521 if (frame == -1) {
4521 host_impl->active_tree()->QueuePinnedSwapPromise(base::WrapUnique( 4522 host_impl->active_tree()->QueuePinnedSwapPromise(base::WrapUnique(
4522 new TestSwapPromise(&pinned_active_swap_promise_result_))); 4523 new TestSwapPromise(&pinned_active_swap_promise_result_)));
4523 host_impl->pending_tree()->QueueSwapPromise( 4524 host_impl->pending_tree()->QueueSwapPromise(
4524 base::WrapUnique(new TestSwapPromise(&pending_swap_promise_result_))); 4525 base::WrapUnique(new TestSwapPromise(&pending_swap_promise_result_)));
4525 host_impl->active_tree()->QueueSwapPromise( 4526 host_impl->active_tree()->QueueSwapPromise(
4526 base::WrapUnique(new TestSwapPromise(&active_swap_promise_result_))); 4527 base::WrapUnique(new TestSwapPromise(&active_swap_promise_result_)));
4527 } 4528 }
4528 } 4529 }
4529 4530
4530 void SwapBuffersCompleteOnThread() override { EndTest(); } 4531 void DisplayDidDrawAndSwapOnThread() override { EndTest(); }
4531 4532
4532 void AfterTest() override { 4533 void AfterTest() override {
4533 // The pending swap promise should activate and swap. 4534 // The pending swap promise should activate and swap.
4534 EXPECT_TRUE(pending_swap_promise_result_.did_activate_called); 4535 EXPECT_TRUE(pending_swap_promise_result_.did_activate_called);
4535 EXPECT_TRUE(pending_swap_promise_result_.did_swap_called); 4536 EXPECT_TRUE(pending_swap_promise_result_.did_swap_called);
4536 4537
4537 // The active swap promise should fail to swap (it is cancelled by 4538 // The active swap promise should fail to swap (it is cancelled by
4538 // the activation of a new frame). 4539 // the activation of a new frame).
4539 EXPECT_FALSE(active_swap_promise_result_.did_activate_called); 4540 EXPECT_FALSE(active_swap_promise_result_.did_activate_called);
4540 EXPECT_FALSE(active_swap_promise_result_.did_swap_called); 4541 EXPECT_FALSE(active_swap_promise_result_.did_swap_called);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4712 } 4713 }
4713 4714
4714 void SetCallback(LayerTreeHostImpl* host_impl, bool enable) { 4715 void SetCallback(LayerTreeHostImpl* host_impl, bool enable) {
4715 host_impl->SetTreeActivationCallback( 4716 host_impl->SetTreeActivationCallback(
4716 enable 4717 enable
4717 ? base::Bind(&LayerTreeHostTestKeepSwapPromise::ActivationCallback, 4718 ? base::Bind(&LayerTreeHostTestKeepSwapPromise::ActivationCallback,
4718 base::Unretained(this)) 4719 base::Unretained(this))
4719 : base::Closure()); 4720 : base::Closure());
4720 } 4721 }
4721 4722
4722 void SwapBuffersCompleteOnThread() override { 4723 void DisplayDidDrawAndSwapOnThread() override {
4723 if (num_swaps_++ >= 1) { 4724 if (num_swaps_++ >= 1) {
4724 // The commit changes layers so it should cause a swap. 4725 // The commit changes layers so it should cause a swap.
4725 base::AutoLock lock(swap_promise_result_.lock); 4726 base::AutoLock lock(swap_promise_result_.lock);
4726 EXPECT_TRUE(swap_promise_result_.did_swap_called); 4727 EXPECT_TRUE(swap_promise_result_.did_swap_called);
4727 EXPECT_FALSE(swap_promise_result_.did_not_swap_called); 4728 EXPECT_FALSE(swap_promise_result_.did_not_swap_called);
4728 EXPECT_TRUE(swap_promise_result_.dtor_called); 4729 EXPECT_TRUE(swap_promise_result_.dtor_called);
4729 EndTest(); 4730 EndTest();
4730 } 4731 }
4731 } 4732 }
4732 4733
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
5456 }; 5457 };
5457 5458
5458 // TODO(vmpstr): Enable with single thread impl-side painting. 5459 // TODO(vmpstr): Enable with single thread impl-side painting.
5459 // This test blocks activation which is not supported for single thread mode. 5460 // This test blocks activation which is not supported for single thread mode.
5460 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible); 5461 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible);
5461 5462
5462 // Do a synchronous composite and assert that the swap promise succeeds. 5463 // Do a synchronous composite and assert that the swap promise succeeds.
5463 class LayerTreeHostTestSynchronousCompositeSwapPromise 5464 class LayerTreeHostTestSynchronousCompositeSwapPromise
5464 : public LayerTreeHostTest { 5465 : public LayerTreeHostTest {
5465 public: 5466 public:
5466 LayerTreeHostTestSynchronousCompositeSwapPromise() : commit_count_(0) {} 5467 LayerTreeHostTestSynchronousCompositeSwapPromise() = default;
5467 5468
5468 void InitializeSettings(LayerTreeSettings* settings) override { 5469 void InitializeSettings(LayerTreeSettings* settings) override {
5469 settings->single_thread_proxy_scheduler = false; 5470 settings->single_thread_proxy_scheduler = false;
5470 settings->use_zero_copy = true; 5471 settings->use_zero_copy = true;
5471 } 5472 }
5472 5473
5474 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface(
5475 scoped_refptr<ContextProvider> compositor_context_provider,
5476 scoped_refptr<ContextProvider> worker_context_provider) override {
5477 bool synchronous_composite =
5478 !HasImplThread() &&
5479 !layer_tree_host()->settings().single_thread_proxy_scheduler;
5480 // Relaiming resources is parameterized for this test.
5481 bool force_disable_reclaim_resources = !reclaim_resources_;
5482 return base::MakeUnique<TestDelegatingOutputSurface>(
5483 compositor_context_provider, std::move(worker_context_provider),
5484 CreateDisplayOutputSurface(compositor_context_provider),
5485 shared_bitmap_manager(), gpu_memory_buffer_manager(),
5486 layer_tree_host()->settings().renderer_settings, ImplThreadTaskRunner(),
5487 synchronous_composite, force_disable_reclaim_resources);
5488 }
5489
5473 void BeginTest() override { 5490 void BeginTest() override {
5474 // Successful composite. 5491 // Successful composite.
5475 std::unique_ptr<SwapPromise> swap_promise0( 5492 std::unique_ptr<SwapPromise> swap_promise0(
5476 new TestSwapPromise(&swap_promise_result_[0])); 5493 new TestSwapPromise(&swap_promise_result_[0]));
5477 layer_tree_host()->QueueSwapPromise(std::move(swap_promise0)); 5494 layer_tree_host()->QueueSwapPromise(std::move(swap_promise0));
5478 layer_tree_host()->Composite(base::TimeTicks::Now()); 5495 layer_tree_host()->Composite(base::TimeTicks::Now());
5479 5496
5480 // Fail to swap (no damage). 5497 // Fail to swap (no damage) if not reclaiming resources from the Display.
5481 std::unique_ptr<SwapPromise> swap_promise1( 5498 std::unique_ptr<SwapPromise> swap_promise1(
5482 new TestSwapPromise(&swap_promise_result_[1])); 5499 new TestSwapPromise(&swap_promise_result_[1]));
5483 layer_tree_host()->QueueSwapPromise(std::move(swap_promise1)); 5500 layer_tree_host()->QueueSwapPromise(std::move(swap_promise1));
5484 layer_tree_host()->SetNeedsCommit(); 5501 layer_tree_host()->SetNeedsCommit();
5485 layer_tree_host()->Composite(base::TimeTicks::Now()); 5502 layer_tree_host()->Composite(base::TimeTicks::Now());
5486 5503
5487 // Fail to draw (not visible). 5504 // Fail to draw (not visible).
5488 std::unique_ptr<SwapPromise> swap_promise2( 5505 std::unique_ptr<SwapPromise> swap_promise2(
5489 new TestSwapPromise(&swap_promise_result_[2])); 5506 new TestSwapPromise(&swap_promise_result_[2]));
5490 layer_tree_host()->QueueSwapPromise(std::move(swap_promise2)); 5507 layer_tree_host()->QueueSwapPromise(std::move(swap_promise2));
(...skipping 13 matching lines...) Expand all
5504 EXPECT_EQ(3, commit_count_); 5521 EXPECT_EQ(3, commit_count_);
5505 5522
5506 // Initial swap promise should have succeded. 5523 // Initial swap promise should have succeded.
5507 { 5524 {
5508 base::AutoLock lock(swap_promise_result_[0].lock); 5525 base::AutoLock lock(swap_promise_result_[0].lock);
5509 EXPECT_TRUE(swap_promise_result_[0].did_swap_called); 5526 EXPECT_TRUE(swap_promise_result_[0].did_swap_called);
5510 EXPECT_FALSE(swap_promise_result_[0].did_not_swap_called); 5527 EXPECT_FALSE(swap_promise_result_[0].did_not_swap_called);
5511 EXPECT_TRUE(swap_promise_result_[0].dtor_called); 5528 EXPECT_TRUE(swap_promise_result_[0].dtor_called);
5512 } 5529 }
5513 5530
5514 // Second swap promise fails to swap. 5531 // Second swap promise fails to swap if not reclaiming resources from the
5532 // Display.
5515 { 5533 {
5516 base::AutoLock lock(swap_promise_result_[1].lock); 5534 base::AutoLock lock(swap_promise_result_[1].lock);
5517 EXPECT_TRUE(swap_promise_result_[1].did_activate_called); 5535 EXPECT_TRUE(swap_promise_result_[1].did_activate_called);
5518 EXPECT_FALSE(swap_promise_result_[1].did_swap_called); 5536 if (!reclaim_resources_) {
5519 EXPECT_TRUE(swap_promise_result_[1].did_not_swap_called); 5537 EXPECT_FALSE(swap_promise_result_[1].did_swap_called);
5520 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[1].reason); 5538 EXPECT_TRUE(swap_promise_result_[1].did_not_swap_called);
5539 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[1].reason);
5540 } else {
5541 EXPECT_TRUE(swap_promise_result_[1].did_swap_called);
5542 EXPECT_FALSE(swap_promise_result_[1].did_not_swap_called);
5543 }
5521 EXPECT_TRUE(swap_promise_result_[1].dtor_called); 5544 EXPECT_TRUE(swap_promise_result_[1].dtor_called);
5522 } 5545 }
5523 5546
5524 // Third swap promises also fails to swap (and draw). 5547 // Third swap promises also fails to swap (and draw).
5525 { 5548 {
5526 base::AutoLock lock(swap_promise_result_[2].lock); 5549 base::AutoLock lock(swap_promise_result_[2].lock);
5527 EXPECT_TRUE(swap_promise_result_[2].did_activate_called); 5550 EXPECT_TRUE(swap_promise_result_[2].did_activate_called);
5528 EXPECT_FALSE(swap_promise_result_[2].did_swap_called); 5551 EXPECT_FALSE(swap_promise_result_[2].did_swap_called);
5529 EXPECT_TRUE(swap_promise_result_[2].did_not_swap_called); 5552 EXPECT_TRUE(swap_promise_result_[2].did_not_swap_called);
5530 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason); 5553 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason);
5531 EXPECT_TRUE(swap_promise_result_[2].dtor_called); 5554 EXPECT_TRUE(swap_promise_result_[2].dtor_called);
5532 } 5555 }
5533 } 5556 }
5534 5557
5535 int commit_count_; 5558 bool reclaim_resources_;
5559 int commit_count_ = 0;
5536 TestSwapPromiseResult swap_promise_result_[3]; 5560 TestSwapPromiseResult swap_promise_result_[3];
5537 }; 5561 };
5538 5562
5539 SINGLE_THREAD_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise); 5563 TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise, NoReclaim) {
5564 reclaim_resources_ = false;
5565 RunTest(CompositorMode::SINGLE_THREADED, true);
5566 }
5567
5568 TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise, Reclaim) {
5569 reclaim_resources_ = true;
5570 RunTest(CompositorMode::SINGLE_THREADED, true);
5571 }
5540 5572
5541 // Make sure page scale and top control deltas are applied to the client even 5573 // Make sure page scale and top control deltas are applied to the client even
5542 // when the LayerTreeHost doesn't have a root layer. 5574 // when the LayerTreeHost doesn't have a root layer.
5543 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer 5575 class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer
5544 : public LayerTreeHostTest { 5576 : public LayerTreeHostTest {
5545 public: 5577 public:
5546 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer() 5578 LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer()
5547 : deltas_sent_to_client_(false) {} 5579 : deltas_sent_to_client_(false) {}
5548 5580
5549 void BeginTest() override { 5581 void BeginTest() override {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
5767 base::WaitableEvent playback_allowed_event_; 5799 base::WaitableEvent playback_allowed_event_;
5768 }; 5800 };
5769 5801
5770 // This test does pinching on the impl side which is not supported in single 5802 // This test does pinching on the impl side which is not supported in single
5771 // thread. 5803 // thread.
5772 MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEnds); 5804 MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEnds);
5773 5805
5774 class LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy 5806 class LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy
5775 : public LayerTreeHostTestCrispUpAfterPinchEnds { 5807 : public LayerTreeHostTestCrispUpAfterPinchEnds {
5776 protected: 5808 protected:
5777 std::unique_ptr<OutputSurface> CreateOutputSurface() override { 5809 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface(
5778 std::unique_ptr<TestWebGraphicsContext3D> context3d = 5810 scoped_refptr<ContextProvider> compositor_context_provider) override {
5779 TestWebGraphicsContext3D::Create(); 5811 scoped_refptr<TestContextProvider> display_context_provider =
5780 context3d->set_support_image(true); 5812 TestContextProvider::Create();
5813 TestWebGraphicsContext3D* context3d =
5814 display_context_provider->UnboundTestContext3d();
5781 context3d->set_support_sync_query(true); 5815 context3d->set_support_sync_query(true);
5782 #if defined(OS_MACOSX) 5816 #if defined(OS_MACOSX)
5783 context3d->set_support_texture_rectangle(true); 5817 context3d->set_support_texture_rectangle(true);
5784 #endif 5818 #endif
5785 5819 return LayerTreeTest::CreateDisplayOutputSurface(
5786 if (delegating_renderer()) 5820 std::move(display_context_provider));
5787 return FakeOutputSurface::CreateDelegating3d(std::move(context3d));
5788 else
5789 return FakeOutputSurface::Create3d(std::move(context3d));
5790 } 5821 }
5791 }; 5822 };
5792 5823
5793 // This test does pinching on the impl side which is not supported in single 5824 // This test does pinching on the impl side which is not supported in single
5794 // thread. 5825 // thread.
5795 MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy); 5826 MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy);
5796 5827
5797 class RasterizeWithGpuRasterizationCreatesResources : public LayerTreeHostTest { 5828 class RasterizeWithGpuRasterizationCreatesResources : public LayerTreeHostTest {
5798 protected: 5829 protected:
5799 RasterizeWithGpuRasterizationCreatesResources() {} 5830 RasterizeWithGpuRasterizationCreatesResources() {}
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
6819 6850
6820 void AfterTest() override {} 6851 void AfterTest() override {}
6821 }; 6852 };
6822 6853
6823 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); 6854 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface);
6824 6855
6825 // Makes sure that painted_device_scale_factor is propagated to the 6856 // Makes sure that painted_device_scale_factor is propagated to the
6826 // frame's metadata. 6857 // frame's metadata.
6827 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { 6858 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest {
6828 protected: 6859 protected:
6829 LayerTreeHostTestPaintedDeviceScaleFactor() = default;
6830
6831 std::unique_ptr<OutputSurface> CreateOutputSurface() override {
6832 auto ret = FakeOutputSurface::CreateDelegating3d();
6833 fake_output_surface_ = ret.get();
6834 return std::move(ret);
6835 }
6836
6837 void BeginTest() override { 6860 void BeginTest() override {
6838 layer_tree_host()->SetPaintedDeviceScaleFactor(2.0f); 6861 layer_tree_host()->SetPaintedDeviceScaleFactor(2.0f);
6839 EXPECT_EQ(1.0f, layer_tree_host()->device_scale_factor()); 6862 EXPECT_EQ(1.0f, layer_tree_host()->device_scale_factor());
6840 PostSetNeedsCommitToMainThread(); 6863 PostSetNeedsCommitToMainThread();
6841 } 6864 }
6842 6865
6843 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 6866 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
6844 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); 6867 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor());
6845 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); 6868 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor());
6846 } 6869 }
6847 6870
6848 void SwapBuffersCompleteOnThread() override { 6871 void DisplayReceivedCompositorFrameOnThread(
6849 EXPECT_EQ( 6872 const CompositorFrame& frame) override {
6850 2.0f, 6873 EXPECT_EQ(2.0f, frame.metadata.device_scale_factor);
6851 fake_output_surface_->last_sent_frame()->metadata.device_scale_factor);
6852 EndTest(); 6874 EndTest();
6853 } 6875 }
6854 6876
6855 void AfterTest() override {} 6877 void AfterTest() override {}
6856
6857 FakeOutputSurface* fake_output_surface_ = nullptr;
6858 }; 6878 };
6859 6879
6860 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6880 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6861 6881
6862 // The GPU image decode controller hands images off to Skia for rasterization. 6882 // The GPU image decode controller hands images off to Skia for rasterization.
6863 // When used with large images, the images in question could be deleted before 6883 // When used with large images, the images in question could be deleted before
6864 // Skia was done with them, causing a crash. This test performs an end-to-end 6884 // Skia was done with them, causing a crash. This test performs an end-to-end
6865 // check of large image rasterization to ensure we do not hit this crash. 6885 // check of large image rasterization to ensure we do not hit this crash.
6866 // Note that this code path won't always hit the crash, even when incorrect 6886 // Note that this code path won't always hit the crash, even when incorrect
6867 // behavior occurs, so this is more of a sanity check. 6887 // behavior occurs, so this is more of a sanity check.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
6932 private: 6952 private:
6933 FakeContentLayerClient client_; 6953 FakeContentLayerClient client_;
6934 const gfx::Size viewport_size_; 6954 const gfx::Size viewport_size_;
6935 const gfx::Size large_image_size_; 6955 const gfx::Size large_image_size_;
6936 }; 6956 };
6937 6957
6938 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); 6958 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage);
6939 6959
6940 } // namespace 6960 } // namespace
6941 } // namespace cc 6961 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698