Index: content/browser/child_process_launcher_helper_android.cc |
diff --git a/content/browser/child_process_launcher_helper_android.cc b/content/browser/child_process_launcher_helper_android.cc |
index 5a241753ea9c867916810b264c6c052a99f2d7c6..f37da2d32c39713e61b24947b4b7077e582d281e 100644 |
--- a/content/browser/child_process_launcher_helper_android.cc |
+++ b/content/browser/child_process_launcher_helper_android.cc |
@@ -6,6 +6,7 @@ |
#include <memory> |
+#include "base/android/apk_assets.h" |
#include "base/i18n/icu_util.h" |
#include "base/logging.h" |
#include "base/metrics/field_trial.h" |
@@ -89,32 +90,14 @@ ChildProcessLauncherHelper::GetFilesToMap() { |
CHECK(!command_line()->HasSwitch(switches::kSingleProcess)); |
std::unique_ptr<FileDescriptorInfo> files_to_register = |
- CreateDefaultPosixFilesToMap(*command_line(), child_process_id(), |
- mojo_client_handle()); |
- |
-#if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
- base::MemoryMappedFile::Region region; |
- auto maybe_register = [®ion, &files_to_register](int key, int fd) { |
- if (fd != -1) |
- files_to_register->ShareWithRegion(key, fd, region); |
- }; |
- maybe_register( |
- kV8NativesDataDescriptor, |
- gin::V8Initializer::GetOpenNativesFileForChildProcesses(®ion)); |
- maybe_register( |
- kV8SnapshotDataDescriptor32, |
- gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(®ion, true)); |
- maybe_register( |
- kV8SnapshotDataDescriptor64, |
- gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(®ion, false)); |
- |
- command_line()->AppendSwitch(::switches::kV8NativesPassedByFD); |
- command_line()->AppendSwitch(::switches::kV8SnapshotPassedByFD); |
-#endif // defined(V8_USE_EXTERNAL_STARTUP_DATA) |
+ CreateDefaultPosixFilesToMap(child_process_id(), mojo_client_handle(), |
+ true /* include_service_required_files */, |
+ GetProcessType(), command_line()); |
#if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE |
- int fd = base::i18n::GetIcuDataFileHandle(®ion); |
- files_to_register->ShareWithRegion(kAndroidICUDataDescriptor, fd, region); |
+ base::MemoryMappedFile::Region icu_region; |
+ int fd = base::i18n::GetIcuDataFileHandle(&icu_region); |
+ files_to_register->ShareWithRegion(kAndroidICUDataDescriptor, fd, icu_region); |
#endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE |
return files_to_register; |
@@ -179,5 +162,18 @@ void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( |
SetChildProcessInForeground(process.Handle(), !background); |
} |
+// static |
+void ChildProcessLauncherHelper::SetRegisteredFilesForService( |
+ const std::string& service_name, |
+ std::unique_ptr<catalog::RequiredFileMap> required_files) { |
+ SetFilesToShareForServicePosix(service_name, std::move(required_files)); |
+} |
+ |
+// static |
+base::File OpenFileToShare(const base::FilePath& path, |
+ base::MemoryMappedFile::Region* region) { |
+ return base::File(base::android::OpenApkAsset(path.value(), region)); |
+} |
+ |
} // namespace internal |
} // namespace content |