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

Unified Diff: base/sync_socket.h

Issue 525313002: SyncSocket Transit Descriptor - refactoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits done - Prelanding checks Created 6 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 | « no previous file | base/sync_socket_nacl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sync_socket.h
diff --git a/base/sync_socket.h b/base/sync_socket.h
index 71addd1e163a9ab16d201a961ba3ae5b3ed6972f..992359166e51929ba8ec5a113becc38259d560d4 100644
--- a/base/sync_socket.h
+++ b/base/sync_socket.h
@@ -17,17 +17,24 @@
#include "base/base_export.h"
#include "base/compiler_specific.h"
+#include "base/process/process_handle.h"
#include "base/synchronization/waitable_event.h"
#include "base/time/time.h"
+#if defined(OS_POSIX)
+#include "base/file_descriptor_posix.h"
+#endif
+
namespace base {
class BASE_EXPORT SyncSocket {
public:
#if defined(OS_WIN)
typedef HANDLE Handle;
+ typedef Handle TransitDescriptor;
#else
typedef int Handle;
+ typedef FileDescriptor TransitDescriptor;
#endif
static const Handle kInvalidHandle;
@@ -42,6 +49,15 @@ class BASE_EXPORT SyncSocket {
// return, the sockets will both be valid and connected.
static bool CreatePair(SyncSocket* socket_a, SyncSocket* socket_b);
+ // Returns |Handle| wrapped in a |TransitDescriptor|.
+ static Handle UnwrapHandle(const TransitDescriptor& descriptor);
+
+ // Prepares a |TransitDescriptor| which wraps |Handle| used for transit.
+ // This is used to prepare the underlying shared resource before passing back
+ // the handle to be used by the peer process.
+ bool PrepareTransitDescriptor(ProcessHandle peer_process_handle,
+ TransitDescriptor* descriptor);
+
// Closes the SyncSocket. Returns true on success, false on failure.
virtual bool Close();
« no previous file with comments | « no previous file | base/sync_socket_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698