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

Side by Side Diff: remoting/webapp/client_session.js

Issue 15927033: Add host-side rate-limiting to desktop resize events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Class handling creation and teardown of a remoting client session. 7 * Class handling creation and teardown of a remoting client session.
8 * 8 *
9 * The ClientSession class controls lifetime of the client plugin 9 * The ClientSession class controls lifetime of the client plugin
10 * object and provides the plugin with the functionality it needs to 10 * object and provides the plugin with the functionality it needs to
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 } 878 }
879 879
880 // Defer notifying the host of the change until the window stops resizing, to 880 // Defer notifying the host of the change until the window stops resizing, to
881 // avoid overloading the control channel with notifications. 881 // avoid overloading the control channel with notifications.
882 if (this.resizeToClient_) { 882 if (this.resizeToClient_) {
883 this.notifyClientResolutionTimer_ = window.setTimeout( 883 this.notifyClientResolutionTimer_ = window.setTimeout(
884 this.plugin.notifyClientResolution.bind(this.plugin, 884 this.plugin.notifyClientResolution.bind(this.plugin,
885 window.innerWidth, 885 window.innerWidth,
886 window.innerHeight, 886 window.innerHeight,
887 window.devicePixelRatio), 887 window.devicePixelRatio),
888 1000); 888 250);
Jamie 2013/06/03 23:26:28 250ms seems to be a good compromise between sendin
alexeypa (please no reviews) 2013/06/04 00:05:26 Consider using different timeout depending on the
Jamie 2013/06/04 01:27:49 Done.
889 } 889 }
890 890
891 // If bump-scrolling is enabled, adjust the plugin margins to fully utilize 891 // If bump-scrolling is enabled, adjust the plugin margins to fully utilize
892 // the new window area. 892 // the new window area.
893 this.scroll_(0, 0); 893 this.scroll_(0, 0);
894 }; 894 };
895 895
896 /** 896 /**
897 * Requests that the host pause or resume video updates. 897 * Requests that the host pause or resume video updates.
898 * 898 *
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 var lateAdjustment = 1 + (now - expected) / timeout; 1204 var lateAdjustment = 1 + (now - expected) / timeout;
1205 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { 1205 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) {
1206 that.bumpScrollTimer_ = window.setTimeout( 1206 that.bumpScrollTimer_ = window.setTimeout(
1207 function() { repeatScroll(now + timeout); }, 1207 function() { repeatScroll(now + timeout); },
1208 timeout); 1208 timeout);
1209 } 1209 }
1210 }; 1210 };
1211 repeatScroll(new Date().getTime()); 1211 repeatScroll(new Date().getTime());
1212 } 1212 }
1213 }; 1213 };
OLDNEW
« remoting/host/resizing_host_observer.cc ('K') | « remoting/host/resizing_host_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698