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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 5749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5760 ManagedMemoryPolicy policy1( | 5760 ManagedMemoryPolicy policy1( |
5761 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000); | 5761 456, gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, 1000); |
5762 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( | 5762 int everything_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( |
5763 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); | 5763 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING); |
5764 int allow_nice_to_have_cutoff_value = | 5764 int allow_nice_to_have_cutoff_value = |
5765 ManagedMemoryPolicy::PriorityCutoffToValue( | 5765 ManagedMemoryPolicy::PriorityCutoffToValue( |
5766 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE); | 5766 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE); |
5767 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( | 5767 int nothing_cutoff_value = ManagedMemoryPolicy::PriorityCutoffToValue( |
5768 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); | 5768 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); |
5769 | 5769 |
5770 // GPU rasterization should be disabled by default. | 5770 // GPU rasterization should be disabled by default on the tree(s) |
5771 EXPECT_FALSE(host_impl_->settings().gpu_rasterization_enabled); | 5771 EXPECT_FALSE(host_impl_->active_tree()->use_gpu_rasterization()); |
5772 EXPECT_FALSE(host_impl_->settings().gpu_rasterization_forced); | 5772 EXPECT_TRUE(host_impl_->pending_tree() == NULL); |
5773 | 5773 |
5774 host_impl_->SetVisible(true); | 5774 host_impl_->SetVisible(true); |
5775 host_impl_->SetMemoryPolicy(policy1); | 5775 host_impl_->SetMemoryPolicy(policy1); |
5776 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); | 5776 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); |
5777 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); | 5777 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); |
5778 | 5778 |
5779 host_impl_->SetVisible(false); | 5779 host_impl_->SetVisible(false); |
5780 EXPECT_EQ(0u, current_limit_bytes_); | 5780 EXPECT_EQ(0u, current_limit_bytes_); |
5781 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); | 5781 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); |
5782 | 5782 |
5783 host_impl_->SetVisible(true); | 5783 host_impl_->SetVisible(true); |
5784 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); | 5784 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); |
5785 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); | 5785 EXPECT_EQ(everything_cutoff_value, current_priority_cutoff_value_); |
5786 | 5786 |
5787 // Now enable GPU rasterization and test if we get required only cutoff, | 5787 // Now enable GPU rasterization and test if we get nice to have cutoff, |
5788 // when visible. | 5788 // when visible. |
5789 LayerTreeSettings settings; | 5789 LayerTreeSettings settings; |
5790 settings.gpu_rasterization_forced = true; | 5790 settings.gpu_rasterization_enabled = true; |
5791 host_impl_ = LayerTreeHostImpl::Create( | 5791 host_impl_ = LayerTreeHostImpl::Create( |
5792 settings, this, &proxy_, &stats_instrumentation_, NULL, 0); | 5792 settings, this, &proxy_, &stats_instrumentation_, NULL, 0); |
5793 | 5793 host_impl_->active_tree()->SetUseGpuRasterization(true); |
5794 host_impl_->SetVisible(true); | 5794 host_impl_->SetVisible(true); |
5795 host_impl_->SetMemoryPolicy(policy1); | 5795 host_impl_->SetMemoryPolicy(policy1); |
5796 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); | 5796 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); |
5797 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_); | 5797 EXPECT_EQ(allow_nice_to_have_cutoff_value, current_priority_cutoff_value_); |
5798 | 5798 |
5799 host_impl_->SetVisible(false); | 5799 host_impl_->SetVisible(false); |
5800 EXPECT_EQ(0u, current_limit_bytes_); | 5800 EXPECT_EQ(0u, current_limit_bytes_); |
5801 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); | 5801 EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_); |
5802 } | 5802 } |
5803 | 5803 |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6541 FakePictureLayerImpl* active_mask_content = | 6541 FakePictureLayerImpl* active_mask_content = |
6542 static_cast<FakePictureLayerImpl*>( | 6542 static_cast<FakePictureLayerImpl*>( |
6543 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); | 6543 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); |
6544 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); | 6544 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); |
6545 | 6545 |
6546 ASSERT_TRUE(!r2.IsEmpty()); | 6546 ASSERT_TRUE(!r2.IsEmpty()); |
6547 } | 6547 } |
6548 | 6548 |
6549 } // namespace | 6549 } // namespace |
6550 } // namespace cc | 6550 } // namespace cc |
OLD | NEW |