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

Unified Diff: src/images/SkImageDecoder_libwebp.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/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkJpegUtility.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libwebp.cpp
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index c56933dd2a6c015b366908f0240fae31dc0677bd..5ac647a588322f8fd7d4fd64cf0d2780f1c91556 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -95,14 +95,10 @@ static bool webp_parse_header(SkStream* stream, int* width, int* height, int* al
class SkWEBPImageDecoder: public SkImageDecoder {
public:
SkWEBPImageDecoder() {
- fInputStream = NULL;
fOrigWidth = 0;
fOrigHeight = 0;
fHasAlpha = 0;
}
- virtual ~SkWEBPImageDecoder() {
- SkSafeUnref(fInputStream);
- }
Format getFormat() const SK_OVERRIDE {
return kWEBP_Format;
@@ -125,7 +121,7 @@ private:
bool setDecodeConfig(SkBitmap* decodedBitmap, int width, int height);
- SkStream* fInputStream;
+ SkAutoTDelete<SkStream> fInputStream;
int fOrigWidth;
int fOrigHeight;
int fHasAlpha;
@@ -316,6 +312,7 @@ bool SkWEBPImageDecoder::setDecodeConfig(SkBitmap* decodedBitmap, int width, int
bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream,
int *width, int *height) {
+ SkAutoTDelete<SkStreamRewindable> streamDeleter(stream);
int origWidth, origHeight, hasAlpha;
if (!webp_parse_header(stream, &origWidth, &origHeight, &hasAlpha)) {
return false;
@@ -329,7 +326,7 @@ bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream,
*width = origWidth;
*height = origHeight;
- SkRefCnt_SafeAssign(this->fInputStream, stream);
+ this->fInputStream.reset(streamDeleter.detach());
this->fOrigWidth = origWidth;
this->fOrigHeight = origHeight;
this->fHasAlpha = hasAlpha;
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkJpegUtility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698