Chromium Code Reviews| Index: ipc/ipc_channel_posix.h |
| diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h |
| index 4ff3de14575694e113f0ae4d08d5ddcbd92439c9..c85b1ef4a59d940949a723d8cbe70f9e3dcf3ff4 100644 |
| --- a/ipc/ipc_channel_posix.h |
| +++ b/ipc/ipc_channel_posix.h |
| @@ -40,12 +40,10 @@ |
| namespace IPC { |
| -// An implementation of ChannelImpl for POSIX systems that works via |
| -// socketpairs. See the .cc file for an overview of the implementation. |
| class Channel::ChannelImpl : public MessageLoopForIO::Watcher { |
| public: |
| // Mirror methods of Channel, see ipc_channel.h for description. |
| - ChannelImpl(const IPC::ChannelHandle &channel_handle, Mode mode, |
| + ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode, |
| Listener* listener); |
| ~ChannelImpl(); |
| bool Connect(); |
| @@ -53,13 +51,21 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { |
| void set_listener(Listener* listener) { listener_ = listener; } |
| bool Send(Message* message); |
| int GetClientFileDescriptor() const; |
| + bool AcceptsConnections() const; |
| + bool HasAcceptedConnection() const; |
| + void ResetToAcceptingConnectionState(); |
| private: |
| - bool CreatePipe(const IPC::ChannelHandle &channel_handle, Mode mode); |
| + bool CreatePipe(const IPC::ChannelHandle& channel_handle, Mode mode); |
| bool ProcessIncomingMessages(); |
| bool ProcessOutgoingMessages(); |
| + bool AcceptConnection(); |
| + void ClosePipeOnError(); |
| + void QueueHelloMessage(); |
| + bool IsHelloMessage(const Message* m) const; |
| + |
| // MessageLoopForIO::Watcher implementation. |
| virtual void OnFileCanReadWithoutBlocking(int fd); |
| virtual void OnFileCanWriteWithoutBlocking(int fd); |
| @@ -74,17 +80,14 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { |
| // Indicates whether we're currently blocked waiting for a write to complete. |
| bool is_blocked_on_write_; |
| + bool waiting_connect_; |
| // If sending a message blocks then we use this variable |
| // to keep track of where we are. |
| size_t message_send_bytes_written_; |
| - // If the kTestingChannelID flag is specified, we use a FIFO instead of |
| - // a socketpair(). |
| - bool uses_fifo_; |
| - |
| - // File descriptor we're listening on for new connections in the FIFO case; |
| - // unused otherwise. |
| + // File descriptor we're listening on for new connections if we listen |
| + // for connections. |
| int server_listen_pipe_; |
| // The pipe used for communication. |
| @@ -132,10 +135,8 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { |
| std::string input_overflow_buf_; |
| std::vector<int> input_overflow_fds_; |
| - // In server-mode, we have to wait for the client to connect before we |
| - // can begin reading. We make use of the input_state_ when performing |
| - // the connect operation in overlapped mode. |
| - bool waiting_connect_; |
| + // true if we responsible for unlinking the unix domain socket file. |
|
Nico
2010/12/10 18:08:03
no verb
dmac
2010/12/13 18:32:29
Done.
|
| + bool must_unlink_; |
| ScopedRunnableMethodFactory<ChannelImpl> factory_; |