aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkStream.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-11 13:02:28 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-11 13:02:28 -0800
commitfde05114e6c4107b36e1aa571c64d31def40f613 (patch)
treebb3997b32141ea4984255e833d03cb1caed76904 /include/core/SkStream.h
parent51c8cfc64c7286ad8a392064cd376bb9974c7bc1 (diff)
Make sp variants for SkData
Diffstat (limited to 'include/core/SkStream.h')
-rw-r--r--include/core/SkStream.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 4502416fd9..e311a4ac49 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -8,11 +8,10 @@
#ifndef SkStream_DEFINED
#define SkStream_DEFINED
+#include "SkData.h"
#include "SkRefCnt.h"
#include "SkScalar.h"
-class SkData;
-
class SkStream;
class SkStreamRewindable;
class SkStreamSeekable;
@@ -270,11 +269,11 @@ public:
const void* getMemoryBase() override;
private:
- FILE* fFILE;
+ FILE* fFILE;
SkString fName;
Ownership fOwnership;
// fData is lazilly initialized when needed.
- mutable SkAutoTUnref<SkData> fData;
+ mutable sk_sp<SkData> fData;
typedef SkStreamAsset INHERITED;
};
@@ -291,10 +290,12 @@ public:
/** Use the specified data as the memory for this stream.
* The stream will call ref() on the data (assuming it is not NULL).
+ * DEPRECATED
*/
SkMemoryStream(SkData*);
- virtual ~SkMemoryStream();
+ /** Creates the stream to read from the specified data */
+ SkMemoryStream(sk_sp<SkData>);
/** Resets the stream to the specified data and length,
just like the constructor.
@@ -341,8 +342,8 @@ public:
const void* getMemoryBase() override;
private:
- SkData* fData;
- size_t fOffset;
+ sk_sp<SkData> fData;
+ size_t fOffset;
typedef SkStreamMemory INHERITED;
};
@@ -417,7 +418,7 @@ private:
Block* fHead;
Block* fTail;
size_t fBytesWritten;
- mutable SkData* fCopy; // is invalidated if we write after it is created
+ mutable sk_sp<SkData> fCopy; // is invalidated if we write after it is created
void invalidateCopy();