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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 if (this.plugin_.hasCapability( | 559 if (this.plugin_.hasCapability( |
560 remoting.ClientSession.Capability.TOUCH_EVENTS)) { | 560 remoting.ClientSession.Capability.TOUCH_EVENTS)) { |
561 this.plugin_.enableTouchEvents(true); | 561 this.plugin_.enableTouchEvents(true); |
562 } | 562 } |
563 } else if (this.isFinished()) { | 563 } else if (this.isFinished()) { |
564 base.dispose(this.connectedDisposables_); | 564 base.dispose(this.connectedDisposables_); |
565 this.connectedDisposables_ = null; | 565 this.connectedDisposables_ = null; |
566 } | 566 } |
567 | 567 |
568 this.notifyStateChanges_(oldState, this.state_); | 568 this.notifyStateChanges_(oldState, this.state_); |
569 if (this.state_ > 1) { | |
kelvinp
2015/08/21 16:29:23
Currently initializing doesn't fire so this check
anandc
2015/08/21 18:56:56
Done.
| |
570 // Record state in an UMA histogram if it is after initializing. | |
571 recordState(this.state_); | |
572 } | |
569 this.logger_.logClientSessionStateChange( | 573 this.logger_.logClientSessionStateChange( |
570 this.state_, this.error_, this.xmppErrorCache_.getFirstError()); | 574 this.state_, this.error_, this.xmppErrorCache_.getFirstError()); |
571 }; | 575 }; |
572 | 576 |
573 /** | 577 /** |
578 * Records a Chromoting Connection State. | |
579 * @param {remoting.ClientSession.State} state State identifier. | |
580 */ | |
581 function recordState(state) { | |
582 var metricDescription = { | |
583 metricName: 'Chromoting.Connections', | |
584 type: 'histogram-linear', | |
585 min: 2, | |
kelvinp
2015/08/21 16:29:24
Use enum values from remoting.ClientSession.State
anandc
2015/08/21 18:56:56
Done.
| |
586 max: 7, | |
kelvinp
2015/08/21 16:29:23
The enum range is not consecutive, for example CON
anandc
2015/08/21 18:56:56
Thanks. PTAL at the latest implementation.
I consi
| |
587 buckets: 7 | |
anandc
2015/08/21 16:23:01
We only want to log when the connection state is a
| |
588 }; | |
589 | |
590 chrome.metricsPrivate.recordValue(metricDescription, state); | |
591 } | |
592 | |
593 /** | |
574 * @param {remoting.ClientSession.State} oldState The new state for the session. | 594 * @param {remoting.ClientSession.State} oldState The new state for the session. |
575 * @param {remoting.ClientSession.State} newState The new state for the session. | 595 * @param {remoting.ClientSession.State} newState The new state for the session. |
576 * @private | 596 * @private |
577 */ | 597 */ |
578 remoting.ClientSession.prototype.notifyStateChanges_ = | 598 remoting.ClientSession.prototype.notifyStateChanges_ = |
579 function(oldState, newState) { | 599 function(oldState, newState) { |
580 /** @type {remoting.Error} */ | 600 /** @type {remoting.Error} */ |
581 var error; | 601 var error; |
582 switch (this.state_) { | 602 switch (this.state_) { |
583 case remoting.ClientSession.State.CONNECTED: | 603 case remoting.ClientSession.State.CONNECTED: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 * Enable or disable logging of connection errors due to a host being offline. | 680 * Enable or disable logging of connection errors due to a host being offline. |
661 * For example, if attempting a connection using a cached JID, host-offline | 681 * For example, if attempting a connection using a cached JID, host-offline |
662 * errors should not be logged because the JID will be refreshed and the | 682 * errors should not be logged because the JID will be refreshed and the |
663 * connection retried. | 683 * connection retried. |
664 * | 684 * |
665 * @param {boolean} enable True to log host-offline errors; false to suppress. | 685 * @param {boolean} enable True to log host-offline errors; false to suppress. |
666 */ | 686 */ |
667 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { | 687 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { |
668 this.logHostOfflineErrors_ = enable; | 688 this.logHostOfflineErrors_ = enable; |
669 }; | 689 }; |
OLD | NEW |