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

Unified Diff: src/core/SkFontMgr.cpp

Issue 2339273002: SkFontData to use smart pointers. (Closed)
Patch Set: Add trivial bodies to the trivial implementations. Created 4 years, 3 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/SkFontDescriptor.cpp ('k') | src/core/SkStream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFontMgr.cpp
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp
index 0f0066792636837af660e610ab96ede11b5d7bb2..57f82b03ba28201a21959f67ace59c7787191bc7 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -139,11 +139,11 @@ SkTypeface* SkFontMgr::createFromStream(SkStreamAsset* stream, const FontParamet
return this->onCreateFromStream(stream, params);
}
-SkTypeface* SkFontMgr::createFromFontData(SkFontData* data) const {
+SkTypeface* SkFontMgr::createFromFontData(std::unique_ptr<SkFontData> data) const {
if (nullptr == data) {
return nullptr;
}
- return this->onCreateFromFontData(data);
+ return this->onCreateFromFontData(std::move(data));
}
// This implementation is temporary until it can be made pure virtual.
@@ -152,10 +152,8 @@ SkTypeface* SkFontMgr::onCreateFromStream(SkStreamAsset* stream, const FontParam
}
// This implementation is temporary until it can be made pure virtual.
-SkTypeface* SkFontMgr::onCreateFromFontData(SkFontData* data) const {
- SkTypeface* ret = this->createFromStream(data->detachStream(), data->getIndex());
- delete data;
- return ret;
+SkTypeface* SkFontMgr::onCreateFromFontData(std::unique_ptr<SkFontData> data) const {
+ return this->createFromStream(data->detachStream().release(), data->getIndex());
}
SkTypeface* SkFontMgr::createFromFile(const char path[], int ttcIndex) const {
« no previous file with comments | « src/core/SkFontDescriptor.cpp ('k') | src/core/SkStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698