| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/utility_process_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" |
| 9 #include "content/browser/content_browser_client.h" | 10 #include "content/browser/content_browser_client.h" |
| 10 #include "content/common/content_switches.h" | 11 #include "content/common/content_switches.h" |
| 11 #include "content/common/utility_messages.h" | 12 #include "content/common/utility_messages.h" |
| 12 #include "ipc/ipc_switches.h" | 13 #include "ipc/ipc_switches.h" |
| 13 #include "ui/base/ui_base_switches.h" | 14 #include "ui/base/ui_base_switches.h" |
| 14 | 15 |
| 15 UtilityProcessHost::Client::Client() { | 16 UtilityProcessHost::Client::Client() { |
| 16 } | 17 } |
| 17 | 18 |
| 18 UtilityProcessHost::Client::~Client() { | 19 UtilityProcessHost::Client::~Client() { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 66 |
| 66 bool UtilityProcessHost::StartProcess() { | 67 bool UtilityProcessHost::StartProcess() { |
| 67 if (started_) | 68 if (started_) |
| 68 return true; | 69 return true; |
| 69 started_ = true; | 70 started_ = true; |
| 70 | 71 |
| 71 if (is_batch_mode_) | 72 if (is_batch_mode_) |
| 72 return true; | 73 return true; |
| 73 // Name must be set or metrics_service will crash in any test which | 74 // Name must be set or metrics_service will crash in any test which |
| 74 // launches a UtilityProcessHost. | 75 // launches a UtilityProcessHost. |
| 75 set_name(L"utility process"); | 76 set_name(ASCIIToUTF16("utility process")); |
| 76 | 77 |
| 77 if (!CreateChannel()) | 78 if (!CreateChannel()) |
| 78 return false; | 79 return false; |
| 79 | 80 |
| 80 FilePath exe_path = GetUtilityProcessCmd(); | 81 FilePath exe_path = GetUtilityProcessCmd(); |
| 81 if (exe_path.empty()) { | 82 if (exe_path.empty()) { |
| 82 NOTREACHED() << "Unable to get utility process binary name."; | 83 NOTREACHED() << "Unable to get utility process binary name."; |
| 83 return false; | 84 return false; |
| 84 } | 85 } |
| 85 | 86 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 134 |
| 134 void UtilityProcessHost::OnProcessCrashed(int exit_code) { | 135 void UtilityProcessHost::OnProcessCrashed(int exit_code) { |
| 135 BrowserThread::PostTask( | 136 BrowserThread::PostTask( |
| 136 client_thread_id_, FROM_HERE, | 137 client_thread_id_, FROM_HERE, |
| 137 NewRunnableMethod(client_.get(), &Client::OnProcessCrashed, exit_code)); | 138 NewRunnableMethod(client_.get(), &Client::OnProcessCrashed, exit_code)); |
| 138 } | 139 } |
| 139 | 140 |
| 140 bool UtilityProcessHost::CanShutdown() { | 141 bool UtilityProcessHost::CanShutdown() { |
| 141 return true; | 142 return true; |
| 142 } | 143 } |
| OLD | NEW |