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 #ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_POSIX_H_ | 5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_POSIX_H_ |
6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_POSIX_H_ | 6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_POSIX_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
| 10 #include "base/files/file.h" |
| 11 #include "base/files/memory_mapped_file.h" |
| 12 #include "services/catalog/public/cpp/manifest_parsing_util.h" |
| 13 |
10 namespace base { | 14 namespace base { |
11 class CommandLine; | 15 class CommandLine; |
| 16 class FilePath; |
12 } // namespace base | 17 } // namespace base |
13 | 18 |
14 namespace mojo { | 19 namespace mojo { |
15 namespace edk { | 20 namespace edk { |
16 struct PlatformHandle; | 21 struct PlatformHandle; |
17 } // namespace mojo | 22 } // namespace mojo |
18 } // namespace edk | 23 } // namespace edk |
19 | 24 |
20 // Contains the common functionalities between the various POSIX child process | 25 // Contains the common functionalities between the various POSIX child process |
21 // launcher implementations. | 26 // launcher implementations. |
22 | 27 |
23 namespace content { | 28 namespace content { |
24 | 29 |
25 class FileDescriptorInfo; | 30 class FileDescriptorInfo; |
26 | 31 |
27 namespace internal { | 32 namespace internal { |
28 | 33 |
29 std::unique_ptr<FileDescriptorInfo> CreateDefaultPosixFilesToMap( | 34 std::unique_ptr<FileDescriptorInfo> CreateDefaultPosixFilesToMap( |
30 const base::CommandLine& command_line, | |
31 int child_process_id, | 35 int child_process_id, |
32 const mojo::edk::PlatformHandle& mojo_client_handle); | 36 const mojo::edk::PlatformHandle& mojo_client_handle, |
| 37 bool include_service_required_files, |
| 38 const std::string& process_type, |
| 39 base::CommandLine* command_line); |
| 40 |
| 41 // Called by the service manager to register the files that should be mapped for |
| 42 // a service in the child process. |
| 43 void SetFilesToShareForServicePosix( |
| 44 const std::string& service_name, |
| 45 std::unique_ptr<catalog::RequiredFileMap> required_files); |
| 46 |
| 47 // Opens the file in read mode at the given path. Note that the path should be |
| 48 // relative and the way it is resolved is platform specific. |
| 49 // |region| is set to the region of the file that should be read. |
| 50 base::File OpenFileToShare(const base::FilePath& path, |
| 51 base::MemoryMappedFile::Region* region); |
33 | 52 |
34 } // namespace internal | 53 } // namespace internal |
35 | 54 |
36 } // namespace content | 55 } // namespace content |
37 | 56 |
38 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_POSIX_H_ | 57 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_POSIX_H_ |
OLD | NEW |