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

Unified Diff: content/browser/child_process_launcher_helper_mac.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Merge Created 3 years, 5 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_mac.cc
diff --git a/content/browser/child_process_launcher_helper_mac.cc b/content/browser/child_process_launcher_helper_mac.cc
index c90a377d6479e255336788b072ee75b70a6faa80..30f77f81ea63c7a429787338aa4e1924aa8e1542 100644
--- a/content/browser/child_process_launcher_helper_mac.cc
+++ b/content/browser/child_process_launcher_helper_mac.cc
@@ -38,7 +38,7 @@ void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
DCHECK_CURRENTLY_ON(client_thread_id_);
}
-std::unique_ptr<FileDescriptorInfo>
+std::unique_ptr<PosixFileDescriptorInfo>
ChildProcessLauncherHelper::GetFilesToMap() {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
return CreateDefaultPosixFilesToMap(
@@ -51,9 +51,8 @@ void ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
const FileMappedForLaunch& files_to_register,
base::LaunchOptions* options) {
// Convert FD mapping to FileHandleMappingVector.
- std::unique_ptr<base::FileHandleMappingVector> fds_to_map =
- files_to_register.GetMappingWithIDAdjustment(
- base::GlobalDescriptors::kBaseDescriptor);
+ options->fds_to_remap = files_to_register.GetMappingWithIDAdjustment(
+ base::GlobalDescriptors::kBaseDescriptor);
options->environ = delegate_->GetEnvironment();
@@ -73,7 +72,7 @@ void ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
base::FilePath helper_executable;
CHECK(PathService::Get(content::CHILD_PROCESS_EXE, &helper_executable));
- fds_to_map->push_back(std::make_pair(pipe, pipe));
+ options->fds_to_remap.push_back(std::make_pair(pipe, pipe));
// Update the command line to enable the V2 sandbox and pass the
// communication FD to the helper executable.
@@ -81,9 +80,6 @@ void ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
command_line_->AppendArg("--fd_mapping=" + std::to_string(pipe));
}
- // fds_to_remap will de deleted in AfterLaunchOnLauncherThread() below.
- options->fds_to_remap = fds_to_map.release();
-
// Hold the MachBroker lock for the duration of LaunchProcess. The child will
// send its task port to the parent almost immediately after startup. The Mach
// message will be delivered to the parent, but updating the record of the
@@ -115,7 +111,7 @@ void ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
ChildProcessLauncherHelper::Process
ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
const base::LaunchOptions& options,
- std::unique_ptr<FileDescriptorInfo> files_to_register,
+ std::unique_ptr<PosixFileDescriptorInfo> files_to_register,
bool* is_synchronous_launch,
int* launch_result) {
*is_synchronous_launch = true;
@@ -129,8 +125,6 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread(
const ChildProcessLauncherHelper::Process& process,
const base::LaunchOptions& options) {
- delete options.fds_to_remap;
-
std::unique_ptr<sandbox::PreExecDelegate> pre_exec_delegate =
base::WrapUnique(static_cast<sandbox::PreExecDelegate*>(
options.pre_exec_delegate));
« no previous file with comments | « content/browser/child_process_launcher_helper_linux.cc ('k') | content/browser/child_process_launcher_helper_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698