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

Unified Diff: cc/CCPrioritizedTextureManager.cpp

Issue 10920059: Rolls cc and webkit_compositor up to 127340 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/CCOcclusionTrackerTest.cpp ('k') | cc/CCPrioritizedTextureTest.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 2678ec9ce4b2ee6967cfdbba6056f25b83d6029d..3089d00a913a7076650853020184c9613b8f9553 100644
--- a/cc/CCPrioritizedTextureManager.cpp
+++ b/cc/CCPrioritizedTextureManager.cpp
@@ -8,6 +8,7 @@
#include "CCPrioritizedTexture.h"
#include "CCPriorityCalculator.h"
+#include "CCProxy.h"
#include "TraceEvent.h"
#include <algorithm>
@@ -38,6 +39,7 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager()
void CCPrioritizedTextureManager::prioritizeTextures()
{
TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures");
+ ASSERT(CCProxy::isMainThread());
#if !ASSERT_DISABLED
assertInvariants();
@@ -117,6 +119,7 @@ void CCPrioritizedTextureManager::prioritizeTextures()
void CCPrioritizedTextureManager::clearPriorities()
{
+ ASSERT(CCProxy::isMainThread());
for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) {
// FIXME: We should remove this and just set all priorities to
// CCPriorityCalculator::lowestPriority() once we have priorities
@@ -128,6 +131,8 @@ void CCPrioritizedTextureManager::clearPriorities()
bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture)
{
+ ASSERT(CCProxy::isMainThread());
+
// This is already above cutoff, so don't double count it's memory below.
if (texture->isAbovePriorityCutoff())
return true;
@@ -150,6 +155,7 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture)
void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, CCResourceProvider* resourceProvider)
{
+ ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
ASSERT(!texture->isSelfManaged());
ASSERT(texture->isAbovePriorityCutoff());
if (texture->backing() || !texture->isAbovePriorityCutoff())
@@ -184,6 +190,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex
void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, CCResourceProvider* resourceProvider)
{
+ ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
if (memoryUseBytes() <= limitBytes)
return;
// Destroy backings until we are below the limit,
@@ -198,6 +205,7 @@ void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, CCResourceProv
void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvider)
{
+ ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());
reduceMemory(m_memoryAvailableBytes, resourceProvider);
ASSERT(memoryUseBytes() <= maxMemoryLimitBytes());
@@ -239,6 +247,7 @@ void CCPrioritizedTextureManager::allBackingTexturesWereDeleted()
void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture)
{
+ ASSERT(CCProxy::isMainThread());
ASSERT(texture);
ASSERT(!texture->textureManager());
ASSERT(!texture->backing());
@@ -251,6 +260,7 @@ void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture)
void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* texture)
{
+ ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()));
ASSERT(texture);
ASSERT(m_textures.find(texture) != m_textures.end());
@@ -260,9 +270,9 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur
texture->setAbovePriorityCutoff(false);
}
-
void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture)
{
+ ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()));
if (texture->backing()) {
// Move the backing texture to the front for eviction/recycling and unlink it.
m_backings.remove(texture->backing());
@@ -273,8 +283,8 @@ void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* tex
CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, CCResourceProvider* resourceProvider)
{
+ 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);
m_memoryUseBytes += backing->bytes();
@@ -304,6 +314,8 @@ void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing*
#if !ASSERT_DISABLED
void CCPrioritizedTextureManager::assertInvariants()
{
+ ASSERT(CCProxy::isMainThread());
+
// If we hit any of these asserts, there is a bug in this class. To see
// where the bug is, call this function at the beginning and end of
// every public function.
« no previous file with comments | « cc/CCOcclusionTrackerTest.cpp ('k') | cc/CCPrioritizedTextureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698