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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Connect the pipe. On the server side, this will initiate | 215 // Connect the pipe. On the server side, this will initiate |
216 // waiting for connections. On the client, it attempts to | 216 // waiting for connections. On the client, it attempts to |
217 // connect to a pre-existing pipe. Note, calling Connect() | 217 // connect to a pre-existing pipe. Note, calling Connect() |
218 // will not block the calling thread and may complete | 218 // will not block the calling thread and may complete |
219 // asynchronously. | 219 // asynchronously. |
220 // | 220 // |
221 // The subclass implementation must call WillConnect() at the beginning of its | 221 // The subclass implementation must call WillConnect() at the beginning of its |
222 // implementation. | 222 // implementation. |
223 virtual bool Connect() WARN_UNUSED_RESULT = 0; | 223 virtual bool Connect() WARN_UNUSED_RESULT = 0; |
224 | 224 |
| 225 // Similar to (and exclusive to) Connect() above, but blocks outgoing messages |
| 226 // until a future call to Unpause(). |
| 227 // |
| 228 // Not all implementations support ConnectPaused(). Note that this interface |
| 229 // exists only to facilitate weird behavior where some Channel consumers want |
| 230 // to force some early messages to be transmitted before ones which were sent |
| 231 // earlier. This allows that to be done without the consumer implementing |
| 232 // their own message queueing support which may be incompatible with the |
| 233 // Channel's internal queueing behavior. |
| 234 virtual bool ConnectPaused() WARN_UNUSED_RESULT; |
| 235 |
| 236 // Unpause the pipe. This allows subsequent Send() calls to transmit messages |
| 237 // immediately, without queueing. If |flush| is true, any messages queued |
| 238 // while paused will be flushed immediately upon unpausing. Otherwise you must |
| 239 // call Flush() explicitly. |
| 240 // |
| 241 // Not all implementations support Unpause(). See ConnectPaused() above for |
| 242 // details. |
| 243 virtual void Unpause(bool flush); |
| 244 |
| 245 // Manually flush the pipe. This is only useful exactly once, and only after |
| 246 // a call to Unpause(false), in order to explicitly flush out any |
| 247 // messages which were queued prior to unpausing. |
| 248 // |
| 249 // Not all implementations support Flush(). See ConnectPaused() above for |
| 250 // details. |
| 251 virtual void Flush(); |
| 252 |
225 // Close this Channel explicitly. May be called multiple times. | 253 // Close this Channel explicitly. May be called multiple times. |
226 // On POSIX calling close on an IPC channel that listens for connections will | 254 // On POSIX calling close on an IPC channel that listens for connections will |
227 // cause it to close any accepted connections, and it will stop listening for | 255 // cause it to close any accepted connections, and it will stop listening for |
228 // new connections. If you just want to close the currently accepted | 256 // new connections. If you just want to close the currently accepted |
229 // connection and listen for new ones, use ResetToAcceptingConnectionState. | 257 // connection and listen for new ones, use ResetToAcceptingConnectionState. |
230 virtual void Close() = 0; | 258 virtual void Close() = 0; |
231 | 259 |
232 // Get its own process id. This value is told to the peer. | 260 // Get its own process id. This value is told to the peer. |
233 virtual base::ProcessId GetSelfPID() const = 0; | 261 virtual base::ProcessId GetSelfPID() const = 0; |
234 | 262 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 368 |
341 #if defined(OS_POSIX) | 369 #if defined(OS_POSIX) |
342 // SocketPair() creates a pair of socket FDs suitable for using with | 370 // SocketPair() creates a pair of socket FDs suitable for using with |
343 // IPC::Channel. | 371 // IPC::Channel. |
344 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 372 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
345 #endif | 373 #endif |
346 | 374 |
347 } // namespace IPC | 375 } // namespace IPC |
348 | 376 |
349 #endif // IPC_IPC_CHANNEL_H_ | 377 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |