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

Unified Diff: components/font_service/font_service_app.cc

Issue 2539383002: Replace base::File wrapping with typemapping. (Closed)
Patch Set: Created 4 years 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
Index: components/font_service/font_service_app.cc
diff --git a/components/font_service/font_service_app.cc b/components/font_service/font_service_app.cc
index f78b4c23b93129ba0802f73cae973895dc0e3619..78f6d4a336bb295d2f6ffdf6bf90f2a7f1a360bb 100644
--- a/components/font_service/font_service_app.cc
+++ b/components/font_service/font_service_app.cc
@@ -28,18 +28,13 @@ static_assert(
namespace {
-mojo::ScopedHandle GetHandleForPath(const base::FilePath& path) {
+base::File GetFileForPath(const base::FilePath& path) {
if (path.empty())
- return mojo::ScopedHandle();
+ return base::File();
- mojo::ScopedHandle to_pass;
base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
- if (!file.IsValid()) {
- LOG(WARNING) << "file not valid, path=" << path.value();
- return mojo::ScopedHandle();
- }
-
- return mojo::WrapPlatformFile(file.TakePlatformFile());
+ LOG_IF(WARNING, !file.IsValid()) << "file not valid, path=" << path.value();
+ return file;
}
} // namespace
@@ -109,12 +104,12 @@ void FontServiceApp::MatchFamilyName(const std::string& family_name,
void FontServiceApp::OpenStream(uint32_t id_number,
const OpenStreamCallback& callback) {
- mojo::ScopedHandle handle;
+ base::File file;
if (id_number < static_cast<uint32_t>(paths_.size())) {
- handle = GetHandleForPath(base::FilePath(paths_[id_number].c_str()));
+ file = GetFileForPath(base::FilePath(paths_[id_number].c_str()));
}
- callback.Run(std::move(handle));
+ callback.Run(std::move(file));
}
int FontServiceApp::FindOrAddPath(const SkString& path) {

Powered by Google App Engine
This is Rietveld 408576698