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 30 matching lines...) Expand all Loading... |
41 #include "cc/quads/solid_color_draw_quad.h" | 41 #include "cc/quads/solid_color_draw_quad.h" |
42 #include "cc/quads/texture_draw_quad.h" | 42 #include "cc/quads/texture_draw_quad.h" |
43 #include "cc/quads/tile_draw_quad.h" | 43 #include "cc/quads/tile_draw_quad.h" |
44 #include "cc/test/animation_test_common.h" | 44 #include "cc/test/animation_test_common.h" |
45 #include "cc/test/begin_frame_args_test.h" | 45 #include "cc/test/begin_frame_args_test.h" |
46 #include "cc/test/fake_display_list_raster_source.h" | 46 #include "cc/test/fake_display_list_raster_source.h" |
47 #include "cc/test/fake_layer_tree_host_impl.h" | 47 #include "cc/test/fake_layer_tree_host_impl.h" |
48 #include "cc/test/fake_output_surface.h" | 48 #include "cc/test/fake_output_surface.h" |
49 #include "cc/test/fake_output_surface_client.h" | 49 #include "cc/test/fake_output_surface_client.h" |
50 #include "cc/test/fake_picture_layer_impl.h" | 50 #include "cc/test/fake_picture_layer_impl.h" |
51 #include "cc/test/fake_proxy.h" | |
52 #include "cc/test/fake_video_frame_provider.h" | 51 #include "cc/test/fake_video_frame_provider.h" |
53 #include "cc/test/geometry_test_utils.h" | 52 #include "cc/test/geometry_test_utils.h" |
54 #include "cc/test/gpu_rasterization_enabled_settings.h" | 53 #include "cc/test/gpu_rasterization_enabled_settings.h" |
55 #include "cc/test/layer_test_common.h" | 54 #include "cc/test/layer_test_common.h" |
56 #include "cc/test/layer_tree_test.h" | 55 #include "cc/test/layer_tree_test.h" |
57 #include "cc/test/test_gpu_memory_buffer_manager.h" | 56 #include "cc/test/test_gpu_memory_buffer_manager.h" |
58 #include "cc/test/test_shared_bitmap_manager.h" | 57 #include "cc/test/test_shared_bitmap_manager.h" |
59 #include "cc/test/test_task_graph_runner.h" | 58 #include "cc/test/test_task_graph_runner.h" |
60 #include "cc/test/test_web_graphics_context_3d.h" | 59 #include "cc/test/test_web_graphics_context_3d.h" |
61 #include "cc/trees/layer_tree_impl.h" | 60 #include "cc/trees/layer_tree_impl.h" |
(...skipping 13 matching lines...) Expand all Loading... |
75 using ::testing::_; | 74 using ::testing::_; |
76 using media::VideoFrame; | 75 using media::VideoFrame; |
77 | 76 |
78 namespace cc { | 77 namespace cc { |
79 namespace { | 78 namespace { |
80 | 79 |
81 class LayerTreeHostImplTest : public testing::Test, | 80 class LayerTreeHostImplTest : public testing::Test, |
82 public LayerTreeHostImplClient { | 81 public LayerTreeHostImplClient { |
83 public: | 82 public: |
84 LayerTreeHostImplTest() | 83 LayerTreeHostImplTest() |
85 : proxy_(base::ThreadTaskRunnerHandle::Get(), | 84 : thread_verifier_(base::ThreadTaskRunnerHandle::Get(), |
86 base::ThreadTaskRunnerHandle::Get()), | 85 base::ThreadTaskRunnerHandle::Get()), |
87 always_impl_thread_(&proxy_), | 86 always_impl_thread_(&thread_verifier_), |
88 always_main_thread_blocked_(&proxy_), | 87 always_main_thread_blocked_(&thread_verifier_), |
89 on_can_draw_state_changed_called_(false), | 88 on_can_draw_state_changed_called_(false), |
90 did_notify_ready_to_activate_(false), | 89 did_notify_ready_to_activate_(false), |
91 did_request_commit_(false), | 90 did_request_commit_(false), |
92 did_request_redraw_(false), | 91 did_request_redraw_(false), |
93 did_request_animate_(false), | 92 did_request_animate_(false), |
94 did_request_prepare_tiles_(false), | 93 did_request_prepare_tiles_(false), |
95 did_complete_page_scale_animation_(false), | 94 did_complete_page_scale_animation_(false), |
96 reduce_memory_result_(true) { | 95 reduce_memory_result_(true) { |
97 media::InitializeMediaLibrary(); | 96 media::InitializeMediaLibrary(); |
98 } | 97 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) | 158 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) |
160 override {} | 159 override {} |
161 | 160 |
162 void set_reduce_memory_result(bool reduce_memory_result) { | 161 void set_reduce_memory_result(bool reduce_memory_result) { |
163 reduce_memory_result_ = reduce_memory_result; | 162 reduce_memory_result_ = reduce_memory_result; |
164 } | 163 } |
165 | 164 |
166 virtual bool CreateHostImpl(const LayerTreeSettings& settings, | 165 virtual bool CreateHostImpl(const LayerTreeSettings& settings, |
167 scoped_ptr<OutputSurface> output_surface) { | 166 scoped_ptr<OutputSurface> output_surface) { |
168 host_impl_ = LayerTreeHostImpl::Create( | 167 host_impl_ = LayerTreeHostImpl::Create( |
169 settings, this, &proxy_, &stats_instrumentation_, | 168 settings, this, &thread_verifier_, &stats_instrumentation_, |
170 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, | 169 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, |
171 &task_graph_runner_, 0); | 170 &task_graph_runner_, 0); |
172 output_surface_ = output_surface.Pass(); | 171 output_surface_ = output_surface.Pass(); |
173 host_impl_->SetVisible(true); | 172 host_impl_->SetVisible(true); |
174 bool init = host_impl_->InitializeRenderer(output_surface_.get()); | 173 bool init = host_impl_->InitializeRenderer(output_surface_.get()); |
175 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 174 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
176 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); | 175 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); |
177 // Set the BeginFrameArgs so that methods which use it are able to. | 176 // Set the BeginFrameArgs so that methods which use it are able to. |
178 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting( | 177 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting( |
179 BEGINFRAME_FROM_HERE, | 178 BEGINFRAME_FROM_HERE, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 virtual scoped_ptr<OutputSurface> CreateOutputSurface() { | 421 virtual scoped_ptr<OutputSurface> CreateOutputSurface() { |
423 return FakeOutputSurface::Create3d(); | 422 return FakeOutputSurface::Create3d(); |
424 } | 423 } |
425 | 424 |
426 void DrawOneFrame() { | 425 void DrawOneFrame() { |
427 LayerTreeHostImpl::FrameData frame_data; | 426 LayerTreeHostImpl::FrameData frame_data; |
428 PrepareToDrawFrame(&frame_data); | 427 PrepareToDrawFrame(&frame_data); |
429 host_impl_->DidDrawAllLayers(frame_data); | 428 host_impl_->DidDrawAllLayers(frame_data); |
430 } | 429 } |
431 | 430 |
432 FakeProxy proxy_; | 431 ThreadVerifier thread_verifier_; |
433 DebugScopedSetImplThread always_impl_thread_; | 432 DebugScopedSetImplThread always_impl_thread_; |
434 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; | 433 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; |
435 | 434 |
436 TestSharedBitmapManager shared_bitmap_manager_; | 435 TestSharedBitmapManager shared_bitmap_manager_; |
437 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 436 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
438 TestTaskGraphRunner task_graph_runner_; | 437 TestTaskGraphRunner task_graph_runner_; |
439 scoped_ptr<OutputSurface> output_surface_; | 438 scoped_ptr<OutputSurface> output_surface_; |
440 scoped_ptr<LayerTreeHostImpl> host_impl_; | 439 scoped_ptr<LayerTreeHostImpl> host_impl_; |
441 FakeRenderingStatsInstrumentation stats_instrumentation_; | 440 FakeRenderingStatsInstrumentation stats_instrumentation_; |
442 bool on_can_draw_state_changed_called_; | 441 bool on_can_draw_state_changed_called_; |
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 host_impl_->Animate(); | 2141 host_impl_->Animate(); |
2143 EXPECT_TRUE(did_complete_page_scale_animation_); | 2142 EXPECT_TRUE(did_complete_page_scale_animation_); |
2144 host_impl_->DidFinishImplFrame(); | 2143 host_impl_->DidFinishImplFrame(); |
2145 } | 2144 } |
2146 | 2145 |
2147 class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { | 2146 class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { |
2148 public: | 2147 public: |
2149 LayerTreeHostImplOverridePhysicalTime( | 2148 LayerTreeHostImplOverridePhysicalTime( |
2150 const LayerTreeSettings& settings, | 2149 const LayerTreeSettings& settings, |
2151 LayerTreeHostImplClient* client, | 2150 LayerTreeHostImplClient* client, |
2152 Proxy* proxy, | 2151 ThreadVerifier* thread_verifier, |
2153 SharedBitmapManager* manager, | 2152 SharedBitmapManager* manager, |
2154 TaskGraphRunner* task_graph_runner, | 2153 TaskGraphRunner* task_graph_runner, |
2155 RenderingStatsInstrumentation* rendering_stats_instrumentation) | 2154 RenderingStatsInstrumentation* rendering_stats_instrumentation) |
2156 : LayerTreeHostImpl(settings, | 2155 : LayerTreeHostImpl(settings, |
2157 client, | 2156 client, |
2158 proxy, | 2157 thread_verifier, |
2159 rendering_stats_instrumentation, | 2158 rendering_stats_instrumentation, |
2160 manager, | 2159 manager, |
2161 nullptr, | 2160 nullptr, |
2162 task_graph_runner, | 2161 task_graph_runner, |
2163 0) {} | 2162 0) {} |
2164 | 2163 |
2165 BeginFrameArgs CurrentBeginFrameArgs() const override { | 2164 BeginFrameArgs CurrentBeginFrameArgs() const override { |
2166 return CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, | 2165 return CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, |
2167 fake_current_physical_time_); | 2166 fake_current_physical_time_); |
2168 } | 2167 } |
2169 | 2168 |
2170 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) { | 2169 void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) { |
2171 fake_current_physical_time_ = fake_now; | 2170 fake_current_physical_time_ = fake_now; |
2172 } | 2171 } |
2173 | 2172 |
2174 private: | 2173 private: |
2175 base::TimeTicks fake_current_physical_time_; | 2174 base::TimeTicks fake_current_physical_time_; |
2176 }; | 2175 }; |
2177 | 2176 |
2178 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { | 2177 class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { |
2179 protected: | 2178 protected: |
2180 void SetupLayers(LayerTreeSettings settings) { | 2179 void SetupLayers(LayerTreeSettings settings) { |
2181 gfx::Size content_size(100, 100); | 2180 gfx::Size content_size(100, 100); |
2182 | 2181 |
2183 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = | 2182 LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = |
2184 new LayerTreeHostImplOverridePhysicalTime( | 2183 new LayerTreeHostImplOverridePhysicalTime( |
2185 settings, this, &proxy_, &shared_bitmap_manager_, | 2184 settings, this, &thread_verifier_, &shared_bitmap_manager_, |
2186 &task_graph_runner_, &stats_instrumentation_); | 2185 &task_graph_runner_, &stats_instrumentation_); |
2187 host_impl_ = make_scoped_ptr(host_impl_override_time); | 2186 host_impl_ = make_scoped_ptr(host_impl_override_time); |
2188 output_surface_ = CreateOutputSurface(); | 2187 output_surface_ = CreateOutputSurface(); |
2189 host_impl_->SetVisible(true); | 2188 host_impl_->SetVisible(true); |
2190 host_impl_->InitializeRenderer(output_surface_.get()); | 2189 host_impl_->InitializeRenderer(output_surface_.get()); |
2191 | 2190 |
2192 SetupScrollAndContentsLayers(content_size); | 2191 SetupScrollAndContentsLayers(content_size); |
2193 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); | 2192 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); |
2194 host_impl_->SetViewportSize( | 2193 host_impl_->SetViewportSize( |
2195 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 2194 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
(...skipping 3639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5835 scoped_ptr<FakeOutputSurface> output_surface( | 5834 scoped_ptr<FakeOutputSurface> output_surface( |
5836 FakeOutputSurface::Create3d(context_provider)); | 5835 FakeOutputSurface::Create3d(context_provider)); |
5837 FakeOutputSurface* fake_output_surface = output_surface.get(); | 5836 FakeOutputSurface* fake_output_surface = output_surface.get(); |
5838 | 5837 |
5839 // This test creates its own LayerTreeHostImpl, so | 5838 // This test creates its own LayerTreeHostImpl, so |
5840 // that we can force partial swap enabled. | 5839 // that we can force partial swap enabled. |
5841 LayerTreeSettings settings; | 5840 LayerTreeSettings settings; |
5842 settings.renderer_settings.partial_swap_enabled = true; | 5841 settings.renderer_settings.partial_swap_enabled = true; |
5843 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = | 5842 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = |
5844 LayerTreeHostImpl::Create( | 5843 LayerTreeHostImpl::Create( |
5845 settings, this, &proxy_, &stats_instrumentation_, | 5844 settings, this, &thread_verifier_, &stats_instrumentation_, |
5846 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); | 5845 &shared_bitmap_manager_, NULL, &task_graph_runner_, 0); |
5847 layer_tree_host_impl->SetVisible(true); | 5846 layer_tree_host_impl->SetVisible(true); |
5848 layer_tree_host_impl->InitializeRenderer(output_surface.get()); | 5847 layer_tree_host_impl->InitializeRenderer(output_surface.get()); |
5849 layer_tree_host_impl->WillBeginImplFrame( | 5848 layer_tree_host_impl->WillBeginImplFrame( |
5850 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 5849 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5851 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 5850 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
5852 | 5851 |
5853 scoped_ptr<LayerImpl> root = | 5852 scoped_ptr<LayerImpl> root = |
5854 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 5853 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
5855 root->SetHasRenderSurface(true); | 5854 root->SetHasRenderSurface(true); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6111 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); | 6110 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); |
6112 host_impl_->DrawLayers(&frame); | 6111 host_impl_->DrawLayers(&frame); |
6113 host_impl_->DidDrawAllLayers(frame); | 6112 host_impl_->DidDrawAllLayers(frame); |
6114 } | 6113 } |
6115 Mock::VerifyAndClearExpectations(&mock_context); | 6114 Mock::VerifyAndClearExpectations(&mock_context); |
6116 } | 6115 } |
6117 | 6116 |
6118 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( | 6117 static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity( |
6119 bool partial_swap, | 6118 bool partial_swap, |
6120 LayerTreeHostImplClient* client, | 6119 LayerTreeHostImplClient* client, |
6121 Proxy* proxy, | 6120 ThreadVerifier* thread_verifier, |
6122 SharedBitmapManager* manager, | 6121 SharedBitmapManager* manager, |
6123 TaskGraphRunner* task_graph_runner, | 6122 TaskGraphRunner* task_graph_runner, |
6124 RenderingStatsInstrumentation* stats_instrumentation, | 6123 RenderingStatsInstrumentation* stats_instrumentation, |
6125 OutputSurface* output_surface) { | 6124 OutputSurface* output_surface) { |
6126 LayerTreeSettings settings; | 6125 LayerTreeSettings settings; |
6127 settings.renderer_settings.partial_swap_enabled = partial_swap; | 6126 settings.renderer_settings.partial_swap_enabled = partial_swap; |
6128 scoped_ptr<LayerTreeHostImpl> my_host_impl = | 6127 scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create( |
6129 LayerTreeHostImpl::Create(settings, client, proxy, stats_instrumentation, | 6128 settings, client, thread_verifier, stats_instrumentation, manager, |
6130 manager, nullptr, task_graph_runner, 0); | 6129 nullptr, task_graph_runner, 0); |
6131 my_host_impl->SetVisible(true); | 6130 my_host_impl->SetVisible(true); |
6132 my_host_impl->InitializeRenderer(output_surface); | 6131 my_host_impl->InitializeRenderer(output_surface); |
6133 my_host_impl->WillBeginImplFrame( | 6132 my_host_impl->WillBeginImplFrame( |
6134 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); | 6133 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
6135 my_host_impl->SetViewportSize(gfx::Size(100, 100)); | 6134 my_host_impl->SetViewportSize(gfx::Size(100, 100)); |
6136 | 6135 |
6137 /* | 6136 /* |
6138 Layers are created as follows: | 6137 Layers are created as follows: |
6139 | 6138 |
6140 +--------------------+ | 6139 +--------------------+ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6191 | 6190 |
6192 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { | 6191 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { |
6193 TestSharedBitmapManager shared_bitmap_manager; | 6192 TestSharedBitmapManager shared_bitmap_manager; |
6194 TestTaskGraphRunner task_graph_runner; | 6193 TestTaskGraphRunner task_graph_runner; |
6195 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 6194 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
6196 provider->BindToCurrentThread(); | 6195 provider->BindToCurrentThread(); |
6197 provider->TestContext3d()->set_have_post_sub_buffer(true); | 6196 provider->TestContext3d()->set_have_post_sub_buffer(true); |
6198 scoped_ptr<OutputSurface> output_surface( | 6197 scoped_ptr<OutputSurface> output_surface( |
6199 FakeOutputSurface::Create3d(provider)); | 6198 FakeOutputSurface::Create3d(provider)); |
6200 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( | 6199 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
6201 true, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, | 6200 true, this, &thread_verifier_, &shared_bitmap_manager, &task_graph_runner, |
6202 &stats_instrumentation_, output_surface.get()); | 6201 &stats_instrumentation_, output_surface.get()); |
6203 { | 6202 { |
6204 LayerTreeHostImpl::FrameData frame; | 6203 LayerTreeHostImpl::FrameData frame; |
6205 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 6204 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
6206 | 6205 |
6207 // Verify all quads have been computed | 6206 // Verify all quads have been computed |
6208 ASSERT_EQ(2U, frame.render_passes.size()); | 6207 ASSERT_EQ(2U, frame.render_passes.size()); |
6209 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 6208 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
6210 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 6209 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
6211 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 6210 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
6212 frame.render_passes[0]->quad_list.front()->material); | 6211 frame.render_passes[0]->quad_list.front()->material); |
6213 EXPECT_EQ(DrawQuad::RENDER_PASS, | 6212 EXPECT_EQ(DrawQuad::RENDER_PASS, |
6214 frame.render_passes[1]->quad_list.front()->material); | 6213 frame.render_passes[1]->quad_list.front()->material); |
6215 | 6214 |
6216 my_host_impl->DrawLayers(&frame); | 6215 my_host_impl->DrawLayers(&frame); |
6217 my_host_impl->DidDrawAllLayers(frame); | 6216 my_host_impl->DidDrawAllLayers(frame); |
6218 } | 6217 } |
6219 } | 6218 } |
6220 | 6219 |
6221 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { | 6220 TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { |
6222 TestSharedBitmapManager shared_bitmap_manager; | 6221 TestSharedBitmapManager shared_bitmap_manager; |
6223 TestTaskGraphRunner task_graph_runner; | 6222 TestTaskGraphRunner task_graph_runner; |
6224 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 6223 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
6225 provider->BindToCurrentThread(); | 6224 provider->BindToCurrentThread(); |
6226 provider->TestContext3d()->set_have_post_sub_buffer(true); | 6225 provider->TestContext3d()->set_have_post_sub_buffer(true); |
6227 scoped_ptr<OutputSurface> output_surface( | 6226 scoped_ptr<OutputSurface> output_surface( |
6228 FakeOutputSurface::Create3d(provider)); | 6227 FakeOutputSurface::Create3d(provider)); |
6229 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( | 6228 scoped_ptr<LayerTreeHostImpl> my_host_impl = SetupLayersForOpacity( |
6230 false, this, &proxy_, &shared_bitmap_manager, &task_graph_runner, | 6229 false, this, &thread_verifier_, &shared_bitmap_manager, |
6231 &stats_instrumentation_, output_surface.get()); | 6230 &task_graph_runner, &stats_instrumentation_, output_surface.get()); |
6232 { | 6231 { |
6233 LayerTreeHostImpl::FrameData frame; | 6232 LayerTreeHostImpl::FrameData frame; |
6234 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); | 6233 EXPECT_EQ(DRAW_SUCCESS, my_host_impl->PrepareToDraw(&frame)); |
6235 | 6234 |
6236 // Verify all quads have been computed | 6235 // Verify all quads have been computed |
6237 ASSERT_EQ(2U, frame.render_passes.size()); | 6236 ASSERT_EQ(2U, frame.render_passes.size()); |
6238 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); | 6237 ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size()); |
6239 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); | 6238 ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size()); |
6240 EXPECT_EQ(DrawQuad::SOLID_COLOR, | 6239 EXPECT_EQ(DrawQuad::SOLID_COLOR, |
6241 frame.render_passes[0]->quad_list.front()->material); | 6240 frame.render_passes[0]->quad_list.front()->material); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6637 | 6636 |
6638 EXPECT_EQ(1u, frame.will_draw_layers.size()); | 6637 EXPECT_EQ(1u, frame.will_draw_layers.size()); |
6639 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]); | 6638 EXPECT_EQ(host_impl_->active_tree()->root_layer(), frame.will_draw_layers[0]); |
6640 } | 6639 } |
6641 | 6640 |
6642 // Checks that we have a non-0 default allocation if we pass a context that | 6641 // Checks that we have a non-0 default allocation if we pass a context that |
6643 // doesn't support memory management extensions. | 6642 // doesn't support memory management extensions. |
6644 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { | 6643 TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { |
6645 LayerTreeSettings settings; | 6644 LayerTreeSettings settings; |
6646 host_impl_ = LayerTreeHostImpl::Create( | 6645 host_impl_ = LayerTreeHostImpl::Create( |
6647 settings, this, &proxy_, &stats_instrumentation_, &shared_bitmap_manager_, | 6646 settings, this, &thread_verifier_, &stats_instrumentation_, |
6648 &gpu_memory_buffer_manager_, &task_graph_runner_, 0); | 6647 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, &task_graph_runner_, |
| 6648 0); |
6649 | 6649 |
6650 output_surface_ = | 6650 output_surface_ = |
6651 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); | 6651 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()); |
6652 host_impl_->SetVisible(true); | 6652 host_impl_->SetVisible(true); |
6653 host_impl_->InitializeRenderer(output_surface_.get()); | 6653 host_impl_->InitializeRenderer(output_surface_.get()); |
6654 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); | 6654 EXPECT_LT(0ul, host_impl_->memory_allocation_limit_bytes()); |
6655 } | 6655 } |
6656 | 6656 |
6657 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { | 6657 TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) { |
6658 ASSERT_TRUE(host_impl_->active_tree()); | 6658 ASSERT_TRUE(host_impl_->active_tree()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6701 EXPECT_FALSE(host_impl_->RequiresHighResToDraw()); | 6701 EXPECT_FALSE(host_impl_->RequiresHighResToDraw()); |
6702 host_impl_->SetHasGpuRasterizationTrigger(true); | 6702 host_impl_->SetHasGpuRasterizationTrigger(true); |
6703 host_impl_->UpdateTreeResourcesForGpuRasterizationIfNeeded(); | 6703 host_impl_->UpdateTreeResourcesForGpuRasterizationIfNeeded(); |
6704 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); | 6704 EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); |
6705 } | 6705 } |
6706 | 6706 |
6707 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { | 6707 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { |
6708 public: | 6708 public: |
6709 void SetUp() override { | 6709 void SetUp() override { |
6710 fake_host_impl_ = | 6710 fake_host_impl_ = |
6711 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, | 6711 new FakeLayerTreeHostImpl(LayerTreeSettings(), &thread_verifier_, |
6712 &shared_bitmap_manager_, &task_graph_runner_); | 6712 &shared_bitmap_manager_, &task_graph_runner_); |
6713 host_impl_.reset(fake_host_impl_); | 6713 host_impl_.reset(fake_host_impl_); |
6714 output_surface_ = CreateOutputSurface(); | 6714 output_surface_ = CreateOutputSurface(); |
6715 host_impl_->SetVisible(true); | 6715 host_impl_->SetVisible(true); |
6716 host_impl_->InitializeRenderer(output_surface_.get()); | 6716 host_impl_->InitializeRenderer(output_surface_.get()); |
6717 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6717 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
6718 } | 6718 } |
6719 | 6719 |
6720 FakeLayerTreeHostImpl* fake_host_impl_; | 6720 FakeLayerTreeHostImpl* fake_host_impl_; |
6721 }; | 6721 }; |
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8768 host_impl_->ActivateSyncTree(); | 8768 host_impl_->ActivateSyncTree(); |
8769 host_impl_->active_tree()->UpdateDrawProperties(false); | 8769 host_impl_->active_tree()->UpdateDrawProperties(false); |
8770 active_tree_node = | 8770 active_tree_node = |
8771 host_impl_->active_tree()->property_trees()->transform_tree.Node( | 8771 host_impl_->active_tree()->property_trees()->transform_tree.Node( |
8772 page_scale_layer->transform_tree_index()); | 8772 page_scale_layer->transform_tree_index()); |
8773 EXPECT_EQ(active_tree_node->data.post_local_scale_factor, 2.f); | 8773 EXPECT_EQ(active_tree_node->data.post_local_scale_factor, 2.f); |
8774 } | 8774 } |
8775 | 8775 |
8776 } // namespace | 8776 } // namespace |
8777 } // namespace cc | 8777 } // namespace cc |
OLD | NEW |