Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/utility_process_host_impl.h" | 5 #include "content/browser/utility_process_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 | 141 |
| 142 // Name must be set or metrics_service will crash in any test which | 142 // Name must be set or metrics_service will crash in any test which |
| 143 // launches a UtilityProcessHost. | 143 // launches a UtilityProcessHost. |
| 144 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this)); | 144 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this)); |
| 145 process_->SetName(ASCIIToUTF16("utility process")); | 145 process_->SetName(ASCIIToUTF16("utility process")); |
| 146 | 146 |
| 147 std::string channel_id = process_->GetHost()->CreateChannel(); | 147 std::string channel_id = process_->GetHost()->CreateChannel(); |
| 148 if (channel_id.empty()) | 148 if (channel_id.empty()) |
| 149 return false; | 149 return false; |
| 150 | 150 |
| 151 // Single process not supported in multiple dll mode currently. | 151 if (RenderProcessHost::run_renderer_in_process()) { |
| 152 if (RenderProcessHost::run_renderer_in_process() && | 152 CHECK(g_utility_main_thread_factory); |
|
piman
2013/11/07 22:09:52
Should be DCHECK.
| |
| 153 g_utility_main_thread_factory) { | |
| 154 // See comment in RenderProcessHostImpl::Init() for the background on why we | 153 // See comment in RenderProcessHostImpl::Init() for the background on why we |
| 155 // support single process mode this way. | 154 // support single process mode this way. |
| 156 in_process_thread_.reset(g_utility_main_thread_factory(channel_id)); | 155 in_process_thread_.reset(g_utility_main_thread_factory(channel_id)); |
| 157 in_process_thread_->Start(); | 156 in_process_thread_->Start(); |
| 158 } else { | 157 } else { |
| 159 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 158 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 160 int child_flags = child_flags_; | 159 int child_flags = child_flags_; |
| 161 | 160 |
| 162 #if defined(OS_POSIX) | 161 #if defined(OS_POSIX) |
| 163 bool has_cmd_prefix = browser_command_line.HasSwitch( | 162 bool has_cmd_prefix = browser_command_line.HasSwitch( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 } | 241 } |
| 243 | 242 |
| 244 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { | 243 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { |
| 245 client_task_runner_->PostTask( | 244 client_task_runner_->PostTask( |
| 246 FROM_HERE, | 245 FROM_HERE, |
| 247 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), | 246 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), |
| 248 exit_code)); | 247 exit_code)); |
| 249 } | 248 } |
| 250 | 249 |
| 251 } // namespace content | 250 } // namespace content |
| OLD | NEW |