Index: mojo/edk/system/channel.h |
diff --git a/mojo/edk/system/channel.h b/mojo/edk/system/channel.h |
index ab93431a4439dff624a842242010a593e792d812..f65f41e7b932f11748f0a590e84dacd1cba45e4c 100644 |
--- a/mojo/edk/system/channel.h |
+++ b/mojo/edk/system/channel.h |
@@ -91,6 +91,14 @@ class Channel : public base::RefCountedThreadSafe<Channel> { |
}; |
static_assert(sizeof(MachPortsExtraHeader) == 2, |
"sizeof(MachPortsExtraHeader) must be 2 bytes"); |
+#elif defined(OS_WIN) |
+ struct HandleEntry { |
+ // The windows HANDLE. HANDLEs are guaranteed to fit inside 32-bits. |
+ // See: https://msdn.microsoft.com/en-us/library/aa384203(VS.85).aspx |
+ uint32_t handle; |
+ }; |
+ static_assert(sizeof(HandleEntry) == 4, |
+ "sizeof(HandleEntry) must be 4 bytes"); |
#endif |
#pragma pack(pop) |
@@ -128,7 +136,6 @@ class Channel : public base::RefCountedThreadSafe<Channel> { |
size_t num_handles() const { return header_->num_handles; } |
bool has_handles() const { return header_->num_handles > 0; } |
- PlatformHandle* handles(); |
#if defined(OS_MACOSX) && !defined(OS_IOS) |
bool has_mach_ports() const; |
#endif |
@@ -151,8 +158,7 @@ class Channel : public base::RefCountedThreadSafe<Channel> { |
// duplication. |
static bool RewriteHandles(base::ProcessHandle from_process, |
base::ProcessHandle to_process, |
- PlatformHandle* handles, |
- size_t num_handles); |
+ PlatformHandleVector* handles); |
#endif |
private: |
@@ -161,14 +167,12 @@ class Channel : public base::RefCountedThreadSafe<Channel> { |
char* data_; |
Header* header_; |
-#if defined(OS_WIN) |
- // On Windows, handles are serialised into the extra header section. |
- PlatformHandle* handles_ = nullptr; |
-#else |
ScopedPlatformHandleVectorPtr handle_vector_; |
-#endif |
-#if defined(OS_MACOSX) && !defined(OS_IOS) |
+#if defined(OS_WIN) |
+ // On Windows, handles are serialised into the extra header section. |
+ HandleEntry* handles_ = nullptr; |
+#elif defined(OS_MACOSX) && !defined(OS_IOS) |
// On OSX, handles are serialised into the extra header section. |
MachPortsExtraHeader* mach_ports_header_ = nullptr; |
#endif |