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

Unified Diff: cc/prioritized_texture_manager.h

Issue 11079007: Fix issue incremental upload can evict textures being drawn (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve against The Great Renaming 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
« no previous file with comments | « cc/prioritized_texture.cc ('k') | cc/prioritized_texture_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/prioritized_texture_manager.h
diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h
index 1b3b1edbdfbf5836775a3ba8c8135796e16b4e44..e8998b03d93e6855226d59dbab63bbcdc86b5ab6 100644
--- a/cc/prioritized_texture_manager.h
+++ b/cc/prioritized_texture_manager.h
@@ -67,14 +67,19 @@ public:
void prioritizeTextures();
void clearPriorities();
+ // Delete contents textures' backing resources until they use only bytesLimit bytes. This may
+ // be called on the impl thread while the main thread is running.
void reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider*);
- bool evictedBackingsExist() const { return !m_evictedBackings.isEmpty(); }
+ // Returns true if there exist any textures that are linked to backings that have had their
+ // resources evicted. Only when we commit a tree that has no textures linked to evicted backings
+ // may we allow drawing.
+ bool linkedEvictedBackingsExist() const;
+ // Retrieve the list of all contents textures' backings that have been evicted, to pass to the
+ // main thread to unlink them from their owning textures.
void getEvictedBackings(BackingVector& evictedBackings);
+ // Unlink the list of contents textures' backings from their owning textures on the main thread
+ // before updating layers.
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*);
@@ -87,6 +92,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;
@@ -105,25 +116,29 @@ 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;
+ // Make textures that can be recycled appear first
+ if (a->canBeRecycled() != b->canBeRecycled())
+ return (a->canBeRecycled() > b->canBeRecycled());
+ // Then sort by being above or below the priority cutoff.
+ if (a->wasAbovePriorityCutoffAtLastPriorityUpdate() != b->wasAbovePriorityCutoffAtLastPriorityUpdate())
+ return (a->wasAbovePriorityCutoffAtLastPriorityUpdate() < b->wasAbovePriorityCutoffAtLastPriorityUpdate());
+ // Then sort by priority (note that backings that no longer have owners will
+ // always have the lowest priority)
+ if (a->requestPriorityAtLastPriorityUpdate() != b->requestPriorityAtLastPriorityUpdate())
+ return CCPriorityCalculator::priorityIsLower(a->requestPriorityAtLastPriorityUpdate(), b->requestPriorityAtLastPriorityUpdate());
+ // 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();
@@ -147,10 +162,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);
};
« no previous file with comments | « cc/prioritized_texture.cc ('k') | cc/prioritized_texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698