Chromium Code Reviews| Index: mojo/edk/system/child_broker_host.h |
| diff --git a/mojo/edk/system/parent_token_serializer_win.h b/mojo/edk/system/child_broker_host.h |
| similarity index 78% |
| rename from mojo/edk/system/parent_token_serializer_win.h |
| rename to mojo/edk/system/child_broker_host.h |
| index ec86a775c2ffc89c32bb8cee797096ad3f0567d0..4ec5f910d1f2f128d8643e2319ef023d57d91bf6 100644 |
| --- a/mojo/edk/system/parent_token_serializer_win.h |
| +++ b/mojo/edk/system/child_broker_host.h |
| @@ -2,13 +2,14 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ |
| -#define MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ |
| +#ifndef MOJO_EDK_SYSTEM_CHILD_BROKER_HOST_H_ |
| +#define MOJO_EDK_SYSTEM_CHILD_BROKER_HOST_H_ |
| #include <vector> |
| #include "base/compiler_specific.h" |
| #include "base/message_loop/message_loop.h" |
| +#include "base/process/process_handle.h" |
| #include "mojo/edk/embedder/scoped_platform_handle.h" |
| #include "mojo/edk/system/system_impl_export.h" |
| @@ -18,22 +19,27 @@ namespace edk { |
| // Responds to requests from a child process to exchange handles to tokens and |
| // vice versa. 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 ParentTokenSerializer |
| +class MOJO_SYSTEM_IMPL_EXPORT ChildBrokerHost |
| +#if defined(OS_WIN) |
|
yzshen1
2015/11/25 16:47:09
I think it will be cleaner if we have ChildBrokerH
jam
2015/11/25 16:56:09
I was waiting for the change after this, to implem
|
| : NON_EXPORTED_BASE(public base::MessageLoopForIO::IOHandler) { |
| +#else |
| + { |
| +#endif |
| public: |
| // |child_process| is a handle to the child process. It's not owned by this |
| // class but is guaranteed to be alive as long as the child process is |
| // running. |pipe| is a handle to the communication pipe to the child process, |
| // which is generated inside mojo::edk::ChildProcessLaunched. It is owned by |
| // this class. |
| - ParentTokenSerializer(HANDLE child_process, ScopedPlatformHandle pipe); |
| + ChildBrokerHost(base::ProcessHandle child_process, ScopedPlatformHandle pipe); |
| private: |
| - ~ParentTokenSerializer() override; |
| + virtual ~ChildBrokerHost(); |
|
hans
2015/11/25 20:35:41
The Win-Clang style plugin complains about this on
jam
2015/11/25 21:28:57
I'll fix it. Is there a trybot I can use to verify
Nico
2015/11/25 22:03:33
win_clang_dbg, but it's opt-in and backed by a mea
|
| void RegisterIOHandler(); |
| void BeginRead(); |
| +#if defined(OS_WIN) |
| void OnIOCompleted(base::MessageLoopForIO::IOContext* context, |
| DWORD bytes_transferred, |
| DWORD error) override; |
| @@ -41,11 +47,15 @@ class MOJO_SYSTEM_IMPL_EXPORT ParentTokenSerializer |
| // Helper wrappers around DuplicateHandle. |
| HANDLE DuplicateToChild(HANDLE handle); |
| HANDLE DuplicateFromChild(HANDLE handle); |
| +#endif |
| - HANDLE child_process_; |
| + base::ProcessHandle child_process_; |
| ScopedPlatformHandle pipe_; |
| + |
| +#if defined(OS_WIN) |
| base::MessageLoopForIO::IOContext read_context_; |
| base::MessageLoopForIO::IOContext write_context_; |
| +#endif |
| std::vector<char> read_data_; |
| // How many bytes in read_data_ we already read. |
| @@ -56,4 +66,4 @@ class MOJO_SYSTEM_IMPL_EXPORT ParentTokenSerializer |
| } // namespace edk |
| } // namespace mojo |
| -#endif // MOJO_EDK_SYSTEM_PARENT_TOKEN_SERIALIZER_WIN_H_ |
| +#endif // MOJO_EDK_SYSTEM_CHILD_BROKER_HOST_H_ |