| 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 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5595 FakeOutputSurface* fake_output_surface = output_surface.get(); | 5598 FakeOutputSurface* fake_output_surface = output_surface.get(); |
| 5596 | 5599 |
| 5597 // This test creates its own LayerTreeHostImpl, so | 5600 // This test creates its own LayerTreeHostImpl, so |
| 5598 // that we can force partial swap enabled. | 5601 // that we can force partial swap enabled. |
| 5599 LayerTreeSettings settings; | 5602 LayerTreeSettings settings; |
| 5600 settings.renderer_settings.partial_swap_enabled = true; | 5603 settings.renderer_settings.partial_swap_enabled = true; |
| 5601 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = | 5604 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = |
| 5602 LayerTreeHostImpl::Create( | 5605 LayerTreeHostImpl::Create( |
| 5603 settings, this, &proxy_, &stats_instrumentation_, | 5606 settings, this, &proxy_, &stats_instrumentation_, |
| 5604 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); | 5607 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); |
| 5605 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); | 5608 layer_tree_host_impl->InitializeRenderer(output_surface.get()); |
| 5606 layer_tree_host_impl->WillBeginImplFrame( | 5609 layer_tree_host_impl->WillBeginImplFrame( |
| 5607 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5610 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
| 5608 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 5611 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
| 5609 | 5612 |
| 5610 scoped_ptr<LayerImpl> root = | 5613 scoped_ptr<LayerImpl> root = |
| 5611 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 5614 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
| 5612 root->SetHasRenderSurface(true); | 5615 root->SetHasRenderSurface(true); |
| 5613 scoped_ptr<LayerImpl> child = | 5616 scoped_ptr<LayerImpl> child = |
| 5614 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 5617 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
| 5615 child->SetPosition(gfx::PointF(12.f, 13.f)); | 5618 child->SetPosition(gfx::PointF(12.f, 13.f)); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5872 } | 5875 } |
| 5873 Mock::VerifyAndClearExpectations(&mock_context); | 5876 Mock::VerifyAndClearExpectations(&mock_context); |
| 5874 } | 5877 } |
| 5875 | 5878 |
| 5876 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( | 5879 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( |
| 5877 bool partial_swap, | 5880 bool partial_swap, |
| 5878 LayerTreeHostImplClient* client, | 5881 LayerTreeHostImplClient* client, |
| 5879 Proxy* proxy, | 5882 Proxy* proxy, |
| 5880 SharedBitmapManager* manager, | 5883 SharedBitmapManager* manager, |
| 5881 TaskGraphRunner* task_graph_runner, | 5884 TaskGraphRunner* task_graph_runner, |
| 5882 RenderingStatsInstrumentation* stats_instrumentation) { | 5885 RenderingStatsInstrumentation* stats_instrumentation, |
| 5883 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 5886 OutputSurface* output_surface) { |
| 5884 scoped_ptr<OutputSurface> output_surface( | |
| 5885 FakeOutputSurface::Create3d(provider)); | |
| 5886 provider->BindToCurrentThread(); | |
| 5887 provider->TestContext3d()->set_have_post_sub_buffer(true); | |
| 5888 | |
| 5889 LayerTreeSettings settings; | 5887 LayerTreeSettings settings; |
| 5890 settings.renderer_settings.partial_swap_enabled = partial_swap; | 5888 settings.renderer_settings.partial_swap_enabled = partial_swap; |
| 5891 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5889 scoped_ptr<LayerTreeHostImpl> my_host_impl = |
| 5892 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, | 5890 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, |
| 5893 manager, nullptr, task_graph_runner, 0); | 5891 manager, nullptr, task_graph_runner, 0); |
| 5894 my_host_impl->InitializeRenderer(output_surface.Pass()); | 5892 my_host_impl->InitializeRenderer(output_surface); |
| 5895 my_host_impl->WillBeginImplFrame( | 5893 my_host_impl->WillBeginImplFrame( |
| 5896 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5894 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
| 5897 my_host_impl->SetViewportSize(gfx::Size(100, 100)); | 5895 my_host_impl->SetViewportSize(gfx::Size(100, 100)); |
| 5898 | 5896 |
| 5899 /* | 5897 /* |
| 5900 Layers are created as follows: | 5898 Layers are created as follows: |
| 5901 | 5899 |
| 5902 +--------------------+ | 5900 +--------------------+ |
| 5903 | 1 | | 5901 | 1 | |
| 5904 | +-----------+ | | 5902 | +-----------+ | |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5947 child->AddChild(grand_child.Pass()); | 5945 child->AddChild(grand_child.Pass()); |
| 5948 root->AddChild(child.Pass()); | 5946 root->AddChild(child.Pass()); |
| 5949 | 5947 |
| 5950 my_host_impl->active_tree()->SetRootLayer(root.Pass()); | 5948 my_host_impl->active_tree()->SetRootLayer(root.Pass()); |
| 5951 return my_host_impl.Pass(); | 5949 return my_host_impl.Pass(); |
| 5952 } | 5950 } |
| 5953 | 5951 |
| 5954 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { | 5952 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { |
| 5955 TestSharedBitmapManager shared_bitmap_manager; | 5953 TestSharedBitmapManager shared_bitmap_manager; |
| 5956 TestTaskGraphRunner task_graph_runner; | 5954 TestTaskGraphRunner task_graph_runner; |
| 5957 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5955 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
| 5958 SetupLayersForOpacity(true, this, &proxy_, &shared_bitmap_manager, | 5956 provider->BindToCurrentThread(); |
| 5959 &task_graph_runner, &stats_instrumentation_); | 5957 provider->TestContext3d()->set_have_post_sub_buffer(true); |
| 5958 scoped_ptr<OutputSurface> output_surface( |
| 5959 FakeOutputSurface::Create3d(provider)); |
| 5960 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
| 5961 true, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, |
| 5962 &stats_instrumentation_, output_surface.get()); |
| 5960 { | 5963 { |
| 5961 LayerTreeHostImpl::FrameData frame; | 5964 LayerTreeHostImpl::FrameData frame; |
| 5962 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 5965 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
| 5963 | 5966 |
| 5964 // Verify all quads have been computed | 5967 // Verify all quads have been computed |
| 5965 ASSERT_EQ(2U, frame.render_passes.size()); | 5968 ASSERT_EQ(2U, frame.render_passes.size()); |
| 5966 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 5969 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
| 5967 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 5970 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
| 5968 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 5971 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
| 5969 frame.render_passes[0]->quad_list.front()->material); | 5972 frame.render_passes[0]->quad_list.front()->material); |
| 5970 EXPECT_EQ(DrawQuad::RENDER_PASS, | 5973 EXPECT_EQ(DrawQuad::RENDER_PASS, |
| 5971 frame.render_passes[1]->quad_list.front()->material); | 5974 frame.render_passes[1]->quad_list.front()->material); |
| 5972 | 5975 |
| 5973 my_host_impl->DrawLayers(&frame); | 5976 my_host_impl->DrawLayers(&frame); |
| 5974 my_host_impl->DidDrawAllLayers(frame); | 5977 my_host_impl->DidDrawAllLayers(frame); |
| 5975 } | 5978 } |
| 5976 } | 5979 } |
| 5977 | 5980 |
| 5978 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { | 5981 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { |
| 5979 TestSharedBitmapManager shared_bitmap_manager; | 5982 TestSharedBitmapManager shared_bitmap_manager; |
| 5980 TestTaskGraphRunner task_graph_runner; | 5983 TestTaskGraphRunner task_graph_runner; |
| 5981 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5984 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
| 5982 SetupLayersForOpacity(false, this, &proxy_, &shared_bitmap_manager, | 5985 provider->BindToCurrentThread(); |
| 5983 &task_graph_runner, &stats_instrumentation_); | 5986 provider->TestContext3d()->set_have_post_sub_buffer(true); |
| 5987 scoped_ptr<OutputSurface> output_surface( |
| 5988 FakeOutputSurface::Create3d(provider)); |
| 5989 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
| 5990 false, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, |
| 5991 &stats_instrumentation_, output_surface.get()); |
| 5984 { | 5992 { |
| 5985 LayerTreeHostImpl::FrameData frame; | 5993 LayerTreeHostImpl::FrameData frame; |
| 5986 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 5994 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
| 5987 | 5995 |
| 5988 // Verify all quads have been computed | 5996 // Verify all quads have been computed |
| 5989 ASSERT_EQ(2U, frame.render_passes.size()); | 5997 ASSERT_EQ(2U, frame.render_passes.size()); |
| 5990 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 5998 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
| 5991 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 5999 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
| 5992 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 6000 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
| 5993 frame.render_passes[0]->quad_list.front()->material); | 6001 frame.render_passes[0]->quad_list.front()->material); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6392 } | 6400 } |
| 6393 | 6401 |
| 6394 // Checks that we have a non-0 default allocation if we pass a context that | 6402 // Checks that we have a non-0 default allocation if we pass a context that |
| 6395 // doesn't support memory management extensions. | 6403 // doesn't support memory management extensions. |
| 6396 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { | 6404 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { |
| 6397 LayerTreeSettings settings; | 6405 LayerTreeSettings settings; |
| 6398 host_impl_ = LayerTreeHostImpl::Create( | 6406 host_impl_ = LayerTreeHostImpl::Create( |
| 6399 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, | 6407 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, |
| 6400 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); | 6408 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); |
| 6401 | 6409 |
| 6402 scoped_ptr<OutputSurface> output_surface( | 6410 output_surface_ = |
| 6403 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create())); | 6411 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); |
| 6404 host_impl_->InitializeRenderer(output_surface.Pass()); | 6412 host_impl_->InitializeRenderer(output_surface_.get()); |
| 6405 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); | 6413 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); |
| 6406 } | 6414 } |
| 6407 | 6415 |
| 6408 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { | 6416 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { |
| 6409 ASSERT_TRUE(host_impl_->active_tree()); | 6417 ASSERT_TRUE(host_impl_->active_tree()); |
| 6410 | 6418 |
| 6411 // RequiresHighResToDraw is set when new output surface is used. | 6419 // RequiresHighResToDraw is set when new output surface is used. |
| 6412 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6420 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
| 6413 | 6421 |
| 6414 host_impl_->ResetRequiresHighResToDraw(); | 6422 host_impl_->ResetRequiresHighResToDraw(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6455 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6463 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
| 6456 } | 6464 } |
| 6457 | 6465 |
| 6458 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { | 6466 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { |
| 6459 public: | 6467 public: |
| 6460 void SetUp() override { | 6468 void SetUp() override { |
| 6461 fake_host_impl_ = | 6469 fake_host_impl_ = |
| 6462 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, | 6470 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, |
| 6463 &shared_bitmap_manager_, &task_graph_runner_); | 6471 &shared_bitmap_manager_, &task_graph_runner_); |
| 6464 host_impl_.reset(fake_host_impl_); | 6472 host_impl_.reset(fake_host_impl_); |
| 6465 host_impl_->InitializeRenderer(CreateOutputSurface()); | 6473 output_surface_ = CreateOutputSurface(); |
| 6474 host_impl_->InitializeRenderer(output_surface_.get()); |
| 6466 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6475 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
| 6467 } | 6476 } |
| 6468 | 6477 |
| 6469 FakeLayerTreeHostImpl* fake_host_impl_; | 6478 FakeLayerTreeHostImpl* fake_host_impl_; |
| 6470 }; | 6479 }; |
| 6471 | 6480 |
| 6472 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { | 6481 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { |
| 6473 fake_host_impl_->DidModifyTilePriorities(); | 6482 fake_host_impl_->DidModifyTilePriorities(); |
| 6474 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); | 6483 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); |
| 6475 fake_host_impl_->SetVisible(false); | 6484 fake_host_impl_->SetVisible(false); |
| (...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8451 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, | 8460 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, |
| 8452 host_impl_->gpu_rasterization_status()); | 8461 host_impl_->gpu_rasterization_status()); |
| 8453 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); | 8462 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); |
| 8454 } | 8463 } |
| 8455 | 8464 |
| 8456 // A mock output surface which lets us detect calls to ForceReclaimResources. | 8465 // A mock output surface which lets us detect calls to ForceReclaimResources. |
| 8457 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { | 8466 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { |
| 8458 public: | 8467 public: |
| 8459 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { | 8468 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { |
| 8460 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( | 8469 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( |
| 8461 TestContextProvider::Create(), TestContextProvider::Create(), false)); | 8470 TestContextProvider::Create(), TestContextProvider::CreateWorker(), |
| 8471 false)); |
| 8462 } | 8472 } |
| 8463 | 8473 |
| 8464 MOCK_METHOD0(ForceReclaimResources, void()); | 8474 MOCK_METHOD0(ForceReclaimResources, void()); |
| 8465 | 8475 |
| 8466 protected: | 8476 protected: |
| 8467 MockReclaimResourcesOutputSurface( | 8477 MockReclaimResourcesOutputSurface( |
| 8468 scoped_refptr<ContextProvider> context_provider, | 8478 scoped_refptr<ContextProvider> context_provider, |
| 8469 scoped_refptr<ContextProvider> worker_context_provider, | 8479 scoped_refptr<ContextProvider> worker_context_provider, |
| 8470 bool delegated_rendering) | 8480 bool delegated_rendering) |
| 8471 : FakeOutputSurface(context_provider, | 8481 : FakeOutputSurface(context_provider, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 8483 // Hold an unowned pointer to the output surface to use for mock expectations. | 8493 // Hold an unowned pointer to the output surface to use for mock expectations. |
| 8484 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); | 8494 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); |
| 8485 | 8495 |
| 8486 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 8496 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
| 8487 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); | 8497 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); |
| 8488 host_impl_->BeginCommit(); | 8498 host_impl_->BeginCommit(); |
| 8489 } | 8499 } |
| 8490 | 8500 |
| 8491 } // namespace | 8501 } // namespace |
| 8492 } // namespace cc | 8502 } // namespace cc |
| OLD | NEW |