OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BROKER_MESSAGES_H_ | 5 #ifndef MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ |
6 #define MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ | 6 #define MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 #endif | 47 #endif |
48 | 48 |
49 // Route id used for messages between ChildBroker and ChildBrokerHost. | 49 // Route id used for messages between ChildBroker and ChildBrokerHost. |
50 const uint64_t kBrokerRouteId = 1; | 50 const uint64_t kBrokerRouteId = 1; |
51 | 51 |
52 // Multiplexing related messages. They are all asynchronous messages. | 52 // Multiplexing related messages. They are all asynchronous messages. |
53 // They are sent over RawChannel. | 53 // They are sent over RawChannel. |
54 enum MultiplexMessages { | 54 enum MultiplexMessages { |
55 // Messages from child to parent. | 55 // Messages from child to parent. |
| 56 |
| 57 // Tells the parent that the given pipe id has been bound to a |
| 58 // MessagePipeDispatcher in the child process. The parent will then respond |
| 59 // with either PEER_PIPE_CONNECTED or PEER_DIED when the other side is also |
| 60 // bound. |
56 CONNECT_MESSAGE_PIPE = 0, | 61 CONNECT_MESSAGE_PIPE = 0, |
| 62 // Tells the parent to remove its bookkeeping for the given peer id since |
| 63 // another MessagePipeDispatcher has connected to the pipe in the same |
| 64 // process. |
57 CANCEL_CONNECT_MESSAGE_PIPE, | 65 CANCEL_CONNECT_MESSAGE_PIPE, |
58 | 66 |
| 67 |
59 // Messages from parent to child. | 68 // Messages from parent to child. |
| 69 |
| 70 // Tells the child to open a channel to a given process. This will be followed |
| 71 // by a PEER_PIPE_CONNECTED connecting a message pipe from the child process |
| 72 // to the given process over the new channel. |
60 CONNECT_TO_PROCESS, | 73 CONNECT_TO_PROCESS, |
| 74 |
| 75 // Connect a given message pipe to another process. |
61 PEER_PIPE_CONNECTED, | 76 PEER_PIPE_CONNECTED, |
| 77 |
| 78 // Informs the child that the other end of the message pipe is in a process |
| 79 // that died. |
| 80 PEER_DIED, |
62 }; | 81 }; |
63 | 82 |
64 struct ConnectMessagePipeMessage { | 83 struct ConnectMessagePipeMessage { |
65 // CONNECT_MESSAGE_PIPE or CANCEL_CONNECT_MESSAGE_PIPE | 84 // CONNECT_MESSAGE_PIPE or CANCEL_CONNECT_MESSAGE_PIPE |
66 MultiplexMessages type; | 85 MultiplexMessages type; |
67 uint64_t pipe_id; | 86 uint64_t pipe_id; |
68 }; | 87 }; |
69 | 88 |
70 struct ConnectToProcessMessage { | 89 struct ConnectToProcessMessage { |
71 MultiplexMessages type; // CONNECT_TO_PROCESS | 90 MultiplexMessages type; // CONNECT_TO_PROCESS |
72 base::ProcessId process_id; | 91 base::ProcessId process_id; |
73 // Also has an attached platform handle. | 92 // Also has an attached platform handle. |
74 }; | 93 }; |
75 | 94 |
76 struct PeerPipeConnectedMessage { | 95 struct PeerPipeConnectedMessage { |
77 MultiplexMessages type; // PEER_PIPE_CONNECTED | 96 MultiplexMessages type; // PEER_PIPE_CONNECTED |
78 uint64_t pipe_id; | 97 uint64_t pipe_id; |
79 base::ProcessId process_id; | 98 base::ProcessId process_id; |
80 }; | 99 }; |
81 | 100 |
| 101 struct PeerDiedMessage { |
| 102 MultiplexMessages type; // PEER_DIED |
| 103 uint64_t pipe_id; |
| 104 }; |
| 105 |
82 } // namespace edk | 106 } // namespace edk |
83 } // namespace mojo | 107 } // namespace mojo |
84 | 108 |
85 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ | 109 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ |
OLD | NEW |