summaryrefslogtreecommitdiffstats
path: root/cc/CCPrioritizedTextureManager.cpp
diff options
context:
space:
mode:
authorccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 23:59:01 +0000
committerccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-19 23:59:01 +0000
commit77a60b9b04457ab552e05751a0b863d6be875cc5 (patch)
treed5fbb5d77182954c12b81ae820637a34301f35e2 /cc/CCPrioritizedTextureManager.cpp
parent3196e42a57b359527039fff8873c5f6674d0d9a9 (diff)
downloadchromium_src-77a60b9b04457ab552e05751a0b863d6be875cc5.zip
chromium_src-77a60b9b04457ab552e05751a0b863d6be875cc5.tar.gz
chromium_src-77a60b9b04457ab552e05751a0b863d6be875cc5.tar.bz2
Allow deletion of some (as opposed to all) textures on the impl thread.
Enable removing uploads to evicted textures from texture upload queues. Track whether not a CCPrioritizedTexture::Backing has been evicted in the structure itself. Purge texture upload queues of evicted backings instead of clearing the entire queue. Added CCTextureUpdateControllerTest.ClearUploadsToEvictedResources to test the new eviction logic. BUG=134750 Review URL: https://chromiumcodereview.appspot.com/10947017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/CCPrioritizedTextureManager.cpp')
-rw-r--r--cc/CCPrioritizedTextureManager.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/cc/CCPrioritizedTextureManager.cpp b/cc/CCPrioritizedTextureManager.cpp
index d571e5f..9a5481d 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);