summaryrefslogtreecommitdiffstats
path: root/libs/hwui/ResourceCache.h
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-09-14 15:31:25 -0700
committerChet Haase <chet@google.com>2012-09-17 11:21:34 -0700
commit603f6de35f21d74ae242d52d501f4f5c25ff4f4c (patch)
treeb249a7750a60b445a43670b7ba540beecbe715db /libs/hwui/ResourceCache.h
parentcc5dd18d15a174799ad79d26633c268e8860c8ab (diff)
downloadframeworks_base-603f6de35f21d74ae242d52d501f4f5c25ff4f4c.zip
frameworks_base-603f6de35f21d74ae242d52d501f4f5c25ff4f4c.tar.gz
frameworks_base-603f6de35f21d74ae242d52d501f4f5c25ff4f4c.tar.bz2
Fix occasional crash bug with layers
Launcher occasionally crashes with a stack trace indicating that the memory of a Layer object is corrupt. It is possible for us to delete a Layer structure and then, briefly, use it to draw a DisplayList again before that DisplayList gets recreated (without the layer that got deleted). When this happens, if the memory got corrupted, it's possible to crash. The fix is to add Layer to the other objects which we currently refcount (bitmaps, shaders, etc.). Then instead of deleting a Layer, we decrement the refcount. We increment when creating it, then increment it again when it's referenced from a DisplayList. Then we decrement the refcount instead of deleting it, and decrement when we clear a DisplayList that refers to it. Then when the refcount reaches 0, we delete it. Issue #6994632 Native crash in launcher when trying to launch all apps screen Change-Id: I0627be8d49bb2f9ba8d158a84b764bb4e7df934c
Diffstat (limited to 'libs/hwui/ResourceCache.h')
-rw-r--r--libs/hwui/ResourceCache.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/ResourceCache.h b/libs/hwui/ResourceCache.h
index 60ffa7d..2053d96 100644
--- a/libs/hwui/ResourceCache.h
+++ b/libs/hwui/ResourceCache.h
@@ -23,6 +23,7 @@
#include <SkiaColorFilter.h>
#include <SkiaShader.h>
#include <utils/KeyedVector.h>
+#include "Layer.h"
namespace android {
namespace uirenderer {
@@ -35,6 +36,7 @@ enum ResourceType {
kShader,
kColorFilter,
kPath,
+ kLayer
};
class ResourceReference {
@@ -67,21 +69,25 @@ public:
void incrementRefcount(SkBitmap* resource);
void incrementRefcount(SkiaShader* resource);
void incrementRefcount(SkiaColorFilter* resource);
+ void incrementRefcount(Layer* resource);
void incrementRefcountLocked(SkPath* resource);
void incrementRefcountLocked(SkBitmap* resource);
void incrementRefcountLocked(SkiaShader* resource);
void incrementRefcountLocked(SkiaColorFilter* resource);
+ void incrementRefcountLocked(Layer* resource);
void decrementRefcount(SkBitmap* resource);
void decrementRefcount(SkPath* resource);
void decrementRefcount(SkiaShader* resource);
void decrementRefcount(SkiaColorFilter* resource);
+ void decrementRefcount(Layer* resource);
void decrementRefcountLocked(SkBitmap* resource);
void decrementRefcountLocked(SkPath* resource);
void decrementRefcountLocked(SkiaShader* resource);
void decrementRefcountLocked(SkiaColorFilter* resource);
+ void decrementRefcountLocked(Layer* resource);
void destructor(SkPath* resource);
void destructor(SkBitmap* resource);