Index: cc/prioritized_texture_manager.h |
diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h |
index 1c06a9a58dde57bf1cae59cefebc5c74288b8049..1cb0403778da7756454cf169402a85c23eddfaea 100644 |
--- a/cc/prioritized_texture_manager.h |
+++ b/cc/prioritized_texture_manager.h |
@@ -13,6 +13,7 @@ |
#include "base/basictypes.h" |
#include "base/hash_tables.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/synchronization/lock.h" |
#include "cc/prioritized_texture.h" |
#include "cc/priority_calculator.h" |
#include "cc/texture.h" |
@@ -80,16 +81,16 @@ public: |
// be called on the impl thread while the main thread is running. Returns true if resources are |
// indeed evicted as a result of this call. |
bool reduceMemoryOnImplThread(size_t limitBytes, int priorityCutoff, ResourceProvider*); |
+ |
// 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(BackingList& evictedBackings); |
- // Unlink the list of contents textures' backings from their owning textures on the main thread |
- // before updating layers. |
- void unlinkEvictedBackings(const BackingList& evictedBackings); |
+ |
+ // Unlink the list of contents textures' backings from their owning textures and delete the evicted |
+ // backings' structures. This is called just before updating layers, and is only ever called on the |
+ // main thread. |
+ void unlinkAndClearEvictedBackings(); |
bool requestLate(PrioritizedTexture*); |
@@ -155,7 +156,6 @@ private: |
ResourceProvider*); |
PrioritizedTexture::Backing* createBacking(IntSize, GLenum format, ResourceProvider*); |
void evictFirstBackingResource(ResourceProvider*); |
- void deleteUnlinkedEvictedBackings(); |
void sortBackings(); |
void assertInvariants(); |
@@ -182,6 +182,11 @@ private: |
// are not sorted by priority. |
BackingList m_backings; |
bool m_backingsTailNotSorted; |
+ |
+ // The list of backings that have been evicted, but may still be linked |
+ // to textures. This can be accessed concurrently by the main and impl |
+ // threads, and may only be accessed while holding m_evictedBackingsLock. |
+ mutable base::Lock m_evictedBackingsLock; |
BackingList m_evictedBackings; |
TextureVector m_tempTextureVector; |