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

Side by Side Diff: cc/CCPrioritizedTextureManager.h

Issue 11048004: Only recycle and evict textures not in-use on the impl thread. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months 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
« no previous file with comments | « cc/CCPrioritizedTexture.cpp ('k') | cc/CCPrioritizedTextureManager.cpp » ('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 #ifndef CCPrioritizedTextureManager_h 5 #ifndef CCPrioritizedTextureManager_h
6 #define CCPrioritizedTextureManager_h 6 #define CCPrioritizedTextureManager_h
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "CCPrioritizedTexture.h" 9 #include "CCPrioritizedTexture.h"
10 #include "CCPriorityCalculator.h" 10 #include "CCPriorityCalculator.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 void reduceMemory(CCResourceProvider*); 70 void reduceMemory(CCResourceProvider*);
71 void clearAllMemory(CCResourceProvider*); 71 void clearAllMemory(CCResourceProvider*);
72 72
73 void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider *); 73 void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider *);
74 74
75 void registerTexture(CCPrioritizedTexture*); 75 void registerTexture(CCPrioritizedTexture*);
76 void unregisterTexture(CCPrioritizedTexture*); 76 void unregisterTexture(CCPrioritizedTexture*);
77 void returnBackingTexture(CCPrioritizedTexture*); 77 void returnBackingTexture(CCPrioritizedTexture*);
78 78
79 void updateBackingsPriorities();
80
79 private: 81 private:
80 friend class CCPrioritizedTextureTest; 82 friend class CCPrioritizedTextureTest;
81 83
82 enum EvictionPriorityPolicy { 84 enum EvictionPriorityPolicy {
83 RespectManagerPriorityCutoff, 85 RespectManagerPriorityCutoff,
84 DoNotRespectManagerPriorityCutoff, 86 DoNotRespectManagerPriorityCutoff,
85 }; 87 };
86 88
87 // Compare textures. Highest priority first. 89 // Compare textures. Highest priority first.
88 static inline bool compareTextures(CCPrioritizedTexture* a, CCPrioritizedTex ture* b) 90 static inline bool compareTextures(CCPrioritizedTexture* a, CCPrioritizedTex ture* b)
(...skipping 13 matching lines...) Expand all
102 bool aboveCutoffB = b->wasAbovePriorityCutoffAtLastPriorityUpdate(); 104 bool aboveCutoffB = b->wasAbovePriorityCutoffAtLastPriorityUpdate();
103 if (!aboveCutoffA && aboveCutoffB) 105 if (!aboveCutoffA && aboveCutoffB)
104 return true; 106 return true;
105 if (aboveCutoffA && !aboveCutoffB) 107 if (aboveCutoffA && !aboveCutoffB)
106 return false; 108 return false;
107 return a < b; 109 return a < b;
108 } 110 }
109 111
110 CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool); 112 CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool);
111 113
112 void updateBackingsPriorities();
113 void evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*); 114 void evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*);
114 CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCRes ourceProvider*); 115 CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCRes ourceProvider*);
115 void evictBackingResource(CCPrioritizedTexture::Backing*, CCResourceProvider *); 116 void evictBackingResource(CCPrioritizedTexture::Backing*, CCResourceProvider *);
116 117
117 #if !ASSERT_DISABLED 118 #if !ASSERT_DISABLED
118 void assertInvariants(); 119 void assertInvariants();
119 #endif 120 #endif
120 121
121 size_t m_maxMemoryLimitBytes; 122 size_t m_maxMemoryLimitBytes;
122 unsigned m_priorityCutoff; 123 unsigned m_priorityCutoff;
(...skipping 16 matching lines...) Expand all
139 // Set by the main thread when it adjust priorities in such a way that 140 // Set by the main thread when it adjust priorities in such a way that
140 // the m_backings array's view of priorities is now out of date. 141 // the m_backings array's view of priorities is now out of date.
141 bool m_needsUpdateBackingsPrioritites; 142 bool m_needsUpdateBackingsPrioritites;
142 143
143 DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTextureManager); 144 DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTextureManager);
144 }; 145 };
145 146
146 } // namespace cc 147 } // namespace cc
147 148
148 #endif 149 #endif
OLDNEW
« no previous file with comments | « cc/CCPrioritizedTexture.cpp ('k') | cc/CCPrioritizedTextureManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698