blob: e0d94beddc119903cac771a1e04bbf08f00f943f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// 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 the child process's process handle. Every
// server process that uses ChannelMojo must have a 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 OnChannelDestroyed();
void InvokeOnClientLaunched(base::ProcessHandle process);
base::WeakPtrFactory<ChannelMojoHost> weak_factory_;
scoped_refptr<base::TaskRunner> task_runner_;
ChannelMojo* channel_;
DISALLOW_COPY_AND_ASSIGN(ChannelMojoHost);
};
} // namespace IPC
#endif // IPC_IPC_CHANNEL_MOJO_HOST_H_
|