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

Unified Diff: cc/CCPrioritizedTextureManager.h

Issue 11079007: Fix issue incremental upload can evict textures being drawn (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 8 years, 2 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
Index: cc/CCPrioritizedTextureManager.h
diff --git a/cc/CCPrioritizedTextureManager.h b/cc/CCPrioritizedTextureManager.h
index 88a4f45fcfb176186078e1ce0db5b425e4daf285..6a7a1c61031a71122533241f6f3b9dd0e58e1d2a 100644
--- a/cc/CCPrioritizedTextureManager.h
+++ b/cc/CCPrioritizedTextureManager.h
@@ -57,13 +57,9 @@ public:
void clearPriorities();
void reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider*);
- bool evictedBackingsExist() const { return !m_evictedBackings.isEmpty(); }
+ bool linkedEvictedBackingsExist() const;
epenner 2012/10/09 17:25:04 Nit: I was having trouble understanding what this
ccameron 2012/10/09 21:03:56 I added a comment saying that this returns true if
void getEvictedBackings(BackingVector& evictedBackings);
void unlinkEvictedBackings(const BackingVector& evictedBackings);
- // Deletes all evicted backings, unlinking them from their owning textures if needed.
- // Returns true if this function unlinked any backings from their owning texture while
- // destroying them.
- bool deleteEvictedBackings();
bool requestLate(CCPrioritizedTexture*);
@@ -76,6 +72,12 @@ public:
void unregisterTexture(CCPrioritizedTexture*);
void returnBackingTexture(CCPrioritizedTexture*);
+ // Update all backings' priorities from their owning texture.
+ void pushTexturePrioritiesToBackings();
+
+ // Mark all textures' backings as being in the drawing impl tree.
+ void updateBackingsInDrawingImplTree();
+
private:
friend class CCPrioritizedTextureTest;
@@ -94,25 +96,26 @@ private:
// Compare backings. Lowest priority first.
static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b)
{
- int priorityA = a->requestPriorityAtLastPriorityUpdate();
- int priorityB = b->requestPriorityAtLastPriorityUpdate();
- if (priorityA != priorityB)
- return CCPriorityCalculator::priorityIsLower(priorityA, priorityB);
- bool aboveCutoffA = a->wasAbovePriorityCutoffAtLastPriorityUpdate();
- bool aboveCutoffB = b->wasAbovePriorityCutoffAtLastPriorityUpdate();
- if (!aboveCutoffA && aboveCutoffB)
- return true;
- if (aboveCutoffA && !aboveCutoffB)
- return false;
+ // Sort first by priority (note that backings that no longer have owners will
epenner 2012/10/09 17:25:04 If we make some backings recyclable by intentional
ccameron 2012/10/09 21:03:56 I went ahead and put a "canBeRecycled" test first.
+ // always have the lowest priority)
+ if (a->requestPriorityAtLastPriorityUpdate() != b->requestPriorityAtLastPriorityUpdate())
+ return CCPriorityCalculator::priorityIsLower(a->requestPriorityAtLastPriorityUpdate(), b->requestPriorityAtLastPriorityUpdate());
+ // Then sort by being above or below the priority cutoff.
+ if (a->wasAbovePriorityCutoffAtLastPriorityUpdate() != b->wasAbovePriorityCutoffAtLastPriorityUpdate())
+ return (a->wasAbovePriorityCutoffAtLastPriorityUpdate() < b->wasAbovePriorityCutoffAtLastPriorityUpdate());
+ // Finally sort by being in the impl tree versus being completely unreferenced
+ if (a->inDrawingImplTree() != b->inDrawingImplTree())
+ return (a->inDrawingImplTree() < b->inDrawingImplTree());
return a < b;
}
CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool);
- void updateBackingsPriorities();
void evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*);
CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*);
void evictBackingResource(CCPrioritizedTexture::Backing*, CCResourceProvider*);
+ void deleteUnlinkedEvictedBackings();
+ void sortBackings();
#if !ASSERT_DISABLED
void assertInvariants();
@@ -136,10 +139,6 @@ private:
TextureVector m_tempTextureVector;
BackingVector m_tempBackingVector;
- // Set by the main thread when it adjust priorities in such a way that
- // the m_backings array's view of priorities is now out of date.
- bool m_needsUpdateBackingsPrioritites;
-
DISALLOW_COPY_AND_ASSIGN(CCPrioritizedTextureManager);
};

Powered by Google App Engine
This is Rietveld 408576698