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 b1c9104dc2f6ebbf36cc584febb47b9073f996dc..bf23c9ad2aa2f454142e5e0888093acb7ba67000 100644 |
--- a/remoting/host/wts_session_process_launcher_win.h |
+++ b/remoting/host/wts_session_process_launcher_win.h |
@@ -8,28 +8,93 @@ |
#include <windows.h> |
#include "base/basictypes.h" |
+#include "base/file_path.h" |
+#include "base/memory/scoped_ptr.h" |
Wez
2012/02/28 00:22:07
nit: This include goes after compiler_specific.h
alexeypa (please no reviews)
2012/02/28 01:14:04
Done.
|
#include "base/compiler_specific.h" |
+#include "base/process.h" |
+#include "base/time.h" |
+#include "base/timer.h" |
+#include "base/win/object_watcher.h" |
#include "remoting/host/wts_console_observer_win.h" |
+namespace base { |
+namespace win { |
+ |
+class ScopedHandle; |
+ |
+} // namespace win |
+} // namespace base |
+ |
namespace remoting { |
class WtsConsoleMonitor; |
-class WtsSessionProcessLauncher : public WtsConsoleObserver { |
+class WtsSessionProcessLauncher |
+ : public base::win::ObjectWatcher::Delegate, |
+ public WtsConsoleObserver { |
public: |
// Constructs a WtsSessionProcessLauncher object. |monitor| must outlive this |
- // class. |
- WtsSessionProcessLauncher(WtsConsoleMonitor* monitor); |
+ // class. |host_binary| is the host executable name to be launched in |
Wez
2012/02/28 00:22:07
nit: ... is the name of the executable to be launc
alexeypa (please no reviews)
2012/02/28 01:14:04
Done.
|
+ // the session(s) attached to the console. |
Wez
2012/02/28 00:22:07
nit: the console session.
There can't be >1 conso
alexeypa (please no reviews)
2012/02/28 01:14:04
Done.
|
+ WtsSessionProcessLauncher(WtsConsoleMonitor* monitor, |
+ const FilePath& host_binary); |
+ |
virtual ~WtsSessionProcessLauncher(); |
+ // base::win::ObjectWatcher::Delegate implementation |
+ virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
+ |
// WtsConsoleObserver implementation |
virtual void OnSessionAttached(uint32 session_id) OVERRIDE; |
virtual void OnSessionDetached() OVERRIDE; |
private: |
+ // Attempts to launch the host process in the currently attached session. |
+ // Schedules next launch attempt if creation of the process fails for any |
+ // reason. |
+ void LaunchProcess(); |
+ |
+ // Name of the host executable. |
+ FilePath host_binary_; |
+ |
+ // Time of the last launch attempt. |
+ base::Time launch_time_; |
+ |
+ // Current backoff delay. |
+ base::TimeDelta launch_backoff_; |
+ |
+ // Number of times we tried to launch the process. |
+ int launch_attempts_; |
alexeypa (please no reviews)
2012/02/28 01:14:04
launch_attempts_ is not used BTW. I removed it.
|
+ |
+ // This pointer is used to unsubscribe from session attach and detach events. |
WtsConsoleMonitor* monitor_; |
+ // Impersonation token that has the SE_TCB_NAME privilege enabled. |
+ scoped_ptr<base::win::ScopedHandle> privileged_token_; |
+ |
+ // A handle of the process injected into the watched session. |
Wez
2012/02/28 00:22:07
nit: A -> The
alexeypa (please no reviews)
2012/02/28 01:14:04
Done.
|
+ base::Process process_; |
+ |
+ // Monitors the launched process calling a callback when it terminates. |
+ base::win::ObjectWatcher process_watcher_; |
+ |
+ // A token to be used to launch a process in a different session. |
Wez
2012/02/28 00:22:07
nit: A -> The
This is the token with the console
alexeypa (please no reviews)
2012/02/28 01:14:04
Done.
|
+ scoped_ptr<base::win::ScopedHandle> session_token_; |
+ |
+ // Defines the states the process launcher can be. |
Wez
2012/02/28 00:22:07
nit: ... can be in.
alexeypa (please no reviews)
2012/02/28 01:14:04
Done.
|
+ enum State { |
+ StateDetached, |
+ StateStarting, |
+ StateAttached, |
+ }; |
+ |
+ // Current state of the process launcher. |
+ State state_; |
+ |
+ // This time is used to delay next attempt to launch the host. |
Wez
2012/02/28 00:22:07
nit: suggest "Timer used to schedule the next atte
alexeypa (please no reviews)
2012/02/28 01:14:04
Done.
|
+ base::OneShotTimer<WtsSessionProcessLauncher> timer_; |
Wez
2012/02/28 00:22:07
Why is this timer down here when the |launch_time_
alexeypa (please no reviews)
2012/02/28 01:14:04
The members are sorted alphabetically. It makes se
Wez
2012/02/28 22:55:36
I'd group them logically and sort alphabetically o
alexeypa (please no reviews)
2012/02/29 04:17:56
Make sense. Coincidentally they are grouped and so
|
+ |
DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); |
}; |