OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
6 #define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ | 6 #define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 // main buffer a multiple of |kMessageAlignment| bytes in size. | 39 // main buffer a multiple of |kMessageAlignment| bytes in size. |
40 // | 40 // |
41 // See |TransportData| for a description of the (serialized) transport data | 41 // See |TransportData| for a description of the (serialized) transport data |
42 // buffer. | 42 // buffer. |
43 class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { | 43 class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit { |
44 public: | 44 public: |
45 enum class Type : uint16_t { | 45 enum class Type : uint16_t { |
46 MESSAGE = 0, | 46 MESSAGE = 0, |
47 // Since there's a limit on how many fds can be sent in one sendmsg call, if | 47 // Since there's a limit on how many fds can be sent in one sendmsg call, if |
48 // a message has more than that the fds are sent in this message type first. | 48 // a message has more than that the fds are sent in this message type first. |
49 RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES = 1, | 49 RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES, |
50 // When a RawChannel is serialized, there could be pending messages to be | 50 // When a RawChannel is serialized, there could be pending messages to be |
51 // written to the pipe. They are serialized to shared memory. When they're | 51 // written to the pipe. They are serialized to shared memory. When they're |
52 // deserialized on the receiving end, we want to write them to the pipe | 52 // deserialized on the receiving end, we want to write them to the pipe |
53 // without any message headers, because those have already been written. | 53 // without any message headers, because those have already been written. |
54 RAW_MESSAGE = 3, | 54 RAW_MESSAGE, |
| 55 // Tells the other side to close its pipe. This is needed because when a |
| 56 // MessagePipeDispatcher is closed, it has to wait to flush any pending |
| 57 // messages or else in-flight message pipes won't be closed. |
| 58 QUIT_MESSAGE, |
55 }; | 59 }; |
56 | 60 |
57 // Messages (the header and data) must always be aligned to a multiple of this | 61 // Messages (the header and data) must always be aligned to a multiple of this |
58 // quantity (which must be a power of 2). | 62 // quantity (which must be a power of 2). |
59 static const size_t kMessageAlignment = 8; | 63 static const size_t kMessageAlignment = 8; |
60 | 64 |
61 // Forward-declare |Header| so that |View| can use it: | 65 // Forward-declare |Header| so that |View| can use it: |
62 private: | 66 private: |
63 struct Header; | 67 struct Header; |
64 | 68 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<( | 240 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<( |
237 std::ostream& out, | 241 std::ostream& out, |
238 MessageInTransit::Type type) { | 242 MessageInTransit::Type type) { |
239 return out << static_cast<uint16_t>(type); | 243 return out << static_cast<uint16_t>(type); |
240 } | 244 } |
241 | 245 |
242 } // namespace edk | 246 } // namespace edk |
243 } // namespace mojo | 247 } // namespace mojo |
244 | 248 |
245 #endif // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ | 249 #endif // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_ |
OLD | NEW |