Index: content/browser/utility_process_host_impl.cc |
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc |
index 0d24e3a5e6906b25fe18e6a41e8ee885251439cb..2abe95b15fa3102219f0aa97ac820690aa3fdf7e 100644 |
--- a/content/browser/utility_process_host_impl.cc |
+++ b/content/browser/utility_process_host_impl.cc |
@@ -9,12 +9,14 @@ |
#include "base/command_line.h" |
#include "base/lazy_instance.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/process/process_handle.h" |
#include "base/run_loop.h" |
#include "base/sequenced_task_runner.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/synchronization/lock.h" |
#include "base/synchronization/waitable_event.h" |
#include "content/browser/browser_child_process_host_impl.h" |
+#include "content/browser/mojo/mojo_application_host.h" |
#include "content/browser/renderer_host/render_process_host_impl.h" |
#include "content/common/child_process_host_impl.h" |
#include "content/common/utility_messages.h" |
@@ -166,6 +168,19 @@ void UtilityProcessHostImpl::SetEnv(const base::EnvironmentMap& env) { |
#endif // OS_POSIX |
+bool UtilityProcessHostImpl::StartMojoMode() { |
+ mojo_application_host_.reset(new MojoApplicationHost); |
+ mojo_application_host_->Init(); |
+ return StartProcess(); |
+} |
+ |
+ServiceRegistry* UtilityProcessHostImpl::GetServiceRegistry() { |
+ if (mojo_application_host_) |
+ return mojo_application_host_->service_registry(); |
+ |
+ return nullptr; |
+} |
+ |
bool UtilityProcessHostImpl::StartProcess() { |
if (started_) |
return true; |
@@ -297,4 +312,16 @@ void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { |
exit_code)); |
} |
+void UtilityProcessHostImpl::OnProcessLaunched() { |
+ if (mojo_application_host_) { |
+ base::ProcessHandle handle; |
+ if (RenderProcessHost::run_renderer_in_process()) |
+ handle = base::GetCurrentProcessHandle(); |
+ else |
+ handle = process_->GetData().handle; |
+ |
+ mojo_application_host_->Activate(this, handle); |
+ } |
+} |
+ |
} // namespace content |