| 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 6352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6363 | 6363 |
| 6364 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); | 6364 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); |
| 6365 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); | 6365 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); |
| 6366 } | 6366 } |
| 6367 } | 6367 } |
| 6368 | 6368 |
| 6369 class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest { | 6369 class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest { |
| 6370 public: | 6370 public: |
| 6371 virtual void SetUp() OVERRIDE { | 6371 virtual void SetUp() OVERRIDE { |
| 6372 LayerTreeSettings settings = DefaultSettings(); | 6372 LayerTreeSettings settings = DefaultSettings(); |
| 6373 settings.max_unused_resource_memory_percentage = 50; | |
| 6374 settings.max_memory_for_prepaint_percentage = 50; | 6373 settings.max_memory_for_prepaint_percentage = 50; |
| 6375 CreateHostImpl(settings, CreateOutputSurface()); | 6374 CreateHostImpl(settings, CreateOutputSurface()); |
| 6376 } | 6375 } |
| 6377 }; | 6376 }; |
| 6378 | 6377 |
| 6379 TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) { | 6378 TEST_F(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) { |
| 6380 // Set up a memory policy and percentages which could cause | 6379 // Set up a memory policy and percentages which could cause |
| 6381 // 32-bit integer overflows. | 6380 // 32-bit integer overflows. |
| 6382 ManagedMemoryPolicy mem_policy(300 * 1024 * 1024); // 300MB | 6381 ManagedMemoryPolicy mem_policy(300 * 1024 * 1024); // 300MB |
| 6383 | 6382 |
| 6384 // Verify implicit limits are calculated correctly with no overflows | 6383 // Verify implicit limits are calculated correctly with no overflows |
| 6385 host_impl_->SetMemoryPolicy(mem_policy); | 6384 host_impl_->SetMemoryPolicy(mem_policy); |
| 6386 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, | 6385 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, |
| 6387 300u * 1024u * 1024u); | 6386 300u * 1024u * 1024u); |
| 6388 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, | 6387 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, |
| 6389 150u * 1024u * 1024u); | 6388 150u * 1024u * 1024u); |
| 6390 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, | |
| 6391 75u * 1024u * 1024u); | |
| 6392 } | 6389 } |
| 6393 | 6390 |
| 6394 } // namespace | 6391 } // namespace |
| 6395 } // namespace cc | 6392 } // namespace cc |
| OLD | NEW |