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

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

Issue 2420183002: Don't use barcodes in ProtocolPerfTests (Closed)
Patch Set: . Created 4 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
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/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (audio_capturer) { 286 if (audio_capturer) {
287 audio_stream_ = connection_->StartAudioStream(std::move(audio_capturer)); 287 audio_stream_ = connection_->StartAudioStream(std::move(audio_capturer));
288 } 288 }
289 289
290 video_stream_->SetObserver(this); 290 video_stream_->SetObserver(this);
291 291
292 // Apply video-control parameters to the new stream. 292 // Apply video-control parameters to the new stream.
293 video_stream_->SetLosslessEncode(lossless_video_encode_); 293 video_stream_->SetLosslessEncode(lossless_video_encode_);
294 video_stream_->SetLosslessColor(lossless_video_color_); 294 video_stream_->SetLosslessColor(lossless_video_color_);
295 295
296 // Pause capturing if necessary. 296 // Pause video stream first. It's unpaused OnConnectionChannelsConnected()
297 video_stream_->Pause(pause_video_); 297 // after all channels are connected.
298 video_stream_->Pause(true);
298 } 299 }
299 300
300 void ClientSession::OnConnectionChannelsConnected() { 301 void ClientSession::OnConnectionChannelsConnected() {
301 DCHECK(CalledOnValidThread()); 302 DCHECK(CalledOnValidThread());
302 303
303 DCHECK(!channels_connected_); 304 DCHECK(!channels_connected_);
304 channels_connected_ = true; 305 channels_connected_ = true;
305 306
306 // Negotiate capabilities with the client. 307 // Negotiate capabilities with the client.
307 VLOG(1) << "Host capabilities: " << host_capabilities_; 308 VLOG(1) << "Host capabilities: " << host_capabilities_;
308 protocol::Capabilities capabilities; 309 protocol::Capabilities capabilities;
309 capabilities.set_capabilities(host_capabilities_); 310 capabilities.set_capabilities(host_capabilities_);
310 connection_->client_stub()->SetCapabilities(capabilities); 311 connection_->client_stub()->SetCapabilities(capabilities);
311 312
312 // Start the event executor. 313 // Start the event executor.
313 input_injector_->Start(CreateClipboardProxy()); 314 input_injector_->Start(CreateClipboardProxy());
314 SetDisableInputs(false); 315 SetDisableInputs(false);
315 316
316 // Create MouseShapePump to send mouse cursor shape. 317 // Create MouseShapePump to send mouse cursor shape.
317 mouse_shape_pump_.reset( 318 mouse_shape_pump_.reset(
318 new MouseShapePump(desktop_environment_->CreateMouseCursorMonitor(), 319 new MouseShapePump(desktop_environment_->CreateMouseCursorMonitor(),
319 connection_->client_stub())); 320 connection_->client_stub()));
320 321
321 if (pending_video_layout_message_) { 322 if (pending_video_layout_message_) {
322 connection_->client_stub()->SetVideoLayout(*pending_video_layout_message_); 323 connection_->client_stub()->SetVideoLayout(*pending_video_layout_message_);
323 pending_video_layout_message_.reset(); 324 pending_video_layout_message_.reset();
324 } 325 }
325 326
327 if (video_stream_)
328 video_stream_->Pause(pause_video_);
329
326 // Notify the event handler that all our channels are now connected. 330 // Notify the event handler that all our channels are now connected.
327 event_handler_->OnSessionChannelsConnected(this); 331 event_handler_->OnSessionChannelsConnected(this);
328 } 332 }
329 333
330 void ClientSession::OnConnectionClosed(protocol::ErrorCode error) { 334 void ClientSession::OnConnectionClosed(protocol::ErrorCode error) {
331 DCHECK(CalledOnValidThread()); 335 DCHECK(CalledOnValidThread());
332 336
333 HOST_LOG << "Client disconnected: " << client_jid_ << "; error = " << error; 337 HOST_LOG << "Client disconnected: " << client_jid_ << "; error = " << error;
334 338
335 // Ignore any further callbacks. 339 // Ignore any further callbacks.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 DCHECK(CalledOnValidThread()); 401 DCHECK(CalledOnValidThread());
398 DCHECK(desktop_environment_); 402 DCHECK(desktop_environment_);
399 return desktop_environment_->GetDesktopSessionId(); 403 return desktop_environment_->GetDesktopSessionId();
400 } 404 }
401 405
402 ClientSessionControl* ClientSession::session_control() { 406 ClientSessionControl* ClientSession::session_control() {
403 DCHECK(CalledOnValidThread()); 407 DCHECK(CalledOnValidThread());
404 return this; 408 return this;
405 } 409 }
406 410
411 void ClientSession::SetEventTimestampsSourceForTests(
412 scoped_refptr<protocol::InputEventTimestampsSource>
413 event_timestamp_source) {
414 DCHECK(CalledOnValidThread());
415 video_stream_->SetEventTimestampsSource(event_timestamp_source);
416 }
417
407 std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { 418 std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() {
408 DCHECK(CalledOnValidThread()); 419 DCHECK(CalledOnValidThread());
409
410 return base::MakeUnique<protocol::ClipboardThreadProxy>( 420 return base::MakeUnique<protocol::ClipboardThreadProxy>(
411 client_clipboard_factory_.GetWeakPtr(), 421 client_clipboard_factory_.GetWeakPtr(),
412 base::ThreadTaskRunnerHandle::Get()); 422 base::ThreadTaskRunnerHandle::Get());
413 } 423 }
414 424
415 void ClientSession::OnVideoSizeChanged(protocol::VideoStream* video_stream, 425 void ClientSession::OnVideoSizeChanged(protocol::VideoStream* video_stream,
416 const webrtc::DesktopSize& size, 426 const webrtc::DesktopSize& size,
417 const webrtc::DesktopVector& dpi) { 427 const webrtc::DesktopVector& dpi) {
418 DCHECK(CalledOnValidThread()); 428 DCHECK(CalledOnValidThread());
419 429
(...skipping 29 matching lines...) Expand all
449 connection_->client_stub()->SetVideoLayout(layout); 459 connection_->client_stub()->SetVideoLayout(layout);
450 } else { 460 } else {
451 pending_video_layout_message_.reset(new protocol::VideoLayout(layout)); 461 pending_video_layout_message_.reset(new protocol::VideoLayout(layout));
452 } 462 }
453 break; 463 break;
454 } 464 }
455 } 465 }
456 } 466 }
457 467
458 } // namespace remoting 468 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698