Index: mojo/edk/system/channel.cc |
diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc |
index ee9faa23ff8e771b86a23bafbffbb20433cdaa78..ac97fbbf29c68463d9f9d3cde643b10241f13599 100644 |
--- a/mojo/edk/system/channel.cc |
+++ b/mojo/edk/system/channel.cc |
@@ -29,7 +29,7 @@ namespace { |
static_assert(sizeof(Channel::Message::Header) % kChannelMessageAlignment == 0, |
"Invalid Header size."); |
-#if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#if defined(MOJO_EDK_LEGACY_PROTOCOL) |
static_assert(sizeof(Channel::Message::Header) == 8, |
"Header must be 8 bytes on ChromeOS and Android"); |
#endif |
@@ -67,7 +67,7 @@ Channel::Message::Message(size_t payload_size, |
(extra_header_size % kChannelMessageAlignment); |
} |
DCHECK_EQ(0u, extra_header_size % kChannelMessageAlignment); |
-#if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#if defined(MOJO_EDK_LEGACY_PROTOCOL) |
DCHECK_EQ(0u, extra_header_size); |
#endif |
@@ -88,7 +88,7 @@ Channel::Message::Message(size_t payload_size, |
DCHECK_LE(sizeof(Header) + extra_header_size, |
std::numeric_limits<uint16_t>::max()); |
header_->message_type = message_type; |
-#if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#if defined(MOJO_EDK_LEGACY_PROTOCOL) |
header_->num_handles = static_cast<uint16_t>(max_handles); |
#else |
header_->num_header_bytes = |
@@ -192,7 +192,7 @@ Channel::MessagePtr Channel::Message::Deserialize(const void* data, |
} |
size_t Channel::Message::payload_size() const { |
-#if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#if defined(MOJO_EDK_LEGACY_PROTOCOL) |
return header_->num_bytes - sizeof(Header); |
#else |
return size_ - header_->num_header_bytes; |
@@ -215,7 +215,7 @@ bool Channel::Message::has_mach_ports() const { |
#endif |
void Channel::Message::SetHandles(ScopedPlatformHandleVectorPtr new_handles) { |
-#if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#if defined(MOJO_EDK_LEGACY_PROTOCOL) |
// Old semantics for ChromeOS and Android |
if (header_->num_handles == 0) { |
CHECK(!new_handles || new_handles->size() == 0); |
@@ -238,7 +238,7 @@ void Channel::Message::SetHandles(ScopedPlatformHandleVectorPtr new_handles) { |
for (size_t i = 0; i < handle_vector_->size(); i++) |
handles_[i].handle = base::win::HandleToUint32((*handle_vector_)[i].handle); |
#endif // defined(OS_WIN) |
-#endif // defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#endif // defined(MOJO_EDK_LEGACY_PROTOCOL) |
#if defined(OS_MACOSX) && !defined(OS_IOS) |
size_t mach_port_index = 0; |
@@ -506,7 +506,7 @@ bool Channel::OnReadComplete(size_t bytes_read, size_t *next_read_size_hint) { |
return true; |
} |
-#if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#if defined(MOJO_EDK_LEGACY_PROTOCOL) |
size_t extra_header_size = 0; |
const void* extra_header = nullptr; |
size_t payload_size = header->num_bytes - sizeof(Message::Header); |
@@ -527,7 +527,7 @@ bool Channel::OnReadComplete(size_t bytes_read, size_t *next_read_size_hint) { |
const_cast<char*>(read_buffer_->occupied_bytes()) + |
header->num_header_bytes) |
: nullptr; |
-#endif // defined(OS_CHROMEOS) || defined(OS_ANDROID) |
+#endif // defined(MOJO_EDK_LEGACY_PROTOCOL) |
ScopedPlatformHandleVectorPtr handles; |
if (header->num_handles > 0) { |