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

Side by Side Diff: content/browser/child_process_launcher_helper_linux.cc

Issue 2686983003: Avoid a thread hop when initializing IPC to new processes (Closed)
Patch Set: . 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/posix/global_descriptors.h" 5 #include "base/posix/global_descriptors.h"
6 #include "content/browser/child_process_launcher.h" 6 #include "content/browser/child_process_launcher.h"
7 #include "content/browser/child_process_launcher_helper.h" 7 #include "content/browser/child_process_launcher_helper.h"
8 #include "content/browser/child_process_launcher_helper_posix.h" 8 #include "content/browser/child_process_launcher_helper_posix.h"
9 #include "content/browser/renderer_host/render_sandbox_host_linux.h" 9 #include "content/browser/renderer_host/render_sandbox_host_linux.h"
10 #include "content/browser/zygote_host/zygote_communication_linux.h" 10 #include "content/browser/zygote_host/zygote_communication_linux.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 options->environ = delegate_->GetEnvironment(); 85 options->environ = delegate_->GetEnvironment();
86 // fds_to_remap will de deleted in AfterLaunchOnLauncherThread() below. 86 // fds_to_remap will de deleted in AfterLaunchOnLauncherThread() below.
87 options->fds_to_remap = fds_to_map.release(); 87 options->fds_to_remap = fds_to_map.release();
88 } 88 }
89 89
90 ChildProcessLauncherHelper::Process 90 ChildProcessLauncherHelper::Process
91 ChildProcessLauncherHelper::LaunchProcessOnLauncherThread( 91 ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
92 const base::LaunchOptions& options, 92 const base::LaunchOptions& options,
93 std::unique_ptr<FileMappedForLaunch> files_to_register, 93 std::unique_ptr<FileMappedForLaunch> files_to_register,
94 bool* is_synchronous_launch, 94 bool* is_synchronous_launch,
95 int* launch_result) { 95 int* launch_result,
96 std::unique_ptr<mojo::edk::PendingProcessConnection>* pending_connection,
97 mojo::edk::ScopedPlatformHandle* server_handle) {
96 *is_synchronous_launch = true; 98 *is_synchronous_launch = true;
97 99
98 ZygoteHandle* zygote_handle = 100 ZygoteHandle* zygote_handle =
99 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) ? 101 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) ?
100 nullptr : delegate_->GetZygote(); 102 nullptr : delegate_->GetZygote();
101 if (zygote_handle) { 103 if (zygote_handle) {
102 // This code runs on the PROCESS_LAUNCHER thread so race conditions are not 104 // This code runs on the PROCESS_LAUNCHER thread so race conditions are not
103 // an issue with the lazy initialization. 105 // an issue with the lazy initialization.
104 if (*zygote_handle == nullptr) { 106 if (*zygote_handle == nullptr) {
105 *zygote_handle = CreateZygote(); 107 *zygote_handle = CreateZygote();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // static 169 // static
168 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( 170 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread(
169 base::Process process, bool background) { 171 base::Process process, bool background) {
170 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); 172 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
171 if (process.CanBackgroundProcesses()) 173 if (process.CanBackgroundProcesses())
172 process.SetProcessBackgrounded(background); 174 process.SetProcessBackgrounded(background);
173 } 175 }
174 176
175 } // namespace internal 177 } // namespace internal
176 } // namespace content 178 } // namespace content
OLDNEW
« 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