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

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

Issue 647553004: Mojo: Make room for remotely-allocated channel endpoint IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@channel_endpoint_id_tests
Patch Set: bah Created 6 years, 2 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_endpoint_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/channel_endpoint_id.h
diff --git a/mojo/edk/system/channel_endpoint_id.h b/mojo/edk/system/channel_endpoint_id.h
index 673a2195106cea436992ceccca156035caa73958..c6641c9efa03810804c9ea7c6a1a72ae844b3aba 100644
--- a/mojo/edk/system/channel_endpoint_id.h
+++ b/mojo/edk/system/channel_endpoint_id.h
@@ -26,6 +26,12 @@ FORWARD_DECLARE_TEST(LocalChannelEndpointIdGeneratorTest, WrapAround);
// Represents an ID for an endpoint (i.e., one side of a message pipe) on a
// |Channel|. This class must be POD.
+//
+// Note: The terminology "remotely allocated ID" is for destination IDs with
+// respect to the receiver. I.e., a destination ID in a message is remotely
+// allocated if the ID was allocated by the sender (i.e., the remote side with
+// respect to the receiver). Conversely, a source ID is remotely allocated if it
+// was allocated by the receiver.
class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpointId {
public:
ChannelEndpointId() : value_(0) {}
@@ -51,6 +57,9 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpointId {
}
bool is_valid() const { return !!value_; }
+ bool is_remotely_allocated() const {
+ return !!(value_ & kRemotelyAllocatedFlag);
+ }
uint32_t value() const { return value_; }
private:
@@ -59,6 +68,9 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpointId {
uint32_t value_;
+ static const uint32_t kRemotelyAllocatedFlag = 0x80000000u;
+ static const uint32_t kLocallyAllocatedMask = ~kRemotelyAllocatedFlag;
+
// Copying and assignment allowed.
};
// This wrapper should add no overhead.
« no previous file with comments | « no previous file | mojo/edk/system/channel_endpoint_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698