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

Unified Diff: mojo/edk/embedder/simple_platform_shared_buffer_posix.cc

Issue 1346643003: Convert base::ScopedFD to (mojo::embedder::)ScopedPlatformHandle. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 | « mojo/edk/embedder/simple_platform_shared_buffer_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc b/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
index 4bae02e26d9566532a8b5257f921ab02c327c50f..5e09e7d5f06ca5dfbceddca2abb41e524513d270 100644
--- a/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
@@ -20,7 +20,6 @@
#include "base/posix/eintr_wrapper.h"
#include "base/sys_info.h"
#include "base/threading/thread_restrictions.h"
-#include "mojo/edk/embedder/platform_handle.h"
// We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a
// |uint64_t|.
@@ -71,18 +70,19 @@ bool SimplePlatformSharedBuffer::Init() {
}
// Note: |dup()| is not interruptible (but |dup2()|/|dup3()| are).
- base::ScopedFD fd(dup(fileno(fp.get())));
- if (!fd.is_valid()) {
+ ScopedPlatformHandle handle(PlatformHandle(dup(fileno(fp.get()))));
+ if (!handle.is_valid()) {
PLOG(ERROR) << "dup";
return false;
}
- if (HANDLE_EINTR(ftruncate(fd.get(), static_cast<off_t>(num_bytes_))) != 0) {
+ if (HANDLE_EINTR(
+ ftruncate(handle.get().fd, static_cast<off_t>(num_bytes_))) != 0) {
PLOG(ERROR) << "ftruncate";
return false;
}
- handle_.reset(PlatformHandle(fd.release()));
+ handle_ = handle.Pass();
return true;
}
« no previous file with comments | « mojo/edk/embedder/simple_platform_shared_buffer_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698