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