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

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

Issue 15927033: Add host-side rate-limiting to desktop resize events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer feedback. Created 7 years, 6 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/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "media/video/capture/screen/screen_capturer.h" 10 #include "media/video/capture/screen/screen_capturer.h"
(...skipping 13 matching lines...) Expand all
24 #include "remoting/host/screen_resolution.h" 24 #include "remoting/host/screen_resolution.h"
25 #include "remoting/host/video_scheduler.h" 25 #include "remoting/host/video_scheduler.h"
26 #include "remoting/proto/control.pb.h" 26 #include "remoting/proto/control.pb.h"
27 #include "remoting/proto/event.pb.h" 27 #include "remoting/proto/event.pb.h"
28 #include "remoting/protocol/client_stub.h" 28 #include "remoting/protocol/client_stub.h"
29 #include "remoting/protocol/clipboard_thread_proxy.h" 29 #include "remoting/protocol/clipboard_thread_proxy.h"
30 30
31 // Default DPI to assume for old clients that use notifyClientDimensions. 31 // Default DPI to assume for old clients that use notifyClientDimensions.
32 const int kDefaultDPI = 96; 32 const int kDefaultDPI = 96;
33 33
34 // All DesktopEnvironment implementations rate-limit desktop resize requests,
35 // so this Capability is added automatically.
36 const char kRateLimitResizeRequests[] = "rateLimitResizeRequests";
37
34 namespace remoting { 38 namespace remoting {
35 39
36 ClientSession::ClientSession( 40 ClientSession::ClientSession(
37 EventHandler* event_handler, 41 EventHandler* event_handler,
38 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, 42 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
39 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 43 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
40 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, 44 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
41 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, 45 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
42 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, 46 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
43 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 47 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Create the desktop environment. Drop the connection if it could not be 208 // Create the desktop environment. Drop the connection if it could not be
205 // created for any reason (for instance the curtain could not initialize). 209 // created for any reason (for instance the curtain could not initialize).
206 desktop_environment_ = 210 desktop_environment_ =
207 desktop_environment_factory_->Create(control_factory_.GetWeakPtr()); 211 desktop_environment_factory_->Create(control_factory_.GetWeakPtr());
208 if (!desktop_environment_) { 212 if (!desktop_environment_) {
209 DisconnectSession(); 213 DisconnectSession();
210 return; 214 return;
211 } 215 }
212 216
213 host_capabilities_ = desktop_environment_->GetCapabilities(); 217 host_capabilities_ = desktop_environment_->GetCapabilities();
218 host_capabilities_ = host_capabilities_ + " " + kRateLimitResizeRequests;
Jamie 2013/06/04 01:27:49 Is this an acceptable way of getting the capabilit
alexeypa (please no reviews) 2013/06/04 17:07:37 No, I don't think we should do it this way. I thin
Jamie 2013/06/04 21:18:03 Done. However, see my comments below.
214 219
215 // Ignore protocol::Capabilities messages from the client if it does not 220 // Ignore protocol::Capabilities messages from the client if it does not
216 // support any capabilities. 221 // support any capabilities.
217 if (!connection_->session()->config().SupportsCapabilities()) { 222 if (!connection_->session()->config().SupportsCapabilities()) {
218 VLOG(1) << "The client does not support any capabilities."; 223 VLOG(1) << "The client does not support any capabilities.";
219 224
220 client_capabilities_ = make_scoped_ptr(new std::string()); 225 client_capabilities_ = make_scoped_ptr(new std::string());
221 desktop_environment_->SetCapabilities(*client_capabilities_); 226 desktop_environment_->SetCapabilities(*client_capabilities_);
222 } 227 }
223 228
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex()); 421 return scoped_ptr<AudioEncoder>(new AudioEncoderSpeex());
417 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { 422 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
418 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); 423 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus());
419 } 424 }
420 425
421 NOTIMPLEMENTED(); 426 NOTIMPLEMENTED();
422 return scoped_ptr<AudioEncoder>(NULL); 427 return scoped_ptr<AudioEncoder>(NULL);
423 } 428 }
424 429
425 } // namespace remoting 430 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/resizing_host_observer.h » ('j') | remoting/host/resizing_host_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698