| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 35 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 36 | 36 |
| 37 Stop(); | 37 Stop(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void DaemonProcess::OnChannelConnected() { | 40 void DaemonProcess::OnChannelConnected() { |
| 41 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 41 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| 42 | 42 |
| 43 DeleteAllDesktopSessions(); | 43 DeleteAllDesktopSessions(); |
| 44 | 44 |
| 45 // Reset the last known desktop session ID because no IDs have been allocated | 45 // Reset the last known terminal ID because no IDs have been allocated |
| 46 // by the the newly started process yet. | 46 // by the the newly started process yet. |
| 47 next_terminal_id_ = 0; | 47 next_terminal_id_ = 0; |
| 48 | 48 |
| 49 // Send the configuration to the network process. | 49 // Send the configuration to the network process. |
| 50 SendToNetwork( | 50 SendToNetwork( |
| 51 new ChromotingDaemonNetworkMsg_Configuration(serialized_config_)); | 51 new ChromotingDaemonNetworkMsg_Configuration(serialized_config_)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool DaemonProcess::OnMessageReceived(const IPC::Message& message) { | 54 bool DaemonProcess::OnMessageReceived(const IPC::Message& message) { |
| 55 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 55 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 | 85 |
| 86 DesktopSessionList::iterator i; | 86 DesktopSessionList::iterator i; |
| 87 for (i = desktop_sessions_.begin(); i != desktop_sessions_.end(); ++i) { | 87 for (i = desktop_sessions_.begin(); i != desktop_sessions_.end(); ++i) { |
| 88 if ((*i)->id() == terminal_id) { | 88 if ((*i)->id() == terminal_id) { |
| 89 break; | 89 break; |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 // It is OK if the desktop session ID wasn't found. There is a race between | 93 // It is OK if the terminal ID wasn't found. There is a race between |
| 94 // the network and daemon processes. Each frees its own recources first and | 94 // the network and daemon processes. Each frees its own recources first and |
| 95 // notifies the other party if there was something to clean up. | 95 // notifies the other party if there was something to clean up. |
| 96 if (i == desktop_sessions_.end()) | 96 if (i == desktop_sessions_.end()) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 delete *i; | 99 delete *i; |
| 100 desktop_sessions_.erase(i); | 100 desktop_sessions_.erase(i); |
| 101 | 101 |
| 102 VLOG(1) << "Daemon: closed desktop session " << terminal_id; | 102 VLOG(1) << "Daemon: closed desktop session " << terminal_id; |
| 103 SendToNetwork( | 103 SendToNetwork( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 void DaemonProcess::DeleteAllDesktopSessions() { | 171 void DaemonProcess::DeleteAllDesktopSessions() { |
| 172 while (!desktop_sessions_.empty()) { | 172 while (!desktop_sessions_.empty()) { |
| 173 delete desktop_sessions_.front(); | 173 delete desktop_sessions_.front(); |
| 174 desktop_sessions_.pop_front(); | 174 desktop_sessions_.pop_front(); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace remoting | 178 } // namespace remoting |
| OLD | NEW |