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/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 4653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4664 PicturePile* pile = layer->GetPicturePileForTesting(); | 4664 PicturePile* pile = layer->GetPicturePileForTesting(); |
4665 | 4665 |
4666 // Verify default values. | 4666 // Verify default values. |
4667 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); | 4667 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); |
4668 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); | 4668 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); |
4669 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); | 4669 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); |
4670 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4670 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4671 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); | 4671 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); |
4672 | 4672 |
4673 // Setting gpu rasterization trigger does not enable gpu rasterization. | 4673 // Setting gpu rasterization trigger does not enable gpu rasterization. |
4674 layer_tree_host()->set_has_gpu_rasterization_trigger(true); | 4674 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
4675 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4675 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4676 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); | 4676 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); |
4677 | 4677 |
4678 PostSetNeedsCommitToMainThread(); | 4678 PostSetNeedsCommitToMainThread(); |
4679 } | 4679 } |
4680 | 4680 |
4681 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 4681 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
4682 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); | 4682 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); |
4683 EXPECT_FALSE(host_impl->use_gpu_rasterization()); | 4683 EXPECT_FALSE(host_impl->use_gpu_rasterization()); |
4684 } | 4684 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4720 PicturePile* pile = layer->GetPicturePileForTesting(); | 4720 PicturePile* pile = layer->GetPicturePileForTesting(); |
4721 | 4721 |
4722 // Verify default values. | 4722 // Verify default values. |
4723 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); | 4723 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); |
4724 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); | 4724 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); |
4725 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); | 4725 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); |
4726 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4726 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4727 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); | 4727 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); |
4728 | 4728 |
4729 // Gpu rasterization trigger is relevant. | 4729 // Gpu rasterization trigger is relevant. |
4730 layer_tree_host()->set_has_gpu_rasterization_trigger(true); | 4730 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
4731 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4731 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4732 EXPECT_TRUE(layer_tree_host()->UseGpuRasterization()); | 4732 EXPECT_TRUE(layer_tree_host()->UseGpuRasterization()); |
4733 | 4733 |
4734 // Content-based veto is relevant as well. | 4734 // Content-based veto is relevant as well. |
4735 pile->SetUnsuitableForGpuRasterizationForTesting(); | 4735 pile->SetUnsuitableForGpuRasterizationForTesting(); |
4736 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); | 4736 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); |
4737 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 4737 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
4738 // Veto will take effect when layers are updated. | 4738 // Veto will take effect when layers are updated. |
4739 // The results will be verified after commit is completed below. | 4739 // The results will be verified after commit is completed below. |
4740 // Since we are manually marking picture pile as unsuitable, | 4740 // Since we are manually marking picture pile as unsuitable, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4785 PicturePile* pile = layer->GetPicturePileForTesting(); | 4785 PicturePile* pile = layer->GetPicturePileForTesting(); |
4786 | 4786 |
4787 // Verify default values. | 4787 // Verify default values. |
4788 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); | 4788 EXPECT_TRUE(root->IsSuitableForGpuRasterization()); |
4789 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); | 4789 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); |
4790 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); | 4790 EXPECT_TRUE(pile->is_suitable_for_gpu_rasterization()); |
4791 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4791 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4792 | 4792 |
4793 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. | 4793 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. |
4794 EXPECT_TRUE(layer_tree_host()->UseGpuRasterization()); | 4794 EXPECT_TRUE(layer_tree_host()->UseGpuRasterization()); |
4795 layer_tree_host()->set_has_gpu_rasterization_trigger(true); | 4795 layer_tree_host()->SetHasGpuRasterizationTrigger(true); |
4796 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4796 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
4797 EXPECT_TRUE(layer_tree_host()->UseGpuRasterization()); | 4797 EXPECT_TRUE(layer_tree_host()->UseGpuRasterization()); |
4798 | 4798 |
4799 // Content-based veto is irrelevant as well. | 4799 // Content-based veto is irrelevant as well. |
4800 pile->SetUnsuitableForGpuRasterizationForTesting(); | 4800 pile->SetUnsuitableForGpuRasterizationForTesting(); |
4801 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); | 4801 EXPECT_FALSE(pile->is_suitable_for_gpu_rasterization()); |
4802 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 4802 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
4803 // Veto will take effect when layers are updated. | 4803 // Veto will take effect when layers are updated. |
4804 // The results will be verified after commit is completed below. | 4804 // The results will be verified after commit is completed below. |
4805 // Since we are manually marking picture pile as unsuitable, | 4805 // Since we are manually marking picture pile as unsuitable, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4899 const gfx::Size bounds_; | 4899 const gfx::Size bounds_; |
4900 FakeContentLayerClient client_; | 4900 FakeContentLayerClient client_; |
4901 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4901 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
4902 scoped_refptr<FakePictureLayer> picture_layer_; | 4902 scoped_refptr<FakePictureLayer> picture_layer_; |
4903 Layer* child_layer_; | 4903 Layer* child_layer_; |
4904 }; | 4904 }; |
4905 | 4905 |
4906 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4906 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
4907 | 4907 |
4908 } // namespace cc | 4908 } // namespace cc |
OLD | NEW |