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

Unified Diff: src/ports/SkFontMgr_fontconfig.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/ports/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_win_dw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_fontconfig.cpp
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index b5e4eaed647fa8d36526dba65b73ec1c002bb8ca..28df5d479093ae92997726774ecec60ab570afc5 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -378,7 +378,7 @@ public:
/** @param stream does not take ownership of the reference, does take ownership of the stream.*/
SkTypeface_stream(const SkFontStyle& style, bool fixedWidth, int index, SkStreamAsset* stream)
: INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth)
- , fStream(SkRef(stream))
+ , fStream(stream)
, fIndex(index)
{ };
@@ -397,7 +397,7 @@ public:
}
private:
- SkAutoTUnref<SkStreamAsset> fStream;
+ SkAutoTDelete<SkStreamAsset> fStream;
int fIndex;
typedef SkTypeface_FreeType INHERITED;
@@ -809,8 +809,8 @@ protected:
return this->matchFamilyStyle(get_string(fcTypeface->fPattern, FC_FAMILY), style);
}
- /** @param stream does not take ownership of the reference. */
- SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE {
+ SkTypeface* onCreateFromStream(SkStream* inputStream, int ttcIndex) const SK_OVERRIDE {
+ SkAutoTDelete<SkStream> stream(inputStream);
const size_t length = stream->getLength();
if (length <= 0 || (1u << 30) < length) {
return NULL;
@@ -823,17 +823,15 @@ protected:
}
return SkNEW_ARGS(SkTypeface_stream, (style, isFixedWidth, ttcIndex,
- static_cast<SkStreamAsset*>(stream)));
+ static_cast<SkStreamAsset*>(stream.detach())));
}
SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OVERRIDE {
- SkAutoTUnref<SkStreamAsset> stream(SkNEW_ARGS(SkMemoryStream, (data)));
- return this->createFromStream(stream, ttcIndex);
+ return this->createFromStream(SkNEW_ARGS(SkMemoryStream, (data)), ttcIndex);
}
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERRIDE {
- SkAutoTUnref<SkStreamAsset> stream(SkStream::NewFromFile(path));
- return this->createFromStream(stream, ttcIndex);
+ return this->createFromStream(SkStream::NewFromFile(path), ttcIndex);
}
virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
« no previous file with comments | « src/ports/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698