From 701b40543d5d124dfa1e59b051cba9d2aaf61670 Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Mon, 18 Nov 2013 16:26:25 +0000 Subject: Fix DocumentTest/SkDocument memory leaks https://codereview.chromium.org/72833002/ git-svn-id: http://skia.googlecode.com/svn/trunk@12302 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkDocument.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include/core') diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h index 66946fe7c5..83b4e7a3ee 100644 --- a/include/core/SkDocument.h +++ b/include/core/SkDocument.h @@ -64,6 +64,9 @@ public: * The proc can delete the stream, or whatever it needs to do. * encoder sets the DCTEncoder for images, to encode a bitmap * as JPEG (DCT). + * Done - clean up method intended to allow deletion of the stream. + * Its aborted parameter is true if the cleanup is due to an abort + * call. It is false otherwise. * rasterDpi - the DPI at which features without native PDF support * will be rasterized (e.g. draw image with perspective, * draw text with perspective, ...) @@ -73,7 +76,7 @@ public: * and it would be slower to be processed or sent online or * to printer. */ static SkDocument* CreatePDF( - SkWStream*, void (*Done)(SkWStream*) = NULL, + SkWStream*, void (*Done)(SkWStream*,bool aborted) = NULL, SkPicture::EncodeBitmap encoder = NULL, SkScalar rasterDpi = SK_ScalarDefaultRasterDPI); @@ -108,7 +111,7 @@ public: void abort(); protected: - SkDocument(SkWStream*, void (*)(SkWStream*)); + SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted)); // note: subclasses must call close() in their destructor, as the base class // cannot do this for them. virtual ~SkDocument(); @@ -128,7 +131,7 @@ protected: private: SkWStream* fStream; - void (*fDoneProc)(SkWStream*); + void (*fDoneProc)(SkWStream*, bool aborted); State fState; typedef SkRefCnt INHERITED; -- cgit v1.2.3