| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/edk/system/node_channel.h" | 5 #include "mojo/edk/system/node_channel.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "mojo/edk/system/channel.h" | 14 #include "mojo/edk/system/channel.h" |
| 15 #include "mojo/edk/system/request_context.h" | 15 #include "mojo/edk/system/request_context.h" |
| 16 | 16 |
| 17 #if defined(OS_MACOSX) && !defined(OS_IOS) | 17 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 18 #include "mojo/edk/system/mach_port_relay.h" | 18 #include "mojo/edk/system/mach_port_relay.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace mojo { | 21 namespace mojo { |
| 22 namespace edk { | 22 namespace edk { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 template <typename T> | |
| 27 T Align(T t) { | |
| 28 const auto k = kChannelMessageAlignment; | |
| 29 return t + (k - (t % k)) % k; | |
| 30 } | |
| 31 | |
| 32 // NOTE: Please ONLY append messages to the end of this enum. | 26 // NOTE: Please ONLY append messages to the end of this enum. |
| 33 enum class MessageType : uint32_t { | 27 enum class MessageType : uint32_t { |
| 34 ACCEPT_CHILD, | 28 ACCEPT_CHILD, |
| 35 ACCEPT_PARENT, | 29 ACCEPT_PARENT, |
| 36 ADD_BROKER_CLIENT, | 30 ADD_BROKER_CLIENT, |
| 37 BROKER_CLIENT_ADDED, | 31 BROKER_CLIENT_ADDED, |
| 38 ACCEPT_BROKER_CLIENT, | 32 ACCEPT_BROKER_CLIENT, |
| 39 PORTS_MESSAGE, | 33 PORTS_MESSAGE, |
| 40 REQUEST_PORT_MERGE, | 34 REQUEST_PORT_MERGE, |
| 41 REQUEST_INTRODUCTION, | 35 REQUEST_INTRODUCTION, |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 | 890 |
| 897 base::AutoLock lock(channel_lock_); | 891 base::AutoLock lock(channel_lock_); |
| 898 if (!channel_) | 892 if (!channel_) |
| 899 DLOG(ERROR) << "Dropping message on closed channel."; | 893 DLOG(ERROR) << "Dropping message on closed channel."; |
| 900 else | 894 else |
| 901 channel_->Write(std::move(message)); | 895 channel_->Write(std::move(message)); |
| 902 } | 896 } |
| 903 | 897 |
| 904 } // namespace edk | 898 } // namespace edk |
| 905 } // namespace mojo | 899 } // namespace mojo |
| OLD | NEW |