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

Unified Diff: cc/CCPrioritizedTextureManager.cpp

Issue 10919227: Roll in CC changes up to 128196 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/CCPrioritizedTextureManager.h ('k') | cc/CCRenderSurfaceFilters.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/CCPrioritizedTextureManager.cpp
diff --git a/cc/CCPrioritizedTextureManager.cpp b/cc/CCPrioritizedTextureManager.cpp
index 3089d00a913a7076650853020184c9613b8f9553..00d06897cc77f92b8618b15d13bf0d0516eaa84f 100644
--- a/cc/CCPrioritizedTextureManager.cpp
+++ b/cc/CCPrioritizedTextureManager.cpp
@@ -228,6 +228,8 @@ void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvi
void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourceProvider)
{
+ ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ ASSERT(resourceProvider);
// Unlink and destroy all backing textures.
while (m_backings.size() > 0) {
BackingSet::iterator it = m_backings.begin();
@@ -237,12 +239,24 @@ void CCPrioritizedTextureManager::clearAllMemory(CCResourceProvider* resourcePro
}
}
-void CCPrioritizedTextureManager::allBackingTexturesWereDeleted()
+void CCPrioritizedTextureManager::unlinkAllBackings()
+{
+ ASSERT(CCProxy::isMainThread());
+ for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it)
+ if ((*it)->owner())
+ (*it)->owner()->unlink();
+}
+
+void CCPrioritizedTextureManager::deleteAllUnlinkedBackings()
{
- // Same as clearAllMemory, except all our textures were already
- // deleted externally, so we don't delete them. Passing no
- // resourceProvider results in leaking the (now invalid) texture ids.
- clearAllMemory(0);
+ ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
+ BackingVector backingsToDelete;
+ for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it)
+ if (!(*it)->owner())
+ backingsToDelete.append((*it));
+
+ for (BackingVector::iterator it = backingsToDelete.begin(); it != backingsToDelete.end(); ++it)
+ destroyBacking((*it), 0);
}
void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture)
« no previous file with comments | « cc/CCPrioritizedTextureManager.h ('k') | cc/CCRenderSurfaceFilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698