From 9733976130e9df953c41469be9cbfcbdd4667887 Mon Sep 17 00:00:00 2001 From: "alexeypa@chromium.org" Date: Wed, 10 Oct 2012 19:00:06 +0000 Subject: [Chromoting] Reimplement the worker process launcher to address issues with job control and launching of elevated processes. This CL makes three changes: 1. We create a new job object every time we launch a worker into a new session, under Vista and above. This addresses the limitation that a job object used with processes from one session cannot later be re-used to manage processes from a different session. 2. We launch and manage worker processes directly on XP/W2K3, without a job object. We don't need a job object since these platforms don't support/need elevation anyway. This addresses the limitation that processes created via CreateRemoteSessionProcess() cannot be assigned to a job object. 3. We allow WorkerProcessLauncher instances to be dropped synchronously from the caller's perspective; the class takes care of asynchronous tear-down tasks transparently. This addresses a race condition in tear-down of old worker processes and creation of new ones arising from delayed session change notifications. The new layout assigns the following responsibilities: - WorkerProcessLauncher is used to manage a worker process, taking care of setting up the IPC channel, and re-launching it w/ exponential back-off. It supports fire-and-forget tear-down. - WorkerProcessLauncher defers launch & termination to a caller-supplied Delegate, responsible for launching the process as the caller requires. - Our current "single-process" service launches the host process via WtsConsoleSessionProcessDriver, which tracks which session is currently attached to the console and uses WtsSessionProcessDelegate instances to have WorkerProcessLauncher re-launch the host into the new console session whenever it is switched. WtsSessionProcessDelegate takes care of OS-version-specific process management tasks. - Our experimental "multi-process" service launches the host's network process, undependent of session lifetimes, by passing an UnprivilegedProcessDelegate to WorkerProcessLauncher. This launches the host process in the same session as the caller. BUG=153005, 148781, 149098 TEST=remoting_unittests.WorkerProcessLauncherTest Review URL: https://chromiumcodereview.appspot.com/11040065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161140 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/host/win/host_service.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'remoting/host/win/host_service.cc') diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc index b882d52..d8ff0d1 100644 --- a/remoting/host/win/host_service.cc +++ b/remoting/host/win/host_service.cc @@ -39,7 +39,7 @@ #include "remoting/host/win/wts_console_observer.h" #if !defined(REMOTING_MULTI_PROCESS) -#include "remoting/host/win/wts_session_process_launcher.h" +#include "remoting/host/win/wts_console_session_process_driver.h" #endif // !defined(REMOTING_MULTI_PROCESS) using base::StringPrintf; @@ -213,8 +213,8 @@ void HostService::CreateLauncher( #else // !defined(REMOTING_MULTI_PROCESS) - // Create the session process launcher. - child_.reset(new WtsSessionProcessLauncher( + // Create the console session process driver. + child_.reset(new WtsConsoleSessionProcessDriver( base::Bind(&HostService::OnChildStopped, base::Unretained(this)), this, main_task_runner_, @@ -249,7 +249,7 @@ int HostService::Elevate() { CommandLine command_line(CommandLine::NO_PROGRAM); command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(), kCopiedSwitchNames, - _countof(kCopiedSwitchNames)); + arraysize(kCopiedSwitchNames)); CommandLine::StringType parameters = command_line.GetCommandLineString(); // Launch the child process requesting elevation. -- cgit v1.1