mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Reduce usage of Date.now()
in src/core/worker.js
Currently for every single parsed/rendered page there's no less than *four* `Date.now()` calls being made on the worker-side. This seems totally unnecessary, since the result of these calls are, by default, not used for anything *unless* the verbosity level is set to `INFO`.
This commit is contained in:
parent
c43396c2b7
commit
4170c414fa
2 changed files with 22 additions and 15 deletions
|
@ -2028,11 +2028,11 @@ class WorkerTransport {
|
|||
return; // Ignore any pending requests if the worker was terminated.
|
||||
}
|
||||
|
||||
const page = this.pageCache[data.pageNum - 1];
|
||||
const page = this.pageCache[data.pageIndex];
|
||||
const intentState = page.intentStates[data.intent];
|
||||
|
||||
if (intentState.displayReadyCapability) {
|
||||
intentState.displayReadyCapability.reject(data.error);
|
||||
intentState.displayReadyCapability.reject(new Error(data.error));
|
||||
} else {
|
||||
throw new Error(data.error);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue