| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 // static | 147 // static |
| 148 void ChildProcessLauncherHelper::SetRegisteredFilesForService( | 148 void ChildProcessLauncherHelper::SetRegisteredFilesForService( |
| 149 const std::string& service_name, | 149 const std::string& service_name, |
| 150 catalog::RequiredFileMap required_files) { | 150 catalog::RequiredFileMap required_files) { |
| 151 SetFilesToShareForServicePosix(service_name, std::move(required_files)); | 151 SetFilesToShareForServicePosix(service_name, std::move(required_files)); |
| 152 } | 152 } |
| 153 | 153 |
| 154 // static | 154 // static |
| 155 void ChildProcessLauncherHelper::ResetRegisteredFilesForTesting() { |
| 156 ResetFilesToShareForTestingPosix(); |
| 157 } |
| 158 |
| 159 // static |
| 155 base::File OpenFileToShare(const base::FilePath& path, | 160 base::File OpenFileToShare(const base::FilePath& path, |
| 156 base::MemoryMappedFile::Region* region) { | 161 base::MemoryMappedFile::Region* region) { |
| 157 base::FilePath exe_dir; | 162 base::FilePath exe_dir; |
| 158 bool result = base::PathService::Get(base::BasePathKey::DIR_EXE, &exe_dir); | 163 bool result = base::PathService::Get(base::BasePathKey::DIR_EXE, &exe_dir); |
| 159 DCHECK(result); | 164 DCHECK(result); |
| 160 base::File file(exe_dir.Append(path), | 165 base::File file(exe_dir.Append(path), |
| 161 base::File::FLAG_OPEN | base::File::FLAG_READ); | 166 base::File::FLAG_OPEN | base::File::FLAG_READ); |
| 162 *region = base::MemoryMappedFile::Region::kWholeFile; | 167 *region = base::MemoryMappedFile::Region::kWholeFile; |
| 163 return file; | 168 return file; |
| 164 } | 169 } |
| 165 | 170 |
| 166 } // namespace internal | 171 } // namespace internal |
| 167 } // namespace content | 172 } // namespace content |
| OLD | NEW |