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

Side by Side Diff: remoting/host/daemon_process.h

Issue 10855249: [Chromoting] The daemon process now starts the networking process and passes the host configuration… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing signal.h 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/config_file_watcher.cc ('k') | remoting/host/daemon_process.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_DAEMON_PROCESS_H_ 5 #ifndef REMOTING_HOST_DAEMON_PROCESS_H_
6 #define REMOTING_HOST_DAEMON_PROCESS_H_ 6 #define REMOTING_HOST_DAEMON_PROCESS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "ipc/ipc_channel.h" 12 #include "ipc/ipc_channel.h"
13 #include "ipc/ipc_channel_proxy.h" 13 #include "ipc/ipc_channel_proxy.h"
14 #include "remoting/base/stoppable.h" 14 #include "remoting/base/stoppable.h"
15 #include "remoting/host/config_file_watcher.h"
16 #include "remoting/host/worker_process_ipc_delegate.h"
17
18 class FilePath;
15 19
16 namespace base { 20 namespace base {
17 class SingleThreadTaskRunner; 21 class SingleThreadTaskRunner;
18 class Thread;
19 } // namespace base 22 } // namespace base
20 23
21 namespace IPC {
22 class Message;
23 } // namespace IPC
24
25 namespace remoting { 24 namespace remoting {
26 25
27 // This class implements core of the daemon process. It manages the networking 26 // This class implements core of the daemon process. It manages the networking
28 // process running at lower privileges and maintains the list of virtual 27 // process running at lower privileges and maintains the list of virtual
29 // terminals. 28 // terminals.
30 class DaemonProcess : public Stoppable, public IPC::Listener { 29 class DaemonProcess
30 : public Stoppable,
31 public ConfigFileWatcher::Delegate,
32 public WorkerProcessIpcDelegate {
31 public: 33 public:
32 virtual ~DaemonProcess(); 34 virtual ~DaemonProcess();
33 35
34 // Creates a platform-specific implementation of the daemon process object. 36 // Creates a platform-specific implementation of the daemon process object.
35 static scoped_ptr<DaemonProcess> Create( 37 static scoped_ptr<DaemonProcess> Create(
36 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 38 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
37 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 39 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
38 const base::Closure& stopped_callback); 40 const base::Closure& stopped_callback);
39 41
40 // IPC::Listener implementation. 42 // ConfigFileWatcher::Delegate
43 virtual void OnConfigUpdated(const std::string& serialized_config) OVERRIDE;
44 virtual void OnConfigWatcherError() OVERRIDE;
45
46 // WorkerProcessIpcDelegate implementation.
47 virtual void OnChannelConnected() OVERRIDE;
41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
42 49
50 // Sends an IPC message to the network process. The message will be dropped
51 // unless the network process is connected over the IPC channel.
52 virtual void Send(IPC::Message* message) = 0;
53
43 protected: 54 protected:
44 DaemonProcess(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 55 DaemonProcess(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
45 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 56 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
46 const base::Closure& stopped_callback); 57 const base::Closure& stopped_callback);
47 58
48 // Reads the host configuration and launches the networking process. 59 // Reads the host configuration and launches the networking process.
49 void Init(); 60 void Initialize();
50 61
51 // Stoppable implementation. 62 // Stoppable implementation.
52 virtual void DoStop() OVERRIDE; 63 virtual void DoStop() OVERRIDE;
53 64
54 // Launches the network process and establishes an IPC channel with it. 65 // Launches the network process and establishes an IPC channel with it.
55 virtual bool LaunchNetworkProcess() = 0; 66 virtual void LaunchNetworkProcess() = 0;
67
68 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner() {
69 return main_task_runner_;
70 }
71
72 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() {
73 return io_task_runner_;
74 }
56 75
57 private: 76 private:
77 scoped_ptr<ConfigFileWatcher> config_watcher_;
78
79 // The configuration file contents.
80 std::string serialized_config_;
81
58 // The main task runner. Typically it is the UI message loop. 82 // The main task runner. Typically it is the UI message loop.
59 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 83 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
60 84
61 // Handles IPC and background I/O tasks. 85 // Handles IPC and background I/O tasks.
62 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 86 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
63 87
64 // The IPC channel connecting the daemon process to the networking process.
65 scoped_ptr<IPC::ChannelProxy> network_process_channel_;
66
67 DISALLOW_COPY_AND_ASSIGN(DaemonProcess); 88 DISALLOW_COPY_AND_ASSIGN(DaemonProcess);
68 }; 89 };
69 90
70 } // namespace remoting 91 } // namespace remoting
71 92
72 #endif // REMOTING_HOST_DAEMON_PROCESS_H_ 93 #endif // REMOTING_HOST_DAEMON_PROCESS_H_
OLDNEW
« no previous file with comments | « remoting/host/config_file_watcher.cc ('k') | remoting/host/daemon_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698