| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 using content::UtilityProcessHostClient; | 24 using content::UtilityProcessHostClient; |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 UtilityProcessHost* UtilityProcessHost::Create( | 28 UtilityProcessHost* UtilityProcessHost::Create( |
| 29 UtilityProcessHostClient* client, | 29 UtilityProcessHostClient* client, |
| 30 BrowserThread::ID client_thread_id) { | 30 BrowserThread::ID client_thread_id) { |
| 31 return new UtilityProcessHostImpl(client, client_thread_id); | 31 return new UtilityProcessHostImpl(client, client_thread_id); |
| 32 } | 32 } |
| 33 | 33 |
| 34 } | 34 } // namespace content |
| 35 | 35 |
| 36 UtilityProcessHostImpl::UtilityProcessHostImpl( | 36 UtilityProcessHostImpl::UtilityProcessHostImpl( |
| 37 UtilityProcessHostClient* client, | 37 UtilityProcessHostClient* client, |
| 38 BrowserThread::ID client_thread_id) | 38 BrowserThread::ID client_thread_id) |
| 39 : client_(client), | 39 : client_(client), |
| 40 client_thread_id_(client_thread_id), | 40 client_thread_id_(client_thread_id), |
| 41 is_batch_mode_(false), | 41 is_batch_mode_(false), |
| 42 no_sandbox_(false), | 42 no_sandbox_(false), |
| 43 #if defined(OS_LINUX) | 43 #if defined(OS_LINUX) |
| 44 child_flags_(ChildProcessHost::CHILD_ALLOW_SELF), | 44 child_flags_(ChildProcessHost::CHILD_ALLOW_SELF), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void UtilityProcessHostImpl::DisableSandbox() { | 83 void UtilityProcessHostImpl::DisableSandbox() { |
| 84 no_sandbox_ = true; | 84 no_sandbox_ = true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void UtilityProcessHostImpl::EnableZygote() { | 87 void UtilityProcessHostImpl::EnableZygote() { |
| 88 use_linux_zygote_ = true; | 88 use_linux_zygote_ = true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 #if defined(OS_POSIX) | 91 #if defined(OS_POSIX) |
| 92 | 92 |
| 93 void UtilityProcessHostImpl::SetEnv(const base::environment_vector& env) { | 93 void UtilityProcessHostImpl::SetEnv(const base::EnvironmentVector& env) { |
| 94 env_ = env; | 94 env_ = env; |
| 95 } | 95 } |
| 96 | 96 |
| 97 #endif // OS_POSIX | 97 #endif // OS_POSIX |
| 98 | 98 |
| 99 bool UtilityProcessHostImpl::StartProcess() { | 99 bool UtilityProcessHostImpl::StartProcess() { |
| 100 if (started_) | 100 if (started_) |
| 101 return true; | 101 return true; |
| 102 started_ = true; | 102 started_ = true; |
| 103 | 103 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 message)); | 174 message)); |
| 175 return true; | 175 return true; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { | 178 void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { |
| 179 BrowserThread::PostTask( | 179 BrowserThread::PostTask( |
| 180 client_thread_id_, FROM_HERE, | 180 client_thread_id_, FROM_HERE, |
| 181 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), | 181 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), |
| 182 exit_code)); | 182 exit_code)); |
| 183 } | 183 } |
| OLD | NEW |