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

Unified Diff: content/browser/child_process_launcher_helper_mac.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Created 3 years, 6 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 30435b6dff14702d1c34a272f4d4432c7bf73f0e..7a6ee5aa2e306504e26d96f64a93e9370ed09e8e 100644
--- a/content/browser/child_process_launcher_helper_mac.cc
+++ b/content/browser/child_process_launcher_helper_mac.cc
@@ -29,7 +29,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(
@@ -42,13 +42,10 @@ 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();
- // 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
@@ -81,7 +78,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;
@@ -95,8 +92,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));

Powered by Google App Engine
This is Rietveld 408576698