OLD | NEW |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void set_reduce_memory_result(bool reduce_memory_result) { | 161 void set_reduce_memory_result(bool reduce_memory_result) { |
162 reduce_memory_result_ = reduce_memory_result; | 162 reduce_memory_result_ = reduce_memory_result; |
163 } | 163 } |
164 | 164 |
165 virtual bool CreateHostImpl(const LayerTreeSettings& settings, | 165 virtual bool CreateHostImpl(const LayerTreeSettings& settings, |
166 scoped_ptr<OutputSurface> output_surface) { | 166 scoped_ptr<OutputSurface> output_surface) { |
167 host_impl_ = LayerTreeHostImpl::Create( | 167 host_impl_ = LayerTreeHostImpl::Create( |
168 settings, this, &proxy_, &stats_instrumentation_, | 168 settings, this, &proxy_, &stats_instrumentation_, |
169 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, | 169 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, |
170 &task_graph_runner_, 0); | 170 &task_graph_runner_, 0); |
171 output_surface_ = output_surface.Pass(); | 171 bool init = host_impl_->InitializeRenderer(output_surface.Pass()); |
172 bool init = host_impl_->InitializeRenderer(output_surface_.get()); | |
173 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 172 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
174 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); | 173 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); |
175 // Set the BeginFrameArgs so that methods which use it are able to. | 174 // Set the BeginFrameArgs so that methods which use it are able to. |
176 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting( | 175 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting( |
177 BEGINFRAME_FROM_HERE, | 176 BEGINFRAME_FROM_HERE, |
178 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1))); | 177 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1))); |
179 host_impl_->DidFinishImplFrame(); | 178 host_impl_->DidFinishImplFrame(); |
180 return init; | 179 return init; |
181 } | 180 } |
182 | 181 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 host_impl_->DidDrawAllLayers(frame_data); | 413 host_impl_->DidDrawAllLayers(frame_data); |
415 } | 414 } |
416 | 415 |
417 FakeProxy proxy_; | 416 FakeProxy proxy_; |
418 DebugScopedSetImplThread always_impl_thread_; | 417 DebugScopedSetImplThread always_impl_thread_; |
419 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; | 418 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; |
420 | 419 |
421 TestSharedBitmapManager shared_bitmap_manager_; | 420 TestSharedBitmapManager shared_bitmap_manager_; |
422 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 421 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
423 TestTaskGraphRunner task_graph_runner_; | 422 TestTaskGraphRunner task_graph_runner_; |
424 scoped_ptr<OutputSurface> output_surface_; | |
425 scoped_ptr<LayerTreeHostImpl> host_impl_; | 423 scoped_ptr<LayerTreeHostImpl> host_impl_; |
426 FakeRenderingStatsInstrumentation stats_instrumentation_; | 424 FakeRenderingStatsInstrumentation stats_instrumentation_; |
427 bool on_can_draw_state_changed_called_; | 425 bool on_can_draw_state_changed_called_; |
428 bool did_notify_ready_to_activate_; | 426 bool did_notify_ready_to_activate_; |
429 bool did_request_commit_; | 427 bool did_request_commit_; |
430 bool did_request_redraw_; | 428 bool did_request_redraw_; |
431 bool did_request_animate_; | 429 bool did_request_animate_; |
432 bool did_request_prepare_tiles_; | 430 bool did_request_prepare_tiles_; |
433 bool did_complete_page_scale_animation_; | 431 bool did_complete_page_scale_animation_; |
434 bool reduce_memory_result_; | 432 bool reduce_memory_result_; |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { | 2109 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { |
2112 protected: | 2110 protected: |
2113 void SetupLayers(LayerTreeSettings settings) { | 2111 void SetupLayers(LayerTreeSettings settings) { |
2114 gfx::Size content_size(100, 100); | 2112 gfx::Size content_size(100, 100); |
2115 | 2113 |
2116 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = | 2114 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = |
2117 new LayerTreeHostImplOverridePhysicalTime( | 2115 new LayerTreeHostImplOverridePhysicalTime( |
2118 settings, this, &proxy_, &shared_bitmap_manager_, | 2116 settings, this, &proxy_, &shared_bitmap_manager_, |
2119 &task_graph_runner_, &stats_instrumentation_); | 2117 &task_graph_runner_, &stats_instrumentation_); |
2120 host_impl_ = make_scoped_ptr(host_impl_override_time); | 2118 host_impl_ = make_scoped_ptr(host_impl_override_time); |
2121 output_surface_ = CreateOutputSurface(); | 2119 host_impl_->InitializeRenderer(CreateOutputSurface()); |
2122 host_impl_->InitializeRenderer(output_surface_.get()); | |
2123 | 2120 |
2124 SetupScrollAndContentsLayers(content_size); | 2121 SetupScrollAndContentsLayers(content_size); |
2125 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); | 2122 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); |
2126 host_impl_->SetViewportSize( | 2123 host_impl_->SetViewportSize( |
2127 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 2124 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
2128 | 2125 |
2129 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar = | 2126 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar = |
2130 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, | 2127 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, |
2131 VERTICAL, 10, 0, false, true); | 2128 VERTICAL, 10, 0, false, true); |
2132 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity()); | 2129 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity()); |
(...skipping 3476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5609 FakeOutputSurface* fake_output_surface = output_surface.get(); | 5606 FakeOutputSurface* fake_output_surface = output_surface.get(); |
5610 | 5607 |
5611 // This test creates its own LayerTreeHostImpl, so | 5608 // This test creates its own LayerTreeHostImpl, so |
5612 // that we can force partial swap enabled. | 5609 // that we can force partial swap enabled. |
5613 LayerTreeSettings settings; | 5610 LayerTreeSettings settings; |
5614 settings.renderer_settings.partial_swap_enabled = true; | 5611 settings.renderer_settings.partial_swap_enabled = true; |
5615 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = | 5612 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = |
5616 LayerTreeHostImpl::Create( | 5613 LayerTreeHostImpl::Create( |
5617 settings, this, &proxy_, &stats_instrumentation_, | 5614 settings, this, &proxy_, &stats_instrumentation_, |
5618 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); | 5615 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); |
5619 layer_tree_host_impl->InitializeRenderer(output_surface.get()); | 5616 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); |
5620 layer_tree_host_impl->WillBeginImplFrame( | 5617 layer_tree_host_impl->WillBeginImplFrame( |
5621 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5618 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5622 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 5619 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
5623 | 5620 |
5624 scoped_ptr<LayerImpl> root = | 5621 scoped_ptr<LayerImpl> root = |
5625 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 5622 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
5626 root->SetHasRenderSurface(true); | 5623 root->SetHasRenderSurface(true); |
5627 scoped_ptr<LayerImpl> child = | 5624 scoped_ptr<LayerImpl> child = |
5628 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 5625 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
5629 child->SetPosition(gfx::PointF(12.f, 13.f)); | 5626 child->SetPosition(gfx::PointF(12.f, 13.f)); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5886 } | 5883 } |
5887 Mock::VerifyAndClearExpectations(&mock_context); | 5884 Mock::VerifyAndClearExpectations(&mock_context); |
5888 } | 5885 } |
5889 | 5886 |
5890 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( | 5887 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( |
5891 bool partial_swap, | 5888 bool partial_swap, |
5892 LayerTreeHostImplClient* client, | 5889 LayerTreeHostImplClient* client, |
5893 Proxy* proxy, | 5890 Proxy* proxy, |
5894 SharedBitmapManager* manager, | 5891 SharedBitmapManager* manager, |
5895 TaskGraphRunner* task_graph_runner, | 5892 TaskGraphRunner* task_graph_runner, |
5896 RenderingStatsInstrumentation* stats_instrumentation, | 5893 RenderingStatsInstrumentation* stats_instrumentation) { |
5897 OutputSurface* output_surface) { | 5894 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
| 5895 scoped_ptr<OutputSurface> output_surface( |
| 5896 FakeOutputSurface::Create3d(provider)); |
| 5897 provider->BindToCurrentThread(); |
| 5898 provider->TestContext3d()->set_have_post_sub_buffer(true); |
| 5899 |
5898 LayerTreeSettings settings; | 5900 LayerTreeSettings settings; |
5899 settings.renderer_settings.partial_swap_enabled = partial_swap; | 5901 settings.renderer_settings.partial_swap_enabled = partial_swap; |
5900 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5902 scoped_ptr<LayerTreeHostImpl> my_host_impl = |
5901 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, | 5903 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, |
5902 manager, nullptr, task_graph_runner, 0); | 5904 manager, nullptr, task_graph_runner, 0); |
5903 my_host_impl->InitializeRenderer(output_surface); | 5905 my_host_impl->InitializeRenderer(output_surface.Pass()); |
5904 my_host_impl->WillBeginImplFrame( | 5906 my_host_impl->WillBeginImplFrame( |
5905 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5907 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5906 my_host_impl->SetViewportSize(gfx::Size(100, 100)); | 5908 my_host_impl->SetViewportSize(gfx::Size(100, 100)); |
5907 | 5909 |
5908 /* | 5910 /* |
5909 Layers are created as follows: | 5911 Layers are created as follows: |
5910 | 5912 |
5911 +--------------------+ | 5913 +--------------------+ |
5912 | 1 | | 5914 | 1 | |
5913 | +-----------+ | | 5915 | +-----------+ | |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5956 child->AddChild(grand_child.Pass()); | 5958 child->AddChild(grand_child.Pass()); |
5957 root->AddChild(child.Pass()); | 5959 root->AddChild(child.Pass()); |
5958 | 5960 |
5959 my_host_impl->active_tree()->SetRootLayer(root.Pass()); | 5961 my_host_impl->active_tree()->SetRootLayer(root.Pass()); |
5960 return my_host_impl.Pass(); | 5962 return my_host_impl.Pass(); |
5961 } | 5963 } |
5962 | 5964 |
5963 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { | 5965 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { |
5964 TestSharedBitmapManager shared_bitmap_manager; | 5966 TestSharedBitmapManager shared_bitmap_manager; |
5965 TestTaskGraphRunner task_graph_runner; | 5967 TestTaskGraphRunner task_graph_runner; |
5966 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 5968 scoped_ptr<LayerTreeHostImpl> my_host_impl = |
5967 provider->BindToCurrentThread(); | 5969 SetupLayersForOpacity(true, this, &proxy_, &shared_bitmap_manager, |
5968 provider->TestContext3d()->set_have_post_sub_buffer(true); | 5970 &task_graph_runner, &stats_instrumentation_); |
5969 scoped_ptr<OutputSurface> output_surface( | |
5970 FakeOutputSurface::Create3d(provider)); | |
5971 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( | |
5972 true, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, | |
5973 &stats_instrumentation_, output_surface.get()); | |
5974 { | 5971 { |
5975 LayerTreeHostImpl::FrameData frame; | 5972 LayerTreeHostImpl::FrameData frame; |
5976 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 5973 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
5977 | 5974 |
5978 // Verify all quads have been computed | 5975 // Verify all quads have been computed |
5979 ASSERT_EQ(2U, frame.render_passes.size()); | 5976 ASSERT_EQ(2U, frame.render_passes.size()); |
5980 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 5977 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
5981 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 5978 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
5982 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 5979 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
5983 frame.render_passes[0]->quad_list.front()->material); | 5980 frame.render_passes[0]->quad_list.front()->material); |
5984 EXPECT_EQ(DrawQuad::RENDER_PASS, | 5981 EXPECT_EQ(DrawQuad::RENDER_PASS, |
5985 frame.render_passes[1]->quad_list.front()->material); | 5982 frame.render_passes[1]->quad_list.front()->material); |
5986 | 5983 |
5987 my_host_impl->DrawLayers(&frame); | 5984 my_host_impl->DrawLayers(&frame); |
5988 my_host_impl->DidDrawAllLayers(frame); | 5985 my_host_impl->DidDrawAllLayers(frame); |
5989 } | 5986 } |
5990 } | 5987 } |
5991 | 5988 |
5992 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { | 5989 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { |
5993 TestSharedBitmapManager shared_bitmap_manager; | 5990 TestSharedBitmapManager shared_bitmap_manager; |
5994 TestTaskGraphRunner task_graph_runner; | 5991 TestTaskGraphRunner task_graph_runner; |
5995 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 5992 scoped_ptr<LayerTreeHostImpl> my_host_impl = |
5996 provider->BindToCurrentThread(); | 5993 SetupLayersForOpacity(false, this, &proxy_, &shared_bitmap_manager, |
5997 provider->TestContext3d()->set_have_post_sub_buffer(true); | 5994 &task_graph_runner, &stats_instrumentation_); |
5998 scoped_ptr<OutputSurface> output_surface( | |
5999 FakeOutputSurface::Create3d(provider)); | |
6000 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( | |
6001 false, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, | |
6002 &stats_instrumentation_, output_surface.get()); | |
6003 { | 5995 { |
6004 LayerTreeHostImpl::FrameData frame; | 5996 LayerTreeHostImpl::FrameData frame; |
6005 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 5997 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
6006 | 5998 |
6007 // Verify all quads have been computed | 5999 // Verify all quads have been computed |
6008 ASSERT_EQ(2U, frame.render_passes.size()); | 6000 ASSERT_EQ(2U, frame.render_passes.size()); |
6009 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 6001 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
6010 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 6002 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
6011 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 6003 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
6012 frame.render_passes[0]->quad_list.front()->material); | 6004 frame.render_passes[0]->quad_list.front()->material); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6411 } | 6403 } |
6412 | 6404 |
6413 // Checks that we have a non-0 default allocation if we pass a context that | 6405 // Checks that we have a non-0 default allocation if we pass a context that |
6414 // doesn't support memory management extensions. | 6406 // doesn't support memory management extensions. |
6415 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { | 6407 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { |
6416 LayerTreeSettings settings; | 6408 LayerTreeSettings settings; |
6417 host_impl_ = LayerTreeHostImpl::Create( | 6409 host_impl_ = LayerTreeHostImpl::Create( |
6418 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, | 6410 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, |
6419 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); | 6411 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); |
6420 | 6412 |
6421 output_surface_ = | 6413 scoped_ptr<OutputSurface> output_surface( |
6422 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); | 6414 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create())); |
6423 host_impl_->InitializeRenderer(output_surface_.get()); | 6415 host_impl_->InitializeRenderer(output_surface.Pass()); |
6424 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); | 6416 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); |
6425 } | 6417 } |
6426 | 6418 |
6427 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { | 6419 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { |
6428 ASSERT_TRUE(host_impl_->active_tree()); | 6420 ASSERT_TRUE(host_impl_->active_tree()); |
6429 | 6421 |
6430 // RequiresHighResToDraw is set when new output surface is used. | 6422 // RequiresHighResToDraw is set when new output surface is used. |
6431 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6423 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
6432 | 6424 |
6433 host_impl_->ResetRequiresHighResToDraw(); | 6425 host_impl_->ResetRequiresHighResToDraw(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6474 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6466 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
6475 } | 6467 } |
6476 | 6468 |
6477 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { | 6469 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { |
6478 public: | 6470 public: |
6479 void SetUp() override { | 6471 void SetUp() override { |
6480 fake_host_impl_ = | 6472 fake_host_impl_ = |
6481 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, | 6473 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, |
6482 &shared_bitmap_manager_, &task_graph_runner_); | 6474 &shared_bitmap_manager_, &task_graph_runner_); |
6483 host_impl_.reset(fake_host_impl_); | 6475 host_impl_.reset(fake_host_impl_); |
6484 output_surface_ = CreateOutputSurface(); | 6476 host_impl_->InitializeRenderer(CreateOutputSurface()); |
6485 host_impl_->InitializeRenderer(output_surface_.get()); | |
6486 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6477 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
6487 } | 6478 } |
6488 | 6479 |
6489 FakeLayerTreeHostImpl* fake_host_impl_; | 6480 FakeLayerTreeHostImpl* fake_host_impl_; |
6490 }; | 6481 }; |
6491 | 6482 |
6492 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { | 6483 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { |
6493 fake_host_impl_->DidModifyTilePriorities(); | 6484 fake_host_impl_->DidModifyTilePriorities(); |
6494 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); | 6485 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); |
6495 fake_host_impl_->SetVisible(false); | 6486 fake_host_impl_->SetVisible(false); |
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8469 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, | 8460 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, |
8470 host_impl_->gpu_rasterization_status()); | 8461 host_impl_->gpu_rasterization_status()); |
8471 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); | 8462 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); |
8472 } | 8463 } |
8473 | 8464 |
8474 // A mock output surface which lets us detect calls to ForceReclaimResources. | 8465 // A mock output surface which lets us detect calls to ForceReclaimResources. |
8475 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { | 8466 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { |
8476 public: | 8467 public: |
8477 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { | 8468 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { |
8478 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( | 8469 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( |
8479 TestContextProvider::Create(), TestContextProvider::CreateWorker(), | 8470 TestContextProvider::Create(), TestContextProvider::Create(), false)); |
8480 false)); | |
8481 } | 8471 } |
8482 | 8472 |
8483 MOCK_METHOD0(ForceReclaimResources, void()); | 8473 MOCK_METHOD0(ForceReclaimResources, void()); |
8484 | 8474 |
8485 protected: | 8475 protected: |
8486 MockReclaimResourcesOutputSurface( | 8476 MockReclaimResourcesOutputSurface( |
8487 scoped_refptr<ContextProvider> context_provider, | 8477 scoped_refptr<ContextProvider> context_provider, |
8488 scoped_refptr<ContextProvider> worker_context_provider, | 8478 scoped_refptr<ContextProvider> worker_context_provider, |
8489 bool delegated_rendering) | 8479 bool delegated_rendering) |
8490 : FakeOutputSurface(context_provider, | 8480 : FakeOutputSurface(context_provider, |
(...skipping 11 matching lines...) Expand all Loading... |
8502 // Hold an unowned pointer to the output surface to use for mock expectations. | 8492 // Hold an unowned pointer to the output surface to use for mock expectations. |
8503 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); | 8493 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); |
8504 | 8494 |
8505 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 8495 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
8506 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); | 8496 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); |
8507 host_impl_->BeginCommit(); | 8497 host_impl_->BeginCommit(); |
8508 } | 8498 } |
8509 | 8499 |
8510 } // namespace | 8500 } // namespace |
8511 } // namespace cc | 8501 } // namespace cc |
OLD | NEW |