Chromium Code Reviews| 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..35e48d2c7c5be67eab0ded6868d845f6a0ae2721 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) |
|
boliu
2017/02/09 23:59:54
it's not clear to me where this chunk of code went
Jay Civelli
2017/02/10 06:32:34
Yes, it's not needed.
Now these files are specifie
|
| - 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,19 @@ 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) { |
| + base::File file(base::android::OpenApkAsset(path.value(), region)); |
|
boliu
2017/02/09 23:59:54
nit: one line return so RVO works?
Jay Civelli
2017/02/10 06:32:34
Done.
|
| + return file; |
| +} |
| + |
| } // namespace internal |
| } // namespace content |