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

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: Destructors of ref-counted objects should not be public. 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 unified diff | Download patch | Annotate | Revision Log
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)
26 class DaemonProcess;
27 #endif // defined(REMOTING_MULTI_PROCESS)
28
29 class Stoppable; 25 class Stoppable;
30 class WtsConsoleObserver; 26 class WtsConsoleObserver;
31 27
32 #if !defined(REMOTING_MULTI_PROCESS) 28 #if defined(REMOTING_MULTI_PROCESS)
29 class DaemonProcess;
30 #else // !defined(REMOTING_MULTI_PROCESS)
33 class WtsSessionProcessLauncher; 31 class WtsSessionProcessLauncher;
34 #endif // !defined(REMOTING_MULTI_PROCESS) 32 #endif // !defined(REMOTING_MULTI_PROCESS)
35 33
36 class HostService : public WtsConsoleMonitor { 34 class HostService : public WtsConsoleMonitor {
37 public: 35 public:
38 static HostService* GetInstance(); 36 static HostService* GetInstance();
39 37
40 // This function parses the command line and selects the action routine. 38 // This function parses the command line and selects the action routine.
41 bool InitWithCommandLine(const CommandLine* command_line); 39 bool InitWithCommandLine(const CommandLine* command_line);
42 40
43 // Invoke the choosen action routine. 41 // Invoke the choosen action routine.
44 int Run(); 42 int Run();
45 43
46 // WtsConsoleMonitor implementation 44 // WtsConsoleMonitor implementation
47 virtual void AddWtsConsoleObserver(WtsConsoleObserver* observer) OVERRIDE; 45 virtual void AddWtsConsoleObserver(WtsConsoleObserver* observer) OVERRIDE;
48 virtual void RemoveWtsConsoleObserver( 46 virtual void RemoveWtsConsoleObserver(
49 WtsConsoleObserver* observer) OVERRIDE; 47 WtsConsoleObserver* observer) OVERRIDE;
50 48
51 private: 49 private:
52 HostService(); 50 HostService();
53 ~HostService(); 51 ~HostService();
54 52
55 void OnChildStopped(); 53 void OnChildStopped();
56 54
57 // Notifies the service of changes in session state. 55 // Notifies the service of changes in session state.
58 void OnSessionChange(); 56 void OnSessionChange();
59 57
58 // Creates object to be run on the main message loop right before entering
59 // the loop.
60 bool BeforeMessageLoop();
61
60 // This is a common entry point to the main service loop called by both 62 // This is a common entry point to the main service loop called by both
61 // RunAsService() and RunInConsole(). 63 // RunAsService() and RunInConsole().
62 void RunMessageLoop(MessageLoop* message_loop); 64 void RunMessageLoop(MessageLoop* message_loop);
63 65
64 // Runs the binary specified by the command line, elevated. 66 // Runs the binary specified by the command line, elevated.
65 int Elevate(); 67 int Elevate();
66 68
67 // This function handshakes with the service control manager and starts 69 // This function handshakes with the service control manager and starts
68 // the service. 70 // the service.
69 int RunAsService(); 71 int RunAsService();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 113
112 // Singleton. 114 // Singleton.
113 friend struct DefaultSingletonTraits<HostService>; 115 friend struct DefaultSingletonTraits<HostService>;
114 116
115 DISALLOW_COPY_AND_ASSIGN(HostService); 117 DISALLOW_COPY_AND_ASSIGN(HostService);
116 }; 118 };
117 119
118 } // namespace remoting 120 } // namespace remoting
119 121
120 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_ 122 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698