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

Unified Diff: src/core/SkStream.cpp

Issue 2343933002: Revert of SkFontData to use smart pointers. (Closed)
Patch Set: 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/SkFontMgr.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkStream.cpp
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index e7b3a7a7e5777ff40de437a8628a441921b1b259..48eb92cae5c5631c1e4546f95e471040fa2297e9 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -10,7 +10,6 @@
#include "SkStreamPriv.h"
#include "SkData.h"
#include "SkFixed.h"
-#include "SkMakeUnique.h"
#include "SkString.h"
#include "SkOSFile.h"
#include "SkTypes.h"
@@ -855,18 +854,20 @@
return data;
}
-std::unique_ptr<SkStreamAsset> SkStream::MakeFromFile(const char path[]) {
+SkStreamAsset* SkStream::NewFromFile(const char path[]) {
auto data(mmap_filename(path));
if (data) {
- return skstd::make_unique<SkMemoryStream>(std::move(data));
- }
-
- // If we get here, then our attempt at using mmap failed, so try normal file access.
- auto stream = skstd::make_unique<SkFILEStream>(path);
+ return new SkMemoryStream(std::move(data));
+ }
+
+ // If we get here, then our attempt at using mmap failed, so try normal
+ // file access.
+ SkFILEStream* stream = new SkFILEStream(path);
if (!stream->isValid()) {
- return nullptr;
- }
- return std::move(stream);
+ delete stream;
+ stream = nullptr;
+ }
+ return stream;
}
// Declared in SkStreamPriv.h:
« no previous file with comments | « src/core/SkFontMgr.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698