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

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

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