| 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 "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" | 
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" | 
| 10 #include "base/logging.h" | 10 #include "base/logging.h" | 
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" | 
| 13 #include "base/process/process.h" | 13 #include "base/process/process.h" | 
| 14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" | 
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" | 
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" | 
| 17 #include "content/public/browser/content_browser_client.h" | 17 #include "content/public/browser/content_browser_client.h" | 
| 18 #include "content/public/common/content_descriptors.h" | 18 #include "content/public/common/content_descriptors.h" | 
| 19 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" | 
| 20 #include "content/public/common/result_codes.h" | 20 #include "content/public/common/result_codes.h" | 
| 21 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 21 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 
| 22 | 22 | 
| 23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) | 
| 24 #include "base/files/file_path.h" | 24 #include "base/files/file_path.h" | 
| 25 #include "content/common/sandbox_win.h" | 25 #include "content/common/sandbox_win.h" | 
| 26 #include "content/public/common/sandbox_init.h" | 26 #include "content/public/common/sandbox_init.h" | 
| 27 #elif defined(OS_MACOSX) | 27 #elif defined(OS_MACOSX) | 
| 28 #include "content/browser/bootstrap_sandbox_mac.h" | 28 #include "content/browser/bootstrap_sandbox_mac.h" | 
|  | 29 #include "content/browser/browser_io_surface_manager_mac.h" | 
| 29 #include "content/browser/mach_broker_mac.h" | 30 #include "content/browser/mach_broker_mac.h" | 
| 30 #include "sandbox/mac/bootstrap_sandbox.h" | 31 #include "sandbox/mac/bootstrap_sandbox.h" | 
| 31 #elif defined(OS_ANDROID) | 32 #elif defined(OS_ANDROID) | 
| 32 #include "base/android/jni_android.h" | 33 #include "base/android/jni_android.h" | 
| 33 #include "content/browser/android/child_process_launcher_android.h" | 34 #include "content/browser/android/child_process_launcher_android.h" | 
| 34 #elif defined(OS_POSIX) | 35 #elif defined(OS_POSIX) | 
| 35 #include "base/memory/shared_memory.h" | 36 #include "base/memory/shared_memory.h" | 
| 36 #include "base/memory/singleton.h" | 37 #include "base/memory/singleton.h" | 
| 37 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 38 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 
| 38 #include "content/browser/zygote_host/zygote_host_impl_linux.h" | 39 #include "content/browser/zygote_host/zygote_host_impl_linux.h" | 
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 196     // inserted below. This ensures that while the child process may send its | 197     // inserted below. This ensures that while the child process may send its | 
| 197     // port to the parent prior to the parent leaving LaunchProcess, the | 198     // port to the parent prior to the parent leaving LaunchProcess, the | 
| 198     // order in which the record in MachBroker is updated is correct. | 199     // order in which the record in MachBroker is updated is correct. | 
| 199     MachBroker* broker = MachBroker::GetInstance(); | 200     MachBroker* broker = MachBroker::GetInstance(); | 
| 200     broker->GetLock().Acquire(); | 201     broker->GetLock().Acquire(); | 
| 201 | 202 | 
| 202     // Make sure the MachBroker is running, and inform it to expect a | 203     // Make sure the MachBroker is running, and inform it to expect a | 
| 203     // check-in from the new process. | 204     // check-in from the new process. | 
| 204     broker->EnsureRunning(); | 205     broker->EnsureRunning(); | 
| 205 | 206 | 
|  | 207     // Make sure the IOSurfaceManager service is running. | 
|  | 208     BrowserIOSurfaceManager::GetInstance()->EnsureRunning(); | 
|  | 209 | 
| 206     const int bootstrap_sandbox_policy = delegate->GetSandboxType(); | 210     const int bootstrap_sandbox_policy = delegate->GetSandboxType(); | 
| 207     if (ShouldEnableBootstrapSandbox() && | 211     if (ShouldEnableBootstrapSandbox() && | 
| 208         bootstrap_sandbox_policy != SANDBOX_TYPE_INVALID) { | 212         bootstrap_sandbox_policy != SANDBOX_TYPE_INVALID) { | 
| 209       options.replacement_bootstrap_name = | 213       options.replacement_bootstrap_name = | 
| 210           GetBootstrapSandbox()->server_bootstrap_name(); | 214           GetBootstrapSandbox()->server_bootstrap_name(); | 
| 211       GetBootstrapSandbox()->PrepareToForkWithPolicy( | 215       GetBootstrapSandbox()->PrepareToForkWithPolicy( | 
| 212           bootstrap_sandbox_policy); | 216           bootstrap_sandbox_policy); | 
| 213     } | 217     } | 
| 214 #endif  // defined(OS_MACOSX) | 218 #endif  // defined(OS_MACOSX) | 
| 215 | 219 | 
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 493 } | 497 } | 
| 494 | 498 | 
| 495 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 499 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 
| 496     Client* client) { | 500     Client* client) { | 
| 497   Client* ret = client_; | 501   Client* ret = client_; | 
| 498   client_ = client; | 502   client_ = client; | 
| 499   return ret; | 503   return ret; | 
| 500 } | 504 } | 
| 501 | 505 | 
| 502 }  // namespace content | 506 }  // namespace content | 
| OLD | NEW | 
|---|