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

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

Issue 1890043002: [mojo-edk] Support transferring null Mach ports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add header comments. Created 4 years, 8 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/embedder_unittest.cc ('k') | 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 9932c9c71fc0d1695dab89bc6d40491adb70a0a4..7234cb08289ba7e1c0ddfcc28d8c2e9ee65515d0 100644
--- a/mojo/edk/system/channel.h
+++ b/mojo/edk/system/channel.h
@@ -69,13 +69,28 @@ class Channel : public base::RefCountedThreadSafe<Channel> {
#if defined(OS_MACOSX) && !defined(OS_IOS)
struct MachPortsEntry {
+ // Index of Mach port in the original vector of PlatformHandles.
uint16_t index;
+
+ // Mach port name.
uint32_t mach_port;
static_assert(sizeof(mach_port_t) <= sizeof(uint32_t),
"mach_port_t must be no larger than uint32_t");
};
static_assert(sizeof(MachPortsEntry) == 6,
"sizeof(MachPortsEntry) must be 6 bytes");
+
+ // Structure of the extra header field when present on OSX.
+ struct MachPortsExtraHeader {
+ // Actual number of Mach ports encoded in the extra header.
+ uint16_t num_ports;
+
+ // Array of encoded Mach ports. If |num_ports| > 0, |entires[0]| through
+ // to |entries[num_ports-1]| inclusive are valid.
+ MachPortsEntry entries[0];
+ };
+ static_assert(sizeof(MachPortsExtraHeader) == 2,
+ "sizeof(MachPortsExtraHeader) must be 2 bytes");
#endif
#pragma pack(pop)
@@ -155,7 +170,7 @@ class Channel : public base::RefCountedThreadSafe<Channel> {
#if defined(OS_MACOSX) && !defined(OS_IOS)
// On OSX, handles are serialised into the extra header section.
- MachPortsEntry* mach_ports_ = nullptr;
+ MachPortsExtraHeader* mach_ports_header_ = nullptr;
#endif
DISALLOW_COPY_AND_ASSIGN(Message);
« no previous file with comments | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/system/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698