From c5cbee7d78513527e89450e6369a30a04b2d5e7a Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 20 Mar 2013 19:15:02 -0700 Subject: Stop worker threads on memory trim & fix bad pointer access Change-Id: I6fe7e31aeb6dd41fa65ab952caed97bc2da510d7 --- libs/hwui/PathCache.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'libs/hwui/PathCache.h') diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h index e6d92df..1467231 100644 --- a/libs/hwui/PathCache.h +++ b/libs/hwui/PathCache.h @@ -26,6 +26,7 @@ #include "Debug.h" #include "Properties.h" #include "Texture.h" +#include "utils/Pair.h" class SkBitmap; class SkCanvas; @@ -215,10 +216,6 @@ public: PathTexture* get(SkPath* path, SkPaint* paint); /** - * 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. */ @@ -251,6 +248,8 @@ public: float& left, float& top, float& offset, uint32_t& width, uint32_t& height); private: + typedef Pair path_pair_t; + PathTexture* addTexture(const PathDescription& entry, const SkPath *path, const SkPaint* paint); PathTexture* addTexture(const PathDescription& entry, SkBitmap* bitmap); @@ -261,6 +260,12 @@ private: } /** + * Removes an entry. + * The pair must define first=path, second=sourcePath + */ + void remove(const path_pair_t& pair); + + /** * Ensures there is enough space in the cache for a texture of the specified * dimensions. */ @@ -318,7 +323,8 @@ private: bool mDebugEnabled; sp mProcessor; - Vector mGarbage; + + Vector mGarbage; mutable Mutex mLock; }; // class PathCache -- cgit v1.1