| 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_graphics_context.h" | 10 #include "cc/test/fake_graphics_context.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual ~PrioritizedResourceTest() | 31 virtual ~PrioritizedResourceTest() |
| 32 { | 32 { |
| 33 DebugScopedSetImplThread implThread(&m_proxy); | 33 DebugScopedSetImplThread implThread(&m_proxy); |
| 34 m_resourceProvider.reset(); | 34 m_resourceProvider.reset(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 size_t texturesMemorySize(size_t textureCount) | 37 size_t texturesMemorySize(size_t textureCount) |
| 38 { | 38 { |
| 39 return Resource::memorySizeBytes(m_textureSize, m_textureFormat) * textu
reCount; | 39 return Resource::MemorySizeBytes(m_textureSize, m_textureFormat) * textu
reCount; |
| 40 } | 40 } |
| 41 | 41 |
| 42 scoped_ptr<PrioritizedResourceManager> createManager(size_t maxTextures) | 42 scoped_ptr<PrioritizedResourceManager> createManager(size_t maxTextures) |
| 43 { | 43 { |
| 44 scoped_ptr<PrioritizedResourceManager> manager = PrioritizedResourceMana
ger::create(0, &m_proxy); | 44 scoped_ptr<PrioritizedResourceManager> manager = PrioritizedResourceMana
ger::create(0, &m_proxy); |
| 45 manager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); | 45 manager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); |
| 46 return manager.Pass(); | 46 return manager.Pass(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool validateTexture(scoped_ptr<PrioritizedResource>& texture, bool requestL
ate) | 49 bool validateTexture(scoped_ptr<PrioritizedResource>& texture, bool requestL
ate) |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes()); | 696 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes()); |
| 697 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby
Bytes()); | 697 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby
Bytes()); |
| 698 } | 698 } |
| 699 | 699 |
| 700 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); | 700 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(
&m_proxy); |
| 701 resourceManager->clearAllMemory(resourceProvider()); | 701 resourceManager->clearAllMemory(resourceProvider()); |
| 702 } | 702 } |
| 703 | 703 |
| 704 } // namespace | 704 } // namespace |
| 705 } // namespace cc | 705 } // namespace cc |
| OLD | NEW |