mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Cleaning up fonts when viewer is idle for some time
This commit is contained in:
parent
945e370d4f
commit
e712c4136a
9 changed files with 93 additions and 9 deletions
|
@ -270,6 +270,9 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
|
|||
dataLoaded: function PDFDocumentProxy_dataLoaded() {
|
||||
return this.transport.dataLoaded();
|
||||
},
|
||||
cleanup: function PDFDocumentProxy_cleanup() {
|
||||
this.transport.startCleanup();
|
||||
},
|
||||
destroy: function PDFDocumentProxy_destroy() {
|
||||
this.transport.destroy();
|
||||
}
|
||||
|
@ -892,6 +895,21 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||
}
|
||||
);
|
||||
return promise;
|
||||
},
|
||||
|
||||
startCleanup: function WorkerTransport_startCleanup() {
|
||||
this.messageHandler.send('Cleanup', null,
|
||||
function endCleanup() {
|
||||
for (var i = 0, ii = this.pageCache.length; i < ii; i++) {
|
||||
var page = this.pageCache[i];
|
||||
if (page) {
|
||||
page.destroy();
|
||||
}
|
||||
}
|
||||
this.commonObjs.clear();
|
||||
FontLoader.clear();
|
||||
}.bind(this)
|
||||
);
|
||||
}
|
||||
};
|
||||
return WorkerTransport;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue