Remove setGStateForKey() closure.
setGStateForKey() is a closure that serves no particularly useful purpose. This change inlines it at the single call site. This avoids 1.7 MiB of allocations (because closures are objects) for the MTA map mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=835380#c17.
This commit is contained in:
parent
b06dc8d363
commit
96b9af68dd
@ -363,10 +363,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
setGState: function PartialEvaluator_setGState(resources, gState,
|
||||
operatorList, xref,
|
||||
stateManager) {
|
||||
|
||||
// TODO(mack): This should be rewritten so that this function returns
|
||||
// what should be added to the queue during each iteration
|
||||
function setGStateForKey(gStateObj, key, value) {
|
||||
// This array holds the converted/processed state data.
|
||||
var gStateObj = [];
|
||||
var gStateMap = gState.map;
|
||||
var self = this;
|
||||
var promise = Promise.resolve();
|
||||
for (var key in gStateMap) {
|
||||
var value = gStateMap[key];
|
||||
switch (key) {
|
||||
case 'Type':
|
||||
break;
|
||||
@ -435,16 +438,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// This array holds the converted/processed state data.
|
||||
var gStateObj = [];
|
||||
var gStateMap = gState.map;
|
||||
var self = this;
|
||||
var promise = Promise.resolve();
|
||||
for (var key in gStateMap) {
|
||||
var value = gStateMap[key];
|
||||
setGStateForKey(gStateObj, key, value);
|
||||
}
|
||||
return promise.then(function () {
|
||||
if (gStateObj.length >= 0) {
|
||||
operatorList.addOp(OPS.setGState, [gStateObj]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user