Index: remoting/webapp/client_plugin_async.js |
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js |
index 3e0461fd41b70eef35f45951dff8411def826155..e6aee5a6f78ebde4066542e7618fd2cf168cef76 100644 |
--- a/remoting/webapp/client_plugin_async.js |
+++ b/remoting/webapp/client_plugin_async.js |
@@ -222,6 +222,14 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { |
} |
this.onConnectionStatusUpdateHandler(state, error); |
+ } else if (message.method == 'onRouteChanged') { |
Sergey Ulanov
2014/01/07 22:58:43
Instead of adding another message type can we send
Jamie
2014/01/08 11:39:34
I've changed it to use logDebugMessage.
|
+ var channel = /** @type {string} */ (message.data['channel']); |
+ var type = /** @type {string} */ (message.data['type']); |
+ if (typeof channel != 'string' || typeof type != 'string') { |
+ console.error('Received invalid onRouteChanged message: ' + messageStr); |
+ return; |
+ } |
+ this.perfStats_.channelTypes[channel] = type; |
} else if (message.method == 'onDesktopSize') { |
if (typeof message.data['width'] != 'number' || |
typeof message.data['height'] != 'number') { |
@@ -236,18 +244,24 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { |
/** @type {number} */ (message.data['y_dpi']) : 96; |
this.onDesktopSizeUpdateHandler(); |
} else if (message.method == 'onPerfStats') { |
- if (typeof message.data['videoBandwidth'] != 'number' || |
- typeof message.data['videoFrameRate'] != 'number' || |
- typeof message.data['captureLatency'] != 'number' || |
- typeof message.data['encodeLatency'] != 'number' || |
- typeof message.data['decodeLatency'] != 'number' || |
- typeof message.data['renderLatency'] != 'number' || |
- typeof message.data['roundtripLatency'] != 'number') { |
- console.error('Received incorrect onPerfStats message: ' + messageStr); |
- return; |
+ var properties = [ |
+ 'videoBandwidth', |
+ 'videoFrameRate', |
+ 'captureLatency', |
+ 'encodeLatency', |
+ 'decodeLatency', |
+ 'renderLatency', |
+ 'roundtripLatency' |
+ ]; |
+ for (var i = 0; i < properties.length; ++i) { |
+ if (typeof message.data[properties[i]] != 'number') { |
+ console.error('Received incorrect onPerfStats message: ' + messageStr); |
+ return; |
+ } |
+ } |
+ for (var i = 0; i < properties.length; ++i) { |
+ this.perfStats_[properties[i]] = message.data[properties[i]]; |
} |
- this.perfStats_ = |
- /** @type {remoting.ClientSession.PerfStats} */ message.data; |
} else if (message.method == 'injectClipboardItem') { |
if (typeof message.data['mimeType'] != 'string' || |
typeof message.data['item'] != 'string') { |