Merge pull request #11926 from Snuffleupagus/GlobalImageCache-clear-onlyData
Allow `GlobalImageCache.clear` to, optionally, only remove the actual data (PR 11912 follow-up)
This commit is contained in:
commit
cd6d089489
@ -844,8 +844,10 @@ class PDFDocument {
|
||||
return this.catalog.fontFallback(id, handler);
|
||||
}
|
||||
|
||||
async cleanup() {
|
||||
return this.catalog ? this.catalog.cleanup() : clearPrimitiveCaches();
|
||||
async cleanup(manuallyTriggered = false) {
|
||||
return this.catalog
|
||||
? this.catalog.cleanup(manuallyTriggered)
|
||||
: clearPrimitiveCaches();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,8 +199,10 @@ class GlobalImageCache {
|
||||
this._imageCache.put(ref, data);
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._refCache.clear();
|
||||
clear(onlyData = false) {
|
||||
if (!onlyData) {
|
||||
this._refCache.clear();
|
||||
}
|
||||
this._imageCache.clear();
|
||||
}
|
||||
}
|
||||
|
@ -716,9 +716,9 @@ class Catalog {
|
||||
});
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
cleanup(manuallyTriggered = false) {
|
||||
clearPrimitiveCaches();
|
||||
this.globalImageCache.clear();
|
||||
this.globalImageCache.clear(/* onlyData = */ manuallyTriggered);
|
||||
this.pageKidsCountCache.clear();
|
||||
|
||||
const promises = [];
|
||||
|
@ -76,8 +76,8 @@ class BasePdfManager {
|
||||
return this.pdfDocument.fontFallback(id, handler);
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
return this.pdfDocument.cleanup();
|
||||
cleanup(manuallyTriggered = false) {
|
||||
return this.pdfDocument.cleanup(manuallyTriggered);
|
||||
}
|
||||
|
||||
async ensure(obj, prop, args) {
|
||||
|
@ -625,7 +625,7 @@ var WorkerMessageHandler = {
|
||||
});
|
||||
|
||||
handler.on("Cleanup", function wphCleanup(data) {
|
||||
return pdfManager.cleanup();
|
||||
return pdfManager.cleanup(/* manuallyTriggered = */ true);
|
||||
});
|
||||
|
||||
handler.on("Terminate", function wphTerminate(data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user