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 3531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5662 FakeOutputSurface* fake_output_surface = output_surface.get(); | 5665 FakeOutputSurface* fake_output_surface = output_surface.get(); |
5663 | 5666 |
5664 // This test creates its own LayerTreeHostImpl, so | 5667 // This test creates its own LayerTreeHostImpl, so |
5665 // that we can force partial swap enabled. | 5668 // that we can force partial swap enabled. |
5666 LayerTreeSettings settings; | 5669 LayerTreeSettings settings; |
5667 settings.renderer_settings.partial_swap_enabled = true; | 5670 settings.renderer_settings.partial_swap_enabled = true; |
5668 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = | 5671 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = |
5669 LayerTreeHostImpl::Create( | 5672 LayerTreeHostImpl::Create( |
5670 settings, this, &proxy_, &stats_instrumentation_, | 5673 settings, this, &proxy_, &stats_instrumentation_, |
5671 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); | 5674 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); |
5672 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); | 5675 layer_tree_host_impl->InitializeRenderer(output_surface.get()); |
5673 layer_tree_host_impl->WillBeginImplFrame( | 5676 layer_tree_host_impl->WillBeginImplFrame( |
5674 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5677 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5675 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 5678 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
5676 | 5679 |
5677 scoped_ptr<LayerImpl> root = | 5680 scoped_ptr<LayerImpl> root = |
5678 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 5681 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
5679 root->SetHasRenderSurface(true); | 5682 root->SetHasRenderSurface(true); |
5680 scoped_ptr<LayerImpl> child = | 5683 scoped_ptr<LayerImpl> child = |
5681 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 5684 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
5682 child->SetPosition(gfx::PointF(12.f, 13.f)); | 5685 child->SetPosition(gfx::PointF(12.f, 13.f)); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5939 } | 5942 } |
5940 Mock::VerifyAndClearExpectations(&mock_context); | 5943 Mock::VerifyAndClearExpectations(&mock_context); |
5941 } | 5944 } |
5942 | 5945 |
5943 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( | 5946 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( |
5944 bool partial_swap, | 5947 bool partial_swap, |
5945 LayerTreeHostImplClient* client, | 5948 LayerTreeHostImplClient* client, |
5946 Proxy* proxy, | 5949 Proxy* proxy, |
5947 SharedBitmapManager* manager, | 5950 SharedBitmapManager* manager, |
5948 TaskGraphRunner* task_graph_runner, | 5951 TaskGraphRunner* task_graph_runner, |
5949 RenderingStatsInstrumentation* stats_instrumentation) { | 5952 RenderingStatsInstrumentation* stats_instrumentation, |
5950 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 5953 OutputSurface* output_surface) { |
5951 scoped_ptr<OutputSurface> output_surface( | |
5952 FakeOutputSurface::Create3d(provider)); | |
5953 provider->BindToCurrentThread(); | |
5954 provider->TestContext3d()->set_have_post_sub_buffer(true); | |
5955 | |
5956 LayerTreeSettings settings; | 5954 LayerTreeSettings settings; |
5957 settings.renderer_settings.partial_swap_enabled = partial_swap; | 5955 settings.renderer_settings.partial_swap_enabled = partial_swap; |
5958 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 5956 scoped_ptr<LayerTreeHostImpl> my_host_impl = |
5959 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, | 5957 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, |
5960 manager, nullptr, task_graph_runner, 0); | 5958 manager, nullptr, task_graph_runner, 0); |
5961 my_host_impl->InitializeRenderer(output_surface.Pass()); | 5959 my_host_impl->InitializeRenderer(output_surface); |
5962 my_host_impl->WillBeginImplFrame( | 5960 my_host_impl->WillBeginImplFrame( |
5963 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5961 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5964 my_host_impl->SetViewportSize(gfx::Size(100, 100)); | 5962 my_host_impl->SetViewportSize(gfx::Size(100, 100)); |
5965 | 5963 |
5966 /* | 5964 /* |
5967 Layers are created as follows: | 5965 Layers are created as follows: |
5968 | 5966 |
5969 +--------------------+ | 5967 +--------------------+ |
5970 | 1 | | 5968 | 1 | |
5971 | +-----------+ | | 5969 | +-----------+ | |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6014 child->AddChild(grand_child.Pass()); | 6012 child->AddChild(grand_child.Pass()); |
6015 root->AddChild(child.Pass()); | 6013 root->AddChild(child.Pass()); |
6016 | 6014 |
6017 my_host_impl->active_tree()->SetRootLayer(root.Pass()); | 6015 my_host_impl->active_tree()->SetRootLayer(root.Pass()); |
6018 return my_host_impl.Pass(); | 6016 return my_host_impl.Pass(); |
6019 } | 6017 } |
6020 | 6018 |
6021 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { | 6019 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { |
6022 TestSharedBitmapManager shared_bitmap_manager; | 6020 TestSharedBitmapManager shared_bitmap_manager; |
6023 TestTaskGraphRunner task_graph_runner; | 6021 TestTaskGraphRunner task_graph_runner; |
6024 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 6022 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
6025 SetupLayersForOpacity(true, this, &proxy_, &shared_bitmap_manager, | 6023 provider->BindToCurrentThread(); |
6026 &task_graph_runner, &stats_instrumentation_); | 6024 provider->TestContext3d()->set_have_post_sub_buffer(true); |
| 6025 scoped_ptr<OutputSurface> output_surface( |
| 6026 FakeOutputSurface::Create3d(provider)); |
| 6027 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
| 6028 true, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, |
| 6029 &stats_instrumentation_, output_surface.get()); |
6027 { | 6030 { |
6028 LayerTreeHostImpl::FrameData frame; | 6031 LayerTreeHostImpl::FrameData frame; |
6029 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 6032 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
6030 | 6033 |
6031 // Verify all quads have been computed | 6034 // Verify all quads have been computed |
6032 ASSERT_EQ(2U, frame.render_passes.size()); | 6035 ASSERT_EQ(2U, frame.render_passes.size()); |
6033 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 6036 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
6034 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 6037 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
6035 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 6038 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
6036 frame.render_passes[0]->quad_list.front()->material); | 6039 frame.render_passes[0]->quad_list.front()->material); |
6037 EXPECT_EQ(DrawQuad::RENDER_PASS, | 6040 EXPECT_EQ(DrawQuad::RENDER_PASS, |
6038 frame.render_passes[1]->quad_list.front()->material); | 6041 frame.render_passes[1]->quad_list.front()->material); |
6039 | 6042 |
6040 my_host_impl->DrawLayers(&frame); | 6043 my_host_impl->DrawLayers(&frame); |
6041 my_host_impl->DidDrawAllLayers(frame); | 6044 my_host_impl->DidDrawAllLayers(frame); |
6042 } | 6045 } |
6043 } | 6046 } |
6044 | 6047 |
6045 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { | 6048 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { |
6046 TestSharedBitmapManager shared_bitmap_manager; | 6049 TestSharedBitmapManager shared_bitmap_manager; |
6047 TestTaskGraphRunner task_graph_runner; | 6050 TestTaskGraphRunner task_graph_runner; |
6048 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 6051 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
6049 SetupLayersForOpacity(false, this, &proxy_, &shared_bitmap_manager, | 6052 provider->BindToCurrentThread(); |
6050 &task_graph_runner, &stats_instrumentation_); | 6053 provider->TestContext3d()->set_have_post_sub_buffer(true); |
| 6054 scoped_ptr<OutputSurface> output_surface( |
| 6055 FakeOutputSurface::Create3d(provider)); |
| 6056 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
| 6057 false, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, |
| 6058 &stats_instrumentation_, output_surface.get()); |
6051 { | 6059 { |
6052 LayerTreeHostImpl::FrameData frame; | 6060 LayerTreeHostImpl::FrameData frame; |
6053 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 6061 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
6054 | 6062 |
6055 // Verify all quads have been computed | 6063 // Verify all quads have been computed |
6056 ASSERT_EQ(2U, frame.render_passes.size()); | 6064 ASSERT_EQ(2U, frame.render_passes.size()); |
6057 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 6065 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
6058 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 6066 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
6059 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 6067 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
6060 frame.render_passes[0]->quad_list.front()->material); | 6068 frame.render_passes[0]->quad_list.front()->material); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6459 } | 6467 } |
6460 | 6468 |
6461 // Checks that we have a non-0 default allocation if we pass a context that | 6469 // Checks that we have a non-0 default allocation if we pass a context that |
6462 // doesn't support memory management extensions. | 6470 // doesn't support memory management extensions. |
6463 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { | 6471 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { |
6464 LayerTreeSettings settings; | 6472 LayerTreeSettings settings; |
6465 host_impl_ = LayerTreeHostImpl::Create( | 6473 host_impl_ = LayerTreeHostImpl::Create( |
6466 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, | 6474 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, |
6467 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); | 6475 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); |
6468 | 6476 |
6469 scoped_ptr<OutputSurface> output_surface( | 6477 output_surface_ = |
6470 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create())); | 6478 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); |
6471 host_impl_->InitializeRenderer(output_surface.Pass()); | 6479 host_impl_->InitializeRenderer(output_surface_.get()); |
6472 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); | 6480 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); |
6473 } | 6481 } |
6474 | 6482 |
6475 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { | 6483 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { |
6476 ASSERT_TRUE(host_impl_->active_tree()); | 6484 ASSERT_TRUE(host_impl_->active_tree()); |
6477 | 6485 |
6478 // RequiresHighResToDraw is set when new output surface is used. | 6486 // RequiresHighResToDraw is set when new output surface is used. |
6479 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6487 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
6480 | 6488 |
6481 host_impl_->ResetRequiresHighResToDraw(); | 6489 host_impl_->ResetRequiresHighResToDraw(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6522 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6530 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
6523 } | 6531 } |
6524 | 6532 |
6525 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { | 6533 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { |
6526 public: | 6534 public: |
6527 void SetUp() override { | 6535 void SetUp() override { |
6528 fake_host_impl_ = | 6536 fake_host_impl_ = |
6529 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, | 6537 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, |
6530 &shared_bitmap_manager_, &task_graph_runner_); | 6538 &shared_bitmap_manager_, &task_graph_runner_); |
6531 host_impl_.reset(fake_host_impl_); | 6539 host_impl_.reset(fake_host_impl_); |
6532 host_impl_->InitializeRenderer(CreateOutputSurface()); | 6540 output_surface_ = CreateOutputSurface(); |
| 6541 host_impl_->InitializeRenderer(output_surface_.get()); |
6533 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6542 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
6534 } | 6543 } |
6535 | 6544 |
6536 FakeLayerTreeHostImpl* fake_host_impl_; | 6545 FakeLayerTreeHostImpl* fake_host_impl_; |
6537 }; | 6546 }; |
6538 | 6547 |
6539 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { | 6548 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { |
6540 fake_host_impl_->DidModifyTilePriorities(); | 6549 fake_host_impl_->DidModifyTilePriorities(); |
6541 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); | 6550 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); |
6542 fake_host_impl_->SetVisible(false); | 6551 fake_host_impl_->SetVisible(false); |
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8515 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, | 8524 EXPECT_EQ(GpuRasterizationStatus::ON_FORCED, |
8516 host_impl_->gpu_rasterization_status()); | 8525 host_impl_->gpu_rasterization_status()); |
8517 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); | 8526 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); |
8518 } | 8527 } |
8519 | 8528 |
8520 // A mock output surface which lets us detect calls to ForceReclaimResources. | 8529 // A mock output surface which lets us detect calls to ForceReclaimResources. |
8521 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { | 8530 class MockReclaimResourcesOutputSurface : public FakeOutputSurface { |
8522 public: | 8531 public: |
8523 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { | 8532 static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { |
8524 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( | 8533 return make_scoped_ptr(new MockReclaimResourcesOutputSurface( |
8525 TestContextProvider::Create(), TestContextProvider::Create(), false)); | 8534 TestContextProvider::Create(), TestContextProvider::CreateWorker(), |
| 8535 false)); |
8526 } | 8536 } |
8527 | 8537 |
8528 MOCK_METHOD0(ForceReclaimResources, void()); | 8538 MOCK_METHOD0(ForceReclaimResources, void()); |
8529 | 8539 |
8530 protected: | 8540 protected: |
8531 MockReclaimResourcesOutputSurface( | 8541 MockReclaimResourcesOutputSurface( |
8532 scoped_refptr<ContextProvider> context_provider, | 8542 scoped_refptr<ContextProvider> context_provider, |
8533 scoped_refptr<ContextProvider> worker_context_provider, | 8543 scoped_refptr<ContextProvider> worker_context_provider, |
8534 bool delegated_rendering) | 8544 bool delegated_rendering) |
8535 : FakeOutputSurface(context_provider, | 8545 : FakeOutputSurface(context_provider, |
(...skipping 11 matching lines...) Expand all Loading... |
8547 // Hold an unowned pointer to the output surface to use for mock expectations. | 8557 // Hold an unowned pointer to the output surface to use for mock expectations. |
8548 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); | 8558 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); |
8549 | 8559 |
8550 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 8560 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
8551 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); | 8561 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); |
8552 host_impl_->BeginCommit(); | 8562 host_impl_->BeginCommit(); |
8553 } | 8563 } |
8554 | 8564 |
8555 } // namespace | 8565 } // namespace |
8556 } // namespace cc | 8566 } // namespace cc |
OLD | NEW |