For backwards compatibility: use addOp amount instead of queue size.

This commit is contained in:
Yury Delendik 2017-11-01 10:20:36 -05:00
parent 877c2d7743
commit 5fa56f6a9d

View File

@ -567,6 +567,7 @@ var OperatorList = (function OperatorListClosure() {
this._totalLength = 0; this._totalLength = 0;
this.pageIndex = pageIndex; this.pageIndex = pageIndex;
this.intent = intent; this.intent = intent;
this.weight = 0;
} }
OperatorList.prototype = { OperatorList.prototype = {
@ -584,10 +585,11 @@ var OperatorList = (function OperatorListClosure() {
addOp(fn, args) { addOp(fn, args) {
this.optimizer.push(fn, args); this.optimizer.push(fn, args);
this.weight++;
if (this.messageHandler) { if (this.messageHandler) {
if (this.fnArray.length >= CHUNK_SIZE) { if (this.weight >= CHUNK_SIZE) {
this.flush(); this.flush();
} else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && } else if (this.weight >= CHUNK_SIZE_ABOUT &&
(fn === OPS.restore || fn === OPS.endText)) { (fn === OPS.restore || fn === OPS.endText)) {
// heuristic to flush on boundary of restore or endText // heuristic to flush on boundary of restore or endText
this.flush(); this.flush();
@ -643,6 +645,7 @@ var OperatorList = (function OperatorListClosure() {
this.dependencies = Object.create(null); this.dependencies = Object.create(null);
this.fnArray.length = 0; this.fnArray.length = 0;
this.argsArray.length = 0; this.argsArray.length = 0;
this.weight = 0;
this.optimizer.reset(); this.optimizer.reset();
}, },
}; };