OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 #include "services/shell/runner/host/mach_broker.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "base/memory/singleton.h" | |
9 | |
10 namespace shell { | |
11 | |
12 namespace { | |
13 const char kBootstrapPortName[] = "mojo_shell"; | |
14 } | |
15 | |
16 // static | |
17 void MachBroker::SendTaskPortToParent() { | |
18 bool result = base::MachPortBroker::ChildSendTaskPortToParent( | |
19 kBootstrapPortName); | |
20 DCHECK(result); | |
21 } | |
22 | |
23 // static | |
24 MachBroker* MachBroker::GetInstance() { | |
25 return base::Singleton<MachBroker>::get(); | |
26 } | |
27 | |
28 MachBroker::MachBroker() : broker_(kBootstrapPortName) { | |
29 bool result = broker_.Init(); | |
30 DCHECK(result); | |
31 } | |
32 | |
33 MachBroker::~MachBroker() {} | |
34 | |
35 void MachBroker::ExpectPid(base::ProcessHandle pid) { | |
36 broker_.AddPlaceholderForPid(pid); | |
37 } | |
38 | |
39 void MachBroker::RemovePid(base::ProcessHandle pid) { | |
40 broker_.InvalidatePid(pid); | |
41 } | |
42 | |
43 } // namespace shell | |
OLD | NEW |