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/socket.h> | 10 #include <sys/socket.h> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (!CreatePipe(channel_handle)) { | 198 if (!CreatePipe(channel_handle)) { |
199 // The pipe may have been closed already. | 199 // The pipe may have been closed already. |
200 const char *modestr = (mode_ & MODE_SERVER_FLAG) ? "server" : "client"; | 200 const char *modestr = (mode_ & MODE_SERVER_FLAG) ? "server" : "client"; |
201 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name | 201 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name |
202 << "\" in " << modestr << " mode"; | 202 << "\" in " << modestr << " mode"; |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 ChannelPosix::~ChannelPosix() { | 206 ChannelPosix::~ChannelPosix() { |
207 in_dtor_ = true; | 207 in_dtor_ = true; |
| 208 CleanUp(); |
208 Close(); | 209 Close(); |
209 } | 210 } |
210 | 211 |
211 bool SocketPair(int* fd1, int* fd2) { | 212 bool SocketPair(int* fd1, int* fd2) { |
212 int pipe_fds[2]; | 213 int pipe_fds[2]; |
213 if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe_fds) != 0) { | 214 if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe_fds) != 0) { |
214 PLOG(ERROR) << "socketpair()"; | 215 PLOG(ERROR) << "socketpair()"; |
215 return false; | 216 return false; |
216 } | 217 } |
217 | 218 |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 } | 1042 } |
1042 | 1043 |
1043 #if defined(OS_LINUX) | 1044 #if defined(OS_LINUX) |
1044 // static | 1045 // static |
1045 void Channel::SetGlobalPid(int pid) { | 1046 void Channel::SetGlobalPid(int pid) { |
1046 ChannelPosix::SetGlobalPid(pid); | 1047 ChannelPosix::SetGlobalPid(pid); |
1047 } | 1048 } |
1048 #endif // OS_LINUX | 1049 #endif // OS_LINUX |
1049 | 1050 |
1050 } // namespace IPC | 1051 } // namespace IPC |
OLD | NEW |