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

Unified Diff: cc/CCPrioritizedTextureManager.cpp

Issue 10947017: Enable removing uploads to evicted textures from texture upload queues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback 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/CCTextureUpdateController.h » ('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 d571e5f08532ddc8881a418940bd6144e62f90b1..9a5481d2edb4c98ec8a4abd58ea53e178cfa6cbb 100644
--- a/cc/CCPrioritizedTextureManager.cpp
+++ b/cc/CCPrioritizedTextureManager.cpp
@@ -265,11 +265,6 @@ void CCPrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, CC
ASSERT(resourceProvider);
evictBackingsToReduceMemory(limitBytes, DoNotRespectManagerPriorityCutoff, resourceProvider);
-
- // Deleting just some (not all) resources is not supported yet because we do not clear
- // only the deleted resources from the texture upload queues (rather, we clear all uploads).
- // Make sure that if we evict all resources.
- ASSERT(m_backings.isEmpty());
}
void CCPrioritizedTextureManager::getEvictedBackings(BackingVector& evictedBackings)
@@ -344,7 +339,7 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz
ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
ASSERT(resourceProvider);
CCResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, CCResourceProvider::TextureUsageAny);
- CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(resourceId, size, format);
+ CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(resourceId, resourceProvider, size, format);
m_memoryUseBytes += backing->bytes();
// Put backing texture at the front for eviction, since it isn't in use yet.
m_backings.insertBefore(m_backings.begin(), backing);
@@ -358,8 +353,11 @@ void CCPrioritizedTextureManager::evictBackingResource(CCPrioritizedTexture::Bac
ASSERT(resourceProvider);
ASSERT(m_backings.find(backing) != m_backings.end());
- resourceProvider->deleteResource(backing->id());
- backing->setId(0);
+ // Note that we create a backing and its resource at the same time, but we
+ // delete the backing structure and its resource in two steps. This is because
+ // we can delete the resource while the main thread is running, but we cannot
+ // unlink backings while the main thread is running.
+ backing->deleteResource(resourceProvider);
m_memoryUseBytes -= backing->bytes();
m_backings.remove(backing);
m_evictedBackings.append(backing);
« no previous file with comments | « cc/CCPrioritizedTextureManager.h ('k') | cc/CCTextureUpdateController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698