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

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: fix dynamicmemorywstream 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
Index: include/core/SkStream.h
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 4502416fd964e5c24134d6a721df393ee08c3efe..da1786d62836a99c9ffd7f77f05f50d6361a6097 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -8,11 +8,9 @@
#ifndef SkStream_DEFINED
#define SkStream_DEFINED
-#include "SkRefCnt.h"
bungeman-skia 2016/03/11 14:53:13 Please don't remove this. You are directly using s
+#include "SkData.h"
bungeman-skia 2016/03/11 14:53:13 Was there a compiler that required this? It should
reed1 2016/03/11 19:23:34 Needed for destructor
#include "SkScalar.h"
-class SkData;
-
class SkStream;
class SkStreamRewindable;
class SkStreamSeekable;
@@ -270,11 +268,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;
};
@@ -293,8 +291,7 @@ public:
* The stream will call ref() on the data (assuming it is not NULL).
scroggo 2016/03/11 15:28:35 IIUC, this is not necessarily true for the sk_sp v
reed1 2016/03/11 19:23:34 Done.
*/
SkMemoryStream(SkData*);
-
- virtual ~SkMemoryStream();
+ SkMemoryStream(sk_sp<SkData>);
/** Resets the stream to the specified data and length,
just like the constructor.
@@ -341,8 +338,8 @@ public:
const void* getMemoryBase() override;
private:
- SkData* fData;
- size_t fOffset;
+ sk_sp<SkData> fData;
+ size_t fOffset;
typedef SkStreamMemory INHERITED;
};
@@ -417,7 +414,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();

Powered by Google App Engine
This is Rietveld 408576698