| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "base/posix/global_descriptors.h" | 6 #include "base/posix/global_descriptors.h" |
| 7 #include "content/browser/child_process_launcher.h" | 7 #include "content/browser/child_process_launcher.h" |
| 8 #include "content/browser/child_process_launcher_helper.h" | 8 #include "content/browser/child_process_launcher_helper.h" |
| 9 #include "content/browser/child_process_launcher_helper_posix.h" | 9 #include "content/browser/child_process_launcher_helper_posix.h" |
| 10 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 10 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 : LAUNCH_RESULT_FAILURE; | 93 : LAUNCH_RESULT_FAILURE; |
| 94 return process; | 94 return process; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( | 97 void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( |
| 98 const ChildProcessLauncherHelper::Process& process, | 98 const ChildProcessLauncherHelper::Process& process, |
| 99 const base::LaunchOptions& options) { | 99 const base::LaunchOptions& options) { |
| 100 delete options.fds_to_remap; | 100 delete options.fds_to_remap; |
| 101 } | 101 } |
| 102 | 102 |
| 103 // static | |
| 104 base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus( | 103 base::TerminationStatus ChildProcessLauncherHelper::GetTerminationStatus( |
| 105 const ChildProcessLauncherHelper::Process& process, | 104 const ChildProcessLauncherHelper::Process& process, |
| 106 bool known_dead, | 105 bool known_dead, |
| 107 int* exit_code) { | 106 int* exit_code) { |
| 108 if (process.zygote) { | 107 if (process.zygote) { |
| 109 return process.zygote->GetTerminationStatus( | 108 return process.zygote->GetTerminationStatus( |
| 110 process.process.Handle(), known_dead, exit_code); | 109 process.process.Handle(), known_dead, exit_code); |
| 111 } | 110 } |
| 112 if (known_dead) { | 111 if (known_dead) { |
| 113 return base::GetKnownDeadTerminationStatus( | 112 return base::GetKnownDeadTerminationStatus( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 129 // On POSIX, we must additionally reap the child. | 128 // On POSIX, we must additionally reap the child. |
| 130 if (process.zygote) { | 129 if (process.zygote) { |
| 131 // If the renderer was created via a zygote, we have to proxy the reaping | 130 // If the renderer was created via a zygote, we have to proxy the reaping |
| 132 // through the zygote process. | 131 // through the zygote process. |
| 133 process.zygote->EnsureProcessTerminated(process.process.Handle()); | 132 process.zygote->EnsureProcessTerminated(process.process.Handle()); |
| 134 } else { | 133 } else { |
| 135 base::EnsureProcessTerminated(std::move(process.process)); | 134 base::EnsureProcessTerminated(std::move(process.process)); |
| 136 } | 135 } |
| 137 } | 136 } |
| 138 | 137 |
| 139 // static | |
| 140 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( | 138 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( |
| 141 base::Process process, bool background) { | 139 base::Process process, bool background) { |
| 142 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); | 140 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); |
| 143 if (process.CanBackgroundProcesses()) | 141 if (process.CanBackgroundProcesses()) |
| 144 process.SetProcessBackgrounded(background); | 142 process.SetProcessBackgrounded(background); |
| 145 } | 143 } |
| 146 | 144 |
| 147 // static | 145 // static |
| 148 void ChildProcessLauncherHelper::SetRegisteredFilesForService( | 146 void ChildProcessLauncherHelper::SetRegisteredFilesForService( |
| 149 const std::string& service_name, | 147 const std::string& service_name, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 163 bool result = base::PathService::Get(base::BasePathKey::DIR_EXE, &exe_dir); | 161 bool result = base::PathService::Get(base::BasePathKey::DIR_EXE, &exe_dir); |
| 164 DCHECK(result); | 162 DCHECK(result); |
| 165 base::File file(exe_dir.Append(path), | 163 base::File file(exe_dir.Append(path), |
| 166 base::File::FLAG_OPEN | base::File::FLAG_READ); | 164 base::File::FLAG_OPEN | base::File::FLAG_READ); |
| 167 *region = base::MemoryMappedFile::Region::kWholeFile; | 165 *region = base::MemoryMappedFile::Region::kWholeFile; |
| 168 return file; | 166 return file; |
| 169 } | 167 } |
| 170 | 168 |
| 171 } // namespace internal | 169 } // namespace internal |
| 172 } // namespace content | 170 } // namespace content |
| OLD | NEW |