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

Unified Diff: src/ports/SkFontMgr_android.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_win.cpp ('k') | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_android.cpp
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 794790be5909cd729a50841c785e88b94d81795d..ce931941cd1d91949b8cca018c9294e141345e94 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -104,7 +104,7 @@ public:
bool isFixedPitch,
const SkString& familyName)
: INHERITED(index, style, isFixedPitch, familyName)
- , fStream(SkRef(stream)) { }
+ , fStream(stream) { }
virtual void onGetFontDescriptor(SkFontDescriptor* desc,
bool* serialize) const SK_OVERRIDE {
@@ -121,7 +121,7 @@ public:
}
private:
- SkAutoTUnref<SkStream> fStream;
+ SkAutoTDelete<SkStream> fStream;
typedef SkTypeface_Android INHERITED;
};
@@ -152,7 +152,7 @@ public:
SkString pathName;
get_path_for_sys_fonts(basePath, fontFile.fFileName, &pathName);
- SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(pathName.c_str()));
+ SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(pathName.c_str()));
if (!stream.get()) {
DEBUG_FONT(("---- SystemFonts[%d] file=%s (NOT EXIST)", i, pathName.c_str()));
continue;
@@ -409,23 +409,23 @@ 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* 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;
}
SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE {
+ SkAutoTDelete<SkStream> streamDeleter(stream);
bool isFixedPitch;
SkFontStyle style;
SkString name;
if (!fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch)) {
return NULL;
}
- return SkNEW_ARGS(SkTypeface_AndroidStream, (stream, ttcIndex,
+ return SkNEW_ARGS(SkTypeface_AndroidStream, (streamDeleter.detach(), ttcIndex,
style, isFixedPitch, name));
}
« no previous file with comments | « src/ports/SkFontHost_win.cpp ('k') | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698