-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a BMP decoder when resizing an image #18918
base: master
Are you sure you want to change the base?
Conversation
The image decoding won't block the main thread any more. For now, it isn't enabled for Chrome because issue6741.pdf leads to a crash.
/botio browsertest |
From: Bot.io (Linux m4)ReceivedCommand cmd_browsertest from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/89dce42e9880aed/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_browsertest from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/623d99422ac60d8/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/89dce42e9880aed/output.txt Total script time: 21.25 mins
Image differences available at: http://54.241.84.105:8877/89dce42e9880aed/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/623d99422ac60d8/output.txt Total script time: 29.31 mins
Image differences available at: http://54.193.163.58:8877/623d99422ac60d8/reftest-analyzer.html#web=eq.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have benchmarking results that show (clear) improvements with this patch?
Have you reported the Chrome-crash to the browser developers?
return shadow(this, "platform", { | ||
isChrome: !isFirefox && !!window.chrome, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this isn't safe, since code in src/shared/
will run on both the main- and worker-threads (and in Node.js) so you cannot access window
here.
Can we please just revert the changes in this file (I'll make a few other suggestions)?
@@ -1045,6 +1045,7 @@ const PDFViewerApplication = { | |||
const loadingTask = getDocument({ | |||
...apiParams, | |||
...args, | |||
isChrome: FeatureTest.platform.isChrome, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this.
isChrome: FeatureTest.platform.isChrome, |
@@ -177,6 +177,7 @@ const DefaultStandardFontDataFactory = | |||
* `OffscreenCanvas` in the worker. Primarily used to improve performance of | |||
* image conversion/rendering. | |||
* The default value is `true` in web environments and `false` in Node.js. | |||
* @property {boolean} [isChrome] - Determines if we can use bmp ImageDecoder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @property {boolean} [isChrome] - Determines if we can use bmp ImageDecoder. | |
* @property {boolean} [isChrome] - Determines if we can use bmp ImageDecoder. | |
* NOTE: Temporary option until [link to Chromium bug report] is fixed. |
@@ -281,6 +282,7 @@ function getDocument(src = {}) { | |||
typeof src.isOffscreenCanvasSupported === "boolean" | |||
? src.isOffscreenCanvasSupported | |||
: !isNodeJS; | |||
const isChrome = src.isChrome === true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid issues, and to support this properly when running tests, can we please change it as follows?
const isChrome = src.isChrome === true; | |
const isChrome = | |
typeof src.isChrome === "boolean" | |
? src.isChrome | |
: (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) && | |
!FeatureTest.platform.isFirefox && | |
typeof window !== "undefined" && | |
!!window?.chrome; |
let decoder, imagePromise; | ||
|
||
// TODO: remove the isChrome, once Chrome isn't crashing anymore with | ||
// isssue6741.pdf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// isssue6741.pdf. | |
// issue6741.pdf. |
// TODO: remove the isChrome, once Chrome isn't crashing anymore with | ||
// isssue6741.pdf. | ||
if ( | ||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I don't believe that enabling this unconditionally in Firefox is safe, since this can be disabled with a preference and that preference is only enabled by default in Nightly: https://searchfox.org/mozilla-central/rev/ec342a3d481d9ac3324d1041e05eefa6b61392d2/modules/libpref/init/StaticPrefList.yaml#3241-3245
The image decoding won't block the main thread any more.
For now, it isn't enabled for Chrome because issue6741.pdf leads to a crash.