| 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/child_process_launcher.h" | 5 #include "content/browser/child_process_launcher.h" |
| 6 | 6 |
| 7 #include <utility> // For std::pair. | 7 #include <utility> // For std::pair. |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 28 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 29 #elif defined(OS_MACOSX) | 29 #elif defined(OS_MACOSX) |
| 30 #include "content/browser/mach_broker_mac.h" | 30 #include "content/browser/mach_broker_mac.h" |
| 31 #elif defined(OS_ANDROID) | 31 #elif defined(OS_ANDROID) |
| 32 #include "base/android/jni_android.h" | 32 #include "base/android/jni_android.h" |
| 33 #include "content/browser/android/child_process_launcher_android.h" | 33 #include "content/browser/android/child_process_launcher_android.h" |
| 34 #elif defined(OS_POSIX) | 34 #elif defined(OS_POSIX) |
| 35 #include "base/memory/singleton.h" | 35 #include "base/memory/singleton.h" |
| 36 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 36 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
| 37 #include "content/browser/zygote_host/zygote_host_impl_linux.h" | 37 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
| 38 #include "content/common/child_process_sandbox_support_impl_linux.h" |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 #if defined(OS_POSIX) | 41 #if defined(OS_POSIX) |
| 41 #include "base/posix/global_descriptors.h" | 42 #include "base/posix/global_descriptors.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 namespace content { | 45 namespace content { |
| 45 | 46 |
| 46 // Having the functionality of ChildProcessLauncher be in an internal | 47 // Having the functionality of ChildProcessLauncher be in an internal |
| 47 // ref counted object allows us to automatically terminate the process when the | 48 // ref counted object allows us to automatically terminate the process when the |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 files_to_register[i].id + | 250 files_to_register[i].id + |
| 250 base::GlobalDescriptors::kBaseDescriptor)); | 251 base::GlobalDescriptors::kBaseDescriptor)); |
| 251 } | 252 } |
| 252 | 253 |
| 253 #if !defined(OS_MACOSX) | 254 #if !defined(OS_MACOSX) |
| 254 if (process_type == switches::kRendererProcess) { | 255 if (process_type == switches::kRendererProcess) { |
| 255 const int sandbox_fd = | 256 const int sandbox_fd = |
| 256 RenderSandboxHostLinux::GetInstance()->GetRendererSocket(); | 257 RenderSandboxHostLinux::GetInstance()->GetRendererSocket(); |
| 257 fds_to_map.push_back(std::make_pair( | 258 fds_to_map.push_back(std::make_pair( |
| 258 sandbox_fd, | 259 sandbox_fd, |
| 259 kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); | 260 GetSandboxFD())); |
| 260 } | 261 } |
| 261 #endif // defined(OS_MACOSX) | 262 #endif // defined(OS_MACOSX) |
| 262 | 263 |
| 263 // Actually launch the app. | 264 // Actually launch the app. |
| 264 base::LaunchOptions options; | 265 base::LaunchOptions options; |
| 265 options.environ = env; | 266 options.environ = env; |
| 266 options.fds_to_remap = &fds_to_map; | 267 options.fds_to_remap = &fds_to_map; |
| 267 | 268 |
| 268 #if defined(OS_MACOSX) | 269 #if defined(OS_MACOSX) |
| 269 // Hold the MachBroker lock for the duration of LaunchProcess. The child | 270 // Hold the MachBroker lock for the duration of LaunchProcess. The child |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 GetHandle(), background)); | 494 GetHandle(), background)); |
| 494 } | 495 } |
| 495 | 496 |
| 496 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 497 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
| 497 bool terminate_on_shutdown) { | 498 bool terminate_on_shutdown) { |
| 498 if (context_.get()) | 499 if (context_.get()) |
| 499 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 500 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
| 500 } | 501 } |
| 501 | 502 |
| 502 } // namespace content | 503 } // namespace content |
| OLD | NEW |