OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_H_ | 5 #ifndef IPC_IPC_CHANNEL_H_ |
6 #define IPC_IPC_CHANNEL_H_ | 6 #define IPC_IPC_CHANNEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // asynchronously. | 118 // asynchronously. |
119 bool Connect() WARN_UNUSED_RESULT; | 119 bool Connect() WARN_UNUSED_RESULT; |
120 | 120 |
121 // Close this Channel explicitly. May be called multiple times. | 121 // Close this Channel explicitly. May be called multiple times. |
122 // On POSIX calling close on an IPC channel that listens for connections will | 122 // On POSIX calling close on an IPC channel that listens for connections will |
123 // cause it to close any accepted connections, and it will stop listening for | 123 // cause it to close any accepted connections, and it will stop listening for |
124 // new connections. If you just want to close the currently accepted | 124 // new connections. If you just want to close the currently accepted |
125 // connection and listen for new ones, use ResetToAcceptingConnectionState. | 125 // connection and listen for new ones, use ResetToAcceptingConnectionState. |
126 void Close(); | 126 void Close(); |
127 | 127 |
128 // Modify the Channel's listener. | |
129 void set_listener(Listener* listener); | |
130 | |
131 // Get the process ID for the connected peer. | 128 // Get the process ID for the connected peer. |
132 // | 129 // |
133 // Returns base::kNullProcessId if the peer is not connected yet. Watch out | 130 // Returns base::kNullProcessId if the peer is not connected yet. Watch out |
134 // for race conditions. You can easily get a channel to another process, but | 131 // for race conditions. You can easily get a channel to another process, but |
135 // if your process has not yet processed the "hello" message from the remote | 132 // if your process has not yet processed the "hello" message from the remote |
136 // side, this will fail. You should either make sure calling this is either | 133 // side, this will fail. You should either make sure calling this is either |
137 // in response to a message from the remote side (which guarantees that it's | 134 // in response to a message from the remote side (which guarantees that it's |
138 // been connected), or you wait for the "connected" notification on the | 135 // been connected), or you wait for the "connected" notification on the |
139 // listener. | 136 // listener. |
140 base::ProcessId peer_pid() const; | 137 base::ProcessId peer_pid() const; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 206 |
210 private: | 207 private: |
211 // PIMPL to which all channel calls are delegated. | 208 // PIMPL to which all channel calls are delegated. |
212 class ChannelImpl; | 209 class ChannelImpl; |
213 ChannelImpl *channel_impl_; | 210 ChannelImpl *channel_impl_; |
214 }; | 211 }; |
215 | 212 |
216 } // namespace IPC | 213 } // namespace IPC |
217 | 214 |
218 #endif // IPC_IPC_CHANNEL_H_ | 215 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |