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

Unified Diff: remoting/webapp/crd/js/desktop_viewport.js

Issue 2369013008: Log host and client screen sizes. (Closed)
Patch Set: Rename VIDEO_SIZE to SCREEN_RESOLUTIONS. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/desktop_viewport.js
diff --git a/remoting/webapp/crd/js/desktop_viewport.js b/remoting/webapp/crd/js/desktop_viewport.js
index 12b6b9b72b98d897d30d47bd58ebc22e5aa0dcfa..ad7071cc049b5b59645cdc9545231ac5f5f35920 100644
--- a/remoting/webapp/crd/js/desktop_viewport.js
+++ b/remoting/webapp/crd/js/desktop_viewport.js
@@ -22,11 +22,13 @@ var remoting = remoting || {};
* are showing scrollbars on.
* @param {remoting.HostDesktop} hostDesktop
* @param {remoting.HostOptions} hostOptions
+ * @param {!remoting.SessionLogger} logger
*
* @constructor
* @implements {base.Disposable}
*/
-remoting.DesktopViewport = function(rootElement, hostDesktop, hostOptions) {
+ remoting.DesktopViewport = function(rootElement, hostDesktop, hostOptions,
+ logger) {
/** @private */
this.rootElement_ = rootElement;
/** @private */
@@ -49,6 +51,10 @@ remoting.DesktopViewport = function(rootElement, hostDesktop, hostOptions) {
this.pluginWidthForBumpScrollTesting_ = 0;
/** @private {number} */
this.pluginHeightForBumpScrollTesting_ = 0;
+ /** @private {!remoting.SessionLogger} */
+ this.logger_ = logger;
+ /** @private {number?} */
+ this.loggingTimer_ = null;
this.eventHooks_ = new base.Disposables(
new base.EventHook(
@@ -331,11 +337,14 @@ remoting.DesktopViewport.prototype.updateDimensions_ = function() {
height: dimensions.height };
var desktopDpi = { x: dimensions.xDpi,
y: dimensions.yDpi };
+ var clientSize = this.getClientArea();
var newSize = remoting.Viewport.choosePluginSize(
- this.getClientArea(), window.devicePixelRatio,
+ clientSize, window.devicePixelRatio,
desktopSize, desktopDpi, this.hostOptions_.getDesktopScale(),
remoting.fullscreen.isActive(), this.hostOptions_.getShrinkToFit());
+ this.logDimensions_(desktopSize, clientSize, remoting.fullscreen.isActive());
Lambros 2016/09/28 01:30:39 Would it make more sense to log the plugin size in
Jamie 2016/09/28 21:14:36 I think there's value in both. Client area is prob
+
// Resize the plugin if necessary.
console.log('plugin dimensions:' + newSize.width + 'x' + newSize.height);
this.pluginElement_.style.width = newSize.width + 'px';
@@ -366,4 +375,23 @@ remoting.DesktopViewport.prototype.setDesktopScale = function(desktopScale) {
this.hostOptions_.save();
};
+/**
+ * Log the specified client and host sizes after a short delay. Since the host
+ * size may change in response to a change in the client size, the delay allows
+ * time for the desktop size change notification to arrive from the host, and
+ * avoids logging the intermediate state.
+ */
+remoting.DesktopViewport.prototype.logDimensions_ =
+ function(hostSize, clientSize, isFullscreen) {
+ if (this.loggingTimer_ !== null) {
+ window.clearTimeout(this.loggingTimer_);
+ }
+ var kLoggingRateLimitMs = 2000;
+ this.loggingTimer_ = window.setTimeout(
+ () => {
+ this.logger_.logScreenResolutions(hostSize, clientSize, isFullscreen);
+ },
+ kLoggingRateLimitMs);
+};
+
}());

Powered by Google App Engine
This is Rietveld 408576698