| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (started_) | 135 if (started_) |
| 136 return true; | 136 return true; |
| 137 started_ = true; | 137 started_ = true; |
| 138 | 138 |
| 139 if (is_batch_mode_) | 139 if (is_batch_mode_) |
| 140 return true; | 140 return true; |
| 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(base::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 if (RenderProcessHost::run_renderer_in_process()) { | 151 if (RenderProcessHost::run_renderer_in_process()) { |
| 152 DCHECK(g_utility_main_thread_factory); | 152 DCHECK(g_utility_main_thread_factory); |
| 153 // See comment in RenderProcessHostImpl::Init() for the background on why we | 153 // See comment in RenderProcessHostImpl::Init() for the background on why we |
| 154 // support single process mode this way. | 154 // support single process mode this way. |
| 155 in_process_thread_.reset(g_utility_main_thread_factory(channel_id)); | 155 in_process_thread_.reset(g_utility_main_thread_factory(channel_id)); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { | 243 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { |
| 244 client_task_runner_->PostTask( | 244 client_task_runner_->PostTask( |
| 245 FROM_HERE, | 245 FROM_HERE, |
| 246 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), | 246 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), |
| 247 exit_code)); | 247 exit_code)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace content | 250 } // namespace content |
| OLD | NEW |