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

Unified Diff: src/images/SkDecodingImageGenerator.cpp

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase, just in case. Created 5 years, 11 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 | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/images/SkImageDecoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkDecodingImageGenerator.cpp
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index baa112c303d4cfa6b6303a9b8ea08259dc1b7038..e7a775e264b8e9181f5ddaad6e4f57299f10afbe 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -24,11 +24,11 @@ class DecodingImageGenerator : public SkImageGenerator {
public:
virtual ~DecodingImageGenerator();
- SkData* fData;
- SkStreamRewindable* fStream;
- const SkImageInfo fInfo;
- const int fSampleSize;
- const bool fDitherImage;
+ SkData* fData;
+ SkAutoTDelete<SkStreamRewindable> fStream;
+ const SkImageInfo fInfo;
+ const int fSampleSize;
+ const bool fDitherImage;
DecodingImageGenerator(SkData* data,
SkStreamRewindable* stream,
@@ -128,7 +128,6 @@ DecodingImageGenerator::DecodingImageGenerator(
DecodingImageGenerator::~DecodingImageGenerator() {
SkSafeUnref(fData);
- fStream->unref();
}
SkData* DecodingImageGenerator::onRefEncodedData() {
@@ -227,7 +226,7 @@ SkImageGenerator* CreateDecodingImageGenerator(
SkStreamRewindable* stream,
const SkDecodingImageGenerator::Options& opts) {
SkASSERT(stream);
- SkAutoTUnref<SkStreamRewindable> autoStream(stream); // always unref this.
+ SkAutoTDelete<SkStreamRewindable> autoStream(stream); // always delete this
SkAssertResult(autoStream->rewind());
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(autoStream));
if (NULL == decoder.get()) {
@@ -280,7 +279,6 @@ SkImageGenerator* SkDecodingImageGenerator::Create(
}
SkStreamRewindable* stream = SkNEW_ARGS(SkMemoryStream, (data));
SkASSERT(stream != NULL);
- SkASSERT(stream->unique());
return CreateDecodingImageGenerator(data, stream, opts);
}
@@ -288,9 +286,7 @@ SkImageGenerator* SkDecodingImageGenerator::Create(
SkStreamRewindable* stream,
const SkDecodingImageGenerator::Options& opts) {
SkASSERT(stream != NULL);
- SkASSERT(stream->unique());
- if ((stream == NULL) || !stream->unique()) {
- SkSafeUnref(stream);
+ if (stream == NULL) {
return NULL;
}
return CreateDecodingImageGenerator(NULL, stream, opts);
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/images/SkImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698