OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IPC_IPC_CHANNEL_MOJO_HOST_H_ |
| 6 #define IPC_IPC_CHANNEL_MOJO_HOST_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/process/process_handle.h" |
| 11 #include "ipc/ipc_export.h" |
| 12 |
| 13 namespace base { |
| 14 class TaskRunner; |
| 15 } |
| 16 |
| 17 namespace IPC { |
| 18 |
| 19 class ChannelMojo; |
| 20 |
| 21 // Through ChannelMojoHost, ChannelMojo gets extra information that |
| 22 // its client provides, including the child process's process handle. Every |
| 23 // server process that uses ChannelMojo must have a ChannelMojoHost |
| 24 // instance and call OnClientLaunched(). |
| 25 class IPC_MOJO_EXPORT ChannelMojoHost { |
| 26 public: |
| 27 explicit ChannelMojoHost(scoped_refptr<base::TaskRunner> task_runner); |
| 28 ~ChannelMojoHost(); |
| 29 |
| 30 void OnClientLaunched(base::ProcessHandle process); |
| 31 |
| 32 private: |
| 33 friend class ChannelMojo; |
| 34 |
| 35 void OnChannelCreated(ChannelMojo* channel); |
| 36 void OnChannelDestroyed(); |
| 37 |
| 38 void InvokeOnClientLaunched(base::ProcessHandle process); |
| 39 |
| 40 base::WeakPtrFactory<ChannelMojoHost> weak_factory_; |
| 41 scoped_refptr<base::TaskRunner> task_runner_; |
| 42 ChannelMojo* channel_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ChannelMojoHost); |
| 45 }; |
| 46 |
| 47 } // namespace IPC |
| 48 |
| 49 #endif // IPC_IPC_CHANNEL_MOJO_HOST_H_ |
OLD | NEW |