Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/resources/file_manager/js/metadata/exif_parser.js

Issue 12212127: [cleanup] Files.app: Remove Function declarations within blocks #3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 var EXIF_MARK_SOI = 0xffd8; // Start of image data. 5 var EXIF_MARK_SOI = 0xffd8; // Start of image data.
6 var EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data). 6 var EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data).
7 var EXIF_MARK_SOF = 0xffc0; // Start of "frame" 7 var EXIF_MARK_SOF = 0xffc0; // Start of "frame"
8 var EXIF_MARK_EXIF = 0xffe1; // Start of exif block. 8 var EXIF_MARK_EXIF = 0xffe1; // Start of exif block.
9 9
10 var EXIF_ALIGN_LITTLE = 0x4949; // Indicates little endian exif data. 10 var EXIF_ALIGN_LITTLE = 0x4949; // Indicates little endian exif data.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 if (filePos == 0) { 59 if (filePos == 0) {
60 // First slice, check for the SOI mark. 60 // First slice, check for the SOI mark.
61 var firstMark = this.readMark(br); 61 var firstMark = this.readMark(br);
62 if (firstMark != EXIF_MARK_SOI) 62 if (firstMark != EXIF_MARK_SOI)
63 throw new Error('Invalid file header: ' + firstMark.toString(16)); 63 throw new Error('Invalid file header: ' + firstMark.toString(16));
64 } 64 }
65 65
66 var self = this; 66 var self = this;
67 function reread(opt_offset, opt_bytes) { 67 var reread = function(opt_offset, opt_bytes) {
68 self.requestSlice(file, callback, errorCallback, metadata, 68 self.requestSlice(file, callback, errorCallback, metadata,
69 filePos + br.tell() + (opt_offset || 0), opt_bytes); 69 filePos + br.tell() + (opt_offset || 0), opt_bytes);
70 } 70 };
71 71
72 while (true) { 72 while (true) {
73 if (!br.canRead(4)) { 73 if (!br.canRead(4)) {
74 // Cannot read the mark and the length, request a minimum-size slice. 74 // Cannot read the mark and the length, request a minimum-size slice.
75 reread(); 75 reread();
76 return; 76 return;
77 } 77 }
78 78
79 var mark = this.readMark(br); 79 var mark = this.readMark(br);
80 if (mark == EXIF_MARK_SOS) 80 if (mark == EXIF_MARK_SOS)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 return { 362 return {
363 scaleX: ExifParser.SCALEX[index], 363 scaleX: ExifParser.SCALEX[index],
364 scaleY: ExifParser.SCALEY[index], 364 scaleY: ExifParser.SCALEY[index],
365 rotate90: ExifParser.ROTATE90[index] 365 rotate90: ExifParser.ROTATE90[index]
366 }; 366 };
367 } 367 }
368 return null; 368 return null;
369 }; 369 };
370 370
371 MetadataDispatcher.registerParserClass(ExifParser); 371 MetadataDispatcher.registerParserClass(ExifParser);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698