Merge pull request #11993 from Snuffleupagus/OperatorList-dependencies-set
Change the `dependencies` property, on `OperatorList` instances, from an Object to a Set
This commit is contained in:
		
						commit
						973936f469
					
				| @ -270,7 +270,7 @@ class Page { | |||||||
| 
 | 
 | ||||||
|     const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); |     const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); | ||||||
|     const pageListPromise = dataPromises.then(([contentStream]) => { |     const pageListPromise = dataPromises.then(([contentStream]) => { | ||||||
|       const opList = new OperatorList(intent, sink, this.pageIndex); |       const opList = new OperatorList(intent, sink); | ||||||
| 
 | 
 | ||||||
|       handler.send("StartRenderPage", { |       handler.send("StartRenderPage", { | ||||||
|         transparency: partialEvaluator.hasBlendModes(this.resources), |         transparency: partialEvaluator.hasBlendModes(this.resources), | ||||||
|  | |||||||
| @ -609,7 +609,7 @@ var OperatorList = (function OperatorListClosure() { | |||||||
|   var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; // close to chunk size
 |   var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; // close to chunk size
 | ||||||
| 
 | 
 | ||||||
|   // eslint-disable-next-line no-shadow
 |   // eslint-disable-next-line no-shadow
 | ||||||
|   function OperatorList(intent, streamSink, pageIndex) { |   function OperatorList(intent, streamSink) { | ||||||
|     this._streamSink = streamSink; |     this._streamSink = streamSink; | ||||||
|     this.fnArray = []; |     this.fnArray = []; | ||||||
|     this.argsArray = []; |     this.argsArray = []; | ||||||
| @ -618,10 +618,8 @@ var OperatorList = (function OperatorListClosure() { | |||||||
|     } else { |     } else { | ||||||
|       this.optimizer = new NullOptimizer(this); |       this.optimizer = new NullOptimizer(this); | ||||||
|     } |     } | ||||||
|     this.dependencies = Object.create(null); |     this.dependencies = new Set(); | ||||||
|     this._totalLength = 0; |     this._totalLength = 0; | ||||||
|     this.pageIndex = pageIndex; |  | ||||||
|     this.intent = intent; |  | ||||||
|     this.weight = 0; |     this.weight = 0; | ||||||
|     this._resolved = streamSink ? null : Promise.resolve(); |     this._resolved = streamSink ? null : Promise.resolve(); | ||||||
|   } |   } | ||||||
| @ -660,16 +658,16 @@ var OperatorList = (function OperatorListClosure() { | |||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     addDependency(dependency) { |     addDependency(dependency) { | ||||||
|       if (dependency in this.dependencies) { |       if (this.dependencies.has(dependency)) { | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       this.dependencies[dependency] = true; |       this.dependencies.add(dependency); | ||||||
|       this.addOp(OPS.dependency, [dependency]); |       this.addOp(OPS.dependency, [dependency]); | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     addDependencies(dependencies) { |     addDependencies(dependencies) { | ||||||
|       for (var key in dependencies) { |       for (const dependency of dependencies) { | ||||||
|         this.addDependency(key); |         this.addDependency(dependency); | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
| @ -678,7 +676,9 @@ var OperatorList = (function OperatorListClosure() { | |||||||
|         warn('addOpList - ignoring invalid "opList" parameter.'); |         warn('addOpList - ignoring invalid "opList" parameter.'); | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       Object.assign(this.dependencies, opList.dependencies); |       for (const dependency of opList.dependencies) { | ||||||
|  |         this.dependencies.add(dependency); | ||||||
|  |       } | ||||||
|       for (var i = 0, ii = opList.length; i < ii; i++) { |       for (var i = 0, ii = opList.length; i < ii; i++) { | ||||||
|         this.addOp(opList.fnArray[i], opList.argsArray[i]); |         this.addOp(opList.fnArray[i], opList.argsArray[i]); | ||||||
|       } |       } | ||||||
| @ -736,7 +736,7 @@ var OperatorList = (function OperatorListClosure() { | |||||||
|         this._transfers |         this._transfers | ||||||
|       ); |       ); | ||||||
| 
 | 
 | ||||||
|       this.dependencies = Object.create(null); |       this.dependencies.clear(); | ||||||
|       this.fnArray.length = 0; |       this.fnArray.length = 0; | ||||||
|       this.argsArray.length = 0; |       this.argsArray.length = 0; | ||||||
|       this.weight = 0; |       this.weight = 0; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user