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

Unified Diff: mojo/edk/system/channel.h

Issue 2008953003: [mojo-edk] Explicitly serialise HANDLEs into messages instead of PlatformHandles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cast2 Created 4 years, 7 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 | mojo/edk/system/channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | mojo/edk/system/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698