mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Move the Metadata parsing to the worker-thread
The only reason, as far as I can tell, for parsing the Metadata on the main-thread is how it was originally implemented. When Metadata support was first implemented, it utilized the [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser) which isn't available in workers. Today, with the custom XML-parser being used, that's no longer an issue and it seems reasonable to move the Metadata parsing to the worker-thread[1], since that's where all parsing should happen (for performance reasons). Based on these changes, we'll be able to reduce the now unnecessary duplication of the XML-parser (and related code) in both of the *built* `pdf.js`/`pdf.worker.js` files. Finally, this patch changes the `_repair` method to use "Array + join" rather than string concatenation. --- [1] This needed the previous patch, to enable sending of `Map`s between threads with workers disabled.
This commit is contained in:
parent
73bf45e64b
commit
cc3a6563ee
6 changed files with 177 additions and 142 deletions
|
@ -16,7 +16,7 @@
|
|||
// The code for XMLParserBase copied from
|
||||
// https://github.com/mozilla/shumway/blob/16451d8836fa85f4b16eeda8b4bda2fa9e2b22b0/src/avm2/natives/xml.ts
|
||||
|
||||
import { encodeToXmlString } from "./util.js";
|
||||
import { encodeToXmlString } from "../shared/util.js";
|
||||
|
||||
const XMLParserErrorCode = {
|
||||
NoError: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue