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 #include "ipc/ipc_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 void Channel::ChannelImpl::ClearInputFDs() { | 1119 void Channel::ChannelImpl::ClearInputFDs() { |
1120 while (!input_fds_.empty()) { | 1120 while (!input_fds_.empty()) { |
1121 if (HANDLE_EINTR(close(input_fds_.front())) < 0) | 1121 if (HANDLE_EINTR(close(input_fds_.front())) < 0) |
1122 PLOG(ERROR) << "close "; | 1122 PLOG(ERROR) << "close "; |
1123 input_fds_.pop_front(); | 1123 input_fds_.pop_front(); |
1124 } | 1124 } |
1125 } | 1125 } |
1126 | 1126 |
1127 void Channel::ChannelImpl::HandleHelloMessage(const Message& msg) { | 1127 void Channel::ChannelImpl::HandleHelloMessage(const Message& msg) { |
1128 // The Hello message contains only the process id. | 1128 // The Hello message contains only the process id. |
1129 void *iter = NULL; | 1129 PickleIterator iter(msg); |
1130 int pid; | 1130 int pid; |
1131 if (!msg.ReadInt(&iter, &pid)) | 1131 if (!msg.ReadInt(&iter, &pid)) |
1132 NOTREACHED(); | 1132 NOTREACHED(); |
1133 | 1133 |
1134 #if defined(IPC_USES_READWRITE) | 1134 #if defined(IPC_USES_READWRITE) |
1135 if (mode_ & MODE_SERVER_FLAG) { | 1135 if (mode_ & MODE_SERVER_FLAG) { |
1136 // With IPC_USES_READWRITE, the Hello message from the client to the | 1136 // With IPC_USES_READWRITE, the Hello message from the client to the |
1137 // server also contains the fd_pipe_, which will be used for all | 1137 // server also contains the fd_pipe_, which will be used for all |
1138 // subsequent file descriptor passing. | 1138 // subsequent file descriptor passing. |
1139 DCHECK_EQ(msg.file_descriptor_set()->size(), 1U); | 1139 DCHECK_EQ(msg.file_descriptor_set()->size(), 1U); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 } | 1226 } |
1227 | 1227 |
1228 #if defined(OS_LINUX) | 1228 #if defined(OS_LINUX) |
1229 // static | 1229 // static |
1230 void Channel::SetGlobalPid(int pid) { | 1230 void Channel::SetGlobalPid(int pid) { |
1231 ChannelImpl::SetGlobalPid(pid); | 1231 ChannelImpl::SetGlobalPid(pid); |
1232 } | 1232 } |
1233 #endif // OS_LINUX | 1233 #endif // OS_LINUX |
1234 | 1234 |
1235 } // namespace IPC | 1235 } // namespace IPC |
OLD | NEW |