OLD | NEW |
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 #include "remoting/host/daemon_process.h" | 5 #include "remoting/host/daemon_process.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/location.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/process.h" | 14 #include "base/process.h" |
14 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
15 #include "base/time.h" | 16 #include "base/time.h" |
16 #include "base/timer.h" | 17 #include "base/timer.h" |
17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
18 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
19 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 61 |
61 protected: | 62 protected: |
62 // Stoppable implementation. | 63 // Stoppable implementation. |
63 virtual void DoStop() OVERRIDE; | 64 virtual void DoStop() OVERRIDE; |
64 | 65 |
65 // DaemonProcess implementation. | 66 // DaemonProcess implementation. |
66 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( | 67 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( |
67 int terminal_id, | 68 int terminal_id, |
68 const DesktopSessionParams& params, | 69 const DesktopSessionParams& params, |
69 bool virtual_terminal) OVERRIDE; | 70 bool virtual_terminal) OVERRIDE; |
| 71 virtual void DoCrashNetworkProcess( |
| 72 const tracked_objects::Location& location) OVERRIDE; |
70 virtual void LaunchNetworkProcess() OVERRIDE; | 73 virtual void LaunchNetworkProcess() OVERRIDE; |
71 | 74 |
72 private: | 75 private: |
73 scoped_ptr<WorkerProcessLauncher> network_launcher_; | 76 scoped_ptr<WorkerProcessLauncher> network_launcher_; |
74 | 77 |
75 // Handle of the network process. | 78 // Handle of the network process. |
76 ScopedHandle network_process_; | 79 ScopedHandle network_process_; |
77 | 80 |
78 DISALLOW_COPY_AND_ASSIGN(DaemonProcessWin); | 81 DISALLOW_COPY_AND_ASSIGN(DaemonProcessWin); |
79 }; | 82 }; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int terminal_id, | 149 int terminal_id, |
147 const DesktopSessionParams& params, | 150 const DesktopSessionParams& params, |
148 bool virtual_terminal) { | 151 bool virtual_terminal) { |
149 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 152 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
150 | 153 |
151 return scoped_ptr<DesktopSession>(new DesktopSessionWin( | 154 return scoped_ptr<DesktopSession>(new DesktopSessionWin( |
152 caller_task_runner(), io_task_runner(), this, terminal_id, | 155 caller_task_runner(), io_task_runner(), this, terminal_id, |
153 params, virtual_terminal, HostService::GetInstance())); | 156 params, virtual_terminal, HostService::GetInstance())); |
154 } | 157 } |
155 | 158 |
| 159 void DaemonProcessWin::DoCrashNetworkProcess( |
| 160 const tracked_objects::Location& location) { |
| 161 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 162 |
| 163 network_launcher_->Crash(location); |
| 164 } |
| 165 |
156 void DaemonProcessWin::LaunchNetworkProcess() { | 166 void DaemonProcessWin::LaunchNetworkProcess() { |
157 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 167 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
158 DCHECK(!network_launcher_); | 168 DCHECK(!network_launcher_); |
159 | 169 |
160 // Construct the host binary name. | 170 // Construct the host binary name. |
161 base::FilePath host_binary; | 171 base::FilePath host_binary; |
162 if (!GetInstalledBinaryPath(kHostBinaryName, &host_binary)) { | 172 if (!GetInstalledBinaryPath(kHostBinaryName, &host_binary)) { |
163 Stop(); | 173 Stop(); |
164 return; | 174 return; |
165 } | 175 } |
(...skipping 16 matching lines...) Expand all Loading... |
182 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 192 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
183 const base::Closure& stopped_callback) { | 193 const base::Closure& stopped_callback) { |
184 scoped_ptr<DaemonProcessWin> daemon_process( | 194 scoped_ptr<DaemonProcessWin> daemon_process( |
185 new DaemonProcessWin(caller_task_runner, io_task_runner, | 195 new DaemonProcessWin(caller_task_runner, io_task_runner, |
186 stopped_callback)); | 196 stopped_callback)); |
187 daemon_process->Initialize(); | 197 daemon_process->Initialize(); |
188 return daemon_process.PassAs<DaemonProcess>(); | 198 return daemon_process.PassAs<DaemonProcess>(); |
189 } | 199 } |
190 | 200 |
191 } // namespace remoting | 201 } // namespace remoting |
OLD | NEW |