mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Merge pull request #3911 from yurydelendik/mem-redux2
Cleaning up fonts when viewer is idle for some time
This commit is contained in:
commit
3132c9e7e9
9 changed files with 93 additions and 9 deletions
|
@ -276,6 +276,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();
|
||||
}
|
||||
|
@ -907,6 +910,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