Merge pull request #15916 from Snuffleupagus/fetch-transfer

[api-minor] Enabling transferring of data fetched with the `PDFFetchStream` implementation
This commit is contained in:
Jonas Jenwald 2023-01-13 13:28:12 +01:00 committed by GitHub
commit e09ad99973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 11 deletions

View file

@ -192,9 +192,7 @@ if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("PRODUCTION")) {
* @property {boolean} [transferPdfData] - Determines if we can transfer
* TypedArrays used for loading the PDF file, utilized together with:
* - The `data`-option, for the `getDocument` function.
* - The `initialData`-option, for the `PDFDataRangeTransport` constructor.
* - The `chunk`-option, for the `PDFDataTransportStream._onReceiveData`
* method.
* - The `PDFDataTransportStream` implementation.
* This will help reduce main-thread memory usage, however it will take
* ownership of the TypedArrays. The default value is `false`.
* @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
@ -2499,7 +2497,7 @@ class WorkerTransport {
return;
}
assert(
isArrayBuffer(value),
value instanceof ArrayBuffer,
"GetReader - expected an ArrayBuffer."
);
// Enqueue data chunk into sink, and transfer it
@ -2585,7 +2583,7 @@ class WorkerTransport {
return;
}
assert(
isArrayBuffer(value),
value instanceof ArrayBuffer,
"GetRangeReader - expected an ArrayBuffer."
);
sink.enqueue(new Uint8Array(value), 1, [value]);