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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
18 #include "remoting/base/auto_thread_task_runner.h" | 18 #include "remoting/base/auto_thread_task_runner.h" |
19 #include "remoting/host/branding.h" | 19 #include "remoting/host/branding.h" |
20 #include "remoting/host/chromoting_messages.h" | 20 #include "remoting/host/chromoting_messages.h" |
21 #include "remoting/host/config_file_watcher.h" | 21 #include "remoting/host/config_file_watcher.h" |
22 #include "remoting/host/desktop_session.h" | 22 #include "remoting/host/desktop_session.h" |
23 #include "remoting/host/host_event_logger.h" | 23 #include "remoting/host/host_event_logger.h" |
| 24 #include "remoting/host/host_exit_codes.h" |
24 #include "remoting/host/host_status_observer.h" | 25 #include "remoting/host/host_status_observer.h" |
25 #include "remoting/host/screen_resolution.h" | 26 #include "remoting/host/screen_resolution.h" |
26 #include "remoting/protocol/transport.h" | 27 #include "remoting/protocol/transport.h" |
27 | 28 |
28 namespace remoting { | 29 namespace remoting { |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 // This is used for tagging system event logs. | 33 // This is used for tagging system event logs. |
33 const char kApplicationName[] = "chromoting"; | 34 const char kApplicationName[] = "chromoting"; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (!handled) { | 126 if (!handled) { |
126 LOG(ERROR) << "Received unexpected IPC type: " << message.type(); | 127 LOG(ERROR) << "Received unexpected IPC type: " << message.type(); |
127 CrashNetworkProcess(FROM_HERE); | 128 CrashNetworkProcess(FROM_HERE); |
128 } | 129 } |
129 | 130 |
130 return handled; | 131 return handled; |
131 } | 132 } |
132 | 133 |
133 void DaemonProcess::OnPermanentError(int exit_code) { | 134 void DaemonProcess::OnPermanentError(int exit_code) { |
134 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 135 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 136 DCHECK(kMinPermanentErrorExitCode <= exit_code && |
| 137 exit_code <= kMaxPermanentErrorExitCode); |
| 138 |
135 Stop(); | 139 Stop(); |
136 } | 140 } |
137 | 141 |
138 void DaemonProcess::CloseDesktopSession(int terminal_id) { | 142 void DaemonProcess::CloseDesktopSession(int terminal_id) { |
139 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 143 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
140 | 144 |
141 // Validate the supplied terminal ID. An attempt to use a desktop session ID | 145 // Validate the supplied terminal ID. An attempt to use a desktop session ID |
142 // that couldn't possibly have been allocated is considered a protocol error | 146 // that couldn't possibly have been allocated is considered a protocol error |
143 // and the network process will be restarted. | 147 // and the network process will be restarted. |
144 if (!WasTerminalIdAllocated(terminal_id)) { | 148 if (!WasTerminalIdAllocated(terminal_id)) { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } | 374 } |
371 | 375 |
372 void DaemonProcess::DeleteAllDesktopSessions() { | 376 void DaemonProcess::DeleteAllDesktopSessions() { |
373 while (!desktop_sessions_.empty()) { | 377 while (!desktop_sessions_.empty()) { |
374 delete desktop_sessions_.front(); | 378 delete desktop_sessions_.front(); |
375 desktop_sessions_.pop_front(); | 379 desktop_sessions_.pop_front(); |
376 } | 380 } |
377 } | 381 } |
378 | 382 |
379 } // namespace remoting | 383 } // namespace remoting |
OLD | NEW |