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 * @typedef {{ | 6 * @typedef {{ |
7 * cache: (boolean|undefined), | 7 * cache: (boolean|undefined), |
8 * priority: (number|undefined), | 8 * priority: (number|undefined), |
9 * taskId: number, | 9 * taskId: number, |
10 * timestamp: (number|undefined), | 10 * timestamp: (number|undefined), |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 metrics.Categories.INTERNALS, | 254 metrics.Categories.INTERNALS, |
255 metrics.timing.Variables.EXTRACT_THUMBNAIL_FROM_RAW, | 255 metrics.timing.Variables.EXTRACT_THUMBNAIL_FROM_RAW, |
256 fileType.subtype); | 256 fileType.subtype); |
257 this.piexLoader_.load(this.request_.url).then(function(data) { | 257 this.piexLoader_.load(this.request_.url).then(function(data) { |
258 timer.send(); | 258 timer.send(); |
259 var blob = new Blob([data.thumbnail], {type: 'image/jpeg'}); | 259 var blob = new Blob([data.thumbnail], {type: 'image/jpeg'}); |
260 var url = URL.createObjectURL(blob); | 260 var url = URL.createObjectURL(blob); |
261 this.image_.src = url; | 261 this.image_.src = url; |
262 this.request_.orientation = data.orientation; | 262 this.request_.orientation = data.orientation; |
263 this.request_.colorSpace = data.colorSpace; | 263 this.request_.colorSpace = data.colorSpace; |
264 }.bind(this), function(error) { | 264 }.bind(this), function() { |
265 console.error('PiexLoaderError: ', error); | 265 // The error has already been logged in PiexLoader. |
266 onFailure(); | 266 onFailure(); |
267 }); | 267 }); |
268 return; | 268 return; |
269 } | 269 } |
270 | 270 |
271 // Load video thumbnails by using video tag instead of XHR. | 271 // Load video thumbnails by using video tag instead of XHR. |
272 if (fileType.type === 'video') { | 272 if (fileType.type === 'video') { |
273 this.createVideoThumbnailUrl_(this.request_.url).then(function(url) { | 273 this.createVideoThumbnailUrl_(this.request_.url).then(function(url) { |
274 this.image_.src = url; | 274 this.image_.src = url; |
275 }.bind(this)).catch(function(error) { | 275 }.bind(this)).catch(function(error) { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + | 582 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + |
583 'ABAAEAAAICTAEAOw=='; | 583 'ABAAEAAAICTAEAOw=='; |
584 | 584 |
585 this.xhr_.onload = function() {}; | 585 this.xhr_.onload = function() {}; |
586 this.xhr_.abort(); | 586 this.xhr_.abort(); |
587 | 587 |
588 // Dispose memory allocated by Canvas. | 588 // Dispose memory allocated by Canvas. |
589 this.canvas_.width = 0; | 589 this.canvas_.width = 0; |
590 this.canvas_.height = 0; | 590 this.canvas_.height = 0; |
591 }; | 591 }; |
OLD | NEW |