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

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

Issue 1177033008: cc: Turn impl_side_painting and use_one_copy on in LayerTreeSettings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 namespace { 80 namespace {
81 81
82 class LayerTreeHostImplTest : public testing::Test, 82 class LayerTreeHostImplTest : public testing::Test,
83 public LayerTreeHostImplClient { 83 public LayerTreeHostImplClient {
84 public: 84 public:
85 LayerTreeHostImplTest() 85 LayerTreeHostImplTest()
86 : proxy_(base::ThreadTaskRunnerHandle::Get(), 86 : proxy_(base::ThreadTaskRunnerHandle::Get(),
87 base::ThreadTaskRunnerHandle::Get()), 87 base::ThreadTaskRunnerHandle::Get()),
88 always_impl_thread_(&proxy_), 88 always_impl_thread_(&proxy_),
89 always_main_thread_blocked_(&proxy_), 89 always_main_thread_blocked_(&proxy_),
90 shared_bitmap_manager_(new TestSharedBitmapManager),
91 gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager),
92 task_graph_runner_(new TestTaskGraphRunner),
93 on_can_draw_state_changed_called_(false), 90 on_can_draw_state_changed_called_(false),
94 did_notify_ready_to_activate_(false), 91 did_notify_ready_to_activate_(false),
95 did_request_commit_(false), 92 did_request_commit_(false),
96 did_request_redraw_(false), 93 did_request_redraw_(false),
97 did_request_animate_(false), 94 did_request_animate_(false),
98 did_request_prepare_tiles_(false), 95 did_request_prepare_tiles_(false),
99 did_complete_page_scale_animation_(false), 96 did_complete_page_scale_animation_(false),
100 reduce_memory_result_(true), 97 reduce_memory_result_(true),
101 current_limit_bytes_(0), 98 current_limit_bytes_(0),
102 current_priority_cutoff_value_(0) { 99 current_priority_cutoff_value_(0) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 override {} 169 override {}
173 170
174 void set_reduce_memory_result(bool reduce_memory_result) { 171 void set_reduce_memory_result(bool reduce_memory_result) {
175 reduce_memory_result_ = reduce_memory_result; 172 reduce_memory_result_ = reduce_memory_result;
176 } 173 }
177 174
178 virtual bool CreateHostImpl(const LayerTreeSettings& settings, 175 virtual bool CreateHostImpl(const LayerTreeSettings& settings,
179 scoped_ptr<OutputSurface> output_surface) { 176 scoped_ptr<OutputSurface> output_surface) {
180 host_impl_ = LayerTreeHostImpl::Create( 177 host_impl_ = LayerTreeHostImpl::Create(
181 settings, this, &proxy_, &stats_instrumentation_, 178 settings, this, &proxy_, &stats_instrumentation_,
182 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), 179 &shared_bitmap_manager_, &gpu_memory_buffer_manager_,
183 task_graph_runner_.get(), 0); 180 &task_graph_runner_, 0);
184 bool init = host_impl_->InitializeRenderer(output_surface.Pass()); 181 bool init = host_impl_->InitializeRenderer(output_surface.Pass());
185 host_impl_->SetViewportSize(gfx::Size(10, 10)); 182 host_impl_->SetViewportSize(gfx::Size(10, 10));
186 // Set the BeginFrameArgs so that methods which use it are able to. 183 // Set the BeginFrameArgs so that methods which use it are able to.
187 host_impl_->WillBeginImplFrame( 184 host_impl_->WillBeginImplFrame(
188 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 185 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
189 return init; 186 return init;
190 } 187 }
191 188
192 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { 189 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) {
193 root->SetPosition(gfx::PointF()); 190 root->SetPosition(gfx::PointF());
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void DrawOneFrame() { 414 void DrawOneFrame() {
418 LayerTreeHostImpl::FrameData frame_data; 415 LayerTreeHostImpl::FrameData frame_data;
419 host_impl_->PrepareToDraw(&frame_data); 416 host_impl_->PrepareToDraw(&frame_data);
420 host_impl_->DidDrawAllLayers(frame_data); 417 host_impl_->DidDrawAllLayers(frame_data);
421 } 418 }
422 419
423 FakeProxy proxy_; 420 FakeProxy proxy_;
424 DebugScopedSetImplThread always_impl_thread_; 421 DebugScopedSetImplThread always_impl_thread_;
425 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; 422 DebugScopedSetMainThreadBlocked always_main_thread_blocked_;
426 423
427 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; 424 TestSharedBitmapManager shared_bitmap_manager_;
428 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; 425 TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
429 scoped_ptr<TestTaskGraphRunner> task_graph_runner_; 426 TestTaskGraphRunner task_graph_runner_;
430 scoped_ptr<LayerTreeHostImpl> host_impl_; 427 scoped_ptr<LayerTreeHostImpl> host_impl_;
431 FakeRenderingStatsInstrumentation stats_instrumentation_; 428 FakeRenderingStatsInstrumentation stats_instrumentation_;
432 bool on_can_draw_state_changed_called_; 429 bool on_can_draw_state_changed_called_;
433 bool did_notify_ready_to_activate_; 430 bool did_notify_ready_to_activate_;
434 bool did_request_commit_; 431 bool did_request_commit_;
435 bool did_request_redraw_; 432 bool did_request_redraw_;
436 bool did_request_animate_; 433 bool did_request_animate_;
437 bool did_request_prepare_tiles_; 434 bool did_request_prepare_tiles_;
438 bool did_complete_page_scale_animation_; 435 bool did_complete_page_scale_animation_;
439 bool reduce_memory_result_; 436 bool reduce_memory_result_;
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 EXPECT_TRUE(did_complete_page_scale_animation_); 1754 EXPECT_TRUE(did_complete_page_scale_animation_);
1758 } 1755 }
1759 1756
1760 class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { 1757 class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
1761 public: 1758 public:
1762 LayerTreeHostImplOverridePhysicalTime( 1759 LayerTreeHostImplOverridePhysicalTime(
1763 const LayerTreeSettings& settings, 1760 const LayerTreeSettings& settings,
1764 LayerTreeHostImplClient* client, 1761 LayerTreeHostImplClient* client,
1765 Proxy* proxy, 1762 Proxy* proxy,
1766 SharedBitmapManager* manager, 1763 SharedBitmapManager* manager,
1764 TaskGraphRunner* task_graph_runner,
1767 RenderingStatsInstrumentation* rendering_stats_instrumentation) 1765 RenderingStatsInstrumentation* rendering_stats_instrumentation)
1768 : LayerTreeHostImpl(settings, 1766 : LayerTreeHostImpl(settings,
1769 client, 1767 client,
1770 proxy, 1768 proxy,
1771 rendering_stats_instrumentation, 1769 rendering_stats_instrumentation,
1772 manager, 1770 manager,
1773 NULL, 1771 nullptr,
1774 NULL, 1772 task_graph_runner,
1775 0) {} 1773 0) {}
1776 1774
1777 BeginFrameArgs CurrentBeginFrameArgs() const override { 1775 BeginFrameArgs CurrentBeginFrameArgs() const override {
1778 return CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 1776 return CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE,
1779 fake_current_physical_time_); 1777 fake_current_physical_time_);
1780 } 1778 }
1781 1779
1782 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) { 1780 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) {
1783 fake_current_physical_time_ = fake_now; 1781 fake_current_physical_time_ = fake_now;
1784 } 1782 }
1785 1783
1786 private: 1784 private:
1787 base::TimeTicks fake_current_physical_time_; 1785 base::TimeTicks fake_current_physical_time_;
1788 }; 1786 };
1789 1787
1790 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { 1788 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
1791 protected: 1789 protected:
1792 void SetupLayers(LayerTreeSettings settings) { 1790 void SetupLayers(LayerTreeSettings settings) {
1793 gfx::Size viewport_size(10, 10); 1791 gfx::Size viewport_size(10, 10);
1794 gfx::Size content_size(100, 100); 1792 gfx::Size content_size(100, 100);
1795 1793
1796 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = 1794 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time =
1797 new LayerTreeHostImplOverridePhysicalTime(settings, this, &proxy_, 1795 new LayerTreeHostImplOverridePhysicalTime(
1798 shared_bitmap_manager_.get(), 1796 settings, this, &proxy_, &shared_bitmap_manager_,
1799 &stats_instrumentation_); 1797 &task_graph_runner_, &stats_instrumentation_);
1800 host_impl_ = make_scoped_ptr(host_impl_override_time); 1798 host_impl_ = make_scoped_ptr(host_impl_override_time);
1801 host_impl_->InitializeRenderer(CreateOutputSurface()); 1799 host_impl_->InitializeRenderer(CreateOutputSurface());
1802 host_impl_->SetViewportSize(viewport_size); 1800 host_impl_->SetViewportSize(viewport_size);
1803 1801
1804 scoped_ptr<LayerImpl> root = 1802 scoped_ptr<LayerImpl> root =
1805 LayerImpl::Create(host_impl_->active_tree(), 1); 1803 LayerImpl::Create(host_impl_->active_tree(), 1);
1806 root->SetBounds(viewport_size); 1804 root->SetBounds(viewport_size);
1807 1805
1808 scoped_ptr<LayerImpl> scroll = 1806 scoped_ptr<LayerImpl> scroll =
1809 LayerImpl::Create(host_impl_->active_tree(), 2); 1807 LayerImpl::Create(host_impl_->active_tree(), 2);
(...skipping 3440 matching lines...) Expand 10 before | Expand all | Expand 10 after
5250 FakeOutputSurface::Create3d(context_provider)); 5248 FakeOutputSurface::Create3d(context_provider));
5251 FakeOutputSurface* fake_output_surface = output_surface.get(); 5249 FakeOutputSurface* fake_output_surface = output_surface.get();
5252 5250
5253 // This test creates its own LayerTreeHostImpl, so 5251 // This test creates its own LayerTreeHostImpl, so
5254 // that we can force partial swap enabled. 5252 // that we can force partial swap enabled.
5255 LayerTreeSettings settings; 5253 LayerTreeSettings settings;
5256 settings.renderer_settings.partial_swap_enabled = true; 5254 settings.renderer_settings.partial_swap_enabled = true;
5257 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = 5255 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl =
5258 LayerTreeHostImpl::Create( 5256 LayerTreeHostImpl::Create(
5259 settings, this, &proxy_, &stats_instrumentation_, 5257 settings, this, &proxy_, &stats_instrumentation_,
5260 shared_bitmap_manager_.get(), NULL, task_graph_runner_.get(), 0); 5258 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0);
5261 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); 5259 layer_tree_host_impl->InitializeRenderer(output_surface.Pass());
5262 layer_tree_host_impl->WillBeginImplFrame( 5260 layer_tree_host_impl->WillBeginImplFrame(
5263 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 5261 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
5264 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); 5262 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500));
5265 5263
5266 scoped_ptr<LayerImpl> root = 5264 scoped_ptr<LayerImpl> root =
5267 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); 5265 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1);
5268 root->SetHasRenderSurface(true); 5266 root->SetHasRenderSurface(true);
5269 scoped_ptr<LayerImpl> child = 5267 scoped_ptr<LayerImpl> child =
5270 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); 5268 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
5530 host_impl_->DidDrawAllLayers(frame); 5528 host_impl_->DidDrawAllLayers(frame);
5531 } 5529 }
5532 Mock::VerifyAndClearExpectations(&mock_context); 5530 Mock::VerifyAndClearExpectations(&mock_context);
5533 } 5531 }
5534 5532
5535 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( 5533 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
5536 bool partial_swap, 5534 bool partial_swap,
5537 LayerTreeHostImplClient* client, 5535 LayerTreeHostImplClient* client,
5538 Proxy* proxy, 5536 Proxy* proxy,
5539 SharedBitmapManager* manager, 5537 SharedBitmapManager* manager,
5538 TaskGraphRunner* task_graph_runner,
5540 RenderingStatsInstrumentation* stats_instrumentation) { 5539 RenderingStatsInstrumentation* stats_instrumentation) {
5541 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); 5540 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create());
5542 scoped_ptr<OutputSurface> output_surface( 5541 scoped_ptr<OutputSurface> output_surface(
5543 FakeOutputSurface::Create3d(provider)); 5542 FakeOutputSurface::Create3d(provider));
5544 provider->BindToCurrentThread(); 5543 provider->BindToCurrentThread();
5545 provider->TestContext3d()->set_have_post_sub_buffer(true); 5544 provider->TestContext3d()->set_have_post_sub_buffer(true);
5546 5545
5547 LayerTreeSettings settings; 5546 LayerTreeSettings settings;
5548 settings.renderer_settings.partial_swap_enabled = partial_swap; 5547 settings.renderer_settings.partial_swap_enabled = partial_swap;
5549 scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create( 5548 scoped_ptr<LayerTreeHostImpl> my_host_impl =
5550 settings, client, proxy, stats_instrumentation, manager, NULL, NULL, 0); 5549 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation,
5550 manager, nullptr, task_graph_runner, 0);
5551 my_host_impl->InitializeRenderer(output_surface.Pass()); 5551 my_host_impl->InitializeRenderer(output_surface.Pass());
5552 my_host_impl->WillBeginImplFrame( 5552 my_host_impl->WillBeginImplFrame(
5553 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 5553 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
5554 my_host_impl->SetViewportSize(gfx::Size(100, 100)); 5554 my_host_impl->SetViewportSize(gfx::Size(100, 100));
5555 5555
5556 /* 5556 /*
5557 Layers are created as follows: 5557 Layers are created as follows:
5558 5558
5559 +--------------------+ 5559 +--------------------+
5560 | 1 | 5560 | 1 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
5605 grand_child->SetDrawsContent(true); 5605 grand_child->SetDrawsContent(true);
5606 5606
5607 child->AddChild(grand_child.Pass()); 5607 child->AddChild(grand_child.Pass());
5608 root->AddChild(child.Pass()); 5608 root->AddChild(child.Pass());
5609 5609
5610 my_host_impl->active_tree()->SetRootLayer(root.Pass()); 5610 my_host_impl->active_tree()->SetRootLayer(root.Pass());
5611 return my_host_impl.Pass(); 5611 return my_host_impl.Pass();
5612 } 5612 }
5613 5613
5614 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { 5614 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) {
5615 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 5615 TestSharedBitmapManager shared_bitmap_manager;
5616 new TestSharedBitmapManager()); 5616 TestTaskGraphRunner task_graph_runner;
5617 scoped_ptr<LayerTreeHostImpl> my_host_impl = 5617 scoped_ptr<LayerTreeHostImpl> my_host_impl =
5618 SetupLayersForOpacity(true, 5618 SetupLayersForOpacity(true, this, &proxy_, &shared_bitmap_manager,
5619 this, 5619 &task_graph_runner, &stats_instrumentation_);
5620 &proxy_,
5621 shared_bitmap_manager.get(),
5622 &stats_instrumentation_);
5623 { 5620 {
5624 LayerTreeHostImpl::FrameData frame; 5621 LayerTreeHostImpl::FrameData frame;
5625 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); 5622 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
5626 5623
5627 // Verify all quads have been computed 5624 // Verify all quads have been computed
5628 ASSERT_EQ(2U, frame.render_passes.size()); 5625 ASSERT_EQ(2U, frame.render_passes.size());
5629 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 5626 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
5630 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 5627 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
5631 EXPECT_EQ(DrawQuad::SOLID_COLOR, 5628 EXPECT_EQ(DrawQuad::SOLID_COLOR,
5632 frame.render_passes[0]->quad_list.front()->material); 5629 frame.render_passes[0]->quad_list.front()->material);
5633 EXPECT_EQ(DrawQuad::RENDER_PASS, 5630 EXPECT_EQ(DrawQuad::RENDER_PASS,
5634 frame.render_passes[1]->quad_list.front()->material); 5631 frame.render_passes[1]->quad_list.front()->material);
5635 5632
5636 my_host_impl->DrawLayers(&frame); 5633 my_host_impl->DrawLayers(&frame);
5637 my_host_impl->DidDrawAllLayers(frame); 5634 my_host_impl->DidDrawAllLayers(frame);
5638 } 5635 }
5639 } 5636 }
5640 5637
5641 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { 5638 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) {
5642 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 5639 TestSharedBitmapManager shared_bitmap_manager;
5643 new TestSharedBitmapManager()); 5640 TestTaskGraphRunner task_graph_runner;
5644 scoped_ptr<LayerTreeHostImpl> my_host_impl = 5641 scoped_ptr<LayerTreeHostImpl> my_host_impl =
5645 SetupLayersForOpacity(false, 5642 SetupLayersForOpacity(false, this, &proxy_, &shared_bitmap_manager,
5646 this, 5643 &task_graph_runner, &stats_instrumentation_);
5647 &proxy_,
5648 shared_bitmap_manager.get(),
5649 &stats_instrumentation_);
5650 { 5644 {
5651 LayerTreeHostImpl::FrameData frame; 5645 LayerTreeHostImpl::FrameData frame;
5652 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); 5646 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame));
5653 5647
5654 // Verify all quads have been computed 5648 // Verify all quads have been computed
5655 ASSERT_EQ(2U, frame.render_passes.size()); 5649 ASSERT_EQ(2U, frame.render_passes.size());
5656 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); 5650 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
5657 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); 5651 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
5658 EXPECT_EQ(DrawQuad::SOLID_COLOR, 5652 EXPECT_EQ(DrawQuad::SOLID_COLOR,
5659 frame.render_passes[0]->quad_list.front()->material); 5653 frame.render_passes[0]->quad_list.front()->material);
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
6094 6088
6095 EXPECT_EQ(1u, frame.will_draw_layers.size()); 6089 EXPECT_EQ(1u, frame.will_draw_layers.size());
6096 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]); 6090 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]);
6097 } 6091 }
6098 6092
6099 // Checks that we have a non-0 default allocation if we pass a context that 6093 // Checks that we have a non-0 default allocation if we pass a context that
6100 // doesn't support memory management extensions. 6094 // doesn't support memory management extensions.
6101 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { 6095 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) {
6102 LayerTreeSettings settings; 6096 LayerTreeSettings settings;
6103 host_impl_ = LayerTreeHostImpl::Create( 6097 host_impl_ = LayerTreeHostImpl::Create(
6104 settings, this, &proxy_, &stats_instrumentation_, 6098 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_,
6105 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), 6099 &gpu_memory_buffer_manager_, &task_graph_runner_, 0);
6106 task_graph_runner_.get(), 0);
6107 6100
6108 scoped_ptr<OutputSurface> output_surface( 6101 scoped_ptr<OutputSurface> output_surface(
6109 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create())); 6102 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()));
6110 host_impl_->InitializeRenderer(output_surface.Pass()); 6103 host_impl_->InitializeRenderer(output_surface.Pass());
6111 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); 6104 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes());
6112 } 6105 }
6113 6106
6114 TEST_F(LayerTreeHostImplTest, MemoryPolicy) { 6107 TEST_F(LayerTreeHostImplTest, MemoryPolicy) {
6115 ManagedMemoryPolicy policy1( 6108 ManagedMemoryPolicy policy1(
6116 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000); 6109 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
6205 host_impl_->UpdateTreeResourcesForGpuRasterizationIfNeeded(); 6198 host_impl_->UpdateTreeResourcesForGpuRasterizationIfNeeded();
6206 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); 6199 EXPECT_TRUE(host_impl_->RequiresHighResToDraw());
6207 } 6200 }
6208 6201
6209 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { 6202 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest {
6210 public: 6203 public:
6211 void SetUp() override { 6204 void SetUp() override {
6212 LayerTreeSettings settings; 6205 LayerTreeSettings settings;
6213 settings.impl_side_painting = true; 6206 settings.impl_side_painting = true;
6214 6207
6215 fake_host_impl_ = new FakeLayerTreeHostImpl(settings, &proxy_, 6208 fake_host_impl_ = new FakeLayerTreeHostImpl(
6216 shared_bitmap_manager_.get(), 6209 settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_);
6217 task_graph_runner_.get());
6218 host_impl_.reset(fake_host_impl_); 6210 host_impl_.reset(fake_host_impl_);
6219 host_impl_->InitializeRenderer(CreateOutputSurface()); 6211 host_impl_->InitializeRenderer(CreateOutputSurface());
6220 host_impl_->SetViewportSize(gfx::Size(10, 10)); 6212 host_impl_->SetViewportSize(gfx::Size(10, 10));
6221 } 6213 }
6222 6214
6223 FakeLayerTreeHostImpl* fake_host_impl_; 6215 FakeLayerTreeHostImpl* fake_host_impl_;
6224 }; 6216 };
6225 6217
6226 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { 6218 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) {
6227 fake_host_impl_->DidModifyTilePriorities(); 6219 fake_host_impl_->DidModifyTilePriorities();
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
8048 // Hold an unowned pointer to the output surface to use for mock expectations. 8040 // Hold an unowned pointer to the output surface to use for mock expectations.
8049 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); 8041 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
8050 8042
8051 CreateHostImpl(DefaultSettings(), output_surface.Pass()); 8043 CreateHostImpl(DefaultSettings(), output_surface.Pass());
8052 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); 8044 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
8053 host_impl_->BeginCommit(); 8045 host_impl_->BeginCommit();
8054 } 8046 }
8055 8047
8056 } // namespace 8048 } // namespace
8057 } // namespace cc 8049 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698