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

Unified Diff: ipc/attachment_broker_privileged.cc

Issue 1509063003: Remoting: Remove references to POSIX shared memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp57_base
Patch Set: Rebase. Created 5 years 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 | « ipc/attachment_broker_privileged.h ('k') | remoting/host/chromoting_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/attachment_broker_privileged.cc
diff --git a/ipc/attachment_broker_privileged.cc b/ipc/attachment_broker_privileged.cc
index 2b14217b7c352e40e973448a3b84c1ea1798e46e..85c1ac949cd858704effd0cb8dba4b4cb6ffefaf 100644
--- a/ipc/attachment_broker_privileged.cc
+++ b/ipc/attachment_broker_privileged.cc
@@ -16,6 +16,9 @@
#endif
#if defined(OS_MACOSX) && !defined(OS_IOS)
+#include <mach/mach.h>
+
+#include "base/process/port_provider_mac.h"
#include "ipc/attachment_broker_privileged_mac.h"
#endif
@@ -24,6 +27,19 @@ namespace IPC {
namespace {
#if defined(OS_MACOSX) && !defined(OS_IOS)
+
+// A fake port provider that does nothing. Intended for single process unit
+// tests.
+class FakePortProvider : public base::PortProvider {
+ mach_port_t TaskForPid(base::ProcessHandle process) const override {
+ DCHECK_EQ(process, getpid());
+ return mach_task_self();
+ }
+};
+
+base::LazyInstance<FakePortProvider>::Leaky
+ g_fake_port_provider = LAZY_INSTANCE_INITIALIZER;
+
// Passed as a constructor parameter to AttachmentBrokerPrivilegedMac.
base::PortProvider* g_port_provider = nullptr;
#endif // defined(OS_MACOSX) && !defined(OS_IOS)
@@ -86,6 +102,15 @@ void AttachmentBrokerPrivileged::CreateBrokerIfNeeded() {
}
#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+// static
+void AttachmentBrokerPrivileged::CreateBrokerForSingleProcessTests() {
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ CreateBrokerIfNeeded(&g_fake_port_provider.Get());
+#else
+ CreateBrokerIfNeeded();
+#endif // defined(OS_MACOSX) && !defined(OS_IOS)
+}
+
void AttachmentBrokerPrivileged::RegisterCommunicationChannel(
Endpoint* endpoint) {
base::AutoLock auto_lock(*get_lock());
« no previous file with comments | « ipc/attachment_broker_privileged.h ('k') | remoting/host/chromoting_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698