OLD | NEW |
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 remoting.ClientSession.PerfStats.prototype.maxDecodeLatency = 0; | 221 remoting.ClientSession.PerfStats.prototype.maxDecodeLatency = 0; |
222 /** @type {number} */ | 222 /** @type {number} */ |
223 remoting.ClientSession.PerfStats.prototype.renderLatency = 0; | 223 remoting.ClientSession.PerfStats.prototype.renderLatency = 0; |
224 /** @type {number} */ | 224 /** @type {number} */ |
225 remoting.ClientSession.PerfStats.prototype.maxRenderLatency = 0; | 225 remoting.ClientSession.PerfStats.prototype.maxRenderLatency = 0; |
226 /** @type {number} */ | 226 /** @type {number} */ |
227 remoting.ClientSession.PerfStats.prototype.roundtripLatency = 0; | 227 remoting.ClientSession.PerfStats.prototype.roundtripLatency = 0; |
228 /** @type {number} */ | 228 /** @type {number} */ |
229 remoting.ClientSession.PerfStats.prototype.maxRoundtripLatency = 0; | 229 remoting.ClientSession.PerfStats.prototype.maxRoundtripLatency = 0; |
230 | 230 |
| 231 /** |
| 232 * @param {!remoting.ClientSession.PerfStats} stats |
| 233 * @return {boolean} true if there is any non-zero value in stats, false |
| 234 * otherwise. |
| 235 */ |
| 236 remoting.ClientSession.PerfStats.hasValidField = function(stats) { |
| 237 for (var key in stats) { |
| 238 if (stats[key] !== 0) { |
| 239 return true; |
| 240 } |
| 241 } |
| 242 return false; |
| 243 } |
| 244 |
231 // Keys for connection statistics. | 245 // Keys for connection statistics. |
232 remoting.ClientSession.STATS_KEY_VIDEO_BANDWIDTH = 'videoBandwidth'; | 246 remoting.ClientSession.STATS_KEY_VIDEO_BANDWIDTH = 'videoBandwidth'; |
233 remoting.ClientSession.STATS_KEY_VIDEO_FRAME_RATE = 'videoFrameRate'; | 247 remoting.ClientSession.STATS_KEY_VIDEO_FRAME_RATE = 'videoFrameRate'; |
234 remoting.ClientSession.STATS_KEY_CAPTURE_LATENCY = 'captureLatency'; | 248 remoting.ClientSession.STATS_KEY_CAPTURE_LATENCY = 'captureLatency'; |
235 remoting.ClientSession.STATS_KEY_ENCODE_LATENCY = 'encodeLatency'; | 249 remoting.ClientSession.STATS_KEY_ENCODE_LATENCY = 'encodeLatency'; |
236 remoting.ClientSession.STATS_KEY_DECODE_LATENCY = 'decodeLatency'; | 250 remoting.ClientSession.STATS_KEY_DECODE_LATENCY = 'decodeLatency'; |
237 remoting.ClientSession.STATS_KEY_RENDER_LATENCY = 'renderLatency'; | 251 remoting.ClientSession.STATS_KEY_RENDER_LATENCY = 'renderLatency'; |
238 remoting.ClientSession.STATS_KEY_ROUNDTRIP_LATENCY = 'roundtripLatency'; | 252 remoting.ClientSession.STATS_KEY_ROUNDTRIP_LATENCY = 'roundtripLatency'; |
239 | 253 |
240 /** | 254 /** |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 // If we are at a finished state, ignore further state changes. | 568 // If we are at a finished state, ignore further state changes. |
555 if (this.isFinished()) { | 569 if (this.isFinished()) { |
556 return; | 570 return; |
557 } | 571 } |
558 | 572 |
559 var oldState = this.state_; | 573 var oldState = this.state_; |
560 this.state_ = this.translateState_(oldState, newState); | 574 this.state_ = this.translateState_(oldState, newState); |
561 | 575 |
562 if (newState == remoting.ClientSession.State.CONNECTED) { | 576 if (newState == remoting.ClientSession.State.CONNECTED) { |
563 this.connectedDisposables_.add( | 577 this.connectedDisposables_.add( |
564 new base.RepeatingTimer(this.reportStatistics.bind(this), 1000)); | 578 new base.RepeatingTimer(this.reportStatistics.bind(this), 1000 * 60)); |
565 if (this.plugin_.hasCapability( | 579 if (this.plugin_.hasCapability( |
566 remoting.ClientSession.Capability.TOUCH_EVENTS)) { | 580 remoting.ClientSession.Capability.TOUCH_EVENTS)) { |
567 this.plugin_.enableTouchEvents(true); | 581 this.plugin_.enableTouchEvents(true); |
568 } | 582 } |
569 } else if (this.isFinished()) { | 583 } else if (this.isFinished()) { |
570 base.dispose(this.connectedDisposables_); | 584 base.dispose(this.connectedDisposables_); |
571 this.connectedDisposables_ = null; | 585 this.connectedDisposables_ = null; |
572 } | 586 } |
573 | 587 |
574 this.logAuthMethod_(); | 588 this.logAuthMethod_(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 } else if (previous == State.CONNECTED && current == State.FAILED) { | 731 } else if (previous == State.CONNECTED && current == State.FAILED) { |
718 return State.CONNECTION_DROPPED; | 732 return State.CONNECTION_DROPPED; |
719 } | 733 } |
720 return current; | 734 return current; |
721 }; | 735 }; |
722 | 736 |
723 /** @private */ | 737 /** @private */ |
724 remoting.ClientSession.prototype.reportStatistics = function() { | 738 remoting.ClientSession.prototype.reportStatistics = function() { |
725 this.logger_.logStatistics(this.plugin_.getPerfStats()); | 739 this.logger_.logStatistics(this.plugin_.getPerfStats()); |
726 }; | 740 }; |
OLD | NEW |