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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 * @param {remoting.ClientSession.State} state State identifier. | 596 * @param {remoting.ClientSession.State} state State identifier. |
597 */ | 597 */ |
598 function recordState(state) { | 598 function recordState(state) { |
599 // According to src/base/metrics/histogram.h, for a UMA enumerated histogram, | 599 // According to src/base/metrics/histogram.h, for a UMA enumerated histogram, |
600 // the upper limit should be 1 above the max-enum. | 600 // the upper limit should be 1 above the max-enum. |
601 var histogram_max = remoting.ClientSession.State.MAX_STATE_ENUM - | 601 var histogram_max = remoting.ClientSession.State.MAX_STATE_ENUM - |
602 remoting.ClientSession.State.MIN_STATE_ENUM + 1; | 602 remoting.ClientSession.State.MIN_STATE_ENUM + 1; |
603 | 603 |
604 var metricDescription = { | 604 var metricDescription = { |
605 metricName: 'Chromoting.Connections', | 605 metricName: 'Chromoting.Connections', |
606 type: 'histogram-linear', | 606 type: chrome.metricsPrivate.MetricTypeType.HISTOGRAM_LINEAR, |
607 // According to histogram.h, minimum should be 1. Values less than minimum | 607 // According to histogram.h, minimum should be 1. Values less than minimum |
608 // end up in the 0th bucket. | 608 // end up in the 0th bucket. |
609 min: 1, | 609 min: 1, |
610 max: histogram_max, | 610 max: histogram_max, |
611 // The # of buckets should include 1 for underflow. | 611 // The # of buckets should include 1 for underflow. |
612 buckets: histogram_max + 1 | 612 buckets: histogram_max + 1 |
613 }; | 613 }; |
614 | 614 |
615 chrome.metricsPrivate.recordValue(metricDescription, state - | 615 chrome.metricsPrivate.recordValue(metricDescription, state - |
616 remoting.ClientSession.State.MIN_STATE_ENUM); | 616 remoting.ClientSession.State.MIN_STATE_ENUM); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 } else if (previous == State.CONNECTED && current == State.FAILED) { | 717 } else if (previous == State.CONNECTED && current == State.FAILED) { |
718 return State.CONNECTION_DROPPED; | 718 return State.CONNECTION_DROPPED; |
719 } | 719 } |
720 return current; | 720 return current; |
721 }; | 721 }; |
722 | 722 |
723 /** @private */ | 723 /** @private */ |
724 remoting.ClientSession.prototype.reportStatistics = function() { | 724 remoting.ClientSession.prototype.reportStatistics = function() { |
725 this.logger_.logStatistics(this.plugin_.getPerfStats()); | 725 this.logger_.logStatistics(this.plugin_.getPerfStats()); |
726 }; | 726 }; |
OLD | NEW |