]> git.parisson.com Git - pdf.js.git/commitdiff
Remove TODO on PDFDocModel and rename pdf to pdfModel
authorJulian Viereck <julian.viereck@gmail.com>
Tue, 21 Feb 2012 13:10:44 +0000 (14:10 +0100)
committerJulian Viereck <julian.viereck@gmail.com>
Fri, 16 Mar 2012 13:54:10 +0000 (14:54 +0100)
src/core.js
src/worker.js

index 17f188e51f2f5a49b530961fafd3fc9840365193..01bbc85233be8ce1a1b0f9551380b74d64cdfaa2 100644 (file)
@@ -473,9 +473,6 @@ var Page = (function PageClosure() {
  * Right now there exists one PDFDocModel on the main thread + one object
  * for each worker. If there is no worker support enabled, there are two
  * `PDFDocModel` objects on the main thread created.
- * TODO: Refactor the internal object structure, such that there is no
- * need for the `PDFDocModel` anymore and there is only one object on the
- * main thread and not one entire copy on each worker instance.
  */
 var PDFDocModel = (function PDFDocModelClosure() {
   function PDFDocModel(arg, callback) {
@@ -644,9 +641,9 @@ var PDFDoc = (function PDFDocClosure() {
 
     this.data = data;
     this.stream = stream;
-    this.pdf = new PDFDocModel(stream);
-    this.fingerprint = this.pdf.getFingerprint();
-    this.catalog = this.pdf.catalog;
+    this.pdfModel = new PDFDocModel(stream);
+    this.fingerprint = this.pdfModel.getFingerprint();
+    this.catalog = this.pdfModel.catalog;
     this.objs = new PDFObjects();
 
     this.pageCache = [];
@@ -820,7 +817,7 @@ var PDFDoc = (function PDFDocClosure() {
     },
 
     get numPages() {
-      return this.pdf.numPages;
+      return this.pdfModel.numPages;
     },
 
     startRendering: function pdfDocStartRendering(page) {
@@ -835,7 +832,7 @@ var PDFDoc = (function PDFDocClosure() {
       if (this.pageCache[n])
         return this.pageCache[n];
 
-      var page = this.pdf.getPage(n);
+      var page = this.pdfModel.getPage(n);
       // Add a reference to the objects such that Page can forward the reference
       // to the CanvasGraphics and so on.
       page.objs = this.objs;
index dcdffdb1ff00e236d1ad60ddca66ff341e73bbb2..cfa2b4bcbc603f4aa92bcba2ed158b0d3b71e913 100644 (file)
@@ -79,7 +79,7 @@ MessageHandler.prototype = {
 
 var WorkerMessageHandler = {
   setup: function wphSetup(handler) {
-    var pdfDoc = null;
+    var pdfModel = null;
 
     handler.on('test', function wphSetupTest(data) {
       handler.send('test', data instanceof Uint8Array);
@@ -88,7 +88,7 @@ var WorkerMessageHandler = {
     handler.on('doc', function wphSetupDoc(data) {
       // Create only the model of the PDFDoc, which is enough for
       // processing the content of the pdf.
-      pdfDoc = new PDFDocModel(new Stream(data));
+      pdfModel = new PDFDocModel(new Stream(data));
     });
 
     handler.on('page_request', function wphSetupPageRequest(pageNum) {
@@ -105,7 +105,7 @@ var WorkerMessageHandler = {
       var dependency = [];
       var IRQueue = null;
       try {
-        var page = pdfDoc.getPage(pageNum);
+        var page = pdfModel.getPage(pageNum);
         // Pre compile the pdf page and fetch the fonts/images.
         IRQueue = page.getIRQueue(handler, dependency);
       } catch (e) {