[Pkg-javascript-commits] [pdf.js] 56/207: Zero the height and width of the PageView canvas before deleting.

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 97cc06a7f95ea6c25c6699b85a6f746b3ca00cba
Author: Nicholas Nethercote <nnethercote at mozilla.com>
Date:   Thu Jun 12 16:20:30 2014 +1000

    Zero the height and width of the PageView canvas before deleting.
---
 web/page_view.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/web/page_view.js b/web/page_view.js
index 47b18d7..d90419e 100644
--- a/web/page_view.js
+++ b/web/page_view.js
@@ -99,7 +99,13 @@ var PageView = function pageView(container, id, scale,
       this.annotationLayer = null;
     }
 
-    delete this.canvas;
+    if (this.canvas) {
+      // Zeroing the width and height causes Firefox to release graphics
+      // resources immediately, which can greatly reduce memory consumption.
+      this.canvas.width = 0;
+      this.canvas.height = 0;
+      delete this.canvas;
+    }
 
     this.loadingIconDiv = document.createElement('div');
     this.loadingIconDiv.className = 'loadingIcon';

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list