| 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 4678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4689 | 4689 |
| 4690 // Setting gpu rasterization trigger does not enable gpu rasterization. | 4690 // Setting gpu rasterization trigger does not enable gpu rasterization. |
| 4691 layer_tree_host()->set_has_gpu_rasterization_trigger(true); | 4691 layer_tree_host()->set_has_gpu_rasterization_trigger(true); |
| 4692 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); | 4692 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); |
| 4693 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); | 4693 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); |
| 4694 | 4694 |
| 4695 PostSetNeedsCommitToMainThread(); | 4695 PostSetNeedsCommitToMainThread(); |
| 4696 } | 4696 } |
| 4697 | 4697 |
| 4698 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 4698 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 4699 LayerImpl* root = host_impl->pending_tree()->root_layer(); | 4699 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); |
| 4700 PictureLayerImpl* layer_impl = | 4700 EXPECT_FALSE(host_impl->use_gpu_rasterization()); |
| 4701 static_cast<PictureLayerImpl*>(root->children()[0]); | |
| 4702 | |
| 4703 EXPECT_FALSE(layer_impl->use_gpu_rasterization()); | |
| 4704 } | 4701 } |
| 4705 | 4702 |
| 4706 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 4703 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 4707 LayerImpl* root = host_impl->active_tree()->root_layer(); | 4704 EXPECT_FALSE(host_impl->active_tree()->use_gpu_rasterization()); |
| 4708 PictureLayerImpl* layer_impl = | 4705 EXPECT_FALSE(host_impl->use_gpu_rasterization()); |
| 4709 static_cast<PictureLayerImpl*>(root->children()[0]); | |
| 4710 | |
| 4711 EXPECT_FALSE(layer_impl->use_gpu_rasterization()); | |
| 4712 EndTest(); | 4706 EndTest(); |
| 4713 } | 4707 } |
| 4714 | 4708 |
| 4715 virtual void AfterTest() OVERRIDE {} | 4709 virtual void AfterTest() OVERRIDE {} |
| 4716 | 4710 |
| 4717 FakeContentLayerClient layer_client_; | 4711 FakeContentLayerClient layer_client_; |
| 4718 }; | 4712 }; |
| 4719 | 4713 |
| 4720 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationDefault); | 4714 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationDefault); |
| 4721 | 4715 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4760 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 4754 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
| 4761 // Veto will take effect when layers are updated. | 4755 // Veto will take effect when layers are updated. |
| 4762 // The results will be verified after commit is completed below. | 4756 // The results will be verified after commit is completed below. |
| 4763 // Since we are manually marking picture pile as unsuitable, | 4757 // Since we are manually marking picture pile as unsuitable, |
| 4764 // make sure that the layer gets a chance to update. | 4758 // make sure that the layer gets a chance to update. |
| 4765 layer->SetNeedsDisplay(); | 4759 layer->SetNeedsDisplay(); |
| 4766 PostSetNeedsCommitToMainThread(); | 4760 PostSetNeedsCommitToMainThread(); |
| 4767 } | 4761 } |
| 4768 | 4762 |
| 4769 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 4763 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 4770 LayerImpl* root = host_impl->pending_tree()->root_layer(); | 4764 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); |
| 4771 PictureLayerImpl* layer_impl = | 4765 EXPECT_FALSE(host_impl->use_gpu_rasterization()); |
| 4772 static_cast<PictureLayerImpl*>(root->children()[0]); | |
| 4773 | |
| 4774 EXPECT_FALSE(layer_impl->use_gpu_rasterization()); | |
| 4775 } | 4766 } |
| 4776 | 4767 |
| 4777 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 4768 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 4778 LayerImpl* root = host_impl->active_tree()->root_layer(); | 4769 EXPECT_FALSE(host_impl->active_tree()->use_gpu_rasterization()); |
| 4779 PictureLayerImpl* layer_impl = | 4770 EXPECT_FALSE(host_impl->use_gpu_rasterization()); |
| 4780 static_cast<PictureLayerImpl*>(root->children()[0]); | |
| 4781 | |
| 4782 EXPECT_FALSE(layer_impl->use_gpu_rasterization()); | |
| 4783 EndTest(); | 4771 EndTest(); |
| 4784 } | 4772 } |
| 4785 | 4773 |
| 4786 virtual void AfterTest() OVERRIDE {} | 4774 virtual void AfterTest() OVERRIDE {} |
| 4787 | 4775 |
| 4788 FakeContentLayerClient layer_client_; | 4776 FakeContentLayerClient layer_client_; |
| 4789 }; | 4777 }; |
| 4790 | 4778 |
| 4791 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); | 4779 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); |
| 4792 | 4780 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 4819 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
| 4832 // Veto will take effect when layers are updated. | 4820 // Veto will take effect when layers are updated. |
| 4833 // The results will be verified after commit is completed below. | 4821 // The results will be verified after commit is completed below. |
| 4834 // Since we are manually marking picture pile as unsuitable, | 4822 // Since we are manually marking picture pile as unsuitable, |
| 4835 // make sure that the layer gets a chance to update. | 4823 // make sure that the layer gets a chance to update. |
| 4836 layer->SetNeedsDisplay(); | 4824 layer->SetNeedsDisplay(); |
| 4837 PostSetNeedsCommitToMainThread(); | 4825 PostSetNeedsCommitToMainThread(); |
| 4838 } | 4826 } |
| 4839 | 4827 |
| 4840 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 4828 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 4841 LayerImpl* root = host_impl->pending_tree()->root_layer(); | 4829 EXPECT_TRUE(host_impl->pending_tree()->use_gpu_rasterization()); |
| 4842 PictureLayerImpl* layer_impl = | 4830 EXPECT_TRUE(host_impl->use_gpu_rasterization()); |
| 4843 static_cast<PictureLayerImpl*>(root->children()[0]); | |
| 4844 | |
| 4845 EXPECT_TRUE(layer_impl->use_gpu_rasterization()); | |
| 4846 } | 4831 } |
| 4847 | 4832 |
| 4848 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 4833 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 4849 LayerImpl* root = host_impl->active_tree()->root_layer(); | 4834 EXPECT_TRUE(host_impl->active_tree()->use_gpu_rasterization()); |
| 4850 PictureLayerImpl* layer_impl = | 4835 EXPECT_TRUE(host_impl->use_gpu_rasterization()); |
| 4851 static_cast<PictureLayerImpl*>(root->children()[0]); | |
| 4852 | |
| 4853 EXPECT_TRUE(layer_impl->use_gpu_rasterization()); | |
| 4854 EndTest(); | 4836 EndTest(); |
| 4855 } | 4837 } |
| 4856 | 4838 |
| 4857 virtual void AfterTest() OVERRIDE {} | 4839 virtual void AfterTest() OVERRIDE {} |
| 4858 | 4840 |
| 4859 FakeContentLayerClient layer_client_; | 4841 FakeContentLayerClient layer_client_; |
| 4860 }; | 4842 }; |
| 4861 | 4843 |
| 4862 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationForced); | 4844 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationForced); |
| 4863 | 4845 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4934 const gfx::Size bounds_; | 4916 const gfx::Size bounds_; |
| 4935 FakeContentLayerClient client_; | 4917 FakeContentLayerClient client_; |
| 4936 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4918 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 4937 scoped_refptr<FakePictureLayer> picture_layer_; | 4919 scoped_refptr<FakePictureLayer> picture_layer_; |
| 4938 Layer* child_layer_; | 4920 Layer* child_layer_; |
| 4939 }; | 4921 }; |
| 4940 | 4922 |
| 4941 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4923 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 4942 | 4924 |
| 4943 } // namespace cc | 4925 } // namespace cc |
| OLD | NEW |