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

Unified Diff: remoting/host/win/wts_session_process_launcher.h

Issue 10828181: [Chromoting] Moving common logic responsible for launching child processes to WorkerProcessLauncher… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 years, 4 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: remoting/host/win/wts_session_process_launcher.h
diff --git a/remoting/host/win/wts_session_process_launcher.h b/remoting/host/win/wts_session_process_launcher.h
index 577c0746c2a08ae5b44fdb6ab2b6bffd86393422..3bde4c1c3fdf6c67e51eb08277a9d3ac97e71113 100644
--- a/remoting/host/win/wts_session_process_launcher.h
+++ b/remoting/host/win/wts_session_process_launcher.h
@@ -15,9 +15,9 @@
#include "base/time.h"
#include "base/timer.h"
#include "base/win/scoped_handle.h"
-#include "base/win/object_watcher.h"
#include "ipc/ipc_channel.h"
#include "remoting/base/stoppable.h"
+#include "remoting/host/win/worker_process_launcher.h"
#include "remoting/host/win/wts_console_observer.h"
namespace base {
@@ -36,13 +36,13 @@ class WtsConsoleMonitor;
class WtsSessionProcessLauncher
: public Stoppable,
- public base::win::ObjectWatcher::Delegate,
- public IPC::Listener,
+ public WorkerProcessLauncher::Delegate,
public WtsConsoleObserver {
public:
- // Constructs a WtsSessionProcessLauncher object. All interaction with
- // |monitor| should happen on |main_message_loop|. |ipc_message_loop| has
- // to be an I/O message loop.
+ // Constructs a WtsSessionProcessLauncher object. |stopped_callback| and
+ // |main_message_loop| are passed to the undelying |Stoppable| implementation.
+ // All interaction with |monitor| should happen on |main_message_loop|.
+ // |ipc_message_loop| must be an I/O message loop.
WtsSessionProcessLauncher(
const base::Closure& stopped_callback,
WtsConsoleMonitor* monitor,
@@ -51,10 +51,12 @@ class WtsSessionProcessLauncher
virtual ~WtsSessionProcessLauncher();
- // base::win::ObjectWatcher::Delegate implementation.
- virtual void OnObjectSignaled(HANDLE object) OVERRIDE;
-
- // IPC::Listener implementation.
+ // WorkerProcessLauncher::Delegate implementation.
+ virtual bool DoLaunchProcess(
+ const std::string& channel_name,
+ base::win::ScopedHandle* process_exit_event_out) OVERRIDE;
+ virtual void DoKillProcess(DWORD exit_code) OVERRIDE;
+ virtual void OnChannelConnected(DWORD peer_pid) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// WtsConsoleObserver implementation.
@@ -71,10 +73,16 @@ class WtsSessionProcessLauncher
// reason.
void LaunchProcess();
+ // Called when the launcher reports the process to be stopped.
+ void OnLauncherStopped();
+
// Sends the Secure Attention Sequence to the session represented by
// |session_token_|.
void OnSendSasToConsole();
+ // |true| if this object is currently attached to the console session.
+ bool attached_;
+
// Time of the last launch attempt.
base::Time launch_time_;
@@ -93,29 +101,13 @@ class WtsSessionProcessLauncher
// This pointer is used to unsubscribe from session attach and detach events.
WtsConsoleMonitor* monitor_;
- // The handle of the process injected into the console session.
- base::Process process_;
+ scoped_ptr<WorkerProcessLauncher> launcher_;
- // Used to determine when the launched process terminates.
- base::win::ObjectWatcher process_watcher_;
+ base::win::ScopedHandle worker_process_;
// The token to be used to launch a process in a different session.
base::win::ScopedHandle session_token_;
- // Defines the states the process launcher can be in.
- enum State {
- StateDetached,
- StateStarting,
- StateAttached,
- };
-
- // Current state of the process launcher.
- State state_;
-
- // The Chromoting IPC channel connecting the service to the per-session
- // process.
- scoped_ptr<IPC::ChannelProxy> chromoting_channel_;
-
scoped_ptr<SasInjector> sas_injector_;
DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher);

Powered by Google App Engine
This is Rietveld 408576698