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

Unified Diff: src/core/SkValidatingReadBuffer.cpp

Issue 1855733002: change flattenable factory to return sk_sp (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 | « src/core/SkShader.cpp ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkValidatingReadBuffer.cpp
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index bc5611a3e382902878ca99256f6d26ff0e80c3c2..ad4b6c409e6a0adca7c85b87c69a59089ac76779 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -243,7 +243,7 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
// if we get here, factory may still be null, but if that is the case, the
// failure was ours, not the writer.
- SkFlattenable* obj = nullptr;
+ sk_sp<SkFlattenable> obj;
uint32_t sizeRecorded = this->readUInt();
if (factory) {
size_t offset = fReader.offset();
@@ -252,8 +252,6 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
size_t sizeRead = fReader.offset() - offset;
this->validate(sizeRecorded == sizeRead);
if (fError) {
- // we could try to fix up the offset...
- SkSafeUnref(obj);
obj = nullptr;
}
} else {
@@ -261,7 +259,7 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
this->skip(sizeRecorded);
SkASSERT(false);
}
- return obj;
+ return obj.release();
}
void SkValidatingReadBuffer::skipFlattenable() {
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698