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_H_ | 5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_H_ |
6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_H_ | 6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_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" | |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/process/kill.h" | 14 #include "base/process/kill.h" |
13 #include "base/process/process.h" | 15 #include "base/process/process.h" |
14 #include "build/build_config.h" | 16 #include "build/build_config.h" |
15 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/common/result_codes.h" | 18 #include "content/public/common/result_codes.h" |
17 #include "mojo/edk/embedder/embedder.h" | 19 #include "mojo/edk/embedder/embedder.h" |
18 #include "mojo/edk/embedder/scoped_platform_handle.h" | 20 #include "mojo/edk/embedder/scoped_platform_handle.h" |
21 #include "services/catalog/public/cpp/manifest_parsing_util.h" | |
19 | 22 |
20 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
21 #include "sandbox/win/src/sandbox_types.h" | 24 #include "sandbox/win/src/sandbox_types.h" |
22 #else | 25 #else |
23 #include "content/public/browser/file_descriptor_info.h" | 26 #include "content/public/browser/file_descriptor_info.h" |
24 #endif | 27 #endif |
25 | 28 |
26 #if defined(OS_LINUX) | 29 #if defined(OS_LINUX) |
27 #include "content/public/common/zygote_handle.h" | 30 #include "content/public/common/zygote_handle.h" |
28 #endif | 31 #endif |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 // Terminates the process with the normal exit code and ensures it has been | 151 // Terminates the process with the normal exit code and ensures it has been |
149 // stopped. By returning a normal exit code this ensures UMA won't treat this | 152 // stopped. By returning a normal exit code this ensures UMA won't treat this |
150 // as a crash. | 153 // as a crash. |
151 // Returns immediately and perform the work on the launcher thread. | 154 // Returns immediately and perform the work on the launcher thread. |
152 static void ForceNormalProcessTerminationAsync( | 155 static void ForceNormalProcessTerminationAsync( |
153 ChildProcessLauncherHelper::Process process); | 156 ChildProcessLauncherHelper::Process process); |
154 | 157 |
155 static void SetProcessBackgroundedOnLauncherThread( | 158 static void SetProcessBackgroundedOnLauncherThread( |
156 base::Process process, bool background); | 159 base::Process process, bool background); |
157 | 160 |
161 static void SetRegisteredFilesForService( | |
162 const std::string& service_name, | |
163 std::unique_ptr<catalog::RequiredFileMap> required_files); | |
164 | |
165 // Opens the file in read mode at the given path. Note that the path should be | |
166 // relative and the way it is resolved is platform specific. | |
167 // |region| is set to the region of the file that should be read. | |
168 static base::File OpenFile(const base::FilePath& path, | |
Ken Rockot(use gerrit already)
2017/02/09 17:17:28
nit: Maybe a more detailed name like OpenFileToSha
Jay Civelli
2017/02/09 22:08:27
Done.
| |
169 base::MemoryMappedFile::Region* region); | |
170 | |
158 private: | 171 private: |
159 friend class base::RefCountedThreadSafe<ChildProcessLauncherHelper>; | 172 friend class base::RefCountedThreadSafe<ChildProcessLauncherHelper>; |
160 | 173 |
161 ~ChildProcessLauncherHelper(); | 174 ~ChildProcessLauncherHelper(); |
162 | 175 |
163 void LaunchOnLauncherThread(); | 176 void LaunchOnLauncherThread(); |
164 | 177 |
165 const mojo::edk::PlatformHandle& mojo_client_handle() const { | 178 const mojo::edk::PlatformHandle& mojo_client_handle() const { |
166 return mojo_client_handle_.get(); | 179 return mojo_client_handle_.get(); |
167 } | 180 } |
(...skipping 14 matching lines...) Expand all Loading... | |
182 mojo::edk::ScopedPlatformHandle mojo_client_handle_; | 195 mojo::edk::ScopedPlatformHandle mojo_client_handle_; |
183 mojo::edk::ScopedPlatformHandle mojo_server_handle_; | 196 mojo::edk::ScopedPlatformHandle mojo_server_handle_; |
184 bool terminate_on_shutdown_; | 197 bool terminate_on_shutdown_; |
185 }; | 198 }; |
186 | 199 |
187 } // namespace internal | 200 } // namespace internal |
188 | 201 |
189 } // namespace content | 202 } // namespace content |
190 | 203 |
191 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_H_ | 204 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_HELPER_H_ |
OLD | NEW |