| 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 99cc64f68438f6132589c88653043328cbdd71d1..7e7f3aa04c8e746ad5796a9dbf362bc0086681db 100644
|
| --- a/content/browser/utility_process_host_impl.cc
|
| +++ b/content/browser/utility_process_host_impl.cc
|
| @@ -157,6 +157,7 @@ UtilityProcessHostImpl::UtilityProcessHostImpl(
|
| #endif
|
| started_(false),
|
| name_(base::ASCIIToUTF16("utility process")),
|
| + mojo_application_host_(new MojoApplicationHost),
|
| weak_ptr_factory_(this) {
|
| }
|
|
|
| @@ -217,21 +218,13 @@ void UtilityProcessHostImpl::SetEnv(const base::EnvironmentMap& env) {
|
|
|
| #endif // OS_POSIX
|
|
|
| -bool UtilityProcessHostImpl::StartMojoMode() {
|
| - CHECK(!mojo_application_host_);
|
| - mojo_application_host_.reset(new MojoApplicationHost);
|
| -
|
| - bool mojo_result = mojo_application_host_->Init();
|
| - if (!mojo_result)
|
| - return false;
|
| -
|
| +bool UtilityProcessHostImpl::Start() {
|
| return StartProcess();
|
| }
|
|
|
| ServiceRegistry* UtilityProcessHostImpl::GetServiceRegistry() {
|
| - if (mojo_application_host_)
|
| - return mojo_application_host_->service_registry();
|
| - return nullptr;
|
| + DCHECK(mojo_application_host_);
|
| + return mojo_application_host_->service_registry();
|
| }
|
|
|
| void UtilityProcessHostImpl::SetName(const base::string16& name) {
|
| @@ -254,6 +247,10 @@ bool UtilityProcessHostImpl::StartProcess() {
|
| if (is_batch_mode_)
|
| return true;
|
|
|
| + bool mojo_result = mojo_application_host_->Init();
|
| + if (!mojo_result)
|
| + return false;
|
| +
|
| // Name must be set or metrics_service will crash in any test which
|
| // launches a UtilityProcessHost.
|
| process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this));
|
| @@ -397,15 +394,14 @@ void UtilityProcessHostImpl::OnProcessCrashed(int 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);
|
| - }
|
| + DCHECK(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
|
|
|