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

Unified Diff: mojo/edk/system/raw_channel_posix.cc

Issue 1387963004: Create a broker interface for the new Mojo EDK so that the browser can create and duplicate messa... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: presubmit whitespace error Created 5 years, 1 month 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
Index: mojo/edk/system/raw_channel_posix.cc
diff --git a/mojo/edk/system/raw_channel_posix.cc b/mojo/edk/system/raw_channel_posix.cc
index e6627d627ea9725cd610303da7fe9da5c3f69c74..93a97edc910e3f943653fc3779693fc21afe74e5 100644
--- a/mojo/edk/system/raw_channel_posix.cc
+++ b/mojo/edk/system/raw_channel_posix.cc
@@ -566,19 +566,25 @@ size_t RawChannel::GetSerializedPlatformHandleSize() {
}
bool RawChannel::IsOtherEndOf(RawChannel* other) {
+#if defined(OFFICIAL_BUILD)
+ return false;
+#else
+ // We don't check the return code of getsockopt because this is only available
+ // on Linux after 3.4. This is a developer error, so we just have to catch it
+ // on platforms that developers use.
+ // Note that since we're storing a 32 bit integer, we can get collisions so we
+ // will only use it in non-official builds.
DCHECK_NE(other, this);
PlatformHandle this_handle = static_cast<RawChannelPosix*>(this)->GetFD();
PlatformHandle other_handle = static_cast<RawChannelPosix*>(other)->GetFD();
- // We don't check the return code of getsockopt because this is only available
- // on Linux after 3.4. This is a developer error, so we just have to catch it
- // on platforms that developers use.
int id1 = 0;
int id2 = 1;
socklen_t peek_off_size = sizeof(id1);
getsockopt(this_handle.fd, SOL_SOCKET, SO_PEEK_OFF, &id1, &peek_off_size);
getsockopt(other_handle.fd, SOL_SOCKET, SO_PEEK_OFF, &id2, &peek_off_size);
return id1 == id2;
+#endif
}
} // namespace edk

Powered by Google App Engine
This is Rietveld 408576698