| 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/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 Send(new UtilityMsg_BatchMode_Started()); | 63 Send(new UtilityMsg_BatchMode_Started()); |
| 64 return is_batch_mode_; | 64 return is_batch_mode_; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void UtilityProcessHostImpl::EndBatchMode() { | 67 void UtilityProcessHostImpl::EndBatchMode() { |
| 68 CHECK(is_batch_mode_); | 68 CHECK(is_batch_mode_); |
| 69 is_batch_mode_ = false; | 69 is_batch_mode_ = false; |
| 70 Send(new UtilityMsg_BatchMode_Finished()); | 70 Send(new UtilityMsg_BatchMode_Finished()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void UtilityProcessHostImpl::SetExposedDir(const FilePath& dir) { | 73 void UtilityProcessHostImpl::SetExposedDir(const base::FilePath& dir) { |
| 74 exposed_dir_ = dir; | 74 exposed_dir_ = dir; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void UtilityProcessHostImpl::DisableSandbox() { | 77 void UtilityProcessHostImpl::DisableSandbox() { |
| 78 no_sandbox_ = true; | 78 no_sandbox_ = true; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void UtilityProcessHostImpl::EnableZygote() { | 81 void UtilityProcessHostImpl::EnableZygote() { |
| 82 use_linux_zygote_ = true; | 82 use_linux_zygote_ = true; |
| 83 } | 83 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 // When running under gdb, forking /proc/self/exe ends up forking the gdb | 119 // When running under gdb, forking /proc/self/exe ends up forking the gdb |
| 120 // executable instead of Chromium. It is almost safe to assume that no | 120 // executable instead of Chromium. It is almost safe to assume that no |
| 121 // updates will happen while a developer is running with | 121 // updates will happen while a developer is running with |
| 122 // |switches::kUtilityCmdPrefix|. See ChildProcessHost::GetChildPath() for | 122 // |switches::kUtilityCmdPrefix|. See ChildProcessHost::GetChildPath() for |
| 123 // a similar case with Valgrind. | 123 // a similar case with Valgrind. |
| 124 if (has_cmd_prefix) | 124 if (has_cmd_prefix) |
| 125 child_flags = ChildProcessHost::CHILD_NORMAL; | 125 child_flags = ChildProcessHost::CHILD_NORMAL; |
| 126 #endif | 126 #endif |
| 127 | 127 |
| 128 FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); | 128 base::FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); |
| 129 if (exe_path.empty()) { | 129 if (exe_path.empty()) { |
| 130 NOTREACHED() << "Unable to get utility process binary name."; | 130 NOTREACHED() << "Unable to get utility process binary name."; |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 CommandLine* cmd_line = new CommandLine(exe_path); | 134 CommandLine* cmd_line = new CommandLine(exe_path); |
| 135 cmd_line->AppendSwitchASCII(switches::kProcessType, | 135 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 136 switches::kUtilityProcess); | 136 switches::kUtilityProcess); |
| 137 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 137 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 138 std::string locale = GetContentClient()->browser()->GetApplicationLocale(); | 138 std::string locale = GetContentClient()->browser()->GetApplicationLocale(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 | 191 |
| 192 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { | 192 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { |
| 193 client_task_runner_->PostTask( | 193 client_task_runner_->PostTask( |
| 194 FROM_HERE, | 194 FROM_HERE, |
| 195 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), | 195 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), |
| 196 exit_code)); | 196 exit_code)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace content | 199 } // namespace content |
| OLD | NEW |