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

Unified Diff: mojo/edk/platform/platform_handle.h

Issue 1505983002: EDK: Remove platform_handle_utils*. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « mojo/edk/embedder/simple_platform_shared_buffer.cc ('k') | mojo/edk/platform/platform_handle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/platform/platform_handle.h
diff --git a/mojo/edk/platform/platform_handle.h b/mojo/edk/platform/platform_handle.h
index e959a8da5a67749d5edf0724ac8b177545bcddd4..0b32a07743cf784bbed1f6d47b4351766133f0ca 100644
--- a/mojo/edk/platform/platform_handle.h
+++ b/mojo/edk/platform/platform_handle.h
@@ -8,16 +8,26 @@
namespace mojo {
namespace platform {
-// A |PlatformHandle| is just a file descriptor on POSIX.
+class ScopedPlatformHandle;
+
+// A thin wrapper for an OS handle (just a file descriptor on POSIX) on any
+// given platform.
struct PlatformHandle {
PlatformHandle() : fd(-1) {}
explicit PlatformHandle(int fd) : fd(fd) {}
+ // Closes this handle if it's valid (and sets it to be invalid).
void CloseIfNecessary();
bool is_valid() const { return fd != -1; }
+ // Creates a duplicate of this handle. On failure, or if this is an invalid
+ // handle, this returns an invalid handle.
+ ScopedPlatformHandle Duplicate() const;
+
int fd;
+
+ // Copy and assignment allowed.
};
} // namespace platform
« no previous file with comments | « mojo/edk/embedder/simple_platform_shared_buffer.cc ('k') | mojo/edk/platform/platform_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698