Index: mojo/edk/system/child_broker_host.h |
diff --git a/mojo/edk/system/child_broker_host.h b/mojo/edk/system/child_broker_host.h |
index 943ff13e280f47296477f17c41c41c05a9bec21e..3e6c377308e84581fe1ec703c23fc062fcac1699 100644 |
--- a/mojo/edk/system/child_broker_host.h |
+++ b/mojo/edk/system/child_broker_host.h |
@@ -21,15 +21,15 @@ namespace mojo { |
namespace edk { |
// Responds to requests from ChildBroker. This is used to handle message pipe |
-// multiplexing and Windows sandbox messages. There is one object of this class |
+// multiplexing and sandbox messages. There is one object of this class |
// per child process host object. |
// This object will delete itself when it notices that the pipe is broken. |
class MOJO_SYSTEM_IMPL_EXPORT ChildBrokerHost |
- : public RawChannel::Delegate |
+ : public RawChannel::Delegate, |
#if defined(OS_WIN) |
- , NON_EXPORTED_BASE(public base::MessageLoopForIO::IOHandler) { |
+ NON_EXPORTED_BASE(public base::MessageLoopForIO::IOHandler) { |
#else |
- { |
+ public base::MessageLoopForIO::Watcher { |
#endif |
public: |
// |child_process| is a handle to the child process. It will be duplicated by |
@@ -75,6 +75,13 @@ class MOJO_SYSTEM_IMPL_EXPORT ChildBrokerHost |
// Helper wrappers around DuplicateHandle. |
HANDLE DuplicateToChild(HANDLE handle); |
HANDLE DuplicateFromChild(HANDLE handle); |
+#else |
+ void DoRead(); |
+ void DoWrite(); |
+ |
+ // base::MessageLoopForIO::Watcher implementation: |
+ void OnFileCanReadWithoutBlocking(int fd) override; |
+ void OnFileCanWriteWithoutBlocking(int fd) override; |
#endif |
base::ProcessId process_id_; |
@@ -82,22 +89,24 @@ class MOJO_SYSTEM_IMPL_EXPORT ChildBrokerHost |
// Channel used to receive and send multiplexing related messages. |
RoutedRawChannel* child_channel_; |
-#if defined(OS_WIN) |
- // Handle to the child process, used for duplication of handles. |
- base::Process child_process_; |
- |
// Pipe used for synchronous messages from the child. Responses are written to |
// it as well. |
ScopedPlatformHandle sync_channel_; |
+#if defined(OS_WIN) |
+ // Handle to the child process, used for duplication of handles. |
+ base::Process child_process_; |
+ std::vector<char> write_data_; |
base::MessageLoopForIO::IOContext read_context_; |
base::MessageLoopForIO::IOContext write_context_; |
+#else |
+ std::deque<PlatformHandle> write_handles_; |
+ base::MessageLoopForIO::FileDescriptorWatcher fd_controller_; |
+#endif |
std::vector<char> read_data_; |
// How many bytes in read_data_ we already read. |
uint32_t num_bytes_read_; |
- std::vector<char> write_data_; |
-#endif |
DISALLOW_COPY_AND_ASSIGN(ChildBrokerHost); |
}; |