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 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { | 2112 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { |
2111 protected: | 2113 protected: |
2112 void SetupLayers(LayerTreeSettings settings) { | 2114 void SetupLayers(LayerTreeSettings settings) { |
2113 gfx::Size content_size(100, 100); | 2115 gfx::Size content_size(100, 100); |
2114 | 2116 |
2115 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = | 2117 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = |
2116 new LayerTreeHostImplOverridePhysicalTime( | 2118 new LayerTreeHostImplOverridePhysicalTime( |
2117 settings, this, &proxy_, &shared_bitmap_manager_, | 2119 settings, this, &proxy_, &shared_bitmap_manager_, |
2118 &task_graph_runner_, &stats_instrumentation_); | 2120 &task_graph_runner_, &stats_instrumentation_); |
2119 host_impl_ = make_scoped_ptr(host_impl_override_time); | 2121 host_impl_ = make_scoped_ptr(host_impl_override_time); |
2120 host_impl_->InitializeRenderer(CreateOutputSurface()); | 2122 output_surface_ = CreateOutputSurface(); |
| 2123 host_impl_->InitializeRenderer(output_surface_.get()); |
2121 | 2124 |
2122 SetupScrollAndContentsLayers(content_size); | 2125 SetupScrollAndContentsLayers(content_size); |
2123 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); | 2126 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); |
2124 host_impl_->SetViewportSize( | 2127 host_impl_->SetViewportSize( |
2125 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 2128 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
2126 | 2129 |
2127 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar = | 2130 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar = |
2128 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, | 2131 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, |
2129 VERTICAL, 10, 0, false, true); | 2132 VERTICAL, 10, 0, false, true); |
2130 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity()); | 2133 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity()); |
(...skipping 3473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5604 FakeOutputSurface* fake_output_surface = output_surface.get(); | 5607 FakeOutputSurface* fake_output_surface = output_surface.get(); |
5605 | 5608 |
5606 // This test creates its own LayerTreeHostImpl, so | 5609 // This test creates its own LayerTreeHostImpl, so |
5607 // that we can force partial swap enabled. | 5610 // that we can force partial swap enabled. |
5608 LayerTreeSettings settings; | 5611 LayerTreeSettings settings; |
5609 settings.renderer_settings.partial_swap_enabled = true; | 5612 settings.renderer_settings.partial_swap_enabled = true; |
5610 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = | 5613 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = |
5611 LayerTreeHostImpl::Create( | 5614 LayerTreeHostImpl::Create( |
5612 settings, this, &proxy_, &stats_instrumentation_, | 5615 settings, this, &proxy_, &stats_instrumentation_, |
5613 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); | 5616 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); |
5614 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); | 5617 layer_tree_host_impl->InitializeRenderer(output_surface.get()); |
5615 layer_tree_host_impl->WillBeginImplFrame( | 5618 layer_tree_host_impl->WillBeginImplFrame( |
5616 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5619 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5617 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 5620 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
5618 | 5621 |
5619 scoped_ptr<LayerImpl> root = | 5622 scoped_ptr<LayerImpl> root = |
5620 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 5623 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
5621 root->SetHasRenderSurface(true); | 5624 root->SetHasRenderSurface(true); |
5622 scoped_ptr<LayerImpl> child = | 5625 scoped_ptr<LayerImpl> child = |
5623 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 5626 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
5624 child->SetPosition(gfx::PointF(12.f, 13.f)); | 5627 child->SetPosition(gfx::PointF(12.f, 13.f)); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5881 } | 5884 } |
5882 Mock::VerifyAndClearExpectations(&mock_context); | 5885 Mock::VerifyAndClearExpectations(&mock_context); |
5883 } | 5886 } |
5884 | 5887 |
5885 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( | 5888 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( |
5886 bool partial_swap, | 5889 bool partial_swap, |
5887 LayerTreeHostImplClient* client, | 5890 LayerTreeHostImplClient* client, |
5888 Proxy* proxy, | 5891 Proxy* proxy, |
5889 SharedBitmapManager* manager, | 5892 SharedBitmapManager* manager, |
5890 TaskGraphRunner* task_graph_runner, | 5893 TaskGraphRunner* task_graph_runner, |
5891 RenderingStatsInstrumentation* stats_instrumentation) { | 5894 RenderingStatsInstrumentation* stats_instrumentation, |
5892 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 5895 OutputSurface* output_surface) { |
5893 scoped_ptr<OutputSurface> output_surface( | |
5894 FakeOutputSurface::Create3d(provider)); | |
5895 provider->BindToCurrentThread(); | |
5896 provider->TestContext3d()->set_have_post_sub_buffer(true); | |
5897 | |
5898 LayerTreeSettings settings; | 5896 LayerTreeSettings settings; |
5899 settings.renderer_settings.partial_swap_enabled = partial_swap; | 5897 settings.renderer_settings.partial_swap_enabled = partial_swap; |
5900 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5898 scoped_ptr<LayerTreeHostImpl> my_host_impl = |
5901 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, | 5899 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, |
5902 manager, nullptr, task_graph_runner, 0); | 5900 manager, nullptr, task_graph_runner, 0); |
5903 my_host_impl->InitializeRenderer(output_surface.Pass()); | 5901 my_host_impl->InitializeRenderer(output_surface); |
5904 my_host_impl->WillBeginImplFrame( | 5902 my_host_impl->WillBeginImplFrame( |
5905 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5903 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5906 my_host_impl->SetViewportSize(gfx::Size(100, 100)); | 5904 my_host_impl->SetViewportSize(gfx::Size(100, 100)); |
5907 | 5905 |
5908 /* | 5906 /* |
5909 Layers are created as follows: | 5907 Layers are created as follows: |
5910 | 5908 |
5911 +--------------------+ | 5909 +--------------------+ |
5912 | 1 | | 5910 | 1 | |
5913 | +-----------+ | | 5911 | +-----------+ | |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5956 child->AddChild(grand_child.Pass()); | 5954 child->AddChild(grand_child.Pass()); |
5957 root->AddChild(child.Pass()); | 5955 root->AddChild(child.Pass()); |
5958 | 5956 |
5959 my_host_impl->active_tree()->SetRootLayer(root.Pass()); | 5957 my_host_impl->active_tree()->SetRootLayer(root.Pass()); |
5960 return my_host_impl.Pass(); | 5958 return my_host_impl.Pass(); |
5961 } | 5959 } |
5962 | 5960 |
5963 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { | 5961 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { |
5964 TestSharedBitmapManager shared_bitmap_manager; | 5962 TestSharedBitmapManager shared_bitmap_manager; |
5965 TestTaskGraphRunner task_graph_runner; | 5963 TestTaskGraphRunner task_graph_runner; |
5966 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5964 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
5967 SetupLayersForOpacity(true, this, &proxy_, &shared_bitmap_manager, | 5965 provider->BindToCurrentThread(); |
5968 &task_graph_runner, &stats_instrumentation_); | 5966 provider->TestContext3d()->set_have_post_sub_buffer(true); |
| 5967 scoped_ptr<OutputSurface> output_surface( |
| 5968 FakeOutputSurface::Create3d(provider)); |
| 5969 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
| 5970 true, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, |
| 5971 &stats_instrumentation_, output_surface.get()); |
5969 { | 5972 { |
5970 LayerTreeHostImpl::FrameData frame; | 5973 LayerTreeHostImpl::FrameData frame; |
5971 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 5974 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
5972 | 5975 |
5973 // Verify all quads have been computed | 5976 // Verify all quads have been computed |
5974 ASSERT_EQ(2U, frame.render_passes.size()); | 5977 ASSERT_EQ(2U, frame.render_passes.size()); |
5975 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 5978 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
5976 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 5979 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
5977 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 5980 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
5978 frame.render_passes[0]->quad_list.front()->material); | 5981 frame.render_passes[0]->quad_list.front()->material); |
5979 EXPECT_EQ(DrawQuad::RENDER_PASS, | 5982 EXPECT_EQ(DrawQuad::RENDER_PASS, |
5980 frame.render_passes[1]->quad_list.front()->material); | 5983 frame.render_passes[1]->quad_list.front()->material); |
5981 | 5984 |
5982 my_host_impl->DrawLayers(&frame); | 5985 my_host_impl->DrawLayers(&frame); |
5983 my_host_impl->DidDrawAllLayers(frame); | 5986 my_host_impl->DidDrawAllLayers(frame); |
5984 } | 5987 } |
5985 } | 5988 } |
5986 | 5989 |
5987 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { | 5990 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { |
5988 TestSharedBitmapManager shared_bitmap_manager; | 5991 TestSharedBitmapManager shared_bitmap_manager; |
5989 TestTaskGraphRunner task_graph_runner; | 5992 TestTaskGraphRunner task_graph_runner; |
5990 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5993 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
5991 SetupLayersForOpacity(false, this, &proxy_, &shared_bitmap_manager, | 5994 provider->BindToCurrentThread(); |
5992 &task_graph_runner, &stats_instrumentation_); | 5995 provider->TestContext3d()->set_have_post_sub_buffer(true); |
| 5996 scoped_ptr<OutputSurface> output_surface( |
| 5997 FakeOutputSurface::Create3d(provider)); |
| 5998 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
| 5999 false, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, |
| 6000 &stats_instrumentation_, output_surface.get()); |
5993 { | 6001 { |
5994 LayerTreeHostImpl::FrameData frame; | 6002 LayerTreeHostImpl::FrameData frame; |
5995 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 6003 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
5996 | 6004 |
5997 // Verify all quads have been computed | 6005 // Verify all quads have been computed |
5998 ASSERT_EQ(2U, frame.render_passes.size()); | 6006 ASSERT_EQ(2U, frame.render_passes.size()); |
5999 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 6007 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
6000 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 6008 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
6001 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 6009 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
6002 frame.render_passes[0]->quad_list.front()->material); | 6010 frame.render_passes[0]->quad_list.front()->material); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6401 } | 6409 } |
6402 | 6410 |
6403 // Checks that we have a non-0 default allocation if we pass a context that | 6411 // Checks that we have a non-0 default allocation if we pass a context that |
6404 // doesn't support memory management extensions. | 6412 // doesn't support memory management extensions. |
6405 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { | 6413 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { |
6406 LayerTreeSettings settings; | 6414 LayerTreeSettings settings; |
6407 host_impl_ = LayerTreeHostImpl::Create( | 6415 host_impl_ = LayerTreeHostImpl::Create( |
6408 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, | 6416 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, |
6409 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); | 6417 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); |
6410 | 6418 |
6411 scoped_ptr<OutputSurface> output_surface( | 6419 output_surface_ = |
6412 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create())); | 6420 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); |
6413 host_impl_->InitializeRenderer(output_surface.Pass()); | 6421 host_impl_->InitializeRenderer(output_surface_.get()); |
6414 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); | 6422 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); |
6415 } | 6423 } |
6416 | 6424 |
6417 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { | 6425 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { |
6418 ASSERT_TRUE(host_impl_->active_tree()); | 6426 ASSERT_TRUE(host_impl_->active_tree()); |
6419 | 6427 |
6420 // RequiresHighResToDraw is set when new output surface is used. | 6428 // RequiresHighResToDraw is set when new output surface is used. |
6421 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6429 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
6422 | 6430 |
6423 host_impl_->ResetRequiresHighResToDraw(); | 6431 host_impl_->ResetRequiresHighResToDraw(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6464 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6472 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
6465 } | 6473 } |
6466 | 6474 |
6467 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { | 6475 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { |
6468 public: | 6476 public: |
6469 void SetUp() override { | 6477 void SetUp() override { |
6470 fake_host_impl_ = | 6478 fake_host_impl_ = |
6471 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, | 6479 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, |
6472 &shared_bitmap_manager_, &task_graph_runner_); | 6480 &shared_bitmap_manager_, &task_graph_runner_); |
6473 host_impl_.reset(fake_host_impl_); | 6481 host_impl_.reset(fake_host_impl_); |
6474 host_impl_->InitializeRenderer(CreateOutputSurface()); | 6482 output_surface_ = CreateOutputSurface(); |
| 6483 host_impl_->InitializeRenderer(output_surface_.get()); |
6475 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6484 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
6476 } | 6485 } |
6477 | 6486 |
6478 FakeLayerTreeHostImpl* fake_host_impl_; | 6487 FakeLayerTreeHostImpl* fake_host_impl_; |
6479 }; | 6488 }; |
6480 | 6489 |
6481 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { | 6490 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { |
6482 fake_host_impl_->DidModifyTilePriorities(); | 6491 fake_host_impl_->DidModifyTilePriorities(); |
6483 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); | 6492 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); |
6484 fake_host_impl_->SetVisible(false); | 6493 fake_host_impl_->SetVisible(false); |
(...skipping 1975 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 |