From e75ab4c26a4f661334845f7bc4132011694836a4 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 7 May 2015 13:14:15 -0700 Subject: 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 --- libs/hwui/ResourceCache.h | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'libs/hwui/ResourceCache.h') 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; -}; - class ANDROID_API ResourceCache: public Singleton { 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* mCache; - KeyedVector mBitmapCache; }; }; // namespace uirenderer -- cgit v1.1