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

Unified Diff: content/browser/child_process_launcher_helper.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | content/browser/child_process_launcher_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_launcher_helper.h
diff --git a/content/browser/child_process_launcher_helper.h b/content/browser/child_process_launcher_helper.h
index ead7d44f4936bc5dee5fcdc0d86a7f0b2522fe4d..51dad0ac45569365096fc9f8d45e8a444492cf0a 100644
--- a/content/browser/child_process_launcher_helper.h
+++ b/content/browser/child_process_launcher_helper.h
@@ -15,6 +15,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/common/result_codes.h"
#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/pending_process_connection.h"
#include "mojo/edk/embedder/scoped_platform_handle.h"
#if defined(OS_WIN)
@@ -73,6 +74,8 @@ class ChildProcessLauncherHelper :
BrowserThread::ID client_thread_id,
std::unique_ptr<base::CommandLine> command_line,
std::unique_ptr<SandboxedProcessLauncherDelegate> delegate,
+ std::unique_ptr<mojo::edk::PendingProcessConnection> pending_connection,
+ const mojo::edk::ProcessErrorCallback& process_error_callback,
const base::WeakPtr<ChildProcessLauncher>& child_process_launcher,
bool terminate_on_shutdown);
@@ -101,13 +104,18 @@ class ChildProcessLauncherHelper :
// |is_synchronous_launch| is set to false if the starting of the process is
// asynchonous (this is the case on Android), in which case the returned
// Process is not valid (and PostLaunchOnLauncherThread() will provide the
- // process once it is available).
+ // process once it is available). Iff |is_synchronous_launch| is set to false,
+ // the implementation must also take ownership of |*pending_connection| and
+ // |*server_handle| to eventually pass them on to
+ // PostLaunchOnLauncherThread().
// Platform specific.
ChildProcessLauncherHelper::Process LaunchProcessOnLauncherThread(
const base::LaunchOptions& options,
std::unique_ptr<FileMappedForLaunch> files_to_register,
bool* is_synchronous_launch,
- int* launch_result);
+ int* launch_result,
+ std::unique_ptr<mojo::edk::PendingProcessConnection>* pending_connection,
+ mojo::edk::ScopedPlatformHandle* server_handle);
// Called right after the process has been launched, whether it was created
// yet or not.
@@ -119,9 +127,12 @@ class ChildProcessLauncherHelper :
// Called once the process has been created, successfully or not.
// If |post_launch_on_client_thread_called| is false,
// this calls PostLaunchOnClientThread on the client thread.
- void PostLaunchOnLauncherThread(ChildProcessLauncherHelper::Process process,
- int launch_result,
- bool post_launch_on_client_thread_called);
+ void PostLaunchOnLauncherThread(
+ ChildProcessLauncherHelper::Process process,
+ int launch_result,
+ bool post_launch_on_client_thread_called,
+ std::unique_ptr<mojo::edk::PendingProcessConnection> pending_connection,
+ mojo::edk::ScopedPlatformHandle server_handle);
// Note that this could be called before PostLaunchOnLauncherThread() is
// called.
@@ -160,7 +171,9 @@ class ChildProcessLauncherHelper :
~ChildProcessLauncherHelper();
- void LaunchOnLauncherThread();
+ void LaunchOnLauncherThread(
+ std::unique_ptr<mojo::edk::PendingProcessConnection> pending_connection,
+ mojo::edk::ScopedPlatformHandle server_handle);
const mojo::edk::PlatformHandle& mojo_client_handle() const {
return mojo_client_handle_.get();
@@ -178,9 +191,10 @@ class ChildProcessLauncherHelper :
base::TimeTicks begin_launch_time_;
std::unique_ptr<base::CommandLine> command_line_;
std::unique_ptr<SandboxedProcessLauncherDelegate> delegate_;
+ std::unique_ptr<mojo::edk::PendingProcessConnection> pending_connection_;
+ const mojo::edk::ProcessErrorCallback process_error_callback_;
base::WeakPtr<ChildProcessLauncher> child_process_launcher_;
mojo::edk::ScopedPlatformHandle mojo_client_handle_;
- mojo::edk::ScopedPlatformHandle mojo_server_handle_;
bool terminate_on_shutdown_;
};
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | content/browser/child_process_launcher_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698