Address latest review comments by Artur

This commit is contained in:
Julian Viereck 2011-10-13 20:30:55 +02:00
parent 3142c2a7da
commit b832aa5c1e
3 changed files with 16 additions and 32 deletions

16
pdf.js
View File

@ -3548,13 +3548,13 @@ var Page = (function pagePage() {
// Firefox error reporting from XHR callbacks. // Firefox error reporting from XHR callbacks.
setTimeout(function pageSetTimeout() { setTimeout(function pageSetTimeout() {
var exc = null; var exc = null;
// try { try {
self.display(gfx, continuation); self.display(gfx, continuation);
// } catch (e) { } catch (e) {
// exc = e.toString(); exc = e.toString();
// continuation(exc); continuation(exc);
// throw e; throw e;
// } }
}); });
}; };
@ -4564,6 +4564,7 @@ var PartialEvaluator = (function partialEvaluator() {
getIRQueue: function partialEvaluatorGetIRQueue(stream, resources, getIRQueue: function partialEvaluatorGetIRQueue(stream, resources,
queue, dependency) { queue, dependency) {
var self = this;
var xref = this.xref; var xref = this.xref;
var handler = this.handler; var handler = this.handler;
var uniquePrefix = this.uniquePrefix; var uniquePrefix = this.uniquePrefix;
@ -4579,7 +4580,6 @@ var PartialEvaluator = (function partialEvaluator() {
} }
} }
var self = this;
function handleSetFont(fontName, fontRef) { function handleSetFont(fontName, fontRef) {
var loadedName = null; var loadedName = null;
@ -5389,7 +5389,7 @@ function ScratchCanvas(width, height) {
} }
var CanvasGraphics = (function canvasGraphics() { var CanvasGraphics = (function canvasGraphics() {
// Defines the time the executeIRQueue gone be executing // Defines the time the executeIRQueue gonna be executing
// before it stops and shedules a continue of execution. // before it stops and shedules a continue of execution.
var kExecutionTime = 50; var kExecutionTime = 50;
// Number of IR commands to execute before checking // Number of IR commands to execute before checking

View File

@ -7,8 +7,8 @@
var useWorker = false; var useWorker = false;
var WorkerPage = (function() { var WorkerPage = (function() {
function constructor(workerPDF, page, objs) { function constructor(pdf, page, objs) {
this.workerPDF = workerPDF; this.pdf = pdf;
this.page = page; this.page = page;
this.objs = objs; this.objs = objs;
@ -39,7 +39,7 @@ var WorkerPage = (function() {
// this.page.startRendering(ctx, callback, errback); // this.page.startRendering(ctx, callback, errback);
this.startRenderingTime = Date.now(); this.startRenderingTime = Date.now();
this.workerPDF.startRendering(this); this.pdf.startRendering(this);
}, },
startRenderingFromIRQueue: function(IRQueue, fonts) { startRenderingFromIRQueue: function(IRQueue, fonts) {
@ -53,7 +53,9 @@ var WorkerPage = (function() {
console.log('page=%d - total time: time=%dms', console.log('page=%d - total time: time=%dms',
pageNum, Date.now() - this.startRenderingTime); pageNum, Date.now() - this.startRenderingTime);
if (this.callback) {
this.callback(err); this.callback(err);
}
}.bind(this); }.bind(this);
this.page.startRenderingFromIRQueue(gfx, IRQueue, fonts, callback); this.page.startRenderingFromIRQueue(gfx, IRQueue, fonts, callback);
}, },
@ -165,7 +167,7 @@ var PDFObjects = (function() {
* Sets the data of an object but *doesn't* resolve it. * Sets the data of an object but *doesn't* resolve it.
*/ */
setData: function(objId, data) { setData: function(objId, data) {
// Watchout! If you call `this.ensureObj(objId, data)` you'll gone create // Watchout! If you call `this.ensureObj(objId, data)` you'll gonna create
// a *resolved* promise which shouldn't be the case! // a *resolved* promise which shouldn't be the case!
this.ensureObj(objId).data = data; this.ensureObj(objId).data = data;
} }

View File

@ -33,24 +33,6 @@ var WorkerProcessorHandler = {
console.log('page=%d - getIRQueue: time=%dms, len=%d', pageNum, console.log('page=%d - getIRQueue: time=%dms, len=%d', pageNum,
Date.now() - start, IRQueue.fnArray.length); Date.now() - start, IRQueue.fnArray.length);
if (false /* show used commands */) {
var cmdMap = {};
var fnArray = IRQueue .fnArray;
for (var i = 0; i < fnArray.length; i++) {
var entry = fnArray[i];
if (entry == 'paintReadyFormXObject') {
//console.log(preCompilation.argsArray[i]);
}
if (cmdMap[entry] == null) {
cmdMap[entry] = 1;
} else {
cmdMap[entry] += 1;
}
}
console.log('cmds', JSON.stringify(cmdMap));
}
// Filter the dependecies for fonts. // Filter the dependecies for fonts.
var fonts = {}; var fonts = {};
for (var i = 0; i < dependency.length; i++) { for (var i = 0; i < dependency.length; i++) {