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