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

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

Issue 13983010: Use webrtc::DesktopCapturer for screen capturer implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: q Created 7 years, 8 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_util.h" 10 #include "base/file_util.h"
(...skipping 11 matching lines...) Expand all
22 #include "remoting/protocol/transport.h" 22 #include "remoting/protocol/transport.h"
23 23
24 namespace remoting { 24 namespace remoting {
25 25
26 namespace { 26 namespace {
27 27
28 // This is used for tagging system event logs. 28 // This is used for tagging system event logs.
29 const char kApplicationName[] = "chromoting"; 29 const char kApplicationName[] = "chromoting";
30 30
31 std::ostream& operator<<(std::ostream& os, const ScreenResolution& resolution) { 31 std::ostream& operator<<(std::ostream& os, const ScreenResolution& resolution) {
32 return os << resolution.dimensions_.width() << "x" 32 return os << resolution.dimensions().width() << "x"
33 << resolution.dimensions_.height() << " at " 33 << resolution.dimensions().height() << " at "
34 << resolution.dpi_.x() << "x" << resolution.dpi_.y() << " DPI"; 34 << resolution.dpi().x() << "x" << resolution.dpi().y() << " DPI";
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 DaemonProcess::~DaemonProcess() { 39 DaemonProcess::~DaemonProcess() {
40 DCHECK(!config_watcher_.get()); 40 DCHECK(!config_watcher_.get());
41 DCHECK(desktop_sessions_.empty()); 41 DCHECK(desktop_sessions_.empty());
42 } 42 }
43 43
44 void DaemonProcess::OnConfigUpdated(const std::string& serialized_config) { 44 void DaemonProcess::OnConfigUpdated(const std::string& serialized_config) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // a protocol error and the network process will be restarted. 181 // a protocol error and the network process will be restarted.
182 if (WasTerminalIdAllocated(terminal_id)) { 182 if (WasTerminalIdAllocated(terminal_id)) {
183 LOG(ERROR) << "Invalid terminal ID: " << terminal_id; 183 LOG(ERROR) << "Invalid terminal ID: " << terminal_id;
184 CrashNetworkProcess(FROM_HERE); 184 CrashNetworkProcess(FROM_HERE);
185 return; 185 return;
186 } 186 }
187 187
188 // Terminal IDs cannot be reused. Update the expected next terminal ID. 188 // Terminal IDs cannot be reused. Update the expected next terminal ID.
189 next_terminal_id_ = std::max(next_terminal_id_, terminal_id + 1); 189 next_terminal_id_ = std::max(next_terminal_id_, terminal_id + 1);
190 190
191 // Validate |resolution| and restart the sender if it is not valid.
192 if (!resolution.IsValid()) {
alexeypa (please no reviews) 2013/04/26 21:33:58 |resolution| is received from less privileged proc
Sergey Ulanov 2013/05/07 22:25:50 There is a check in chromoting_param_traits.cc whe
193 LOG(ERROR) << "Invalid resolution specified: " << resolution;
194 CrashNetworkProcess(FROM_HERE);
195 return;
196 }
197
198 // Create the desktop session. 191 // Create the desktop session.
199 scoped_ptr<DesktopSession> session = DoCreateDesktopSession( 192 scoped_ptr<DesktopSession> session = DoCreateDesktopSession(
200 terminal_id, resolution, virtual_terminal); 193 terminal_id, resolution, virtual_terminal);
201 if (!session) { 194 if (!session) {
202 LOG(ERROR) << "Failed to create a desktop session."; 195 LOG(ERROR) << "Failed to create a desktop session.";
203 SendToNetwork( 196 SendToNetwork(
204 new ChromotingDaemonNetworkMsg_TerminalDisconnected(terminal_id)); 197 new ChromotingDaemonNetworkMsg_TerminalDisconnected(terminal_id));
205 return; 198 return;
206 } 199 }
207 200
208 VLOG(1) << "Daemon: opened desktop session " << terminal_id; 201 VLOG(1) << "Daemon: opened desktop session " << terminal_id;
209 desktop_sessions_.push_back(session.release()); 202 desktop_sessions_.push_back(session.release());
210 } 203 }
211 204
212 void DaemonProcess::SetScreenResolution(int terminal_id, 205 void DaemonProcess::SetScreenResolution(int terminal_id,
213 const ScreenResolution& resolution) { 206 const ScreenResolution& resolution) {
214 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 207 DCHECK(caller_task_runner()->BelongsToCurrentThread());
215 208
216 // Validate the supplied terminal ID. An attempt to use a desktop session ID 209 // Validate the supplied terminal ID. An attempt to use a desktop session ID
217 // that couldn't possibly have been allocated is considered a protocol error 210 // that couldn't possibly have been allocated is considered a protocol error
218 // and the network process will be restarted. 211 // and the network process will be restarted.
219 if (!WasTerminalIdAllocated(terminal_id)) { 212 if (!WasTerminalIdAllocated(terminal_id)) {
220 LOG(ERROR) << "Invalid terminal ID: " << terminal_id; 213 LOG(ERROR) << "Invalid terminal ID: " << terminal_id;
221 CrashNetworkProcess(FROM_HERE); 214 CrashNetworkProcess(FROM_HERE);
222 return; 215 return;
223 } 216 }
224 217
225 // Validate |resolution| and restart the sender if it is not valid. 218 // Validate |resolution| and restart the sender if it is not valid.
226 if (!resolution.IsValid()) { 219 if (resolution.IsEmpty()) {
alexeypa (please no reviews) 2013/04/26 21:33:58 nit: IsEmpty() seems to be OK in this case since y
Sergey Ulanov 2013/05/07 22:25:50 Yes, I understand that there is a difference. Inte
227 LOG(ERROR) << "Invalid resolution specified: " << resolution; 220 LOG(ERROR) << "Invalid resolution specified: " << resolution;
228 CrashNetworkProcess(FROM_HERE); 221 CrashNetworkProcess(FROM_HERE);
229 return; 222 return;
230 } 223 }
231 224
232 DesktopSessionList::iterator i; 225 DesktopSessionList::iterator i;
233 for (i = desktop_sessions_.begin(); i != desktop_sessions_.end(); ++i) { 226 for (i = desktop_sessions_.begin(); i != desktop_sessions_.end(); ++i) {
234 if ((*i)->id() == terminal_id) { 227 if ((*i)->id() == terminal_id) {
235 break; 228 break;
236 } 229 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 365 }
373 366
374 void DaemonProcess::DeleteAllDesktopSessions() { 367 void DaemonProcess::DeleteAllDesktopSessions() {
375 while (!desktop_sessions_.empty()) { 368 while (!desktop_sessions_.empty()) {
376 delete desktop_sessions_.front(); 369 delete desktop_sessions_.front();
377 desktop_sessions_.pop_front(); 370 desktop_sessions_.pop_front();
378 } 371 }
379 } 372 }
380 373
381 } // namespace remoting 374 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698