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

Unified Diff: components/filesystem/file_impl.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/filesystem/file_impl.cc
diff --git a/components/filesystem/file_impl.cc b/components/filesystem/file_impl.cc
index 25a76f3d26bb96dc75dbc5e64276695437f9d946..d15c92c28d67cd6427407234379a1794d218dd79 100644
--- a/components/filesystem/file_impl.cc
+++ b/components/filesystem/file_impl.cc
@@ -18,13 +18,11 @@
#include "components/filesystem/util.h"
#include "mojo/common/common_type_converters.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/public/cpp/system/platform_handle.h"
static_assert(sizeof(off_t) <= sizeof(int64_t), "off_t too big");
static_assert(sizeof(size_t) >= sizeof(uint32_t), "size_t too small");
using base::Time;
-using mojo::ScopedHandle;
namespace filesystem {
namespace {
@@ -327,19 +325,19 @@ void FileImpl::Unlock(const UnlockCallback& callback) {
void FileImpl::AsHandle(const AsHandleCallback& callback) {
if (!file_.IsValid()) {
- callback.Run(GetError(file_), ScopedHandle());
+ callback.Run(GetError(file_), base::File());
return;
}
base::File new_file = file_.Duplicate();
if (!new_file.IsValid()) {
- callback.Run(GetError(new_file), ScopedHandle());
+ callback.Run(GetError(new_file), base::File());
return;
}
base::File::Info info;
if (!new_file.GetInfo(&info)) {
- callback.Run(mojom::FileError::FAILED, ScopedHandle());
+ callback.Run(mojom::FileError::FAILED, base::File());
return;
}
@@ -348,12 +346,11 @@ void FileImpl::AsHandle(const AsHandleCallback& callback) {
// passing a file descriptor to a directory is a sandbox escape on Windows,
// we should be absolutely paranoid.
if (info.is_directory) {
- callback.Run(mojom::FileError::NOT_A_FILE, ScopedHandle());
+ callback.Run(mojom::FileError::NOT_A_FILE, base::File());
return;
}
- callback.Run(mojom::FileError::OK,
- mojo::WrapPlatformFile(new_file.TakePlatformFile()));
+ callback.Run(mojom::FileError::OK, std::move(new_file));
}
} // namespace filesystem

Powered by Google App Engine
This is Rietveld 408576698