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

Unified Diff: cc/prioritized_texture_manager.h

Issue 11280268: Merge 170403 - Use a lock to deal with concurrent access to the m_evictedBackings (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1312/src
Patch Set: Created 8 years, 1 month 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 | « no previous file | 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 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;
« no previous file with comments | « no previous file | cc/prioritized_texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698