Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1038)

Unified Diff: mojo/edk/system/child_broker_host.h

Issue 1555273002: [mojo] Add CreateSharedBuffer method to Broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b638d355c836d79af053471aa8913772198d042a 100644
--- a/mojo/edk/system/child_broker_host.h
+++ b/mojo/edk/system/child_broker_host.h
@@ -21,7 +21,7 @@ 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
@@ -29,7 +29,7 @@ class MOJO_SYSTEM_IMPL_EXPORT ChildBrokerHost
#if defined(OS_WIN)
, NON_EXPORTED_BASE(public base::MessageLoopForIO::IOHandler) {
#else
- {
+ , public base::MessageLoopForIO::Watcher {
jam 2016/01/06 02:58:16 nit: you can now move the comma to line 28
Eliot Courtney 2016/01/07 02:26:09 Done.
#endif
public:
// |child_process| is a handle to the child process. It will be duplicated by
@@ -66,7 +66,6 @@ class MOJO_SYSTEM_IMPL_EXPORT ChildBrokerHost
#if defined(OS_WIN)
void BeginRead();
-
jam 2016/01/06 02:58:16 nit: undo
Eliot Courtney 2016/01/07 02:26:09 Done.
// base::MessageLoopForIO::IOHandler implementation:
void OnIOCompleted(base::MessageLoopForIO::IOContext* context,
DWORD bytes_transferred,
@@ -75,6 +74,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 +88,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);
};

Powered by Google App Engine
This is Rietveld 408576698