[api-minor] Replace the CMapReaderFactory, StandardFontDataFactory, and WasmFactory API options with a single factory/option#20949
Conversation
e192103 to
9806af1
Compare
9806af1 to
3d55c1a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20949 +/- ##
==========================================
- Coverage 62.61% 62.53% -0.08%
==========================================
Files 174 172 -2
Lines 121947 121785 -162
==========================================
- Hits 76355 76162 -193
- Misses 45592 45623 +31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3d55c1a to
c894f01
Compare
…`, and `WasmFactory` API options with a single factory/option Currently we have no less than three different, but very similar, factories for reading built-in CMap files, standard font files, and wasm files on the main-thread.[1] These factories were added at different points in time, since I cannot imagine that we'd add essentially three copies of the same code otherwise. Nowadays these factories are often not even used[2], since worker-thread fetching is used whenever possible to improve performance. In particular, they will *only* be used when either: - The PDF.js library runs in Node.js environments. - The user manually sets `useWorkerFetch = false` when calling `getDocument`. - The user provides custom `CMapReaderFactory`, `StandardFontDataFactory`, and/or `WasmFactory` instances when calling `getDocument`. By replacing these factories with *a single* new `BinaryDataFactory` factory/option the number of `getDocument` options are thus reduced, which cannot hurt. This also reduces the total bundle-size of the Firefox PDF Viewer a little bit, and it slightly reduces the number of import maps that need to be maintained. *Please note:* For users that provide custom `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` instances when calling `getDocument` this will be a breaking change, however it's unlikely that (many) such users exist. (The *internal* format data-format of `CMapReaderFactory` was changed in PR 18951, and there hasn't been a single question/complaint about it in well over a year.) --- [1] Any new functionality could easily lead to more such factories being added in the future, which wouldn't be great. [2] Note that the Firefox PDF Viewer no longer use these factories, since it "forcibly" sets `useWorkerFetch = true` during building.
c894f01 to
3a372fd
Compare
|
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/146549f862dbb6b/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/f7412830035d463/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/146549f862dbb6b/output.txt Total script time: 45.96 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/f7412830035d463/output.txt Total script time: 72.55 mins
|
|
Nice simplification; thanks! |
Currently we have no less than three different, but very similar, factories for reading built-in CMap files, standard font files, and wasm files on the main-thread.[1]
These factories were added at different points in time, since I cannot imagine that we'd add essentially three copies of the same code otherwise.
Nowadays these factories are often not even used[2], since worker-thread fetching is used whenever possible to improve performance. In particular, they will only be used when either:
useWorkerFetch = falsewhen callinggetDocument.CMapReaderFactory,StandardFontDataFactory, and/orWasmFactoryinstances when callinggetDocument.By replacing these factories with a single new
BinaryDataFactoryfactory/option the number ofgetDocumentoptions are thus reduced, which cannot hurt.This also reduces the total bundle-size of the Firefox PDF Viewer a little bit, and it slightly reduces the number of import maps that need to be maintained.
Please note: For users that provide custom
CMapReaderFactory,StandardFontDataFactory, andWasmFactoryinstances when callinggetDocumentthis will be a breaking change, however it's unlikely that (many) such users exist.(The internal format data-format of
CMapReaderFactorywas changed in PR #18951, and there hasn't been a single question/complaint about it in well over a year.)[1] Any new functionality could easily lead to more such factories being added in the future, which wouldn't be great.
[2] Note that the Firefox PDF Viewer no longer use these factories, since it "forcibly" sets
useWorkerFetch = trueduring building.