Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Unified Diff: content/browser/child_process_launcher_helper_android.cc

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Fix build. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..955689e6cd060f535b87f2925795788b77b5d7fd 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 = [&region, &files_to_register](int key, int fd) {
- if (fd != -1)
- files_to_register->ShareWithRegion(key, fd, region);
- };
- maybe_register(
- kV8NativesDataDescriptor,
- gin::V8Initializer::GetOpenNativesFileForChildProcesses(&region));
- maybe_register(
- kV8SnapshotDataDescriptor32,
- gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(&region, true));
- maybe_register(
- kV8SnapshotDataDescriptor64,
- gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(&region, 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(&region);
- 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,
+ 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
« no previous file with comments | « content/browser/child_process_launcher_helper.h ('k') | content/browser/child_process_launcher_helper_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698