OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/prioritized_resource.h" | 5 #include "cc/prioritized_resource.h" |
6 | 6 |
7 #include "cc/prioritized_resource_manager.h" | 7 #include "cc/prioritized_resource_manager.h" |
8 #include "cc/resource.h" | 8 #include "cc/resource.h" |
9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
10 #include "cc/test/fake_output_surface.h" | 10 #include "cc/test/fake_output_surface.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 m_resourceProvider.reset(); | 32 m_resourceProvider.reset(); |
33 } | 33 } |
34 | 34 |
35 size_t texturesMemorySize(size_t textureCount) | 35 size_t texturesMemorySize(size_t textureCount) |
36 { | 36 { |
37 return Resource::MemorySizeBytes(m_textureSize, m_textureFormat) * textu
reCount; | 37 return Resource::MemorySizeBytes(m_textureSize, m_textureFormat) * textu
reCount; |
38 } | 38 } |
39 | 39 |
40 scoped_ptr<PrioritizedResourceManager> createManager(size_t maxTextures) | 40 scoped_ptr<PrioritizedResourceManager> createManager(size_t maxTextures) |
41 { | 41 { |
42 scoped_ptr<PrioritizedResourceManager> manager = PrioritizedResourceMana
ger::create(0, &m_proxy); | 42 scoped_ptr<PrioritizedResourceManager> manager = PrioritizedResourceMana
ger::create(&m_proxy); |
43 manager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); | 43 manager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); |
44 return manager.Pass(); | 44 return manager.Pass(); |
45 } | 45 } |
46 | 46 |
47 bool validateTexture(scoped_ptr<PrioritizedResource>& texture, bool requestL
ate) | 47 bool validateTexture(scoped_ptr<PrioritizedResource>& texture, bool requestL
ate) |
48 { | 48 { |
49 resourceManagerAssertInvariants(texture->resourceManager()); | 49 resourceManagerAssertInvariants(texture->resourceManager()); |
50 if (requestLate) | 50 if (requestLate) |
51 texture->requestLate(); | 51 texture->requestLate(); |
52 resourceManagerAssertInvariants(texture->resourceManager()); | 52 resourceManagerAssertInvariants(texture->resourceManager()); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes()); | 698 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes()); |
699 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby
Bytes()); | 699 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby
Bytes()); |
700 } | 700 } |
701 | 701 |
702 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); | 702 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
703 resourceManager->clearAllMemory(resourceProvider()); | 703 resourceManager->clearAllMemory(resourceProvider()); |
704 } | 704 } |
705 | 705 |
706 } // namespace | 706 } // namespace |
707 } // namespace cc | 707 } // namespace cc |
OLD | NEW |