Merge pull request #4440 from bthorben/refactor/pdf_manager.js

refactor src/core/pdf_manager.js: rename pdfModel to pdfDocument
This commit is contained in:
Brendan Dahl 2014-03-17 10:41:17 -07:00
commit ad4be03a08
2 changed files with 15 additions and 15 deletions

View File

@ -33,24 +33,24 @@ var BasePdfManager = (function BasePdfManagerClosure() {
throw new NotImplementedException();
},
ensureModel: function BasePdfManager_ensureModel(prop, args) {
return this.ensure(this.pdfModel, prop, args);
ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
return this.ensure(this.pdfDocument, prop, args);
},
ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
return this.ensure(this.pdfModel.xref, prop, args);
return this.ensure(this.pdfDocument.xref, prop, args);
},
ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
return this.ensure(this.pdfModel.catalog, prop, args);
return this.ensure(this.pdfDocument.catalog, prop, args);
},
getPage: function BasePdfManager_pagePage(pageIndex) {
return this.pdfModel.getPage(pageIndex);
return this.pdfDocument.getPage(pageIndex);
},
cleanup: function BasePdfManager_cleanup() {
return this.pdfModel.cleanup();
return this.pdfDocument.cleanup();
},
ensure: function BasePdfManager_ensure(obj, prop, args) {
@ -66,7 +66,7 @@ var BasePdfManager = (function BasePdfManagerClosure() {
},
updatePassword: function BasePdfManager_updatePassword(password) {
this.pdfModel.xref.password = this.password = password;
this.pdfDocument.xref.password = this.password = password;
if (this.passwordChangedPromise) {
this.passwordChangedPromise.resolve();
}
@ -83,7 +83,7 @@ var BasePdfManager = (function BasePdfManagerClosure() {
var LocalPdfManager = (function LocalPdfManagerClosure() {
function LocalPdfManager(data, password) {
var stream = new Stream(data);
this.pdfModel = new PDFDocument(this, stream, password);
this.pdfDocument = new PDFDocument(this, stream, password);
this.loadedStream = new LegacyPromise();
this.loadedStream.resolve(stream);
}
@ -150,7 +150,7 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {
this.streamManager = new ChunkedStreamManager(args.length, RANGE_CHUNK_SIZE,
args.url, params);
this.pdfModel = new PDFDocument(this, this.streamManager.getStream(),
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(),
args.password);
}

View File

@ -30,10 +30,10 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
var loadDocumentPromise = new LegacyPromise();
var parseSuccess = function parseSuccess() {
var numPagesPromise = pdfManager.ensureModel('numPages');
var fingerprintPromise = pdfManager.ensureModel('fingerprint');
var numPagesPromise = pdfManager.ensureDoc('numPages');
var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
var outlinePromise = pdfManager.ensureCatalog('documentOutline');
var infoPromise = pdfManager.ensureModel('documentInfo');
var infoPromise = pdfManager.ensureDoc('documentInfo');
var metadataPromise = pdfManager.ensureCatalog('metadata');
var encryptedPromise = pdfManager.ensureXRef('encrypt');
var javaScriptPromise = pdfManager.ensureCatalog('javaScript');
@ -60,9 +60,9 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
loadDocumentPromise.reject(e);
};
pdfManager.ensureModel('checkHeader', []).then(function() {
pdfManager.ensureModel('parseStartXRef', []).then(function() {
pdfManager.ensureModel('parse', [recoveryMode]).then(
pdfManager.ensureDoc('checkHeader', []).then(function() {
pdfManager.ensureDoc('parseStartXRef', []).then(function() {
pdfManager.ensureDoc('parse', [recoveryMode]).then(
parseSuccess, parseFailure);
}, parseFailure);
}, parseFailure);