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

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

Issue 2369013008: Log host and client screen sizes. (Closed)
Patch Set: Added client plugin size logging. 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..09e9045fcdb8f5948856754d5770c7360b7505ef 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,15 @@ 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, newSize, clientSize,
+ remoting.fullscreen.isActive());
+
// Resize the plugin if necessary.
console.log('plugin dimensions:' + newSize.width + 'x' + newSize.height);
this.pluginElement_.style.width = newSize.width + 'px';
@@ -366,4 +376,29 @@ 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.
+ *
+ * @param {{width: number, height: number}} hostSize
+ * @param {{width: number, height: number}} clientPluginSize
+ * @param {{width: number, height: number}} clientWindowSize
+ * @param {boolean} clientFullscreen
+ */
+remoting.DesktopViewport.prototype.logDimensions_ =
+ function(hostSize, clientPluginSize, clientWindowSize, isFullscreen) {
+ if (this.loggingTimer_ !== null) {
+ window.clearTimeout(this.loggingTimer_);
+ }
+ var kLoggingRateLimitMs = 2000;
+ this.loggingTimer_ = window.setTimeout(
+ () => {
+ this.logger_.logScreenResolutions(hostSize, clientPluginSize,
+ clientWindowSize, isFullscreen);
+ },
+ kLoggingRateLimitMs);
+};
+
}());

Powered by Google App Engine
This is Rietveld 408576698