Fix leak of SkPathRefs
bug:15939479
SkPath objects owned by DisplayListOps weren't being torn down, and
thus weren't releasing their SkPathRef innards.
Change-Id: I2581e124600a93a399ef3251f456c02ab52839a8
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index 79a2f61..acfa98e 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -69,7 +69,9 @@
class PlaybackStateStruct {
protected:
PlaybackStateStruct(OpenGLRenderer& renderer, int replayFlags, LinearAllocator* allocator)
- : mRenderer(renderer), mReplayFlags(replayFlags), mAllocator(allocator){}
+ : mRenderer(renderer)
+ , mReplayFlags(replayFlags)
+ , mAllocator(allocator) {}
public:
OpenGLRenderer& mRenderer;
@@ -78,6 +80,15 @@
// Allocator with the lifetime of a single frame.
// replay uses an Allocator owned by the struct, while defer shares the DeferredDisplayList's Allocator
LinearAllocator * const mAllocator;
+
+ SkPath* allocPathForFrame() {
+ mTempPaths.push_back();
+ return &mTempPaths.back();
+ }
+
+private:
+ // Paths kept alive for the duration of the frame
+ std::vector<SkPath> mTempPaths;
};
class DeferStateStruct : public PlaybackStateStruct {