| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 *exposed_dir = exposed_dir_; | 58 *exposed_dir = exposed_dir_; |
| 59 } | 59 } |
| 60 #elif defined(OS_POSIX) | 60 #elif defined(OS_POSIX) |
| 61 | 61 |
| 62 virtual bool ShouldUseZygote() override { | 62 virtual bool ShouldUseZygote() override { |
| 63 return !no_sandbox_ && exposed_dir_.empty(); | 63 return !no_sandbox_ && exposed_dir_.empty(); |
| 64 } | 64 } |
| 65 virtual base::EnvironmentMap GetEnvironment() override { | 65 virtual base::EnvironmentMap GetEnvironment() override { |
| 66 return env_; | 66 return env_; |
| 67 } | 67 } |
| 68 virtual int GetIpcFd() override { | 68 virtual base::ScopedFD TakeIpcFd() override { |
| 69 return ipc_fd_; | 69 return ipc_fd_.Pass(); |
| 70 } | 70 } |
| 71 #endif // OS_WIN | 71 #endif // OS_WIN |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 | 74 |
| 75 base::FilePath exposed_dir_; | 75 base::FilePath exposed_dir_; |
| 76 | 76 |
| 77 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
| 78 bool launch_elevated_; | 78 bool launch_elevated_; |
| 79 #elif defined(OS_POSIX) | 79 #elif defined(OS_POSIX) |
| 80 base::EnvironmentMap env_; | 80 base::EnvironmentMap env_; |
| 81 bool no_sandbox_; | 81 bool no_sandbox_; |
| 82 int ipc_fd_; | 82 base::ScopedFD ipc_fd_; |
| 83 #endif // OS_WIN | 83 #endif // OS_WIN |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 UtilityMainThreadFactoryFunction g_utility_main_thread_factory = NULL; | 86 UtilityMainThreadFactoryFunction g_utility_main_thread_factory = NULL; |
| 87 | 87 |
| 88 UtilityProcessHost* UtilityProcessHost::Create( | 88 UtilityProcessHost* UtilityProcessHost::Create( |
| 89 const scoped_refptr<UtilityProcessHostClient>& client, | 89 const scoped_refptr<UtilityProcessHostClient>& client, |
| 90 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner) { | 90 const scoped_refptr<base::SequencedTaskRunner>& client_task_runner) { |
| 91 return new UtilityProcessHostImpl(client, client_task_runner); | 91 return new UtilityProcessHostImpl(client, client_task_runner); |
| 92 } | 92 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 if (!client_.get()) | 295 if (!client_.get()) |
| 296 return; | 296 return; |
| 297 | 297 |
| 298 client_task_runner_->PostTask( | 298 client_task_runner_->PostTask( |
| 299 FROM_HERE, | 299 FROM_HERE, |
| 300 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), | 300 base::Bind(&UtilityProcessHostClient::OnProcessCrashed, client_.get(), |
| 301 exit_code)); | 301 exit_code)); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace content | 304 } // namespace content |
| OLD | NEW |