Remove some unused code from the _queueLoadingCallback
method (PR 3477 follow-up)
The existing `loadingContext` class-property can be simplified slightly, since we've not been using the `id`-property on the requests ever since PR 3477 (which landed nine years ago). Furthermore, by default we're also not even using that code-path now since the Font Loading API will always be used when available.
This commit is contained in:
parent
5f65df774f
commit
9a03d36af4
@ -167,10 +167,7 @@ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
|||||||
FontLoader = class GenericFontLoader extends BaseFontLoader {
|
FontLoader = class GenericFontLoader extends BaseFontLoader {
|
||||||
constructor(params) {
|
constructor(params) {
|
||||||
super(params);
|
super(params);
|
||||||
this.loadingContext = {
|
this.loadingRequests = [];
|
||||||
requests: [],
|
|
||||||
nextRequestId: 0,
|
|
||||||
};
|
|
||||||
this.loadTestFontId = 0;
|
this.loadTestFontId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,20 +198,19 @@ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
|||||||
request.done = true;
|
request.done = true;
|
||||||
|
|
||||||
// Sending all completed requests in order of how they were queued.
|
// Sending all completed requests in order of how they were queued.
|
||||||
while (context.requests.length > 0 && context.requests[0].done) {
|
while (loadingRequests.length > 0 && loadingRequests[0].done) {
|
||||||
const otherRequest = context.requests.shift();
|
const otherRequest = loadingRequests.shift();
|
||||||
setTimeout(otherRequest.callback, 0);
|
setTimeout(otherRequest.callback, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = this.loadingContext;
|
const { loadingRequests } = this;
|
||||||
const request = {
|
const request = {
|
||||||
id: `pdfjs-font-loading-${context.nextRequestId++}`,
|
|
||||||
done: false,
|
done: false,
|
||||||
complete: completeRequest,
|
complete: completeRequest,
|
||||||
callback,
|
callback,
|
||||||
};
|
};
|
||||||
context.requests.push(request);
|
loadingRequests.push(request);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user