| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * Client used to connect to the remote ImageLoader extension. Client class runs | 6 * Client used to connect to the remote ImageLoader extension. Client class runs |
| 7 * in the extension, where the client.js is included (eg. Files.app). | 7 * in the extension, where the client.js is included (eg. Files.app). |
| 8 * It sends remote requests using IPC to the ImageLoader class and forwards | 8 * It sends remote requests using IPC to the ImageLoader class and forwards |
| 9 * its responses. | 9 * its responses. |
| 10 * | 10 * |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Records binary metrics. Counts for true and false are stored as a histogram. | 56 * Records binary metrics. Counts for true and false are stored as a histogram. |
| 57 * @param {string} name Histogram's name. | 57 * @param {string} name Histogram's name. |
| 58 * @param {boolean} value True or false. | 58 * @param {boolean} value True or false. |
| 59 */ | 59 */ |
| 60 ImageLoaderClient.recordBinary = function(name, value) { | 60 ImageLoaderClient.recordBinary = function(name, value) { |
| 61 chrome.metricsPrivate.recordValue( | 61 chrome.metricsPrivate.recordValue( |
| 62 { metricName: 'ImageLoader.Client.' + name, | 62 { metricName: 'ImageLoader.Client.' + name, |
| 63 type: 'histogram-linear', | 63 type: chrome.metricsPrivate.MetricTypeType.HISTOGRAM_LINEAR, |
| 64 min: 1, // According to histogram.h, this should be 1 for enums. | 64 min: 1, // According to histogram.h, this should be 1 for enums. |
| 65 max: 2, // Maximum should be exclusive. | 65 max: 2, // Maximum should be exclusive. |
| 66 buckets: 3 }, // Number of buckets: 0, 1 and overflowing 2. | 66 buckets: 3 }, // Number of buckets: 0, 1 and overflowing 2. |
| 67 value ? 1 : 0); | 67 value ? 1 : 0); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * Records percent metrics, stored as a histogram. | 71 * Records percent metrics, stored as a histogram. |
| 72 * @param {string} name Histogram's name. | 72 * @param {string} name Histogram's name. |
| 73 * @param {number} value Value (0..100). | 73 * @param {number} value Value (0..100). |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 onError(); | 274 onError(); |
| 275 return; | 275 return; |
| 276 } | 276 } |
| 277 image.src = result.data; | 277 image.src = result.data; |
| 278 onSuccess(); | 278 onSuccess(); |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 return ImageLoaderClient.getInstance().load( | 281 return ImageLoaderClient.getInstance().load( |
| 282 url, callback, options, opt_isValid); | 282 url, callback, options, opt_isValid); |
| 283 }; | 283 }; |
| OLD | NEW |