Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: cc/prioritized_resource_unittest.cc

Issue 11363254: Set contents texture manager's limit to something reasonable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/prioritized_resource_manager.cc ('k') | cc/resource_update_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
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 return PrioritizedResourceManager::create(texturesMemorySize(maxTextures ), 1024, 0, &m_proxy); 44 scoped_ptr<PrioritizedResourceManager> manager = PrioritizedResourceMana ger::create(0, &m_proxy);
45 manager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures));
46 return manager.Pass();
45 } 47 }
46 48
47 bool validateTexture(scoped_ptr<PrioritizedResource>& texture, bool requestL ate) 49 bool validateTexture(scoped_ptr<PrioritizedResource>& texture, bool requestL ate)
48 { 50 {
49 resourceManagerAssertInvariants(texture->resourceManager()); 51 resourceManagerAssertInvariants(texture->resourceManager());
50 if (requestLate) 52 if (requestLate)
51 texture->requestLate(); 53 texture->requestLate();
52 resourceManagerAssertInvariants(texture->resourceManager()); 54 resourceManagerAssertInvariants(texture->resourceManager());
53 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked(&m_proxy); 55 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBloc ked(&m_proxy);
54 bool success = texture->canAcquireBackingTexture(); 56 bool success = texture->canAcquireBackingTexture();
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes()); 696 EXPECT_EQ(texturesMemorySize(3), resourceManager->memoryVisibleBytes());
695 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby Bytes()); 697 EXPECT_EQ(texturesMemorySize(4), resourceManager->memoryVisibleAndNearby Bytes());
696 } 698 }
697 699
698 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked( &m_proxy); 700 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked( &m_proxy);
699 resourceManager->clearAllMemory(resourceProvider()); 701 resourceManager->clearAllMemory(resourceProvider());
700 } 702 }
701 703
702 } // namespace 704 } // namespace
703 } // namespace cc 705 } // namespace cc
OLDNEW
« no previous file with comments | « cc/prioritized_resource_manager.cc ('k') | cc/resource_update_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698