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);
|
return this.catalog.fontFallback(id, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
async cleanup() {
|
async cleanup(manuallyTriggered = false) {
|
||||||
return this.catalog ? this.catalog.cleanup() : clearPrimitiveCaches();
|
return this.catalog
|
||||||
|
? this.catalog.cleanup(manuallyTriggered)
|
||||||
|
: clearPrimitiveCaches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,8 +199,10 @@ class GlobalImageCache {
|
|||||||
this._imageCache.put(ref, data);
|
this._imageCache.put(ref, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear(onlyData = false) {
|
||||||
this._refCache.clear();
|
if (!onlyData) {
|
||||||
|
this._refCache.clear();
|
||||||
|
}
|
||||||
this._imageCache.clear();
|
this._imageCache.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -716,9 +716,9 @@ class Catalog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup(manuallyTriggered = false) {
|
||||||
clearPrimitiveCaches();
|
clearPrimitiveCaches();
|
||||||
this.globalImageCache.clear();
|
this.globalImageCache.clear(/* onlyData = */ manuallyTriggered);
|
||||||
this.pageKidsCountCache.clear();
|
this.pageKidsCountCache.clear();
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
@ -76,8 +76,8 @@ class BasePdfManager {
|
|||||||
return this.pdfDocument.fontFallback(id, handler);
|
return this.pdfDocument.fontFallback(id, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup(manuallyTriggered = false) {
|
||||||
return this.pdfDocument.cleanup();
|
return this.pdfDocument.cleanup(manuallyTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ensure(obj, prop, args) {
|
async ensure(obj, prop, args) {
|
||||||
|
@ -625,7 +625,7 @@ var WorkerMessageHandler = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
handler.on("Cleanup", function wphCleanup(data) {
|
handler.on("Cleanup", function wphCleanup(data) {
|
||||||
return pdfManager.cleanup();
|
return pdfManager.cleanup(/* manuallyTriggered = */ true);
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.on("Terminate", function wphTerminate(data) {
|
handler.on("Terminate", function wphTerminate(data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user