| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Namespace object for the utilities. | 5 // Namespace object for the utilities. |
| 6 var ImageUtil = {}; | 6 var ImageUtil = {}; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Performance trace. | 9 * Performance trace. |
| 10 */ | 10 */ |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 var emptyCanvas = assertInstanceof(this.document_.createElement('canvas'), | 506 var emptyCanvas = assertInstanceof(this.document_.createElement('canvas'), |
| 507 HTMLCanvasElement); | 507 HTMLCanvasElement); |
| 508 emptyCanvas.width = 0; | 508 emptyCanvas.width = 0; |
| 509 emptyCanvas.height = 0; | 509 emptyCanvas.height = 0; |
| 510 tmpCallback(emptyCanvas, opt_error); | 510 tmpCallback(emptyCanvas, opt_error); |
| 511 }; | 511 }; |
| 512 onError = onError.bind(this); | 512 onError = onError.bind(this); |
| 513 | 513 |
| 514 var loadImage = function() { | 514 var loadImage = function() { |
| 515 ImageUtil.metrics.startInterval(ImageUtil.getMetricName('LoadTime')); | 515 ImageUtil.metrics.startInterval(ImageUtil.getMetricName('LoadTime')); |
| 516 this.timeout_ = null; | 516 this.timeout_ = 0; |
| 517 | 517 |
| 518 this.image_.onload = function() { | 518 this.image_.onload = function() { |
| 519 this.image_.onerror = null; | 519 this.image_.onerror = null; |
| 520 this.image_.onload = null; | 520 this.image_.onload = null; |
| 521 this.metadataModel_.get([entry], ['contentImageTransform']).then( | 521 this.metadataModel_.get([entry], ['contentImageTransform']).then( |
| 522 function(metadataItems) { | 522 function(metadataItems) { |
| 523 onTransform(this.image_, metadataItems[0].contentImageTransform); | 523 onTransform(this.image_, metadataItems[0].contentImageTransform); |
| 524 }.bind(this)); | 524 }.bind(this)); |
| 525 }.bind(this); | 525 }.bind(this); |
| 526 | 526 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 ImageUtil.getMetricName = function(name) { | 725 ImageUtil.getMetricName = function(name) { |
| 726 return 'PhotoEditor.' + name; | 726 return 'PhotoEditor.' + name; |
| 727 }; | 727 }; |
| 728 | 728 |
| 729 /** | 729 /** |
| 730 * Used for metrics reporting, keep in sync with the histogram description. | 730 * Used for metrics reporting, keep in sync with the histogram description. |
| 731 * @type {Array.<string>} | 731 * @type {Array.<string>} |
| 732 * @const | 732 * @const |
| 733 */ | 733 */ |
| 734 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; | 734 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; |
| OLD | NEW |