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

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

Issue 11028128: [Chromoting] Request the daemon to open a terminal once a connection has been accepted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feeback and rebased on top of https://chromiumcodereview.appspot.com/11017065/ Created 8 years, 2 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 #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 20 matching lines...) Expand all
31 31
32 void DaemonProcess::OnConfigWatcherError() { 32 void DaemonProcess::OnConfigWatcherError() {
33 Stop(); 33 Stop();
34 } 34 }
35 35
36 void DaemonProcess::OnChannelConnected() { 36 void DaemonProcess::OnChannelConnected() {
37 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 37 DCHECK(caller_task_runner()->BelongsToCurrentThread());
38 38
39 DeleteAllDesktopSessions(); 39 DeleteAllDesktopSessions();
40 40
41 // Reset the last known desktop session ID because no IDs have been allocated 41 // Reset the last known terminal ID because no IDs have been allocated
42 // by the the newly started process yet. 42 // by the the newly started process yet.
43 next_terminal_id_ = 0; 43 next_terminal_id_ = 0;
44 44
45 // Send the configuration to the network process. 45 // Send the configuration to the network process.
46 SendToNetwork( 46 SendToNetwork(
47 new ChromotingDaemonNetworkMsg_Configuration(serialized_config_)); 47 new ChromotingDaemonNetworkMsg_Configuration(serialized_config_));
48 } 48 }
49 49
50 bool DaemonProcess::OnMessageReceived(const IPC::Message& message) { 50 bool DaemonProcess::OnMessageReceived(const IPC::Message& message) {
51 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 51 DCHECK(caller_task_runner()->BelongsToCurrentThread());
(...skipping 27 matching lines...) Expand all
79 return; 79 return;
80 } 80 }
81 81
82 DesktopSessionList::iterator i; 82 DesktopSessionList::iterator i;
83 for (i = desktop_sessions_.begin(); i != desktop_sessions_.end(); ++i) { 83 for (i = desktop_sessions_.begin(); i != desktop_sessions_.end(); ++i) {
84 if ((*i)->id() == terminal_id) { 84 if ((*i)->id() == terminal_id) {
85 break; 85 break;
86 } 86 }
87 } 87 }
88 88
89 // It is OK if the desktop session ID wasn't found. There is a race between 89 // It is OK if the terminal ID wasn't found. There is a race between
90 // the network and daemon processes. Each frees its own recources first and 90 // the network and daemon processes. Each frees its own recources first and
91 // notifies the other party if there was something to clean up. 91 // notifies the other party if there was something to clean up.
92 if (i == desktop_sessions_.end()) 92 if (i == desktop_sessions_.end())
93 return; 93 return;
94 94
95 delete *i; 95 delete *i;
96 desktop_sessions_.erase(i); 96 desktop_sessions_.erase(i);
97 97
98 VLOG(1) << "Daemon: closed desktop session " << terminal_id; 98 VLOG(1) << "Daemon: closed desktop session " << terminal_id;
99 SendToNetwork( 99 SendToNetwork(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 void DaemonProcess::DeleteAllDesktopSessions() { 167 void DaemonProcess::DeleteAllDesktopSessions() {
168 while (!desktop_sessions_.empty()) { 168 while (!desktop_sessions_.empty()) {
169 delete desktop_sessions_.front(); 169 delete desktop_sessions_.front();
170 desktop_sessions_.pop_front(); 170 desktop_sessions_.pop_front();
171 } 171 }
172 } 172 }
173 173
174 } // namespace remoting 174 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698