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