| 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 EXPECT_CALL(*output_surface, | 434 EXPECT_CALL(*output_surface, |
| 435 SetWorkerContextShouldAggressivelyFreeResources(false)) | 435 SetWorkerContextShouldAggressivelyFreeResources(false)) |
| 436 .Times(1); | 436 .Times(1); |
| 437 | 437 |
| 438 // After running, we should get exactly one call to | 438 // After running, we should get exactly one call to |
| 439 // FreeWorkerContextGpuResources. | 439 // FreeWorkerContextGpuResources. |
| 440 EXPECT_CALL(*output_surface, | 440 EXPECT_CALL(*output_surface, |
| 441 SetWorkerContextShouldAggressivelyFreeResources(true)) | 441 SetWorkerContextShouldAggressivelyFreeResources(true)) |
| 442 .After(visibility_true) | 442 .After(visibility_true) |
| 443 .WillOnce(testing::Invoke([this](bool is_visible) { EndTest(); })); | 443 .WillOnce(testing::Invoke([this](bool is_visible) { EndTest(); })); |
| 444 return output_surface.Pass(); | 444 return std::move(output_surface); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void InitializeSettings(LayerTreeSettings* settings) override { | 447 void InitializeSettings(LayerTreeSettings* settings) override { |
| 448 settings->gpu_rasterization_enabled = true; | 448 settings->gpu_rasterization_enabled = true; |
| 449 settings->gpu_rasterization_forced = true; | 449 settings->gpu_rasterization_forced = true; |
| 450 } | 450 } |
| 451 | 451 |
| 452 void BeginTest() override { | 452 void BeginTest() override { |
| 453 // Logic is handled in InitializedRendererOnThread to ensure that our | 453 // Logic is handled in InitializedRendererOnThread to ensure that our |
| 454 // LTHI is fully set up. | 454 // LTHI is fully set up. |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { | 1210 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { |
| 1211 public: | 1211 public: |
| 1212 LayerTreeHostTestDamageWithScale() {} | 1212 LayerTreeHostTestDamageWithScale() {} |
| 1213 | 1213 |
| 1214 void SetupTree() override { | 1214 void SetupTree() override { |
| 1215 client_.set_fill_with_nonsolid_color(true); | 1215 client_.set_fill_with_nonsolid_color(true); |
| 1216 | 1216 |
| 1217 scoped_ptr<FakeDisplayListRecordingSource> recording( | 1217 scoped_ptr<FakeDisplayListRecordingSource> recording( |
| 1218 new FakeDisplayListRecordingSource); | 1218 new FakeDisplayListRecordingSource); |
| 1219 root_layer_ = FakePictureLayer::CreateWithRecordingSource( | 1219 root_layer_ = FakePictureLayer::CreateWithRecordingSource( |
| 1220 layer_settings(), &client_, recording.Pass()); | 1220 layer_settings(), &client_, std::move(recording)); |
| 1221 root_layer_->SetBounds(gfx::Size(50, 50)); | 1221 root_layer_->SetBounds(gfx::Size(50, 50)); |
| 1222 | 1222 |
| 1223 recording.reset(new FakeDisplayListRecordingSource); | 1223 recording.reset(new FakeDisplayListRecordingSource); |
| 1224 child_layer_ = FakePictureLayer::CreateWithRecordingSource( | 1224 child_layer_ = FakePictureLayer::CreateWithRecordingSource( |
| 1225 layer_settings(), &client_, recording.Pass()); | 1225 layer_settings(), &client_, std::move(recording)); |
| 1226 child_layer_->SetBounds(gfx::Size(25, 25)); | 1226 child_layer_->SetBounds(gfx::Size(25, 25)); |
| 1227 child_layer_->SetIsDrawable(true); | 1227 child_layer_->SetIsDrawable(true); |
| 1228 child_layer_->SetContentsOpaque(true); | 1228 child_layer_->SetContentsOpaque(true); |
| 1229 root_layer_->AddChild(child_layer_); | 1229 root_layer_->AddChild(child_layer_); |
| 1230 | 1230 |
| 1231 layer_tree_host()->SetRootLayer(root_layer_); | 1231 layer_tree_host()->SetRootLayer(root_layer_); |
| 1232 LayerTreeHostTest::SetupTree(); | 1232 LayerTreeHostTest::SetupTree(); |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 1235 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 }; | 2239 }; |
| 2240 | 2240 |
| 2241 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { | 2241 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { |
| 2242 protected: | 2242 protected: |
| 2243 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 2243 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
| 2244 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned( | 2244 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned( |
| 2245 new MockIOSurfaceWebGraphicsContext3D); | 2245 new MockIOSurfaceWebGraphicsContext3D); |
| 2246 mock_context_ = mock_context_owned.get(); | 2246 mock_context_ = mock_context_owned.get(); |
| 2247 | 2247 |
| 2248 if (delegating_renderer()) | 2248 if (delegating_renderer()) |
| 2249 return FakeOutputSurface::CreateDelegating3d(mock_context_owned.Pass()); | 2249 return FakeOutputSurface::CreateDelegating3d( |
| 2250 std::move(mock_context_owned)); |
| 2250 else | 2251 else |
| 2251 return FakeOutputSurface::Create3d(mock_context_owned.Pass()); | 2252 return FakeOutputSurface::Create3d(std::move(mock_context_owned)); |
| 2252 } | 2253 } |
| 2253 | 2254 |
| 2254 void SetupTree() override { | 2255 void SetupTree() override { |
| 2255 LayerTreeHostTest::SetupTree(); | 2256 LayerTreeHostTest::SetupTree(); |
| 2256 | 2257 |
| 2257 layer_tree_host()->root_layer()->SetIsDrawable(false); | 2258 layer_tree_host()->root_layer()->SetIsDrawable(false); |
| 2258 | 2259 |
| 2259 io_surface_id_ = 9; | 2260 io_surface_id_ = 9; |
| 2260 io_surface_size_ = gfx::Size(6, 7); | 2261 io_surface_size_ = gfx::Size(6, 7); |
| 2261 | 2262 |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3843 if (delegating_renderer()) | 3844 if (delegating_renderer()) |
| 3844 output_surface = FakeOutputSurface::CreateDelegating3d(provider); | 3845 output_surface = FakeOutputSurface::CreateDelegating3d(provider); |
| 3845 else | 3846 else |
| 3846 output_surface = FakeOutputSurface::Create3d(provider); | 3847 output_surface = FakeOutputSurface::Create3d(provider); |
| 3847 output_surface->SetMemoryPolicyToSetAtBind( | 3848 output_surface->SetMemoryPolicyToSetAtBind( |
| 3848 make_scoped_ptr(new ManagedMemoryPolicy( | 3849 make_scoped_ptr(new ManagedMemoryPolicy( |
| 3849 second_context_provider_.get() ? second_output_surface_memory_limit_ | 3850 second_context_provider_.get() ? second_output_surface_memory_limit_ |
| 3850 : first_output_surface_memory_limit_, | 3851 : first_output_surface_memory_limit_, |
| 3851 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, | 3852 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, |
| 3852 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); | 3853 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); |
| 3853 return output_surface.Pass(); | 3854 return output_surface; |
| 3854 } | 3855 } |
| 3855 | 3856 |
| 3856 void SetupTree() override { | 3857 void SetupTree() override { |
| 3857 root_ = FakePictureLayer::Create(layer_settings(), &client_); | 3858 root_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 3858 root_->SetBounds(gfx::Size(20, 20)); | 3859 root_->SetBounds(gfx::Size(20, 20)); |
| 3859 layer_tree_host()->SetRootLayer(root_); | 3860 layer_tree_host()->SetRootLayer(root_); |
| 3860 LayerTreeHostTest::SetupTree(); | 3861 LayerTreeHostTest::SetupTree(); |
| 3861 } | 3862 } |
| 3862 | 3863 |
| 3863 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3864 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 | 4009 |
| 4009 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { | 4010 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { |
| 4010 protected: | 4011 protected: |
| 4011 LayerTreeHostTestBreakSwapPromise() | 4012 LayerTreeHostTestBreakSwapPromise() |
| 4012 : commit_count_(0), commit_complete_count_(0) {} | 4013 : commit_count_(0), commit_complete_count_(0) {} |
| 4013 | 4014 |
| 4014 void WillBeginMainFrame() override { | 4015 void WillBeginMainFrame() override { |
| 4015 ASSERT_LE(commit_count_, 2); | 4016 ASSERT_LE(commit_count_, 2); |
| 4016 scoped_ptr<SwapPromise> swap_promise( | 4017 scoped_ptr<SwapPromise> swap_promise( |
| 4017 new TestSwapPromise(&swap_promise_result_[commit_count_])); | 4018 new TestSwapPromise(&swap_promise_result_[commit_count_])); |
| 4018 layer_tree_host()->QueueSwapPromise(swap_promise.Pass()); | 4019 layer_tree_host()->QueueSwapPromise(std::move(swap_promise)); |
| 4019 } | 4020 } |
| 4020 | 4021 |
| 4021 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4022 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4022 | 4023 |
| 4023 void DidCommit() override { | 4024 void DidCommit() override { |
| 4024 commit_count_++; | 4025 commit_count_++; |
| 4025 if (commit_count_ == 2) { | 4026 if (commit_count_ == 2) { |
| 4026 // This commit will finish. | 4027 // This commit will finish. |
| 4027 layer_tree_host()->SetNeedsCommit(); | 4028 layer_tree_host()->SetNeedsCommit(); |
| 4028 } | 4029 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4195 | 4196 |
| 4196 class LayerTreeHostTestBreakSwapPromiseForVisibility | 4197 class LayerTreeHostTestBreakSwapPromiseForVisibility |
| 4197 : public LayerTreeHostTest { | 4198 : public LayerTreeHostTest { |
| 4198 protected: | 4199 protected: |
| 4199 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4200 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4200 | 4201 |
| 4201 void SetVisibleFalseAndQueueSwapPromise() { | 4202 void SetVisibleFalseAndQueueSwapPromise() { |
| 4202 layer_tree_host()->SetVisible(false); | 4203 layer_tree_host()->SetVisible(false); |
| 4203 scoped_ptr<SwapPromise> swap_promise( | 4204 scoped_ptr<SwapPromise> swap_promise( |
| 4204 new TestSwapPromise(&swap_promise_result_)); | 4205 new TestSwapPromise(&swap_promise_result_)); |
| 4205 layer_tree_host()->QueueSwapPromise(swap_promise.Pass()); | 4206 layer_tree_host()->QueueSwapPromise(std::move(swap_promise)); |
| 4206 } | 4207 } |
| 4207 | 4208 |
| 4208 void ScheduledActionWillSendBeginMainFrame() override { | 4209 void ScheduledActionWillSendBeginMainFrame() override { |
| 4209 MainThreadTaskRunner()->PostTask( | 4210 MainThreadTaskRunner()->PostTask( |
| 4210 FROM_HERE, | 4211 FROM_HERE, |
| 4211 base::Bind(&LayerTreeHostTestBreakSwapPromiseForVisibility | 4212 base::Bind(&LayerTreeHostTestBreakSwapPromiseForVisibility |
| 4212 ::SetVisibleFalseAndQueueSwapPromise, | 4213 ::SetVisibleFalseAndQueueSwapPromise, |
| 4213 base::Unretained(this))); | 4214 base::Unretained(this))); |
| 4214 } | 4215 } |
| 4215 | 4216 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 4239 LayerTreeHostTestBreakSwapPromiseForContext() | 4240 LayerTreeHostTestBreakSwapPromiseForContext() |
| 4240 : output_surface_lost_triggered_(false) { | 4241 : output_surface_lost_triggered_(false) { |
| 4241 } | 4242 } |
| 4242 | 4243 |
| 4243 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4244 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4244 | 4245 |
| 4245 void LoseOutputSurfaceAndQueueSwapPromise() { | 4246 void LoseOutputSurfaceAndQueueSwapPromise() { |
| 4246 layer_tree_host()->DidLoseOutputSurface(); | 4247 layer_tree_host()->DidLoseOutputSurface(); |
| 4247 scoped_ptr<SwapPromise> swap_promise( | 4248 scoped_ptr<SwapPromise> swap_promise( |
| 4248 new TestSwapPromise(&swap_promise_result_)); | 4249 new TestSwapPromise(&swap_promise_result_)); |
| 4249 layer_tree_host()->QueueSwapPromise(swap_promise.Pass()); | 4250 layer_tree_host()->QueueSwapPromise(std::move(swap_promise)); |
| 4250 } | 4251 } |
| 4251 | 4252 |
| 4252 void ScheduledActionWillSendBeginMainFrame() override { | 4253 void ScheduledActionWillSendBeginMainFrame() override { |
| 4253 if (output_surface_lost_triggered_) | 4254 if (output_surface_lost_triggered_) |
| 4254 return; | 4255 return; |
| 4255 output_surface_lost_triggered_ = true; | 4256 output_surface_lost_triggered_ = true; |
| 4256 | 4257 |
| 4257 MainThreadTaskRunner()->PostTask( | 4258 MainThreadTaskRunner()->PostTask( |
| 4258 FROM_HERE, | 4259 FROM_HERE, |
| 4259 base::Bind(&LayerTreeHostTestBreakSwapPromiseForContext | 4260 base::Bind(&LayerTreeHostTestBreakSwapPromiseForContext |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4419 | 4420 |
| 4420 void SetupTree() override { | 4421 void SetupTree() override { |
| 4421 LayerTreeHostTest::SetupTree(); | 4422 LayerTreeHostTest::SetupTree(); |
| 4422 | 4423 |
| 4423 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4424 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
| 4424 new FakeDisplayListRecordingSource); | 4425 new FakeDisplayListRecordingSource); |
| 4425 recording_source_ = recording_source.get(); | 4426 recording_source_ = recording_source.get(); |
| 4426 | 4427 |
| 4427 scoped_refptr<FakePictureLayer> layer = | 4428 scoped_refptr<FakePictureLayer> layer = |
| 4428 FakePictureLayer::CreateWithRecordingSource( | 4429 FakePictureLayer::CreateWithRecordingSource( |
| 4429 layer_settings(), &layer_client_, recording_source.Pass()); | 4430 layer_settings(), &layer_client_, std::move(recording_source)); |
| 4430 layer_ = layer.get(); | 4431 layer_ = layer.get(); |
| 4431 layer->SetBounds(gfx::Size(10, 10)); | 4432 layer->SetBounds(gfx::Size(10, 10)); |
| 4432 layer->SetIsDrawable(true); | 4433 layer->SetIsDrawable(true); |
| 4433 layer_tree_host()->root_layer()->AddChild(layer); | 4434 layer_tree_host()->root_layer()->AddChild(layer); |
| 4434 } | 4435 } |
| 4435 | 4436 |
| 4436 void BeginTest() override { | 4437 void BeginTest() override { |
| 4437 // Verify default value. | 4438 // Verify default value. |
| 4438 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4439 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 4439 | 4440 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4474 protected: | 4475 protected: |
| 4475 void SetupTree() override { | 4476 void SetupTree() override { |
| 4476 LayerTreeHostTest::SetupTree(); | 4477 LayerTreeHostTest::SetupTree(); |
| 4477 | 4478 |
| 4478 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4479 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
| 4479 new FakeDisplayListRecordingSource); | 4480 new FakeDisplayListRecordingSource); |
| 4480 recording_source_ = recording_source.get(); | 4481 recording_source_ = recording_source.get(); |
| 4481 | 4482 |
| 4482 scoped_refptr<FakePictureLayer> layer = | 4483 scoped_refptr<FakePictureLayer> layer = |
| 4483 FakePictureLayer::CreateWithRecordingSource( | 4484 FakePictureLayer::CreateWithRecordingSource( |
| 4484 layer_settings(), &layer_client_, recording_source.Pass()); | 4485 layer_settings(), &layer_client_, std::move(recording_source)); |
| 4485 layer_ = layer.get(); | 4486 layer_ = layer.get(); |
| 4486 layer->SetBounds(gfx::Size()); | 4487 layer->SetBounds(gfx::Size()); |
| 4487 layer->SetIsDrawable(true); | 4488 layer->SetIsDrawable(true); |
| 4488 layer_tree_host()->root_layer()->AddChild(layer); | 4489 layer_tree_host()->root_layer()->AddChild(layer); |
| 4489 } | 4490 } |
| 4490 | 4491 |
| 4491 void BeginTest() override { | 4492 void BeginTest() override { |
| 4492 // Setting gpu rasterization trigger does not enable gpu rasterization. | 4493 // Setting gpu rasterization trigger does not enable gpu rasterization. |
| 4493 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4494 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 4494 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4495 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 | 4532 |
| 4532 void SetupTree() override { | 4533 void SetupTree() override { |
| 4533 LayerTreeHostTest::SetupTree(); | 4534 LayerTreeHostTest::SetupTree(); |
| 4534 | 4535 |
| 4535 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4536 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
| 4536 new FakeDisplayListRecordingSource); | 4537 new FakeDisplayListRecordingSource); |
| 4537 recording_source_ = recording_source.get(); | 4538 recording_source_ = recording_source.get(); |
| 4538 | 4539 |
| 4539 scoped_refptr<FakePictureLayer> layer = | 4540 scoped_refptr<FakePictureLayer> layer = |
| 4540 FakePictureLayer::CreateWithRecordingSource( | 4541 FakePictureLayer::CreateWithRecordingSource( |
| 4541 layer_settings(), &layer_client_, recording_source.Pass()); | 4542 layer_settings(), &layer_client_, std::move(recording_source)); |
| 4542 layer_ = layer.get(); | 4543 layer_ = layer.get(); |
| 4543 layer->SetBounds(gfx::Size(10, 10)); | 4544 layer->SetBounds(gfx::Size(10, 10)); |
| 4544 layer->SetIsDrawable(true); | 4545 layer->SetIsDrawable(true); |
| 4545 layer_tree_host()->root_layer()->AddChild(layer); | 4546 layer_tree_host()->root_layer()->AddChild(layer); |
| 4546 } | 4547 } |
| 4547 | 4548 |
| 4548 void BeginTest() override { | 4549 void BeginTest() override { |
| 4549 // Verify default value. | 4550 // Verify default value. |
| 4550 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4551 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 4551 | 4552 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4600 | 4601 |
| 4601 void SetupTree() override { | 4602 void SetupTree() override { |
| 4602 LayerTreeHostTest::SetupTree(); | 4603 LayerTreeHostTest::SetupTree(); |
| 4603 | 4604 |
| 4604 scoped_ptr<FakeDisplayListRecordingSource> recording_source( | 4605 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
| 4605 new FakeDisplayListRecordingSource); | 4606 new FakeDisplayListRecordingSource); |
| 4606 recording_source_ = recording_source.get(); | 4607 recording_source_ = recording_source.get(); |
| 4607 | 4608 |
| 4608 scoped_refptr<FakePictureLayer> layer = | 4609 scoped_refptr<FakePictureLayer> layer = |
| 4609 FakePictureLayer::CreateWithRecordingSource( | 4610 FakePictureLayer::CreateWithRecordingSource( |
| 4610 layer_settings(), &layer_client_, recording_source.Pass()); | 4611 layer_settings(), &layer_client_, std::move(recording_source)); |
| 4611 layer_ = layer.get(); | 4612 layer_ = layer.get(); |
| 4612 | 4613 |
| 4613 layer->SetBounds(gfx::Size(10, 10)); | 4614 layer->SetBounds(gfx::Size(10, 10)); |
| 4614 layer->SetIsDrawable(true); | 4615 layer->SetIsDrawable(true); |
| 4615 layer_tree_host()->root_layer()->AddChild(layer); | 4616 layer_tree_host()->root_layer()->AddChild(layer); |
| 4616 } | 4617 } |
| 4617 | 4618 |
| 4618 void BeginTest() override { | 4619 void BeginTest() override { |
| 4619 // Verify default value. | 4620 // Verify default value. |
| 4620 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4621 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4914 | 4915 |
| 4915 void InitializeSettings(LayerTreeSettings* settings) override { | 4916 void InitializeSettings(LayerTreeSettings* settings) override { |
| 4916 settings->single_thread_proxy_scheduler = false; | 4917 settings->single_thread_proxy_scheduler = false; |
| 4917 settings->use_zero_copy = true; | 4918 settings->use_zero_copy = true; |
| 4918 } | 4919 } |
| 4919 | 4920 |
| 4920 void BeginTest() override { | 4921 void BeginTest() override { |
| 4921 // Successful composite. | 4922 // Successful composite. |
| 4922 scoped_ptr<SwapPromise> swap_promise0( | 4923 scoped_ptr<SwapPromise> swap_promise0( |
| 4923 new TestSwapPromise(&swap_promise_result_[0])); | 4924 new TestSwapPromise(&swap_promise_result_[0])); |
| 4924 layer_tree_host()->QueueSwapPromise(swap_promise0.Pass()); | 4925 layer_tree_host()->QueueSwapPromise(std::move(swap_promise0)); |
| 4925 layer_tree_host()->Composite(base::TimeTicks::Now()); | 4926 layer_tree_host()->Composite(base::TimeTicks::Now()); |
| 4926 | 4927 |
| 4927 // Fail to swap (no damage). | 4928 // Fail to swap (no damage). |
| 4928 scoped_ptr<SwapPromise> swap_promise1( | 4929 scoped_ptr<SwapPromise> swap_promise1( |
| 4929 new TestSwapPromise(&swap_promise_result_[1])); | 4930 new TestSwapPromise(&swap_promise_result_[1])); |
| 4930 layer_tree_host()->QueueSwapPromise(swap_promise1.Pass()); | 4931 layer_tree_host()->QueueSwapPromise(std::move(swap_promise1)); |
| 4931 layer_tree_host()->SetNeedsCommit(); | 4932 layer_tree_host()->SetNeedsCommit(); |
| 4932 layer_tree_host()->Composite(base::TimeTicks::Now()); | 4933 layer_tree_host()->Composite(base::TimeTicks::Now()); |
| 4933 | 4934 |
| 4934 // Fail to draw (not visible). | 4935 // Fail to draw (not visible). |
| 4935 scoped_ptr<SwapPromise> swap_promise2( | 4936 scoped_ptr<SwapPromise> swap_promise2( |
| 4936 new TestSwapPromise(&swap_promise_result_[2])); | 4937 new TestSwapPromise(&swap_promise_result_[2])); |
| 4937 layer_tree_host()->QueueSwapPromise(swap_promise2.Pass()); | 4938 layer_tree_host()->QueueSwapPromise(std::move(swap_promise2)); |
| 4938 layer_tree_host()->SetNeedsDisplayOnAllLayers(); | 4939 layer_tree_host()->SetNeedsDisplayOnAllLayers(); |
| 4939 layer_tree_host()->SetVisible(false); | 4940 layer_tree_host()->SetVisible(false); |
| 4940 layer_tree_host()->Composite(base::TimeTicks::Now()); | 4941 layer_tree_host()->Composite(base::TimeTicks::Now()); |
| 4941 | 4942 |
| 4942 EndTest(); | 4943 EndTest(); |
| 4943 } | 4944 } |
| 4944 | 4945 |
| 4945 void DidCommit() override { | 4946 void DidCommit() override { |
| 4946 commit_count_++; | 4947 commit_count_++; |
| 4947 ASSERT_LE(commit_count_, 3); | 4948 ASSERT_LE(commit_count_, 3); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5045 pinch->SetBounds(gfx::Size(500, 500)); | 5046 pinch->SetBounds(gfx::Size(500, 500)); |
| 5046 pinch->SetScrollClipLayerId(root->id()); | 5047 pinch->SetScrollClipLayerId(root->id()); |
| 5047 pinch->SetIsContainerForFixedPositionLayers(true); | 5048 pinch->SetIsContainerForFixedPositionLayers(true); |
| 5048 root->AddChild(pinch); | 5049 root->AddChild(pinch); |
| 5049 | 5050 |
| 5050 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5051 scoped_ptr<FakeDisplayListRecordingSource> recording( |
| 5051 new FakeDisplayListRecordingSource); | 5052 new FakeDisplayListRecordingSource); |
| 5052 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5053 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 5053 scoped_refptr<FakePictureLayer> layer = | 5054 scoped_refptr<FakePictureLayer> layer = |
| 5054 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5055 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, |
| 5055 recording.Pass()); | 5056 std::move(recording)); |
| 5056 layer->SetBounds(gfx::Size(500, 500)); | 5057 layer->SetBounds(gfx::Size(500, 500)); |
| 5057 layer->SetContentsOpaque(true); | 5058 layer->SetContentsOpaque(true); |
| 5058 // Avoid LCD text on the layer so we don't cause extra commits when we | 5059 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 5059 // pinch. | 5060 // pinch. |
| 5060 pinch->AddChild(layer); | 5061 pinch->AddChild(layer); |
| 5061 | 5062 |
| 5062 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); | 5063 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); |
| 5063 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5064 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
| 5064 layer_tree_host()->SetRootLayer(root); | 5065 layer_tree_host()->SetRootLayer(root); |
| 5065 LayerTreeHostTest::SetupTree(); | 5066 LayerTreeHostTest::SetupTree(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5219 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { | 5220 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { |
| 5220 scoped_ptr<TestWebGraphicsContext3D> context3d = | 5221 scoped_ptr<TestWebGraphicsContext3D> context3d = |
| 5221 TestWebGraphicsContext3D::Create(); | 5222 TestWebGraphicsContext3D::Create(); |
| 5222 context3d->set_support_image(true); | 5223 context3d->set_support_image(true); |
| 5223 context3d->set_support_sync_query(true); | 5224 context3d->set_support_sync_query(true); |
| 5224 #if defined(OS_MACOSX) | 5225 #if defined(OS_MACOSX) |
| 5225 context3d->set_support_texture_rectangle(true); | 5226 context3d->set_support_texture_rectangle(true); |
| 5226 #endif | 5227 #endif |
| 5227 | 5228 |
| 5228 if (delegating_renderer()) | 5229 if (delegating_renderer()) |
| 5229 return FakeOutputSurface::CreateDelegating3d(context3d.Pass()); | 5230 return FakeOutputSurface::CreateDelegating3d(std::move(context3d)); |
| 5230 else | 5231 else |
| 5231 return FakeOutputSurface::Create3d(context3d.Pass()); | 5232 return FakeOutputSurface::Create3d(std::move(context3d)); |
| 5232 } | 5233 } |
| 5233 }; | 5234 }; |
| 5234 | 5235 |
| 5235 // This test does pinching on the impl side which is not supported in single | 5236 // This test does pinching on the impl side which is not supported in single |
| 5236 // thread. | 5237 // thread. |
| 5237 MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy); | 5238 MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy); |
| 5238 | 5239 |
| 5239 class RasterizeWithGpuRasterizationCreatesResources : public LayerTreeHostTest { | 5240 class RasterizeWithGpuRasterizationCreatesResources : public LayerTreeHostTest { |
| 5240 protected: | 5241 protected: |
| 5241 RasterizeWithGpuRasterizationCreatesResources() {} | 5242 RasterizeWithGpuRasterizationCreatesResources() {} |
| 5242 | 5243 |
| 5243 void InitializeSettings(LayerTreeSettings* settings) override { | 5244 void InitializeSettings(LayerTreeSettings* settings) override { |
| 5244 settings->gpu_rasterization_forced = true; | 5245 settings->gpu_rasterization_forced = true; |
| 5245 } | 5246 } |
| 5246 | 5247 |
| 5247 void SetupTree() override { | 5248 void SetupTree() override { |
| 5248 client_.set_fill_with_nonsolid_color(true); | 5249 client_.set_fill_with_nonsolid_color(true); |
| 5249 | 5250 |
| 5250 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5251 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 5251 root->SetBounds(gfx::Size(500, 500)); | 5252 root->SetBounds(gfx::Size(500, 500)); |
| 5252 | 5253 |
| 5253 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5254 scoped_ptr<FakeDisplayListRecordingSource> recording( |
| 5254 new FakeDisplayListRecordingSource); | 5255 new FakeDisplayListRecordingSource); |
| 5255 scoped_refptr<FakePictureLayer> layer = | 5256 scoped_refptr<FakePictureLayer> layer = |
| 5256 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5257 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, |
| 5257 recording.Pass()); | 5258 std::move(recording)); |
| 5258 layer->SetBounds(gfx::Size(500, 500)); | 5259 layer->SetBounds(gfx::Size(500, 500)); |
| 5259 layer->SetContentsOpaque(true); | 5260 layer->SetContentsOpaque(true); |
| 5260 root->AddChild(layer); | 5261 root->AddChild(layer); |
| 5261 | 5262 |
| 5262 layer_tree_host()->SetRootLayer(root); | 5263 layer_tree_host()->SetRootLayer(root); |
| 5263 LayerTreeHostTest::SetupTree(); | 5264 LayerTreeHostTest::SetupTree(); |
| 5264 } | 5265 } |
| 5265 | 5266 |
| 5266 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5267 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5267 | 5268 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5288 settings->gpu_rasterization_forced = true; | 5289 settings->gpu_rasterization_forced = true; |
| 5289 } | 5290 } |
| 5290 | 5291 |
| 5291 void SetupTree() override { | 5292 void SetupTree() override { |
| 5292 client_.set_fill_with_nonsolid_color(true); | 5293 client_.set_fill_with_nonsolid_color(true); |
| 5293 | 5294 |
| 5294 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5295 scoped_ptr<FakeDisplayListRecordingSource> recording( |
| 5295 new FakeDisplayListRecordingSource); | 5296 new FakeDisplayListRecordingSource); |
| 5296 scoped_refptr<FakePictureLayer> root = | 5297 scoped_refptr<FakePictureLayer> root = |
| 5297 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5298 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, |
| 5298 recording.Pass()); | 5299 std::move(recording)); |
| 5299 root->SetBounds(gfx::Size(10000, 10000)); | 5300 root->SetBounds(gfx::Size(10000, 10000)); |
| 5300 root->SetContentsOpaque(true); | 5301 root->SetContentsOpaque(true); |
| 5301 | 5302 |
| 5302 layer_tree_host()->SetRootLayer(root); | 5303 layer_tree_host()->SetRootLayer(root); |
| 5303 LayerTreeHostTest::SetupTree(); | 5304 LayerTreeHostTest::SetupTree(); |
| 5304 layer_tree_host()->SetViewportSize(viewport_size_); | 5305 layer_tree_host()->SetViewportSize(viewport_size_); |
| 5305 } | 5306 } |
| 5306 | 5307 |
| 5307 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5308 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 5308 | 5309 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5341 pinch->SetBounds(gfx::Size(500, 500)); | 5342 pinch->SetBounds(gfx::Size(500, 500)); |
| 5342 pinch->SetScrollClipLayerId(root->id()); | 5343 pinch->SetScrollClipLayerId(root->id()); |
| 5343 pinch->SetIsContainerForFixedPositionLayers(true); | 5344 pinch->SetIsContainerForFixedPositionLayers(true); |
| 5344 root->AddChild(pinch); | 5345 root->AddChild(pinch); |
| 5345 | 5346 |
| 5346 scoped_ptr<FakeDisplayListRecordingSource> recording( | 5347 scoped_ptr<FakeDisplayListRecordingSource> recording( |
| 5347 new FakeDisplayListRecordingSource); | 5348 new FakeDisplayListRecordingSource); |
| 5348 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5349 recording->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 5349 scoped_refptr<FakePictureLayer> layer = | 5350 scoped_refptr<FakePictureLayer> layer = |
| 5350 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, | 5351 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, |
| 5351 recording.Pass()); | 5352 std::move(recording)); |
| 5352 layer->SetBounds(gfx::Size(500, 500)); | 5353 layer->SetBounds(gfx::Size(500, 500)); |
| 5353 layer->SetContentsOpaque(true); | 5354 layer->SetContentsOpaque(true); |
| 5354 // Avoid LCD text on the layer so we don't cause extra commits when we | 5355 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 5355 // pinch. | 5356 // pinch. |
| 5356 pinch->AddChild(layer); | 5357 pinch->AddChild(layer); |
| 5357 | 5358 |
| 5358 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); | 5359 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); |
| 5359 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); | 5360 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); |
| 5360 layer_tree_host()->SetRootLayer(root); | 5361 layer_tree_host()->SetRootLayer(root); |
| 5361 LayerTreeHostTest::SetupTree(); | 5362 LayerTreeHostTest::SetupTree(); |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6404 EndTest(); | 6405 EndTest(); |
| 6405 } | 6406 } |
| 6406 | 6407 |
| 6407 void AfterTest() override {} | 6408 void AfterTest() override {} |
| 6408 }; | 6409 }; |
| 6409 | 6410 |
| 6410 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6411 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
| 6411 | 6412 |
| 6412 } // namespace | 6413 } // namespace |
| 6413 } // namespace cc | 6414 } // namespace cc |
| OLD | NEW |