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

Unified Diff: content/browser/child_process_launcher_helper_linux.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_linux.cc
diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc
index 283666a0cc59f8f538b2d753f2f38030338bb72f..b0c476d682c61a98c116b638a5e38e5cf74f39fb 100644
--- a/content/browser/child_process_launcher_helper_linux.cc
+++ b/content/browser/child_process_launcher_helper_linux.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/path_service.h"
#include "base/posix/global_descriptors.h"
#include "content/browser/child_process_launcher.h"
#include "content/browser/child_process_launcher_helper.h"
@@ -34,38 +35,9 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
std::unique_ptr<FileMappedForLaunch>
ChildProcessLauncherHelper::GetFilesToMap() {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
-
- std::unique_ptr<FileDescriptorInfo> files_to_register =
- CreateDefaultPosixFilesToMap(*command_line(), child_process_id(),
- mojo_client_handle());
-
-#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
- bool snapshot_loaded = false;
- base::MemoryMappedFile::Region unused_region;
- base::PlatformFile natives_pf =
- gin::V8Initializer::GetOpenNativesFileForChildProcesses(&unused_region);
- DCHECK_GE(natives_pf, 0);
- files_to_register->Share(kV8NativesDataDescriptor, natives_pf);
-
- base::MemoryMappedFile::Region snapshot_region;
- base::PlatformFile snapshot_pf =
- gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(
- &snapshot_region);
- // Failure to load the V8 snapshot is not necessarily an error. V8 can start
- // up (slower) without the snapshot.
- if (snapshot_pf != -1) {
- snapshot_loaded = true;
- files_to_register->Share(kV8SnapshotDataDescriptor, snapshot_pf);
- }
- if (GetProcessType() != switches::kZygoteProcess) {
- command_line()->AppendSwitch(::switches::kV8NativesPassedByFD);
- if (snapshot_loaded) {
- command_line()->AppendSwitch(::switches::kV8SnapshotPassedByFD);
- }
- }
-#endif // defined(V8_USE_EXTERNAL_STARTUP_DATA)
-
- return files_to_register;
+ return CreateDefaultPosixFilesToMap(child_process_id(), mojo_client_handle(),
+ true /* include_service_required_files */,
+ GetProcessType(), command_line());
}
void ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
@@ -172,5 +144,24 @@ void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread(
process.SetProcessBackgrounded(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) {
+ base::FilePath exe_dir;
+ bool result = base::PathService::Get(base::BasePathKey::DIR_EXE, &exe_dir);
+ DCHECK(result);
+ base::File file(exe_dir.Append(path),
+ base::File::FLAG_OPEN | base::File::FLAG_READ);
+ *region = base::MemoryMappedFile::Region::kWholeFile;
+ return file;
+}
+
} // namespace internal
} // namespace content
« no previous file with comments | « content/browser/child_process_launcher_helper_android.cc ('k') | content/browser/child_process_launcher_helper_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698