Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index 0ef9339e298f5330e551709f6a85d9be3c1d1fa5..b604ddcc9e6947a8782a69dfd12760b191005696 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -138,6 +138,7 @@ |
#include "media/base/media_switches.h" |
#include "net/url_request/url_request_context_getter.h" |
#include "ppapi/shared_impl/ppapi_switches.h" |
+#include "third_party/skia/include/core/SkBitmap.h" |
#include "ui/base/ui_base_switches.h" |
#include "ui/events/event_switches.h" |
#include "ui/gfx/switches.h" |
@@ -158,7 +159,11 @@ |
#include "content/common/media/media_stream_messages.h" |
#endif |
-#include "third_party/skia/include/core/SkBitmap.h" |
+#if defined(USE_MOJO) |
+#include "content/common/mojo/mojo_channel_init.h" |
+#include "content/common/mojo/mojo_messages.h" |
+#include "mojo/system/embedder/platform_channel_pair.h" |
+#endif |
extern bool g_exited_main_message_loop; |
@@ -325,6 +330,17 @@ class RendererSandboxedProcessLauncherDelegate |
#endif // OS_POSIX |
}; |
+#if defined(USE_MOJO) |
+base::PlatformFile PlatformFileFromScopedPlatformHandle( |
+ mojo::embedder::ScopedPlatformHandle handle) { |
+#if defined(OS_POSIX) |
+ return handle.release().fd; |
+#elif defined(OS_WIN) |
+ return handle.release().handle; |
+#endif |
+} |
+#endif |
+ |
} // namespace |
RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
@@ -422,9 +438,9 @@ RenderProcessHostImpl::RenderProcessHostImpl( |
within_process_died_observer_(false), |
power_monitor_broadcaster_(this), |
geolocation_dispatcher_host_(NULL), |
- weak_factory_(this), |
screen_orientation_dispatcher_host_(NULL), |
- worker_ref_count_(0) { |
+ worker_ref_count_(0), |
+ weak_factory_(this) { |
widget_helper_ = new RenderWidgetHelper(); |
ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
@@ -2138,4 +2154,26 @@ void RenderProcessHostImpl::DecrementWorkerRefCount() { |
Cleanup(); |
} |
+#if defined(USE_MOJO) |
+void RenderProcessHostImpl::CreateMojoChannel() { |
+ if (mojo_channel_init_.get()) |
+ return; |
+ |
+ mojo::embedder::PlatformChannelPair channel_pair; |
+ mojo_channel_init_.reset(new MojoChannelInit); |
+ mojo_channel_init_->Init( |
+ PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()), |
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
+ if (mojo_channel_init_->is_handle_valid()) { |
+ base::ProcessHandle process_handle = run_renderer_in_process() ? |
+ base::Process::Current().handle() : |
+ child_process_launcher_->GetHandle(); |
+ base::PlatformFile client_file = |
+ PlatformFileFromScopedPlatformHandle(channel_pair.PassClientHandle()); |
+ Send(new MojoMsg_ChannelCreated( |
+ IPC::GetFileHandleForProcess(client_file, process_handle, true))); |
+ } |
+} |
+#endif |
+ |
} // namespace content |