diff options
author | Romain Guy <romainguy@google.com> | 2010-11-11 15:36:56 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-11-11 15:36:56 -0800 |
commit | fe48f65922d4a3cc4aefe058cee5acec51504a20 (patch) | |
tree | 97ea23ae71dade1ef7bf783523bea9cda31dd042 /libs/hwui/PathCache.h | |
parent | 50c5e4c36e494d092576d42cf2b406abab20510a (diff) | |
download | frameworks_base-fe48f65922d4a3cc4aefe058cee5acec51504a20.zip frameworks_base-fe48f65922d4a3cc4aefe058cee5acec51504a20.tar.gz frameworks_base-fe48f65922d4a3cc4aefe058cee5acec51504a20.tar.bz2 |
Free resources only from the GL context thread.
Bug #3179882
Resources were freed following garbage collections on a worker thread.
This worker thread had no EGL context, which would cause the renderer
to incorrectly assume that the memory was liberated.
Change-Id: Ifdb51f94ddf42641e8654522787bfac532976c7c
Diffstat (limited to 'libs/hwui/PathCache.h')
-rw-r--r-- | libs/hwui/PathCache.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h index 0193f43..ae2e55d 100644 --- a/libs/hwui/PathCache.h +++ b/libs/hwui/PathCache.h @@ -21,6 +21,8 @@ #include <SkPaint.h> #include <SkPath.h> +#include <utils/Vector.h> + #include "Debug.h" #include "Texture.h" #include "utils/Compare.h" @@ -146,6 +148,15 @@ public: * Removes an entry. */ void remove(SkPath* path); + /** + * Removes the specified path. This is meant to be called from threads + * that are not the EGL context thread. + */ + void removeDeferred(SkPath* path); + /** + * Process deferred removals. + */ + void clearGarbage(); /** * Sets the maximum size of the cache in bytes. @@ -166,6 +177,8 @@ private: */ void generateTexture(SkBitmap& bitmap, Texture* texture); + void removeTexture(PathTexture* texture); + PathTexture* addTexture(const PathCacheEntry& entry, const SkPath *path, const SkPaint* paint); void init(); @@ -178,10 +191,7 @@ private: bool mDebugEnabled; - /** - * Used to access mCache and mSize. All methods are accessed from a single - * thread except for remove(). - */ + Vector<SkPath*> mGarbage; mutable Mutex mLock; }; // class PathCache |