Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: mojo/shell/runner/host/mach_broker.cc

Issue 1812523003: Add mach ports support to the Mojo shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-mach-ports
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/runner/host/mach_broker.h ('k') | mojo/shell/standalone/context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « mojo/shell/runner/host/mach_broker.h ('k') | mojo/shell/standalone/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698