summaryrefslogtreecommitdiff
path: root/libs/hwui/ResourceCache.cpp
diff options
context:
space:
mode:
author Derek Sollenberger <djsollen@google.com> 2015-02-12 14:10:21 -0500
committer Derek Sollenberger <djsollen@google.com> 2015-03-13 08:05:55 -0400
commitee248599d49a15fc207c5aeb0b90ec263cc1d600 (patch)
treeabb62a362ef1962a3097a586b638c1d7efc93a31 /libs/hwui/ResourceCache.cpp
parent247dc6e125783b31f5c9a2cbccb34bd2ac575e6d (diff)
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
Diffstat (limited to 'libs/hwui/ResourceCache.cpp')
-rw-r--r--libs/hwui/ResourceCache.cpp44
1 files changed, 0 insertions, 44 deletions
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);