Chromium Code Reviews| Index: ipc/mojo/ipc_channel_mojo_host.h |
| diff --git a/ipc/mojo/ipc_channel_mojo_host.h b/ipc/mojo/ipc_channel_mojo_host.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..97a195cf59cc15293dc946c9cca914a0a79762e8 |
| --- /dev/null |
| +++ b/ipc/mojo/ipc_channel_mojo_host.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef IPC_IPC_CHANNEL_MOJO_HOST_H_ |
| +#define IPC_IPC_CHANNEL_MOJO_HOST_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/process/process_handle.h" |
| +#include "ipc/ipc_export.h" |
| + |
| +namespace base { |
| +class TaskRunner; |
| +} |
| + |
| +namespace IPC { |
| + |
| +class ChannelMojo; |
| + |
| +// Through ChannelMojoHost, ChannelMojo gets extra information that |
| +// its client provides, including child preocess' process handle. Every |
|
viettrungluu
2014/09/17 17:33:15
"including the child process's process handle"
Hajime Morrita
2014/09/17 19:33:48
Done.
|
| +// server process that uses ChannelMojo has to have ChannelMojoHost |
| +// instance and call OnClientLaunched(). |
| +class IPC_MOJO_EXPORT ChannelMojoHost { |
| + public: |
| + explicit ChannelMojoHost(scoped_refptr<base::TaskRunner> task_runner); |
| + ~ChannelMojoHost(); |
| + |
| + void OnClientLaunched(base::ProcessHandle process); |
| + |
| + private: |
| + friend class ChannelMojo; |
| + |
| + void OnChannelCreated(ChannelMojo* channel); |
| + void OnChannelDeleted(); |
|
viettrungluu
2014/09/17 17:33:15
"destroyed" would be more idiomatic?
Hajime Morrita
2014/09/17 19:33:48
Done.
|
| + |
| + void InvokeOnClientLaunched(base::ProcessHandle process); |
| + |
| + base::WeakPtrFactory<ChannelMojoHost> weak_factory_; |
| + scoped_refptr<base::TaskRunner> task_runner_; |
| + ChannelMojo* channel_; |
| +}; |
|
viettrungluu
2014/09/17 17:33:15
nits:
- should have a DISALLOW_COPY_AND_ASSIGN (an
Hajime Morrita
2014/09/17 19:33:48
Done.
|
| +} |
| + |
| +#endif // IPC_IPC_CHANNEL_MOJO_HOST_H_ |