Commit d43146b8 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

FileManager: closure-compile exif_parser.js

The ExifParser constructor was missing a comment causing the compiler to
ignore all the other annotations. Closure didn't complain about the
constructor itself missing a comment because it's never invoked as a
constructor by name. It's passed as a factory to registerParserClass().

Bug: 860355
Change-Id: I12bf8bf1c0b3ac9c5b4825e22a58558121258fa9
Reviewed-on: https://chromium-review.googlesource.com/1160061Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580403}
parent 7b6bda3c
......@@ -20,6 +20,11 @@ importScripts(
FILE_MANAGER_HOST__EXIF_PARSER +
'/foreground/js/metadata/exif_constants.js');
/**
* @param {MetadataParserLogger} parent Parent object.
* @constructor
* @extends {ImageParser}
*/
function ExifParser(parent) {
ImageParser.call(this, parent, 'jpeg', /\.jpe?g$/i);
}
......@@ -52,8 +57,10 @@ ExifParser.prototype.requestSlice = function(
var self = this;
var reader = new FileReader();
reader.onerror = errorCallback;
reader.onload = function() { self.parseSlice(
file, callback, errorCallback, metadata, filePos, reader.result);
reader.onload = function() {
self.parseSlice(
file, callback, errorCallback, metadata, filePos,
/** @type{ArrayBuffer} */ (reader.result));
};
reader.readAsArrayBuffer(file.slice(filePos, filePos + opt_length));
};
......@@ -61,7 +68,7 @@ ExifParser.prototype.requestSlice = function(
/**
* @param {File} file File object to parse.
* @param {function(!Object)} callback Callback to be called on success.
* @param {function(string)} errorCallback Error callback.
* @param {function((Event|string))} errorCallback Error callback.
* @param {!Object} metadata Metadata object.
* @param {number} filePos Position to slice at.
* @param {ArrayBuffer} buf Buffer to be parsed.
......@@ -274,13 +281,13 @@ ExifParser.prototype.readMarkLength = function(br) {
/**
* @param {ByteReader} br Byte reader to be used for reading.
* @param {Array<Object>} tags Array of tags to be written to.
* @param {Object<number, Object>} tags Map of tags to be written to.
* @return {number} Directory offset.
*/
ExifParser.prototype.readDirectory = function(br, tags) {
var entryCount = br.readScalar(2);
for (var i = 0; i < entryCount; i++) {
var tagId = br.readScalar(2);
var tagId = /** @type Exif.Tag<number> */ (br.readScalar(2));
var tag = tags[tagId] = {id: tagId};
tag.format = br.readScalar(2);
tag.componentCount = br.readScalar(4);
......@@ -292,7 +299,7 @@ ExifParser.prototype.readDirectory = function(br, tags) {
/**
* @param {ByteReader} br Byte reader to be used for reading.
* @param {Object} tag Tag object.
* @param {ExifEntry} tag Tag object.
*/
ExifParser.prototype.readTagValue = function(br, tag) {
var self = this;
......@@ -367,9 +374,10 @@ ExifParser.prototype.readTagValue = function(br, tag) {
if (tag.componentCount === 0) {
tag.value = '';
} else if (tag.componentCount === 1) {
tag.value = String.fromCharCode(tag.value);
tag.value = String.fromCharCode(/** @type {number} */ (tag.value));
} else {
tag.value = String.fromCharCode.apply(null, tag.value);
tag.value = String.fromCharCode.apply(
null, /** @type{Array<number>} */ (tag.value));
}
this.validateAndFixStringTag_(tag);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment