Refactor PDFThumbnailView to look more similar to PDFPageView
This includes an optimization to zero the height and width of existing thumbnail canvases, when they are removed and recreated during rotation of the document. (Credit goes to nnethercote, who initially found this in PR 4920.)
This commit is contained in:
parent
7f8f404536
commit
878aa76c15
2 changed files with 110 additions and 84 deletions
|
@ -104,6 +104,13 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
|
|||
},
|
||||
|
||||
cleanup: function PDFThumbnailViewer_cleanup() {
|
||||
var tempCanvas = PDFThumbnailView.tempImageCache;
|
||||
if (tempCanvas) {
|
||||
// Zeroing the width and height causes Firefox to release graphics
|
||||
// resources immediately, which can greatly reduce memory consumption.
|
||||
tempCanvas.width = 0;
|
||||
tempCanvas.height = 0;
|
||||
}
|
||||
PDFThumbnailView.tempImageCache = null;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue