From ee248599d49a15fc207c5aeb0b90ec263cc1d600 Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Thu, 12 Feb 2015 14:10:21 -0500 Subject: Refactor DisplayList path caching. This removes dependence on SkPath ptrs that HWUI does not control the lifecycle of. This clears up some errors where the paths are not generated from Java, but rather the Skia test suites. Cherry-pick of a change that originally landed in master-skia and is dependent on a skia merge (ag/655422). Change-Id: I41b9797a2b0af5d6b4ea51891565469d4f1d832d --- libs/hwui/ResourceCache.cpp | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'libs/hwui/ResourceCache.cpp') diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp index 2d1adc51679a..d3b8d706e606 100644 --- a/libs/hwui/ResourceCache.cpp +++ b/libs/hwui/ResourceCache.cpp @@ -79,10 +79,6 @@ void ResourceCache::incrementRefcount(void* resource, ResourceType resourceType) incrementRefcountLocked(resource, resourceType); } -void ResourceCache::incrementRefcount(const SkPath* pathResource) { - incrementRefcount((void*) pathResource, kPath); -} - void ResourceCache::incrementRefcount(const Res_png_9patch* patchResource) { incrementRefcount((void*) patchResource, kNinePatch); } @@ -107,10 +103,6 @@ void ResourceCache::decrementRefcount(const SkBitmap* bitmapResource) { decrementRefcountLocked(bitmapResource); } -void ResourceCache::decrementRefcount(const SkPath* pathResource) { - decrementRefcount((void*) pathResource); -} - void ResourceCache::decrementRefcount(const Res_png_9patch* patchResource) { decrementRefcount((void*) patchResource); } @@ -145,37 +137,10 @@ void ResourceCache::decrementRefcountLocked(const SkBitmap* bitmapResource) { } } -void ResourceCache::decrementRefcountLocked(const SkPath* pathResource) { - decrementRefcountLocked((void*) pathResource); -} - void ResourceCache::decrementRefcountLocked(const Res_png_9patch* patchResource) { decrementRefcountLocked((void*) patchResource); } -void ResourceCache::destructor(SkPath* resource) { - Mutex::Autolock _l(mLock); - destructorLocked(resource); -} - -void ResourceCache::destructorLocked(SkPath* resource) { - ssize_t index = mCache->indexOfKey(resource); - ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : nullptr; - if (ref == nullptr) { - // If we're not tracking this resource, just delete it - if (Caches::hasInstance()) { - Caches::getInstance().pathCache.removeDeferred(resource); - } else { - delete resource; - } - return; - } - ref->destroyed = true; - if (ref->refCount == 0) { - deleteResourceReferenceLocked(resource, ref); - } -} - void ResourceCache::destructor(Res_png_9patch* resource) { Mutex::Autolock _l(mLock); destructorLocked(resource); @@ -208,15 +173,6 @@ void ResourceCache::destructorLocked(Res_png_9patch* resource) { void ResourceCache::deleteResourceReferenceLocked(const void* resource, ResourceReference* ref) { if (ref->destroyed) { switch (ref->resourceType) { - case kPath: { - SkPath* path = (SkPath*) resource; - if (Caches::hasInstance()) { - Caches::getInstance().pathCache.removeDeferred(path); - } else { - delete path; - } - } - break; case kNinePatch: { if (Caches::hasInstance()) { Caches::getInstance().patchCache.removeDeferred((Res_png_9patch*) resource); -- cgit v1.2.3-59-g8ed1b