| 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 Utility methods for accessing chrome.metricsPrivate API. | 6 * @fileoverview Utility methods for accessing chrome.metricsPrivate API. |
| 7 * | 7 * |
| 8 * To be included as a first script in main.html | 8 * To be included as a first script in main.html |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 * @param {string} name Method name. | 63 * @param {string} name Method name. |
| 64 */ | 64 */ |
| 65 metrics.decorate = function(name) { | 65 metrics.decorate = function(name) { |
| 66 metrics[name] = function() { | 66 metrics[name] = function() { |
| 67 var args = Array.apply(null, arguments); | 67 var args = Array.apply(null, arguments); |
| 68 args[0] = metrics.convertName_(args[0]); | 68 args[0] = metrics.convertName_(args[0]); |
| 69 metrics.call_(name, args); | 69 metrics.call_(name, args); |
| 70 if (metrics.log) { | 70 if (metrics.log) { |
| 71 console.log('chrome.metricsPrivate.' + name, args); | 71 console.log('chrome.metricsPrivate.' + name, args); |
| 72 } | 72 } |
| 73 } | 73 }; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 metrics.decorate('recordMediumCount'); | 76 metrics.decorate('recordMediumCount'); |
| 77 metrics.decorate('recordSmallCount'); | 77 metrics.decorate('recordSmallCount'); |
| 78 metrics.decorate('recordTime'); | 78 metrics.decorate('recordTime'); |
| 79 metrics.decorate('recordUserAction'); | 79 metrics.decorate('recordUserAction'); |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * Complete the time interval recording. | 82 * Complete the time interval recording. |
| 83 * | 83 * |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 'min': 1, | 125 'min': 1, |
| 126 'max': boundaryValue, | 126 'max': boundaryValue, |
| 127 'buckets': boundaryValue + 1 | 127 'buckets': boundaryValue + 1 |
| 128 }; | 128 }; |
| 129 metrics.call_('recordValue', [metricDescr, index]); | 129 metrics.call_('recordValue', [metricDescr, index]); |
| 130 if (metrics.log) { | 130 if (metrics.log) { |
| 131 console.log('chrome.metricsPrivate.recordValue', | 131 console.log('chrome.metricsPrivate.recordValue', |
| 132 [metricDescr.metricName, index, value]); | 132 [metricDescr.metricName, index, value]); |
| 133 } | 133 } |
| 134 }; | 134 }; |
| OLD | NEW |