summaryrefslogtreecommitdiffstats
path: root/libs/hwui/ResourceCache.h
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-05-07 13:14:15 -0700
committerJohn Reck <jreck@google.com>2015-05-07 13:17:18 -0700
commite75ab4c26a4f661334845f7bc4132011694836a4 (patch)
treeffbef5cc8893437299ad0d701c126120287ea464 /libs/hwui/ResourceCache.h
parentb59642bf49e8703ebd88532f06628ef5a7d8b006 (diff)
downloadframeworks_base-e75ab4c26a4f661334845f7bc4132011694836a4.zip
frameworks_base-e75ab4c26a4f661334845f7bc4132011694836a4.tar.gz
frameworks_base-e75ab4c26a4f661334845f7bc4132011694836a4.tar.bz2
Remove SkBitmap from ResourceCache
Bug: 18928352 Fully-proper refcounting via SkBitmap/SkPixelRef, no more side-channel refcounting via ResourceCache. Makes HWUI more resilient to the bitmap being modified as well as the SkBitmap's info & rowBytes() is updated every time a DisplayList is recorded instead of relying on buggy cache eviction logic Change-Id: I2e8292d62ab6c257a2cfa1542387bf2bf1ade816
Diffstat (limited to 'libs/hwui/ResourceCache.h')
-rw-r--r--libs/hwui/ResourceCache.h40
1 files changed, 0 insertions, 40 deletions
diff --git a/libs/hwui/ResourceCache.h b/libs/hwui/ResourceCache.h
index 6c483fa..4583c8d 100644
--- a/libs/hwui/ResourceCache.h
+++ b/libs/hwui/ResourceCache.h
@@ -51,37 +51,6 @@ public:
ResourceType resourceType;
};
-class BitmapKey {
-public:
- BitmapKey(const SkBitmap& bitmap)
- : mRefCount(1)
- , mBitmapDimensions(bitmap.dimensions())
- , mPixelRefOrigin(bitmap.pixelRefOrigin())
- , mPixelRefStableID(bitmap.pixelRef()->getStableID()) { }
-
- void operator=(const BitmapKey& other);
- bool operator==(const BitmapKey& other) const;
- bool operator<(const BitmapKey& other) const;
-
-private:
- // This constructor is only used by the KeyedVector implementation
- BitmapKey()
- : mRefCount(-1)
- , mBitmapDimensions(SkISize::Make(0,0))
- , mPixelRefOrigin(SkIPoint::Make(0,0))
- , mPixelRefStableID(0) { }
-
- // reference count of all HWUI object using this bitmap
- mutable int mRefCount;
-
- SkISize mBitmapDimensions;
- SkIPoint mPixelRefOrigin;
- uint32_t mPixelRefStableID;
-
- friend class ResourceCache;
- friend struct android::key_value_pair_t<BitmapKey, SkBitmap*>;
-};
-
class ANDROID_API ResourceCache: public Singleton<ResourceCache> {
ResourceCache();
~ResourceCache();
@@ -97,18 +66,10 @@ public:
void lock();
void unlock();
- /**
- * The cache stores a copy of the provided resource or refs an existing resource
- * if the bitmap has previously been inserted and returns the cached copy.
- */
- const SkBitmap* insert(const SkBitmap& resource);
-
void incrementRefcount(const Res_png_9patch* resource);
- void decrementRefcount(const SkBitmap* resource);
void decrementRefcount(const Res_png_9patch* resource);
- void decrementRefcountLocked(const SkBitmap* resource);
void decrementRefcountLocked(const Res_png_9patch* resource);
void destructor(Res_png_9patch* resource);
@@ -134,7 +95,6 @@ private:
mutable Mutex mLock;
KeyedVector<const void*, ResourceReference*>* mCache;
- KeyedVector<BitmapKey, SkBitmap*> mBitmapCache;
};
}; // namespace uirenderer