| 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 class Channel::ChannelImpl : public MessageLoopForIO::Watcher { | 21 class Channel::ChannelImpl : public MessageLoopForIO::Watcher { |
| 22 public: | 22 public: |
| 23 // Mirror methods of Channel, see ipc_channel.h for description. | 23 // Mirror methods of Channel, see ipc_channel.h for description. |
| 24 ChannelImpl(const std::wstring& channel_id, Mode mode, Listener* listener); | 24 ChannelImpl(const std::wstring& channel_id, Mode mode, Listener* listener); |
| 25 ~ChannelImpl() { Close(); } | 25 ~ChannelImpl() { Close(); } |
| 26 bool Connect(); | 26 bool Connect(); |
| 27 void Close(); | 27 void Close(); |
| 28 void set_listener(Listener* listener) { listener_ = listener; } | 28 void set_listener(Listener* listener) { listener_ = listener; } |
| 29 bool Send(Message* message); | 29 bool Send(Message* message); |
| 30 void GetClientFileDescriptorMapping(int *src_fd, int *dest_fd); | 30 void GetClientFileDescriptorMapping(int *src_fd, int *dest_fd) const; |
| 31 void OnClientConnected(); | 31 void OnClientConnected(); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 const std::wstring PipeName(const std::wstring& channel_id) const; | 34 const std::wstring PipeName(const std::wstring& channel_id) const; |
| 35 bool CreatePipe(const std::wstring& channel_id, Mode mode); | 35 bool CreatePipe(const std::wstring& channel_id, Mode mode); |
| 36 | 36 |
| 37 bool ProcessIncomingMessages(); | 37 bool ProcessIncomingMessages(); |
| 38 bool ProcessOutgoingMessages(); | 38 bool ProcessOutgoingMessages(); |
| 39 | 39 |
| 40 void OnFileCanReadWithoutBlocking(int fd); | 40 void OnFileCanReadWithoutBlocking(int fd); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 bool processing_incoming_; | 103 bool processing_incoming_; |
| 104 | 104 |
| 105 ScopedRunnableMethodFactory<ChannelImpl> factory_; | 105 ScopedRunnableMethodFactory<ChannelImpl> factory_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(ChannelImpl); | 107 DISALLOW_COPY_AND_ASSIGN(ChannelImpl); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace IPC | 110 } // namespace IPC |
| 111 | 111 |
| 112 #endif // CHROME_COMMON_IPC_CHANNEL_POSIX_H_ | 112 #endif // CHROME_COMMON_IPC_CHANNEL_POSIX_H_ |
| OLD | NEW |