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/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "base/path_service.h" |
6 #include "base/posix/global_descriptors.h" | 7 #include "base/posix/global_descriptors.h" |
7 #include "content/browser/bootstrap_sandbox_manager_mac.h" | 8 #include "content/browser/bootstrap_sandbox_manager_mac.h" |
8 #include "content/browser/child_process_launcher.h" | 9 #include "content/browser/child_process_launcher.h" |
9 #include "content/browser/child_process_launcher_helper.h" | 10 #include "content/browser/child_process_launcher_helper.h" |
10 #include "content/browser/child_process_launcher_helper_posix.h" | 11 #include "content/browser/child_process_launcher_helper_posix.h" |
11 #include "content/browser/mach_broker_mac.h" | 12 #include "content/browser/mach_broker_mac.h" |
12 #include "content/public/common/result_codes.h" | 13 #include "content/public/common/result_codes.h" |
13 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 14 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
14 #include "mojo/edk/embedder/scoped_platform_handle.h" | 15 #include "mojo/edk/embedder/scoped_platform_handle.h" |
15 #include "sandbox/mac/bootstrap_sandbox.h" | 16 #include "sandbox/mac/bootstrap_sandbox.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 base::EnsureProcessTerminated(std::move(process.process)); | 140 base::EnsureProcessTerminated(std::move(process.process)); |
140 } | 141 } |
141 | 142 |
142 // static | 143 // static |
143 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( | 144 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( |
144 base::Process process, bool background) { | 145 base::Process process, bool background) { |
145 if (process.CanBackgroundProcesses()) | 146 if (process.CanBackgroundProcesses()) |
146 process.SetProcessBackgrounded(MachBroker::GetInstance(), background); | 147 process.SetProcessBackgrounded(MachBroker::GetInstance(), background); |
147 } | 148 } |
148 | 149 |
| 150 // static |
| 151 base::File ChildProcessLauncherHelper::OpenFile( |
| 152 const base::FilePath& path, |
| 153 base::MemoryMappedFile::Region* region) { |
| 154 base::FilePath exe_dir; |
| 155 bool result = base::PathService::Get(base::BasePathKey::DIR_EXE, &exe_dir); |
| 156 DCHECK(result); |
| 157 base::File file(exe_dir.Append(path), |
| 158 base::File::FLAG_OPEN | base::File::FLAG_READ); |
| 159 *region = base::MemoryMappedFile::Region::kWholeFile; |
| 160 return file; |
| 161 } |
| 162 |
149 } // namespace internal | 163 } // namespace internal |
150 } // namespace content | 164 } // namespace content |
OLD | NEW |