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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 PORTS_MESSAGE_FROM_RELAY, | 48 PORTS_MESSAGE_FROM_RELAY, |
49 #endif | 49 #endif |
50 ACCEPT_PEER, | 50 ACCEPT_PEER, |
51 }; | 51 }; |
52 | 52 |
53 struct Header { | 53 struct Header { |
54 MessageType type; | 54 MessageType type; |
55 uint32_t padding; | 55 uint32_t padding; |
56 }; | 56 }; |
57 | 57 |
58 static_assert(sizeof(Header) % kChannelMessageAlignment == 0, | 58 static_assert(IsAlignedForChannelMessage(sizeof(Header)), |
59 "Invalid header size."); | 59 "Invalid header size."); |
60 | 60 |
61 struct AcceptChildData { | 61 struct AcceptChildData { |
62 ports::NodeName parent_name; | 62 ports::NodeName parent_name; |
63 ports::NodeName token; | 63 ports::NodeName token; |
64 }; | 64 }; |
65 | 65 |
66 struct AcceptParentData { | 66 struct AcceptParentData { |
67 ports::NodeName token; | 67 ports::NodeName token; |
68 ports::NodeName child_name; | 68 ports::NodeName child_name; |
69 }; | 69 }; |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 | 895 |
896 base::AutoLock lock(channel_lock_); | 896 base::AutoLock lock(channel_lock_); |
897 if (!channel_) | 897 if (!channel_) |
898 DLOG(ERROR) << "Dropping message on closed channel."; | 898 DLOG(ERROR) << "Dropping message on closed channel."; |
899 else | 899 else |
900 channel_->Write(std::move(message)); | 900 channel_->Write(std::move(message)); |
901 } | 901 } |
902 | 902 |
903 } // namespace edk | 903 } // namespace edk |
904 } // namespace mojo | 904 } // namespace mojo |
OLD | NEW |