瀏覽代碼

Node Frame - Simplify Caching (#31896)

* simplify nodeFrame

* fix comment spacing
Christian Helgeson 4 月之前
父節點
當前提交
ecaced55b8
共有 1 個文件被更改,包括 20 次插入20 次删除
  1. 20 20
      src/nodes/core/NodeFrame.js

+ 20 - 20
src/nodes/core/NodeFrame.js

@@ -124,8 +124,8 @@ class NodeFrame {
 		if ( maps === undefined ) {
 		if ( maps === undefined ) {
 
 
 			maps = {
 			maps = {
-				renderMap: new WeakMap(),
-				frameMap: new WeakMap()
+				renderId: 0,
+				frameId: 0,
 			};
 			};
 
 
 			referenceMap.set( nodeRef, maps );
 			referenceMap.set( nodeRef, maps );
@@ -151,13 +151,13 @@ class NodeFrame {
 
 
 		if ( updateType === NodeUpdateType.FRAME ) {
 		if ( updateType === NodeUpdateType.FRAME ) {
 
 
-			const { frameMap } = this._getMaps( this.updateBeforeMap, reference );
+			const nodeUpdateBeforeMap = this._getMaps( this.updateBeforeMap, reference );
 
 
-			if ( frameMap.get( reference ) !== this.frameId ) {
+			if ( nodeUpdateBeforeMap.frameId !== this.frameId ) {
 
 
 				if ( node.updateBefore( this ) !== false ) {
 				if ( node.updateBefore( this ) !== false ) {
 
 
-					frameMap.set( reference, this.frameId );
+					nodeUpdateBeforeMap.frameId = this.frameId;
 
 
 				}
 				}
 
 
@@ -165,13 +165,13 @@ class NodeFrame {
 
 
 		} else if ( updateType === NodeUpdateType.RENDER ) {
 		} else if ( updateType === NodeUpdateType.RENDER ) {
 
 
-			const { renderMap } = this._getMaps( this.updateBeforeMap, reference );
+			const nodeUpdateBeforeMap = this._getMaps( this.updateBeforeMap, reference );
 
 
-			if ( renderMap.get( reference ) !== this.renderId ) {
+			if ( nodeUpdateBeforeMap.renderId !== this.renderId ) {
 
 
 				if ( node.updateBefore( this ) !== false ) {
 				if ( node.updateBefore( this ) !== false ) {
 
 
-					renderMap.set( reference, this.renderId );
+					nodeUpdateBeforeMap.renderId = this.renderId;
 
 
 				}
 				}
 
 
@@ -200,13 +200,13 @@ class NodeFrame {
 
 
 		if ( updateType === NodeUpdateType.FRAME ) {
 		if ( updateType === NodeUpdateType.FRAME ) {
 
 
-			const { frameMap } = this._getMaps( this.updateAfterMap, reference );
+			const nodeUpdateAfterMap = this._getMaps( this.updateAfterMap, reference );
 
 
-			if ( frameMap.get( reference ) !== this.frameId ) {
+			if ( nodeUpdateAfterMap.frameId !== this.frameId ) {
 
 
 				if ( node.updateAfter( this ) !== false ) {
 				if ( node.updateAfter( this ) !== false ) {
 
 
-					frameMap.set( reference, this.frameId );
+					nodeUpdateAfterMap.frameId = this.frameId;
 
 
 				}
 				}
 
 
@@ -214,13 +214,13 @@ class NodeFrame {
 
 
 		} else if ( updateType === NodeUpdateType.RENDER ) {
 		} else if ( updateType === NodeUpdateType.RENDER ) {
 
 
-			const { renderMap } = this._getMaps( this.updateAfterMap, reference );
+			const nodeUpdateAfterMap = this._getMaps( this.updateAfterMap, reference );
 
 
-			if ( renderMap.get( reference ) !== this.renderId ) {
+			if ( nodeUpdateAfterMap.renderId !== this.renderId ) {
 
 
 				if ( node.updateAfter( this ) !== false ) {
 				if ( node.updateAfter( this ) !== false ) {
 
 
-					renderMap.set( reference, this.renderId );
+					nodeUpdateAfterMap.renderId = this.renderId;
 
 
 				}
 				}
 
 
@@ -249,13 +249,13 @@ class NodeFrame {
 
 
 		if ( updateType === NodeUpdateType.FRAME ) {
 		if ( updateType === NodeUpdateType.FRAME ) {
 
 
-			const { frameMap } = this._getMaps( this.updateMap, reference );
+			const nodeUpdateMap = this._getMaps( this.updateMap, reference );
 
 
-			if ( frameMap.get( reference ) !== this.frameId ) {
+			if ( nodeUpdateMap.frameId !== this.frameId ) {
 
 
 				if ( node.update( this ) !== false ) {
 				if ( node.update( this ) !== false ) {
 
 
-					frameMap.set( reference, this.frameId );
+					nodeUpdateMap.frameId = this.frameId;
 
 
 				}
 				}
 
 
@@ -263,13 +263,13 @@ class NodeFrame {
 
 
 		} else if ( updateType === NodeUpdateType.RENDER ) {
 		} else if ( updateType === NodeUpdateType.RENDER ) {
 
 
-			const { renderMap } = this._getMaps( this.updateMap, reference );
+			const nodeUpdateMap = this._getMaps( this.updateMap, reference );
 
 
-			if ( renderMap.get( reference ) !== this.renderId ) {
+			if ( nodeUpdateMap.renderId !== this.renderId ) {
 
 
 				if ( node.update( this ) !== false ) {
 				if ( node.update( this ) !== false ) {
 
 
-					renderMap.set( reference, this.renderId );
+					nodeUpdateMap.renderId = this.renderId;
 
 
 				}
 				}
 
 

粤ICP备19079148号