From e264bb7eb057763b1764a4133aed11dbb407a61a Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Thu, 22 Jun 2017 15:30:51 +0100 Subject: [PATCH] [Event Log] Log ASM flag when modify subnodes #trivial (#379) * Log ASM flag when add subnode * Log other subnode modifications as well --- Source/ASDisplayNode.mm | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index 781862fe6..18528f9d9 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -2006,9 +2006,8 @@ - (void)_insertSubnodeSubviewOrSublayer:(ASDisplayNode *)subnode atIndex:(NSInte - (void)addSubnode:(ASDisplayNode *)subnode { - ASDisplayNodeLogEvent(self, @"addSubnode: %@", subnode); - // TODO: 2.0 Conversion: Reenable and fix within product code - //ASDisplayNodeAssert(self.automaticallyManagesSubnodes == NO, @"Attempt to manually add subnode to node with automaticallyManagesSubnodes=YES. Node: %@", subnode); + ASDisplayNodeLogEvent(self, @"addSubnode: %@ with automaticallyManagesSubnodes: %@", + subnode, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); [self _addSubnode:subnode]; } @@ -2058,9 +2057,8 @@ - (void)_addSubnodeSubviewOrSublayer:(ASDisplayNode *)subnode - (void)replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode *)replacementSubnode { - ASDisplayNodeLogEvent(self, @"replaceSubnode: %@ withSubnode:%@", oldSubnode, replacementSubnode); - // TODO: 2.0 Conversion: Reenable and fix within product code - //ASDisplayNodeAssert(self.automaticallyManagesSubnodes == NO, @"Attempt to manually replace old node with replacement node to node with automaticallyManagesSubnodes=YES. Old Node: %@, replacement node: %@", oldSubnode, replacementSubnode); + ASDisplayNodeLogEvent(self, @"replaceSubnode: %@ withSubnode: %@ with automaticallyManagesSubnodes: %@", + oldSubnode, replacementSubnode, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); [self _replaceSubnode:oldSubnode withSubnode:replacementSubnode]; } @@ -2106,9 +2104,8 @@ - (void)_replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode * - (void)insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below { - ASDisplayNodeLogEvent(self, @"insertSubnode: %@ belowSubnode:%@", subnode, below); - // TODO: 2.0 Conversion: Reenable and fix within product code - //ASDisplayNodeAssert(self.automaticallyManagesSubnodes == NO, @"Attempt to manually insert subnode to node with automaticallyManagesSubnodes=YES. Node: %@", subnode); + ASDisplayNodeLogEvent(self, @"insertSubnode: %@ belowSubnode: %@ with automaticallyManagesSubnodes: %@", + subnode, below, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); [self _insertSubnode:subnode belowSubnode:below]; } @@ -2170,9 +2167,8 @@ - (void)_insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)be - (void)insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above { - ASDisplayNodeLogEvent(self, @"insertSubnode: %@ abodeSubnode: %@", subnode, above); - // TODO: 2.0 Conversion: Reenable and fix within product code - //ASDisplayNodeAssert(self.automaticallyManagesSubnodes == NO, @"Attempt to manually insert subnode to node with automaticallyManagesSubnodes=YES. Node: %@", subnode); + ASDisplayNodeLogEvent(self, @"insertSubnode: %@ abodeSubnode: %@ with automaticallyManagesSubnodes: %@", + subnode, above, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); [self _insertSubnode:subnode aboveSubnode:above]; } @@ -2232,9 +2228,8 @@ - (void)_insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)ab - (void)insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx { - ASDisplayNodeLogEvent(self, @"insertSubnode: %@ atIndex: %td", subnode, idx); - // TODO: 2.0 Conversion: Reenable and fix within product code - //ASDisplayNodeAssert(self.automaticallyManagesSubnodes == NO, @"Attempt to manually insert subnode to node with automaticallyManagesSubnodes=YES. Node: %@", subnode); + ASDisplayNodeLogEvent(self, @"insertSubnode: %@ atIndex: %td with automaticallyManagesSubnodes: %@", + subnode, idx, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); [self _insertSubnode:subnode atIndex:idx]; } @@ -2295,9 +2290,8 @@ - (void)_removeSubnode:(ASDisplayNode *)subnode - (void)removeFromSupernode { - // TODO: 2.0 Conversion: Reenable and fix within product code - //ASDisplayNodeAssert(self.supernode.automaticallyManagesSubnodes == NO, @"Attempt to manually remove subnode from node with automaticallyManagesSubnodes=YES. Node: %@", self); - + ASDisplayNodeLogEvent(self, @"removeFromSupernode with automaticallyManagesSubnodes: %@", + self.automaticallyManagesSubnodes ? @"YES" : @"NO"); [self _removeFromSupernode]; }