Chromium Code Reviews| Index: mojo/edk/system/channel.cc |
| diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc |
| index 8a44d36024e2346b3eab90a48f1eb77a35adcd63..bd4df0f4ad86be3b5c080ed99f94c0e85e40fafe 100644 |
| --- a/mojo/edk/system/channel.cc |
| +++ b/mojo/edk/system/channel.cc |
| @@ -45,6 +45,8 @@ static_assert(offsetof(Channel::Message::LegacyHeader, message_type) == |
| "message_type should be at the same offset in both Header " |
| "structs."); |
| +bool g_use_legacy_protocol = false; |
| + |
| } // namespace |
| const size_t kReadBufferSize = 4096; |
| @@ -53,13 +55,10 @@ const size_t kMaxChannelMessageSize = 256 * 1024 * 1024; |
| const size_t kMaxAttachedHandles = 128; |
| Channel::Message::Message(size_t payload_size, size_t max_handles) |
| -#if defined(MOJO_EDK_LEGACY_PROTOCOL) |
| - : Message(payload_size, max_handles, MessageType::NORMAL_LEGACY) { |
| -} |
| -#else |
| - : Message(payload_size, max_handles, MessageType::NORMAL) { |
| + : Message(payload_size, max_handles, |
| + g_use_legacy_protocol ? MessageType::NORMAL_LEGACY |
| + : MessageType::NORMAL) { |
| } |
| -#endif |
| Channel::Message::Message(size_t payload_size, |
| size_t max_handles, |
| @@ -395,6 +394,11 @@ ScopedPlatformHandleVectorPtr Channel::Message::TakeHandlesForTransport() { |
| #endif |
| } |
| +// static |
| +void Channel::Message::SetUseLegacyTransportProtocol(bool use_legacy_protocol) { |
| + g_use_legacy_protocol = use_legacy_protocol; |
|
Ken Rockot(use gerrit already)
2017/03/15 17:59:31
nit: Let's add a DCHECK(!internal::g_core) to ensu
Jay Civelli
2017/03/15 18:14:09
Good idea, done.
|
| +} |
| + |
| #if defined(OS_WIN) |
| // static |
| bool Channel::Message::RewriteHandles(base::ProcessHandle from_process, |