Add dependency for dependecies on sub getIRQueue

This commit is contained in:
Julian Viereck 2011-09-16 00:11:23 -07:00
parent 8f21f87fd9
commit 0f6bf30228
2 changed files with 23 additions and 4 deletions

25
pdf.js
View File

@ -4167,11 +4167,15 @@ var PartialEvaluator = (function() {
};
constructor.prototype = {
getIRQueue: function(stream, xref, resources, queue, handler, uniquePrefix) {
getIRQueue: function(stream, xref, resources, queue, handler,
uniquePrefix, dependency) {
function insertDependency(depList) {
fnArray.push("dependency");
argsArray.push(depList);
for (var i = 0; i < depList.length; i++) {
dependency.push(depList);
}
}
function buildPaintImageXObject(image, inline) {
@ -4243,6 +4247,7 @@ var PartialEvaluator = (function() {
}
var fnArray = queue.fnArray, argsArray = queue.argsArray;
var dependency = dependency || [];
resources = xref.fetchIfRef(resources) || new Dict();
var xobjs = xref.fetchIfRef(resources.get('XObject')) || new Dict();
@ -4273,10 +4278,15 @@ var PartialEvaluator = (function() {
// Type1 is TilingPattern
if (typeNum == 1) {
// TODO: Add dependency here.
// Create an IR of the pattern code.
var depIdx = dependency.length;
var codeIR = this.getIRQueue(pattern, xref,
dict.get('Resources'), {}, handler, uniquePrefix);
dict.get('Resources'), {}, handler,
uniquePrefix, dependency);
// Add the dependencies that are required to execute the
// codeIR.
insertDependency(dependency.slice(depIdx));
args = TilingPattern.getIR(codeIR, dict, args);
}
@ -4313,9 +4323,14 @@ var PartialEvaluator = (function() {
argsArray.push([ matrix, bbox ]);
// This adds the IRQueue of the xObj to the current queue.
this.getIRQueue(xobj, xref, xobj.dict.get('Resources'), queue,
handler, uniquePrefix);
var depIdx = dependency.length;
this.getIRQueue(xobj, xref, xobj.dict.get('Resources'), queue,
handler, uniquePrefix, dependency);
// Add the dependencies that are required to execute the
// codeIR.
insertDependency(dependency.slice(depIdx));
fn = "paintFormXObjectEnd";
args = [];

View File

@ -149,6 +149,10 @@ var Promise = (function() {
},
then: function(callback) {
if (!callback) {
throw "Requiring callback" + this.name;
}
// If the promise is already resolved, call the callback directly.
if (this.isResolved) {
var data = this.data;