summaryrefslogtreecommitdiffstats
path: root/cc/CCPrioritizedTexture.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/CCPrioritizedTexture.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/CCPrioritizedTexture.cpp')
-rw-r--r--cc/CCPrioritizedTexture.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/cc/CCPrioritizedTexture.cpp b/cc/CCPrioritizedTexture.cpp
index 270ceba..2940e92 100644
--- a/cc/CCPrioritizedTexture.cpp
+++ b/cc/CCPrioritizedTexture.cpp
@@ -69,6 +69,11 @@ bool CCPrioritizedTexture::requestLate()
return m_manager->requestLate(this);
}
+bool CCPrioritizedTexture::backingResourceWasEvicted() const
+{
+ return m_backing ? m_backing->resourceHasBeenDeleted() : false;
+}
+
void CCPrioritizedTexture::acquireBackingTexture(CCResourceProvider* resourceProvider)
{
ASSERT(m_isAbovePriorityCutoff);
@@ -120,18 +125,42 @@ void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes)
m_bytes = bytes;
}
-CCPrioritizedTexture::Backing::Backing(unsigned id, IntSize size, GC3Denum format)
+CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resourceProvider, IntSize size, GC3Denum format)
: CCTexture(id, size, format)
, m_owner(0)
, m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority())
, m_ownerExistedAtLastPriorityUpdate(false)
, m_wasAbovePriorityCutoffAtLastPriorityUpdate(false)
+ , m_resourceHasBeenDeleted(false)
+#ifndef NDEBUG
+ , m_resourceProvider(resourceProvider)
+#endif
{
}
CCPrioritizedTexture::Backing::~Backing()
{
ASSERT(!m_owner);
+ ASSERT(m_resourceHasBeenDeleted);
+}
+
+void CCPrioritizedTexture::Backing::deleteResource(CCResourceProvider* resourceProvider)
+{
+ ASSERT(CCProxy::isImplThread());
+ ASSERT(!m_resourceHasBeenDeleted);
+#ifndef NDEBUG
+ ASSERT(resourceProvider == m_resourceProvider);
+#endif
+
+ resourceProvider->deleteResource(id());
+ setId(0);
+ m_resourceHasBeenDeleted = true;
+}
+
+bool CCPrioritizedTexture::Backing::resourceHasBeenDeleted() const
+{
+ ASSERT(CCProxy::isImplThread());
+ return m_resourceHasBeenDeleted;
}
void CCPrioritizedTexture::Backing::updatePriority()