]> git.parisson.com Git - pdf.js.git/commitdiff
Remove operatorList cache from the backend
authorYury Delendik <ydelendik@mozilla.com>
Mon, 16 Apr 2012 20:23:24 +0000 (15:23 -0500)
committerYury Delendik <ydelendik@mozilla.com>
Mon, 16 Apr 2012 20:23:24 +0000 (15:23 -0500)
src/core.js
web/viewer.js

index 41f9a9c6160aad6af9c4e43f41d04891911a67fa..cbd2abf8d5e084395e2ef696e94e306ff1fcc2db 100644 (file)
@@ -132,11 +132,6 @@ var Page = (function PageClosure() {
     },
 
     getOperatorList: function Page_getOperatorList(handler, dependency) {
-      if (this.operatorList) {
-        // content was compiled
-        return this.operatorList;
-      }
-
       var xref = this.xref;
       var content = this.content;
       var resources = this.resources;
@@ -154,8 +149,7 @@ var Page = (function PageClosure() {
       var pe = this.pe = new PartialEvaluator(
                                 xref, handler, 'p' + this.pageNumber + '_');
 
-      this.operatorList = pe.getOperatorList(content, resources, dependency);
-      return this.operatorList;
+      return pe.getOperatorList(content, resources, dependency);
     },
 
     getLinks: function Page_getLinks() {
index a25a2a3ce3c86901fb9e8f2c62565c6383e9131b..3233371cc25d85435777df0ad4eeb8155c0dd0b7 100644 (file)
@@ -32,7 +32,7 @@ var Cache = function cacheCache(size) {
       data.splice(i);
     data.push(view);
     if (data.length > size)
-      data.shift().update();
+      data.shift().destroy();
   };
 };
 
@@ -743,6 +743,11 @@ var PageView = function pageView(container, pdfPage, id, scale,
   container.appendChild(anchor);
   container.appendChild(div);
 
+  this.destroy = function pageViewDestroy() {
+    this.update();
+    this.pdfPage.destroy();
+  };
+
   this.update = function pageViewUpdate(scale) {
     this.scale = scale || this.scale;
     var viewport = this.pdfPage.getViewport(this.scale);
@@ -756,7 +761,6 @@ var PageView = function pageView(container, pdfPage, id, scale,
     div.removeAttribute('data-loaded');
 
     delete this.canvas;
-    this.pdfPage.destroy();
 
     this.loadingIconDiv = document.createElement('div');
     this.loadingIconDiv.className = 'loadingIcon';