Commit d7a497ba authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[piexwasm] Remove id member from Piex JS objects

The id was a hangover from a time when PIEX image extraction used NaCl
to do thumbnail image extraction. It serves no purpose: remove it from
@typedefs and object properties. Reformat @typedefs for consistency.

No change in behavior, no new tests.

Bug: 1039141
Change-Id: I8c50b7e5906ce3763ba2396b677b7f74f1ec4a09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062014Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742466}
parent 22b75da2
......@@ -58,7 +58,6 @@ function wasmModuleFailed() {
/**
* @typedef {{
* id: number,
* thumbnail: !ArrayBuffer,
* mimeType: (string|undefined),
* orientation: number,
......@@ -69,18 +68,11 @@ function wasmModuleFailed() {
let ImagePreviewResponseData;
/**
*
* @param {!ImagePreviewResponseData} data The preview image data.
* @constructor
* @struct
*/
function PiexLoaderResponse(data) {
/**
* @public {number}
* @const
*/
this.id = data.id;
/**
* @public {!ArrayBuffer}
* @const
......@@ -107,7 +99,7 @@ function PiexLoaderResponse(data) {
this.colorSpace = data.colorSpace;
/**
* JSON encoded RAW image photographic details (Piex Wasm module only).
* JSON encoded RAW image photographic details.
* @public {?string}
* @const
*/
......@@ -120,10 +112,7 @@ function PiexLoaderResponse(data) {
* @struct
*/
function PiexLoader() {
/**
* @private {number}
*/
this.requestIdCount_ = 0;
// TODO(crbug.com/1039141): make this an ES6 class.
}
/**
......@@ -220,16 +209,8 @@ let PiexWasmImageResult;
class ImageBuffer {
/**
* @param {!ArrayBuffer} buffer - raw image source data.
* @param {number} id - caller-defined id.
*/
constructor(buffer, id) {
/**
* @type {number}
* @const
* @private
*/
this.id = id;
constructor(buffer) {
/**
* @type {!Uint8Array}
* @const
......@@ -301,7 +282,6 @@ class ImageBuffer {
ifd: this.details(result, preview.orientation),
orientation: preview.orientation,
colorSpace: preview.colorSpace,
id: this.id,
};
}
......@@ -322,7 +302,6 @@ class ImageBuffer {
thumbnail: new ArrayBuffer(0),
colorSpace: ColorSpace.SRGB,
orientation: 1,
id: this.id,
ifd: null,
};
}
......@@ -344,7 +323,6 @@ class ImageBuffer {
ifd: this.details(result, thumbnail.orientation),
orientation: thumbnail.orientation,
colorSpace: thumbnail.colorSpace,
id: this.id,
};
}
......@@ -365,7 +343,6 @@ class ImageBuffer {
thumbnail: new ArrayBuffer(0),
colorSpace: ColorSpace.SRGB,
orientation: 1,
id: this.id,
ifd: null,
};
}
......@@ -440,7 +417,6 @@ class ImageBuffer {
ifd: this.details(result, thumbnail.orientation),
orientation: thumbnail.orientation,
colorSpace: thumbnail.colorSpace,
id: this.id,
};
}
......@@ -497,15 +473,14 @@ class ImageBuffer {
* @return {!Promise<!PiexLoaderResponse>}
*/
PiexLoader.prototype.load = function(url) {
const requestId = this.requestIdCount_++;
let imageBuffer;
return readFromFileSystem(url)
.then((buffer) => {
if (wasmModuleFailed() === true) {
return Promise.reject('piex wasm module failed');
}
imageBuffer = new ImageBuffer(buffer, requestId);
imageBuffer = new ImageBuffer(buffer);
return imageBuffer.process();
})
.then((result) => {
......
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