Index: remoting/host/wts_session_process_launcher_win.h |
diff --git a/remoting/host/wts_session_process_launcher_win.h b/remoting/host/wts_session_process_launcher_win.h |
index efcb93a75d01f1b72eeefb70304ec2c0b6e71577..c0e752fd065f464dd7d9ba227ca64dfde360bfbd 100644 |
--- a/remoting/host/wts_session_process_launcher_win.h |
+++ b/remoting/host/wts_session_process_launcher_win.h |
@@ -10,6 +10,8 @@ |
#include "base/basictypes.h" |
#include "base/file_path.h" |
#include "base/compiler_specific.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/process.h" |
#include "base/time.h" |
#include "base/timer.h" |
@@ -21,7 +23,7 @@ |
namespace base { |
-class Thread; |
+class MessageLoopProxy; |
} // namespace base |
@@ -36,32 +38,39 @@ namespace remoting { |
class SasInjector; |
class WtsConsoleMonitor; |
+class WorkerProcessLauncher; |
class WtsSessionProcessLauncher |
- : public base::win::ObjectWatcher::Delegate, |
- public IPC::Channel::Listener, |
+ : public IPC::Channel::Listener, |
public WtsConsoleObserver { |
public: |
- // Constructs a WtsSessionProcessLauncher object. |monitor| and |io_thread| |
- // must outlive this object. |host_binary| is the name of the executable to |
- // be launched in the console session. |
+ // Constructs a WtsSessionProcessLauncher object. |monitor| must outlive this |
+ // object. |host_binary| is the name of the executable to be launched in |
+ // the console session. |
WtsSessionProcessLauncher(WtsConsoleMonitor* monitor, |
const FilePath& host_binary, |
- base::Thread* io_thread); |
+ base::MessageLoopProxy* ipc_message_loop); |
Wez
2012/03/15 23:24:31
scoped_refptr<MessageLoopProxy>
alexeypa (please no reviews)
2012/03/16 17:43:50
Done.
|
virtual ~WtsSessionProcessLauncher(); |
- // base::win::ObjectWatcher::Delegate implementation. |
- virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
- |
// IPC::Channel::Listener implementation. |
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ virtual void OnChannelError() OVERRIDE; |
// WtsConsoleObserver implementation. |
virtual void OnSessionAttached(uint32 session_id) OVERRIDE; |
virtual void OnSessionDetached() OVERRIDE; |
private: |
+ // Takes the channel name and returns a channel handle for the server end of |
+ // the channel. |
+ bool CreateChannelHandle(const std::string& channel_name, |
+ IPC::ChannelHandle* channel_handle_out); |
+ |
+ // Launches a worker process passing the IPC channel name to it. |
+ bool LaunchWorker(const std::string& channel_name, |
+ base::Process* process_out); |
+ |
// Attempts to launch the host process in the current console session. |
// Schedules next launch attempt if creation of the process fails for any |
// reason. |
@@ -74,48 +83,33 @@ class WtsSessionProcessLauncher |
// Name of the host executable. |
FilePath host_binary_; |
+ // Message loop used by the IPC channel. |
+ scoped_refptr<base::MessageLoopProxy> ipc_message_loop_; |
+ |
+ // This is a place to store pipe handle until the host process has been |
+ // started. |
+ base::win::ScopedHandle ipc_pipe_; |
+ |
// Time of the last launch attempt. |
base::Time launch_time_; |
// Current backoff delay. |
base::TimeDelta launch_backoff_; |
+ scoped_ptr<WorkerProcessLauncher> launcher_; |
+ |
// Timer used to schedule the next attempt to launch the process. |
base::OneShotTimer<WtsSessionProcessLauncher> timer_; |
- // The I/O thread hosts the Chromoting IPC channel and any other code |
- // requiring an I/O message loop. |
- base::Thread* io_thread_; |
- |
// This pointer is used to unsubscribe from session attach and detach events. |
WtsConsoleMonitor* monitor_; |
// Impersonation token that has the SE_TCB_NAME privilege enabled. |
base::win::ScopedHandle privileged_token_; |
- // The handle of the process injected into the console session. |
- base::Process process_; |
- |
- // Used to determine when the launched process terminates. |
- base::win::ObjectWatcher process_watcher_; |
- |
// 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); |