Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: include/core/SkStream.h

Issue 1779263003: Make sp variants for SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkData.h ('k') | include/core/SkWriter32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkStream.h
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 4502416fd964e5c24134d6a721df393ee08c3efe..e311a4ac4991d8b511b8b43f2a39ff8079ac05ec 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();
« no previous file with comments | « include/core/SkData.h ('k') | include/core/SkWriter32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698