OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 CHROME_COMMON_IPC_CHANNEL_POSIX_H_ | 5 #ifndef CHROME_COMMON_IPC_CHANNEL_POSIX_H_ |
6 #define CHROME_COMMON_IPC_CHANNEL_POSIX_H_ | 6 #define CHROME_COMMON_IPC_CHANNEL_POSIX_H_ |
7 | 7 |
8 #include "chrome/common/ipc_channel.h" | 8 #include "chrome/common/ipc_channel.h" |
9 | 9 |
10 #include <sys/socket.h> // for CMSG macros | 10 #include <sys/socket.h> // for CMSG macros |
11 | 11 |
12 #include <queue> | 12 #include <queue> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "chrome/common/file_descriptor_set_posix.h" | 17 #include "chrome/common/file_descriptor_set_posix.h" |
18 | 18 |
19 namespace IPC { | 19 namespace IPC { |
20 | 20 |
21 // Store that channel name |name| is available via socket |socket|. | 21 // Store that channel name |name| is available via socket |socket|. |
22 // Used when the channel has been precreated by another process on | 22 // Used when the channel has been precreated by another process on |
23 // our behalf and they've just shipped us the socket. | 23 // our behalf and they've just shipped us the socket. |
24 void AddChannelSocket(const std::string& name, int socket); | 24 void AddChannelSocket(const std::string& name, int socket); |
25 | 25 |
| 26 // Remove the channel name mapping, and close the corresponding socket. |
| 27 void RemoveAndCloseChannelSocket(const std::string& name); |
| 28 |
26 // Construct a socket pair appropriate for IPC: UNIX domain, nonblocking. | 29 // Construct a socket pair appropriate for IPC: UNIX domain, nonblocking. |
27 // Returns false on error. | 30 // Returns false on error. |
28 bool SocketPair(int* fd1, int* fd2); | 31 bool SocketPair(int* fd1, int* fd2); |
29 | 32 |
30 // An implementation of ChannelImpl for POSIX systems that works via | 33 // An implementation of ChannelImpl for POSIX systems that works via |
31 // socketpairs. See the .cc file for an overview of the implementation. | 34 // socketpairs. See the .cc file for an overview of the implementation. |
32 class Channel::ChannelImpl : public MessageLoopForIO::Watcher { | 35 class Channel::ChannelImpl : public MessageLoopForIO::Watcher { |
33 public: | 36 public: |
34 // Mirror methods of Channel, see ipc_channel.h for description. | 37 // Mirror methods of Channel, see ipc_channel.h for description. |
35 ChannelImpl(const std::string& channel_id, Mode mode, Listener* listener); | 38 ChannelImpl(const std::string& channel_id, Mode mode, Listener* listener); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 bool processing_incoming_; | 126 bool processing_incoming_; |
124 | 127 |
125 ScopedRunnableMethodFactory<ChannelImpl> factory_; | 128 ScopedRunnableMethodFactory<ChannelImpl> factory_; |
126 | 129 |
127 DISALLOW_COPY_AND_ASSIGN(ChannelImpl); | 130 DISALLOW_COPY_AND_ASSIGN(ChannelImpl); |
128 }; | 131 }; |
129 | 132 |
130 } // namespace IPC | 133 } // namespace IPC |
131 | 134 |
132 #endif // CHROME_COMMON_IPC_CHANNEL_POSIX_H_ | 135 #endif // CHROME_COMMON_IPC_CHANNEL_POSIX_H_ |
OLD | NEW |