| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_POSIX_H_ | 5 #ifndef IPC_IPC_CHANNEL_POSIX_H_ |
| 6 #define IPC_IPC_CHANNEL_POSIX_H_ | 6 #define IPC_IPC_CHANNEL_POSIX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 std::string pipe_name_; | 117 std::string pipe_name_; |
| 118 | 118 |
| 119 Listener* listener_; | 119 Listener* listener_; |
| 120 | 120 |
| 121 // Messages to be sent are queued here. | 121 // Messages to be sent are queued here. |
| 122 std::queue<Message*> output_queue_; | 122 std::queue<Message*> output_queue_; |
| 123 | 123 |
| 124 // We read from the pipe into this buffer | 124 // We read from the pipe into this buffer |
| 125 char input_buf_[Channel::kReadBufferSize]; | 125 char input_buf_[Channel::kReadBufferSize]; |
| 126 | 126 |
| 127 enum { | 127 // We assume a worst case: kReadBufferSize bytes of messages, where each |
| 128 // We assume a worst case: kReadBufferSize bytes of messages, where each | 128 // message has no payload and a full complement of descriptors. |
| 129 // message has no payload and a full complement of descriptors. | 129 static const size_t kMaxReadFDs = |
| 130 MAX_READ_FDS = (Channel::kReadBufferSize / sizeof(IPC::Message::Header)) * | 130 (Channel::kReadBufferSize / sizeof(IPC::Message::Header)) * |
| 131 FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE, | 131 FileDescriptorSet::kMaxDescriptorsPerMessage; |
| 132 }; | |
| 133 | 132 |
| 134 // This is a control message buffer large enough to hold kMaxReadFDs | 133 // This is a control message buffer large enough to hold kMaxReadFDs |
| 135 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
| 136 // TODO(agl): OSX appears to have non-constant CMSG macros! | 135 // TODO(agl): OSX appears to have non-constant CMSG macros! |
| 137 char input_cmsg_buf_[1024]; | 136 char input_cmsg_buf_[1024]; |
| 138 #else | 137 #else |
| 139 char input_cmsg_buf_[CMSG_SPACE(sizeof(int) * MAX_READ_FDS)]; | 138 char input_cmsg_buf_[CMSG_SPACE(sizeof(int) * kMaxReadFDs)]; |
| 140 #endif | 139 #endif |
| 141 | 140 |
| 142 // Large messages that span multiple pipe buffers, get built-up using | 141 // Large messages that span multiple pipe buffers, get built-up using |
| 143 // this buffer. | 142 // this buffer. |
| 144 std::string input_overflow_buf_; | 143 std::string input_overflow_buf_; |
| 145 std::vector<int> input_overflow_fds_; | 144 std::vector<int> input_overflow_fds_; |
| 146 | 145 |
| 147 // True if we are responsible for unlinking the unix domain socket file. | 146 // True if we are responsible for unlinking the unix domain socket file. |
| 148 bool must_unlink_; | 147 bool must_unlink_; |
| 149 | 148 |
| 150 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); | 149 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or | 152 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or |
| 154 // MODE_NAMED_CLIENT if you want to pass in your own socket. | 153 // MODE_NAMED_CLIENT if you want to pass in your own socket. |
| 155 // The standard size on linux is 108, mac is 104. To maintain consistency | 154 // The standard size on linux is 108, mac is 104. To maintain consistency |
| 156 // across platforms we standardize on the smaller value. | 155 // across platforms we standardize on the smaller value. |
| 157 static const size_t kMaxPipeNameLength = 104; | 156 static const size_t kMaxPipeNameLength = 104; |
| 158 | 157 |
| 159 } // namespace IPC | 158 } // namespace IPC |
| 160 | 159 |
| 161 #endif // IPC_IPC_CHANNEL_POSIX_H_ | 160 #endif // IPC_IPC_CHANNEL_POSIX_H_ |
| OLD | NEW |