Index: ppapi/nacl_irt/plugin_startup.cc |
diff --git a/ppapi/nacl_irt/plugin_startup.cc b/ppapi/nacl_irt/plugin_startup.cc |
index 338f524608f767035087d3c207e8445fdc32d1da..1026efd5339bddc0a7a13ba549bbf3fbacb3a04b 100644 |
--- a/ppapi/nacl_irt/plugin_startup.cc |
+++ b/ppapi/nacl_irt/plugin_startup.cc |
@@ -12,6 +12,8 @@ |
#include "base/synchronization/waitable_event.h" |
#include "base/threading/thread.h" |
#include "ipc/ipc_channel_handle.h" |
+#include "ipc/mojo/scoped_ipc_support.h" |
+#include "mojo/edk/embedder/embedder.h" |
#include "ppapi/nacl_irt/manifest_service.h" |
#include "ppapi/shared_impl/ppb_audio_shared.h" |
@@ -21,6 +23,7 @@ namespace { |
int g_nacl_browser_ipc_fd = -1; |
int g_nacl_renderer_ipc_fd = -1; |
int g_manifest_service_fd = -1; |
+int g_nacl_browser_mojo_fd = -1; |
base::WaitableEvent* g_shutdown_event = NULL; |
base::Thread* g_io_thread = NULL; |
@@ -48,14 +51,17 @@ void StartUpManifestServiceOnIOThread(base::WaitableEvent* event) { |
} // namespace |
void SetIPCFileDescriptors( |
- int browser_ipc_fd, int renderer_ipc_fd, int manifest_service_fd) { |
+ int browser_ipc_fd, int renderer_ipc_fd, int manifest_service_fd, |
+ int browser_mojo_fd) { |
// The initialization must be only once. |
DCHECK_EQ(g_nacl_browser_ipc_fd, -1); |
DCHECK_EQ(g_nacl_renderer_ipc_fd, -1); |
DCHECK_EQ(g_manifest_service_fd, -1); |
+ DCHECK_EQ(g_nacl_browser_mojo_fd, -1); |
g_nacl_browser_ipc_fd = browser_ipc_fd; |
g_nacl_renderer_ipc_fd = renderer_ipc_fd; |
g_manifest_service_fd = manifest_service_fd; |
+ g_nacl_browser_mojo_fd = browser_mojo_fd; |
} |
void StartUpPlugin() { |
@@ -68,6 +74,15 @@ void StartUpPlugin() { |
g_io_thread->StartWithOptions( |
base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
+ // Initialize Mojo. |
+ mojo::edk::Init(); |
+ IPC::ScopedIPCSupport scoped_ipc_support(g_io_thread->task_runner()); |
+ if (g_nacl_browser_mojo_fd != -1) { |
+ LOG(ERROR) << "Setting up Mojo channel in NaCl"; |
+// mojo::edk::SetParentPipeHandle(mojo::edk::ScopedPlatformHandle( |
+// mojo::edk::PlatformHandle(g_nacl_browser_mojo_fd))); |
+ } |
+ |
if (g_manifest_service_fd != -1) { |
// Manifest service must be created on IOThread so that the main message |
// handling will be done on the thread, which has a message loop |