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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 CLOSE_FD_MESSAGE_TYPE = HELLO_MESSAGE_TYPE - 1 | 90 CLOSE_FD_MESSAGE_TYPE = HELLO_MESSAGE_TYPE - 1 |
91 }; | 91 }; |
92 | 92 |
93 // The maximum message size in bytes. Attempting to receive a message of this | 93 // The maximum message size in bytes. Attempting to receive a message of this |
94 // size or bigger results in a channel error. | 94 // size or bigger results in a channel error. |
95 static const size_t kMaximumMessageSize = 128 * 1024 * 1024; | 95 static const size_t kMaximumMessageSize = 128 * 1024 * 1024; |
96 | 96 |
97 // Amount of data to read at once from the pipe. | 97 // Amount of data to read at once from the pipe. |
98 static const size_t kReadBufferSize = 4 * 1024; | 98 static const size_t kReadBufferSize = 4 * 1024; |
99 | 99 |
| 100 // Maximum persistent read buffer size. Read buffer can grow larger to |
| 101 // accommodate large messages, but it's recommended to shrink back to this |
| 102 // value because it fits 99.9% of all messages (see issue 529940 for data). |
| 103 static const size_t kMaximumReadBufferSize = 64 * 1024; |
| 104 |
100 // Initialize a Channel. | 105 // Initialize a Channel. |
101 // | 106 // |
102 // |channel_handle| identifies the communication Channel. For POSIX, if | 107 // |channel_handle| identifies the communication Channel. For POSIX, if |
103 // the file descriptor in the channel handle is != -1, the channel takes | 108 // the file descriptor in the channel handle is != -1, the channel takes |
104 // ownership of the file descriptor and will close it appropriately, otherwise | 109 // ownership of the file descriptor and will close it appropriately, otherwise |
105 // it will create a new descriptor internally. | 110 // it will create a new descriptor internally. |
106 // |listener| receives a callback on the current thread for each newly | 111 // |listener| receives a callback on the current thread for each newly |
107 // received message. | 112 // received message. |
108 // | 113 // |
109 // There are four type of modes how channels operate: | 114 // There are four type of modes how channels operate: |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 255 |
251 #if defined(OS_POSIX) | 256 #if defined(OS_POSIX) |
252 // SocketPair() creates a pair of socket FDs suitable for using with | 257 // SocketPair() creates a pair of socket FDs suitable for using with |
253 // IPC::Channel. | 258 // IPC::Channel. |
254 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 259 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
255 #endif | 260 #endif |
256 | 261 |
257 } // namespace IPC | 262 } // namespace IPC |
258 | 263 |
259 #endif // IPC_IPC_CHANNEL_H_ | 264 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |