| 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 4436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4447 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); | 4447 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); |
| 4448 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); | 4448 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); |
| 4449 EXPECT_TRUE(recording_source->IsSuitableForGpuRasterization()); | 4449 EXPECT_TRUE(recording_source->IsSuitableForGpuRasterization()); |
| 4450 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4450 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 4451 | 4451 |
| 4452 // Gpu rasterization trigger is relevant. | 4452 // Gpu rasterization trigger is relevant. |
| 4453 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4453 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 4454 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4454 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 4455 | 4455 |
| 4456 // Content-based veto is relevant as well. | 4456 // Content-based veto is relevant as well. |
| 4457 recording_source->SetUnsuitableForGpuRasterizationForTesting(); | 4457 recording_source->SetUnsuitableForGpuRasterization(); |
| 4458 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); | 4458 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); |
| 4459 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 4459 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
| 4460 // Veto will take effect when layers are updated. | 4460 // Veto will take effect when layers are updated. |
| 4461 // The results will be verified after commit is completed below. | 4461 // The results will be verified after commit is completed below. |
| 4462 // Since we are manually marking picture pile as unsuitable, | 4462 // Since we are manually marking picture pile as unsuitable, |
| 4463 // make sure that the layer gets a chance to update. | 4463 // make sure that the layer gets a chance to update. |
| 4464 layer->SetNeedsDisplay(); | 4464 layer->SetNeedsDisplay(); |
| 4465 PostSetNeedsCommitToMainThread(); | 4465 PostSetNeedsCommitToMainThread(); |
| 4466 } | 4466 } |
| 4467 | 4467 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4486 class LayerTreeHostTestGpuRasterizationForced : public LayerTreeHostTest { | 4486 class LayerTreeHostTestGpuRasterizationForced : public LayerTreeHostTest { |
| 4487 protected: | 4487 protected: |
| 4488 void InitializeSettings(LayerTreeSettings* settings) override { | 4488 void InitializeSettings(LayerTreeSettings* settings) override { |
| 4489 EXPECT_FALSE(settings->gpu_rasterization_forced); | 4489 EXPECT_FALSE(settings->gpu_rasterization_forced); |
| 4490 settings->gpu_rasterization_forced = true; | 4490 settings->gpu_rasterization_forced = true; |
| 4491 } | 4491 } |
| 4492 | 4492 |
| 4493 void SetupTree() override { | 4493 void SetupTree() override { |
| 4494 LayerTreeHostTest::SetupTree(); | 4494 LayerTreeHostTest::SetupTree(); |
| 4495 | 4495 |
| 4496 scoped_ptr<FakeDisplayListRecordingSource> recording_source( |
| 4497 new FakeDisplayListRecordingSource(gfx::Size(100, 100))); |
| 4496 scoped_refptr<FakePictureLayer> layer = | 4498 scoped_refptr<FakePictureLayer> layer = |
| 4497 FakePictureLayer::Create(layer_settings(), &layer_client_); | 4499 FakePictureLayer::CreateWithRecordingSource( |
| 4500 layer_settings(), &layer_client_, recording_source.Pass()); |
| 4501 |
| 4498 layer->SetBounds(gfx::Size(10, 10)); | 4502 layer->SetBounds(gfx::Size(10, 10)); |
| 4499 layer->SetIsDrawable(true); | 4503 layer->SetIsDrawable(true); |
| 4500 layer_tree_host()->root_layer()->AddChild(layer); | 4504 layer_tree_host()->root_layer()->AddChild(layer); |
| 4501 } | 4505 } |
| 4502 | 4506 |
| 4503 void BeginTest() override { | 4507 void BeginTest() override { |
| 4504 Layer* root = layer_tree_host()->root_layer(); | 4508 Layer* root = layer_tree_host()->root_layer(); |
| 4505 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); | 4509 PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0)); |
| 4506 RecordingSource* recording_source = layer->GetRecordingSourceForTesting(); | 4510 FakeDisplayListRecordingSource* recording_source = |
| 4511 static_cast<FakeDisplayListRecordingSource*>( |
| 4512 layer->GetRecordingSourceForTesting()); |
| 4507 | 4513 |
| 4508 // Verify default values. | 4514 // Verify default values. |
| 4509 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); | 4515 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); |
| 4510 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); | 4516 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); |
| 4511 EXPECT_TRUE(recording_source->IsSuitableForGpuRasterization()); | 4517 EXPECT_TRUE(recording_source->IsSuitableForGpuRasterization()); |
| 4512 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4518 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 4513 | 4519 |
| 4514 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. | 4520 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. |
| 4515 layer_tree_host()->SetHasGpuRasterizationTrigger(true); | 4521 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
| 4516 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4522 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 4517 | 4523 |
| 4518 // Content-based veto is irrelevant as well. | 4524 // Content-based veto is irrelevant as well. |
| 4519 recording_source->SetUnsuitableForGpuRasterizationForTesting(); | 4525 recording_source->SetUnsuitableForGpuRasterization(); |
| 4520 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); | 4526 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); |
| 4521 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 4527 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
| 4522 // Veto will take effect when layers are updated. | 4528 // Veto will take effect when layers are updated. |
| 4523 // The results will be verified after commit is completed below. | 4529 // The results will be verified after commit is completed below. |
| 4524 // Since we are manually marking picture pile as unsuitable, | 4530 // Since we are manually marking picture pile as unsuitable, |
| 4525 // make sure that the layer gets a chance to update. | 4531 // make sure that the layer gets a chance to update. |
| 4526 layer->SetNeedsDisplay(); | 4532 layer->SetNeedsDisplay(); |
| 4527 PostSetNeedsCommitToMainThread(); | 4533 PostSetNeedsCommitToMainThread(); |
| 4528 } | 4534 } |
| 4529 | 4535 |
| (...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6185 ScrollAndScaleSet scale_info_; | 6191 ScrollAndScaleSet scale_info_; |
| 6186 ScrollAndScaleSet no_op_info_; | 6192 ScrollAndScaleSet no_op_info_; |
| 6187 bool requested_update_layers_; | 6193 bool requested_update_layers_; |
| 6188 int commit_count_; | 6194 int commit_count_; |
| 6189 }; | 6195 }; |
| 6190 | 6196 |
| 6191 MULTI_THREAD_TEST_F(LayerTreeHostScrollingAndScalingUpdatesLayers); | 6197 MULTI_THREAD_TEST_F(LayerTreeHostScrollingAndScalingUpdatesLayers); |
| 6192 | 6198 |
| 6193 } // namespace | 6199 } // namespace |
| 6194 } // namespace cc | 6200 } // namespace cc |
| OLD | NEW |