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

Unified Diff: src/ports/SkFontHost_linux.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/SkFontHost_fontconfig.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_linux.cpp
diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp
index ec8e33870ca9e94dd99582320821f596a6da999e..b6fab622e8fcc776195f6e8719d66cde18aacd60 100644
--- a/src/ports/SkFontHost_linux.cpp
+++ b/src/ports/SkFontHost_linux.cpp
@@ -139,7 +139,7 @@ protected:
private:
SkString fPath;
- const SkAutoTUnref<SkStreamAsset> fStream;
+ const SkAutoTDelete<SkStreamAsset> fStream;
typedef SkTypeface_Custom INHERITED;
};
@@ -283,13 +283,12 @@ protected:
}
SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OVERRIDE {
- SkAutoTUnref<SkStream> stream(new SkMemoryStream(data));
- return this->createFromStream(stream, ttcIndex);
+ return this->createFromStream(new SkMemoryStream(data), ttcIndex);
}
SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE {
+ SkAutoTDelete<SkStream> streamDeleter(stream);
if (NULL == stream || stream->getLength() <= 0) {
- SkDELETE(stream);
return NULL;
}
@@ -298,15 +297,15 @@ protected:
SkString name;
if (fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch)) {
return SkNEW_ARGS(SkTypeface_Stream, (style, isFixedPitch, false, name,
- stream, ttcIndex));
+ streamDeleter.detach(), ttcIndex));
} else {
return NULL;
}
}
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERRIDE {
- SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
- return stream.get() ? this->createFromStream(stream, ttcIndex) : NULL;
+ SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path));
+ return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : NULL;
}
virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
@@ -341,7 +340,7 @@ private:
while (iter.next(&name, false)) {
SkString filename(SkOSPath::Join(directory.c_str(), name.c_str()));
- SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(filename.c_str()));
+ SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(filename.c_str()));
if (!stream.get()) {
SkDebugf("---- failed to open <%s>\n", filename.c_str());
continue;
« no previous file with comments | « src/ports/SkFontHost_fontconfig.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698