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

Side by Side Diff: remoting/host/win/host_service.h

Issue 10829467: [Chromoting] Introducing refcount-based life time management of the message loops in the service (d… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/simple_host_process.cc ('k') | remoting/host/win/host_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_HOST_WIN_HOST_SERVICE_H_ 5 #ifndef REMOTING_HOST_WIN_HOST_SERVICE_H_
6 #define REMOTING_HOST_WIN_HOST_SERVICE_H_ 6 #define REMOTING_HOST_WIN_HOST_SERVICE_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "remoting/host/win/wts_console_monitor.h" 14 #include "remoting/host/win/wts_console_monitor.h"
15 15
16 class CommandLine; 16 class CommandLine;
17 class MessageLoop; 17 class MessageLoop;
18 18
19 namespace base { 19 namespace base {
20 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
21 } // namespace base 21 } // namespace base
22 22
23 namespace remoting { 23 namespace remoting {
24 24
25 #if defined(REMOTING_MULTI_PROCESS) 25 class AutoThreadTaskRunner;
26 class DaemonProcess;
27 #endif // defined(REMOTING_MULTI_PROCESS)
28
29 class Stoppable; 26 class Stoppable;
30 class WtsConsoleObserver; 27 class WtsConsoleObserver;
31 28
32 #if !defined(REMOTING_MULTI_PROCESS) 29 #if defined(REMOTING_MULTI_PROCESS)
30 class DaemonProcess;
31 #else // !defined(REMOTING_MULTI_PROCESS)
33 class WtsSessionProcessLauncher; 32 class WtsSessionProcessLauncher;
34 #endif // !defined(REMOTING_MULTI_PROCESS) 33 #endif // !defined(REMOTING_MULTI_PROCESS)
35 34
36 class HostService : public WtsConsoleMonitor { 35 class HostService : public WtsConsoleMonitor {
37 public: 36 public:
38 static HostService* GetInstance(); 37 static HostService* GetInstance();
39 38
40 // This function parses the command line and selects the action routine. 39 // This function parses the command line and selects the action routine.
41 bool InitWithCommandLine(const CommandLine* command_line); 40 bool InitWithCommandLine(const CommandLine* command_line);
42 41
43 // Invoke the choosen action routine. 42 // Invoke the choosen action routine.
44 int Run(); 43 int Run();
45 44
46 // WtsConsoleMonitor implementation 45 // WtsConsoleMonitor implementation
47 virtual void AddWtsConsoleObserver(WtsConsoleObserver* observer) OVERRIDE; 46 virtual void AddWtsConsoleObserver(WtsConsoleObserver* observer) OVERRIDE;
48 virtual void RemoveWtsConsoleObserver( 47 virtual void RemoveWtsConsoleObserver(
49 WtsConsoleObserver* observer) OVERRIDE; 48 WtsConsoleObserver* observer) OVERRIDE;
50 49
51 private: 50 private:
52 HostService(); 51 HostService();
53 ~HostService(); 52 ~HostService();
54 53
55 void OnChildStopped(); 54 void OnChildStopped();
56 55
57 // Notifies the service of changes in session state. 56 // Notifies the service of changes in session state.
58 void OnSessionChange(); 57 void OnSessionChange();
59 58
59 // Creates the process launcher.
60 void CreateLauncher(
61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
62
60 // This is a common entry point to the main service loop called by both 63 // This is a common entry point to the main service loop called by both
61 // RunAsService() and RunInConsole(). 64 // RunAsService() and RunInConsole().
62 void RunMessageLoop(MessageLoop* message_loop); 65 void RunMessageLoop(MessageLoop* message_loop);
63 66
64 // Runs the binary specified by the command line, elevated. 67 // Runs the binary specified by the command line, elevated.
65 int Elevate(); 68 int Elevate();
66 69
67 // This function handshakes with the service control manager and starts 70 // This function handshakes with the service control manager and starts
68 // the service. 71 // the service.
69 int RunAsService(); 72 int RunAsService();
(...skipping 21 matching lines...) Expand all
91 // Current physical console session id. 94 // Current physical console session id.
92 uint32 console_session_id_; 95 uint32 console_session_id_;
93 96
94 // The list of observers receiving notifications about any session attached 97 // The list of observers receiving notifications about any session attached
95 // to the physical console. 98 // to the physical console.
96 ObserverList<WtsConsoleObserver> console_observers_; 99 ObserverList<WtsConsoleObserver> console_observers_;
97 100
98 scoped_ptr<Stoppable> child_; 101 scoped_ptr<Stoppable> child_;
99 102
100 // Service message loop. 103 // Service message loop.
101 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 104 scoped_refptr<AutoThreadTaskRunner> main_task_runner_;
102 105
103 // The action routine to be executed. 106 // The action routine to be executed.
104 int (HostService::*run_routine_)(); 107 int (HostService::*run_routine_)();
105 108
106 // The service status handle. 109 // The service status handle.
107 SERVICE_STATUS_HANDLE service_status_handle_; 110 SERVICE_STATUS_HANDLE service_status_handle_;
108 111
109 // A waitable event that is used to wait until the service is stopped. 112 // A waitable event that is used to wait until the service is stopped.
110 base::WaitableEvent stopped_event_; 113 base::WaitableEvent stopped_event_;
111 114
112 // Singleton. 115 // Singleton.
113 friend struct DefaultSingletonTraits<HostService>; 116 friend struct DefaultSingletonTraits<HostService>;
114 117
115 DISALLOW_COPY_AND_ASSIGN(HostService); 118 DISALLOW_COPY_AND_ASSIGN(HostService);
116 }; 119 };
117 120
118 } // namespace remoting 121 } // namespace remoting
119 122
120 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_ 123 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_
OLDNEW
« no previous file with comments | « remoting/host/simple_host_process.cc ('k') | remoting/host/win/host_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698