| Index: mojo/shell/runner/host/mach_broker.cc
|
| diff --git a/mojo/shell/runner/host/mach_broker.cc b/mojo/shell/runner/host/mach_broker.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8b992793a4e3768070a6fcf5af83e241d00999a5
|
| --- /dev/null
|
| +++ b/mojo/shell/runner/host/mach_broker.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2016 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.
|
| +
|
| +#include "mojo/shell/runner/host/mach_broker.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/memory/singleton.h"
|
| +
|
| +namespace mojo {
|
| +namespace shell {
|
| +
|
| +namespace {
|
| +const char kBootstrapPortName[] = "mojo_shell";
|
| +}
|
| +
|
| +// static
|
| +void MachBroker::SendTaskPortToParent() {
|
| + bool result = base::MachPortBroker::ChildSendTaskPortToParent(
|
| + kBootstrapPortName);
|
| + DCHECK(result);
|
| +}
|
| +
|
| +// static
|
| +MachBroker* MachBroker::GetInstance() {
|
| + return base::Singleton<MachBroker>::get();
|
| +}
|
| +
|
| +MachBroker::MachBroker() : broker_(kBootstrapPortName) {
|
| + bool result = broker_.Init();
|
| + DCHECK(result);
|
| +}
|
| +
|
| +MachBroker::~MachBroker() {}
|
| +
|
| +void MachBroker::ExpectPid(base::ProcessHandle pid) {
|
| + broker_.AddPlaceholderForPid(pid);
|
| +}
|
| +
|
| +void MachBroker::RemovePid(base::ProcessHandle pid) {
|
| + broker_.InvalidatePid(pid);
|
| +}
|
| +
|
| +} // namespace shell
|
| +} // namespace mojo
|
|
|