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