From 9d82279aee208a9d5304163a604825fecd9dac0f Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 19 Apr 2019 11:11:52 -0700 Subject: [PATCH 1/7] Remove ASEventLog. We'll focus on ASLog for the future, possibly making it triggerable on a per-node basis --- AsyncDisplayKit.xcodeproj/project.pbxproj | 16 --- Source/ASCollectionView.mm | 2 +- Source/ASDisplayNode+Beta.h | 20 ---- Source/ASDisplayNode+Layout.mm | 1 - Source/ASDisplayNode+LayoutSpec.mm | 2 - Source/ASDisplayNode.mm | 65 ------------ Source/ASTableView.mm | 2 +- Source/ASTableViewInternal.h | 3 +- Source/AsyncDisplayKit.h | 1 - Source/Base/ASBaseDefines.h | 11 -- Source/Details/ASCollectionInternal.h | 2 +- Source/Details/ASDataController.h | 16 +-- Source/Details/ASDataController.mm | 18 +--- Source/Details/ASEventLog.h | 39 ------- Source/Details/ASEventLog.mm | 121 ---------------------- Source/Details/ASTraceEvent.h | 32 ------ Source/Details/ASTraceEvent.mm | 67 ------------ Source/Private/ASDisplayNodeInternal.h | 5 - Source/Private/ASLayoutTransition.mm | 2 - 19 files changed, 6 insertions(+), 419 deletions(-) delete mode 100644 Source/Details/ASEventLog.h delete mode 100644 Source/Details/ASEventLog.mm delete mode 100644 Source/Details/ASTraceEvent.h delete mode 100644 Source/Details/ASTraceEvent.mm diff --git a/AsyncDisplayKit.xcodeproj/project.pbxproj b/AsyncDisplayKit.xcodeproj/project.pbxproj index 42017746e..8736b7d47 100644 --- a/AsyncDisplayKit.xcodeproj/project.pbxproj +++ b/AsyncDisplayKit.xcodeproj/project.pbxproj @@ -149,8 +149,6 @@ 6947B0C51E36B5040007C478 /* ASStackPositionedLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6947B0C21E36B5040007C478 /* ASStackPositionedLayout.mm */; }; 695943401D70815300B0EE1F /* ASDisplayNodeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */; settings = {ATTRIBUTES = (Private, ); }; }; 695BE2551DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 695BE2541DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm */; }; - 696F01EC1DD2AF450049FBD5 /* ASEventLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 696F01EA1DD2AF450049FBD5 /* ASEventLog.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 696F01EE1DD2AF450049FBD5 /* ASEventLog.mm in Sources */ = {isa = PBXBuildFile; fileRef = 696F01EB1DD2AF450049FBD5 /* ASEventLog.mm */; }; 696FCB311D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 696FCB301D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm */; }; 6977965F1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.h in Headers */ = {isa = PBXBuildFile; fileRef = 6977965D1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.h */; settings = {ATTRIBUTES = (Private, ); }; }; 697796611D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */; }; @@ -364,8 +362,6 @@ CC3B208E1C3F7D0A00798563 /* ASWeakSetTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC3B208D1C3F7D0A00798563 /* ASWeakSetTests.mm */; }; CC3B20901C3F892D00798563 /* ASBridgedPropertiesTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC3B208F1C3F892D00798563 /* ASBridgedPropertiesTests.mm */; }; CC4981B31D1A02BE004E13CC /* ASTableViewThrashTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC4981B21D1A02BE004E13CC /* ASTableViewThrashTests.mm */; }; - CC4C2A771D88E3BF0039ACAB /* ASTraceEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = CC4C2A751D88E3BF0039ACAB /* ASTraceEvent.h */; settings = {ATTRIBUTES = (Private, ); }; }; - CC4C2A791D88E3BF0039ACAB /* ASTraceEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC4C2A761D88E3BF0039ACAB /* ASTraceEvent.mm */; }; CC54A81C1D70079800296A24 /* ASDispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = CC54A81B1D70077A00296A24 /* ASDispatch.h */; settings = {ATTRIBUTES = (Private, ); }; }; CC54A81E1D7008B300296A24 /* ASDispatchTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC54A81D1D7008B300296A24 /* ASDispatchTests.mm */; }; CC55A70D1E529FA200594372 /* UIResponder+AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = CC55A70B1E529FA200594372 /* UIResponder+AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -722,8 +718,6 @@ 6947B0C21E36B5040007C478 /* ASStackPositionedLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASStackPositionedLayout.mm; sourceTree = ""; }; 6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDisplayNodeLayout.h; sourceTree = ""; }; 695BE2541DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASWrapperSpecSnapshotTests.mm; sourceTree = ""; }; - 696F01EA1DD2AF450049FBD5 /* ASEventLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEventLog.h; sourceTree = ""; }; - 696F01EB1DD2AF450049FBD5 /* ASEventLog.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEventLog.mm; sourceTree = ""; }; 696FCB301D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = ASBackgroundLayoutSpecSnapshotTests.mm; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 6977965D1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASLayoutSpec+Subclasses.h"; sourceTree = ""; }; 6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ASLayoutSpec+Subclasses.mm"; sourceTree = ""; }; @@ -891,8 +885,6 @@ CC4981B21D1A02BE004E13CC /* ASTableViewThrashTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASTableViewThrashTests.mm; sourceTree = ""; }; CC4981BA1D1C7F65004E13CC /* NSIndexSet+ASHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSIndexSet+ASHelpers.h"; sourceTree = ""; }; CC4981BB1D1C7F65004E13CC /* NSIndexSet+ASHelpers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSIndexSet+ASHelpers.mm"; sourceTree = ""; }; - CC4C2A751D88E3BF0039ACAB /* ASTraceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTraceEvent.h; sourceTree = ""; }; - CC4C2A761D88E3BF0039ACAB /* ASTraceEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASTraceEvent.mm; sourceTree = ""; }; CC512B841DAC45C60054848E /* ASTableView+Undeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASTableView+Undeprecated.h"; sourceTree = ""; }; CC54A81B1D70077A00296A24 /* ASDispatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASDispatch.h; sourceTree = ""; }; CC54A81D1D7008B300296A24 /* ASDispatchTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = ASDispatchTests.mm; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; @@ -1431,8 +1423,6 @@ 205F0E1C1B373A2C007741D0 /* ASCollectionViewLayoutController.mm */, 68C215561DE10D330019C4BC /* ASCollectionViewLayoutInspector.h */, 68C215571DE10D330019C4BC /* ASCollectionViewLayoutInspector.mm */, - 696F01EA1DD2AF450049FBD5 /* ASEventLog.h */, - 696F01EB1DD2AF450049FBD5 /* ASEventLog.mm */, E5B225271F1790B5001E1431 /* ASHashing.h */, E5B225261F1790B5001E1431 /* ASHashing.mm */, 058D09E6195D050800B7D73C /* ASHighlightOverlayLayer.h */, @@ -1466,8 +1456,6 @@ 4640521B1A3F83C40061C0BA /* ASTableLayoutController.h */, 4640521C1A3F83C40061C0BA /* ASTableLayoutController.mm */, 058D0A12195D050800B7D73C /* ASThread.h */, - CC4C2A751D88E3BF0039ACAB /* ASTraceEvent.h */, - CC4C2A761D88E3BF0039ACAB /* ASTraceEvent.mm */, 9C70F2011CDA4EFA007D6C76 /* ASTraitCollection.h */, 9C70F2021CDA4EFA007D6C76 /* ASTraitCollection.mm */, 68B8A4DF1CBDB958007E4543 /* ASWeakProxy.h */, @@ -1904,7 +1892,6 @@ CCCCCCE31EC3EF060087FE10 /* NSParagraphStyle+ASText.h in Headers */, E58E9E441E941D74004CFC59 /* ASCollectionLayoutContext.h in Headers */, E58E9E421E941D74004CFC59 /* ASCollectionFlowLayoutDelegate.h in Headers */, - 696F01EC1DD2AF450049FBD5 /* ASEventLog.h in Headers */, 690C35641E055C7B00069B91 /* ASDimensionInternal.h in Headers */, 3917EBD41E9C2FC400D04A01 /* _ASCollectionReusableView.h in Headers */, CC18248C200D49C800875940 /* ASTextNodeCommon.h in Headers */, @@ -2053,7 +2040,6 @@ 83A7D95C1D44548100BF333E /* ASWeakMap.h in Headers */, E5711A2C1C840C81009619D4 /* ASCollectionElement.h in Headers */, 6947B0BE1E36B4E30007C478 /* ASStackUnpositionedLayout.h in Headers */, - CC4C2A771D88E3BF0039ACAB /* ASTraceEvent.h in Headers */, 254C6B7B1BF94DF4003EC431 /* ASTextKitRenderer+Positioning.h in Headers */, DE4843DC1C93EAC100A1F33B /* ASLayoutTransition.h in Headers */, CC57EAF81E3939450034C595 /* ASTableView+Undeprecated.h in Headers */, @@ -2495,7 +2481,6 @@ 0442850A1BAA63FE00D16268 /* ASBatchFetching.mm in Sources */, CC35CEC420DD7F600006448D /* ASCollections.mm in Sources */, 68FC85E61CE29B9400EDD713 /* ASNavigationController.mm in Sources */, - CC4C2A791D88E3BF0039ACAB /* ASTraceEvent.mm in Sources */, 34EFC76F1B701CF700AD841F /* ASRatioLayoutSpec.mm in Sources */, 254C6B8B1BF94F8A003EC431 /* ASTextKitShadower.mm in Sources */, 254C6B851BF94F8A003EC431 /* ASTextKitAttributes.mm in Sources */, @@ -2510,7 +2495,6 @@ 7AB338661C55B3420055FDE8 /* ASRelativeLayoutSpec.mm in Sources */, CC7AF198200DAB2200A21BDE /* ASExperimentalFeatures.mm in Sources */, E5B2252E1F17E521001E1431 /* ASDispatch.mm in Sources */, - 696F01EE1DD2AF450049FBD5 /* ASEventLog.mm in Sources */, 9C70F2051CDA4F06007D6C76 /* ASTraitCollection.mm in Sources */, 83A7D95B1D44547700BF333E /* ASWeakMap.mm in Sources */, CC034A0A1E60BEB400626263 /* ASDisplayNode+Convenience.mm in Sources */, diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index d8dc9fdfe..376bf25bd 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -270,7 +270,7 @@ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionVi return [self _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil owningNode:nil eventLog:nil]; } -- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id)layoutFacilitator owningNode:(ASCollectionNode *)owningNode eventLog:(ASEventLog *)eventLog +- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id)layoutFacilitator owningNode:(ASCollectionNode *)owningNode { if (!(self = [super initWithFrame:frame collectionViewLayout:layout])) return nil; diff --git a/Source/ASDisplayNode+Beta.h b/Source/ASDisplayNode+Beta.h index 2bb2a4c93..5bcdf6cdb 100644 --- a/Source/ASDisplayNode+Beta.h +++ b/Source/ASDisplayNode+Beta.h @@ -10,7 +10,6 @@ #import #import #import -#import #if YOGA #import YOGA_HEADER_PATH @@ -23,18 +22,6 @@ NS_ASSUME_NONNULL_BEGIN AS_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); AS_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT -#if ASEVENTLOG_ENABLE - #define ASDisplayNodeLogEvent(node, ...) [node.eventLog logEventWithBacktrace:(AS_SAVE_EVENT_BACKTRACES ? [NSThread callStackSymbols] : nil) format:__VA_ARGS__] -#else - #define ASDisplayNodeLogEvent(node, ...) -#endif - -#if ASEVENTLOG_ENABLE - #define ASDisplayNodeGetEventLog(node) node.eventLog -#else - #define ASDisplayNodeGetEventLog(node) nil -#endif - /** * Bitmask to indicate what performance measurements the cell should record. */ @@ -96,13 +83,6 @@ typedef struct { */ @property (readonly) ASDisplayNodePerformanceMeasurements performanceMeasurements; -#if ASEVENTLOG_ENABLE -/* - * @abstract The primitive event tracing object. You shouldn't directly use it to log event. Use the ASDisplayNodeLogEvent macro instead. - */ -@property (nonatomic, readonly) ASEventLog *eventLog; -#endif - /** * @abstract Whether this node acts as an accessibility container. If set to YES, then this node's accessibility label will represent * an aggregation of all child nodes' accessibility labels. Nodes in this node's subtree that are also accessibility containers will diff --git a/Source/ASDisplayNode+Layout.mm b/Source/ASDisplayNode+Layout.mm index 592b18db9..ceaf5ae9a 100644 --- a/Source/ASDisplayNode+Layout.mm +++ b/Source/ASDisplayNode+Layout.mm @@ -137,7 +137,6 @@ - (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection AS::UniqueLock l(__instanceLock__); if (ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(traitCollection, _primitiveTraitCollection) == NO) { _primitiveTraitCollection = traitCollection; - ASDisplayNodeLogEvent(self, @"asyncTraitCollectionDidChange: %@", NSStringFromASPrimitiveTraitCollection(traitCollection)); l.unlock(); [self asyncTraitCollectionDidChange]; diff --git a/Source/ASDisplayNode+LayoutSpec.mm b/Source/ASDisplayNode+LayoutSpec.mm index d79073ffd..9c53ee292 100644 --- a/Source/ASDisplayNode+LayoutSpec.mm +++ b/Source/ASDisplayNode+LayoutSpec.mm @@ -43,7 +43,6 @@ - (ASLayout *)calculateLayoutLayoutSpec:(ASSizeRange)constrainedSize // Manual size calculation via calculateSizeThatFits: if (_layoutSpecBlock == NULL && (_methodOverrides & ASDisplayNodeMethodOverrideLayoutSpecThatFits) == 0) { CGSize size = [self calculateSizeThatFits:constrainedSize.max]; - ASDisplayNodeLogEvent(self, @"calculatedSize: %@", NSStringFromCGSize(size)); return [ASLayout layoutWithLayoutElement:self size:ASSizeRangeClamp(constrainedSize, size) sublayouts:nil]; } @@ -104,7 +103,6 @@ - (ASLayout *)calculateLayoutLayoutSpec:(ASSizeRange)constrainedSize layout.position = CGPointZero; layout = [ASLayout layoutWithLayoutElement:self size:layout.size sublayouts:@[layout]]; } - ASDisplayNodeLogEvent(self, @"computedLayout: %@", layout); // PR #1157: Reduces accuracy of _unflattenedLayout for debugging/Weaver if ([ASDisplayNode shouldStoreUnflattenedLayouts]) { diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index 473b735fa..a5519bd61 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -313,10 +313,6 @@ - (void)_initializeInstance { [self _staticInitialize]; __instanceLock__.SetDebugNameWithObject(self); - -#if ASEVENTLOG_ENABLE - _eventLog = [[ASEventLog alloc] initWithObject:self]; -#endif _viewClass = [self.class viewClass]; _layerClass = [self.class layerClass]; @@ -348,7 +344,6 @@ - (void)_initializeInstance _automaticallyRelayoutOnLayoutMarginsChanges = NO; [self baseDidInit]; - ASDisplayNodeLogEvent(self, @"init"); } - (instancetype)init @@ -595,7 +590,6 @@ - (void)_didLoad { ASDisplayNodeAssertMainThread(); ASAssertUnlocked(__instanceLock__); - ASDisplayNodeLogEvent(self, @"didLoad"); as_log_verbose(ASNodeLog(), "didLoad %@", self); TIME_SCOPED(_debugTimeForDidLoad); @@ -1164,8 +1158,6 @@ - (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize { __ASDisplayNodeCheckForLayoutMethodOverrides; - - ASDisplayNodeLogEvent(self, @"calculateSizeThatFits: with constrainedSize: %@", NSStringFromCGSize(constrainedSize)); return ASIsCGSizeValidForSize(constrainedSize) ? constrainedSize : CGSizeZero; } @@ -1781,7 +1773,6 @@ - (void)displayWillStartAsynchronously:(BOOL)asynchronously { ASDisplayNodeAssertMainThread(); - ASDisplayNodeLogEvent(self, @"displayWillStart"); // in case current node takes longer to display than it's subnodes, treat it as a dependent node [self _pendingNodeWillDisplay:self]; @@ -1796,7 +1787,6 @@ - (void)displayDidFinish { ASDisplayNodeAssertMainThread(); - ASDisplayNodeLogEvent(self, @"displayDidFinish"); [self _pendingNodeDidDisplay:self]; __instanceLock__.lock(); @@ -2034,7 +2024,6 @@ - (void)_setSupernode:(ASDisplayNode *)newSupernode } if (supernodeDidChange) { - ASDisplayNodeLogEvent(self, @"supernodeDidChange: %@, oldValue = %@", ASObjectDescriptionMakeTiny(newSupernode), ASObjectDescriptionMakeTiny(oldSupernode)); // Hierarchy state ASHierarchyState stateToEnterOrExit = (newSupernode ? newSupernode.hierarchyState : oldSupernode.hierarchyState); @@ -2226,13 +2215,6 @@ - (void)_insertSubnodeSubviewOrSublayer:(ASDisplayNode *)subnode atIndex:(NSInte } - (void)addSubnode:(ASDisplayNode *)subnode -{ - ASDisplayNodeLogEvent(self, @"addSubnode: %@ with automaticallyManagesSubnodes: %@", - subnode, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); - [self _addSubnode:subnode]; -} - -- (void)_addSubnode:(ASDisplayNode *)subnode { ASDisplayNodeAssertThreadAffinity(self); @@ -2277,13 +2259,6 @@ - (void)_addSubnodeSubviewOrSublayer:(ASDisplayNode *)subnode } - (void)replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode *)replacementSubnode -{ - ASDisplayNodeLogEvent(self, @"replaceSubnode: %@ withSubnode: %@ with automaticallyManagesSubnodes: %@", - oldSubnode, replacementSubnode, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); - [self _replaceSubnode:oldSubnode withSubnode:replacementSubnode]; -} - -- (void)_replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode *)replacementSubnode { ASDisplayNodeAssertThreadAffinity(self); @@ -2324,13 +2299,6 @@ - (void)_replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode * } - (void)insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below -{ - ASDisplayNodeLogEvent(self, @"insertSubnode: %@ belowSubnode: %@ with automaticallyManagesSubnodes: %@", - subnode, below, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); - [self _insertSubnode:subnode belowSubnode:below]; -} - -- (void)_insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below { ASDisplayNodeAssertThreadAffinity(self); // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 @@ -2389,13 +2357,6 @@ - (void)_insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)be } - (void)insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above -{ - ASDisplayNodeLogEvent(self, @"insertSubnode: %@ abodeSubnode: %@ with automaticallyManagesSubnodes: %@", - subnode, above, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); - [self _insertSubnode:subnode aboveSubnode:above]; -} - -- (void)_insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above { ASDisplayNodeAssertThreadAffinity(self); // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 @@ -2452,13 +2413,6 @@ - (void)_insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)ab } - (void)insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx -{ - ASDisplayNodeLogEvent(self, @"insertSubnode: %@ atIndex: %td with automaticallyManagesSubnodes: %@", - subnode, idx, self.automaticallyManagesSubnodes ? @"YES" : @"NO"); - [self _insertSubnode:subnode atIndex:idx]; -} - -- (void)_insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx { ASDisplayNodeAssertThreadAffinity(self); // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 @@ -2517,13 +2471,6 @@ - (void)_removeSubnode:(ASDisplayNode *)subnode } - (void)removeFromSupernode -{ - ASDisplayNodeLogEvent(self, @"removeFromSupernode with automaticallyManagesSubnodes: %@", - self.automaticallyManagesSubnodes ? @"YES" : @"NO"); - [self _removeFromSupernode]; -} - -- (void)_removeFromSupernode { ASDisplayNodeAssertThreadAffinity(self); // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 @@ -2700,7 +2647,6 @@ - (void)__enterHierarchy { ASDisplayNodeAssertMainThread(); ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"Should not cause recursive __enterHierarchy"); - ASDisplayNodeLogEvent(self, @"enterHierarchy"); // Profiling has shown that locking this method is beneficial, so each of the property accesses don't have to lock and unlock. __instanceLock__.lock(); @@ -2748,7 +2694,6 @@ - (void)__exitHierarchy { ASDisplayNodeAssertMainThread(); ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"Should not cause recursive __exitHierarchy"); - ASDisplayNodeLogEvent(self, @"exitHierarchy"); // Profiling has shown that locking this method is beneficial, so each of the property accesses don't have to lock and unlock. __instanceLock__.lock(); @@ -2843,7 +2788,6 @@ - (void)setHierarchyState:(ASHierarchyState)newState } } - ASDisplayNodeLogEvent(self, @"setHierarchyState: %@", NSStringFromASHierarchyStateChange(oldState, newState)); as_log_verbose(ASNodeLog(), "%s%@ %@", sel_getName(_cmd), NSStringFromASHierarchyStateChange(oldState, newState), self); } @@ -2963,7 +2907,6 @@ - (void)exitInterfaceState:(ASInterfaceState)interfaceState if (interfaceState == ASInterfaceStateNone) { return; // This method is a no-op with a 0-bitfield argument, so don't bother recursing. } - ASDisplayNodeLogEvent(self, @"%s %@", sel_getName(_cmd), NSStringFromASInterfaceState(interfaceState)); ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode *node) { node.interfaceState &= (~interfaceState); }); @@ -3136,7 +3079,6 @@ - (void)applyPendingInterfaceState:(ASInterfaceState)newPendingState as_log_verbose(ASNodeLog(), "%s %@ %@", sel_getName(_cmd), NSStringFromASInterfaceStateChange(oldState, newState), self); } - ASDisplayNodeLogEvent(self, @"interfaceStateDidChange: %@", NSStringFromASInterfaceStateChange(oldState, newState)); [self _interfaceStateDidChange:newState fromState:oldState]; } @@ -3596,13 +3538,6 @@ - (UIAccessibilityTraits)defaultAccessibilityTraits #pragma mark - Debugging (Private) -#if ASEVENTLOG_ENABLE -- (ASEventLog *)eventLog -{ - return _eventLog; -} -#endif - - (NSMutableArray *)propertiesForDescription { NSMutableArray *result = [NSMutableArray array]; diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 9cae6878b..7362fec6a 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -307,7 +307,7 @@ - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style return [self _initWithFrame:frame style:style dataControllerClass:nil owningNode:nil eventLog:nil]; } -- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode eventLog:(ASEventLog *)eventLog +- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode { if (!(self = [super initWithFrame:frame style:style])) { return nil; diff --git a/Source/ASTableViewInternal.h b/Source/ASTableViewInternal.h index d8bbf577a..161b1118e 100644 --- a/Source/ASTableViewInternal.h +++ b/Source/ASTableViewInternal.h @@ -12,7 +12,6 @@ @class ASDataController; @class ASTableNode; @class ASRangeController; -@class ASEventLog; @interface ASTableView (Internal) @@ -32,7 +31,7 @@ * * @param eventLog An event log passed through to the data controller. */ -- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode eventLog:(ASEventLog *)eventLog; +- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode /// Set YES and we'll log every time we call [super insertRows…] etc @property (nonatomic) BOOL test_enableSuperUpdateCallLogging; diff --git a/Source/AsyncDisplayKit.h b/Source/AsyncDisplayKit.h index 476262477..eaab7784f 100644 --- a/Source/AsyncDisplayKit.h +++ b/Source/AsyncDisplayKit.h @@ -101,7 +101,6 @@ #import #import #import -#import #import #import #import diff --git a/Source/Base/ASBaseDefines.h b/Source/Base/ASBaseDefines.h index 4e880f902..357d6bb39 100644 --- a/Source/Base/ASBaseDefines.h +++ b/Source/Base/ASBaseDefines.h @@ -73,17 +73,6 @@ #define AS_ENABLE_TIPS 0 #endif -/** - * The event backtraces take a static 2KB of memory - * and retain all objects present in all the registers - * of the stack frames. The memory consumption impact - * is too significant even to be enabled during general - * development. - */ -#ifndef AS_SAVE_EVENT_BACKTRACES -# define AS_SAVE_EVENT_BACKTRACES 0 -#endif - #ifndef __has_feature // Optional. #define __has_feature(x) 0 // Compatibility with non-clang compilers. #endif diff --git a/Source/Details/ASCollectionInternal.h b/Source/Details/ASCollectionInternal.h index 102356606..42f651ae6 100644 --- a/Source/Details/ASCollectionInternal.h +++ b/Source/Details/ASCollectionInternal.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN @class ASRangeController; @interface ASCollectionView () -- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id)layoutFacilitator owningNode:(nullable ASCollectionNode *)owningNode eventLog:(nullable ASEventLog *)eventLog; +- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id)layoutFacilitator owningNode:(nullable ASCollectionNode *)owningNode; @property (nonatomic, weak) ASCollectionNode *collectionNode; @property (nonatomic, readonly) ASDataController *dataController; diff --git a/Source/Details/ASDataController.h b/Source/Details/ASDataController.h index b64c0520c..099137ad7 100644 --- a/Source/Details/ASDataController.h +++ b/Source/Details/ASDataController.h @@ -12,19 +12,12 @@ #import #import #import -#import #ifdef __cplusplus #import #endif NS_ASSUME_NONNULL_BEGIN -#if ASEVENTLOG_ENABLE -#define ASDataControllerLogEvent(dataController, ...) [dataController.eventLog logEventWithBacktrace:(AS_SAVE_EVENT_BACKTRACES ? [NSThread callStackSymbols] : nil) format:__VA_ARGS__] -#else -#define ASDataControllerLogEvent(dataController, ...) -#endif - @class ASCellNode; @class ASCollectionElement; @class ASCollectionLayoutContext; @@ -163,7 +156,7 @@ AS_EXTERN NSString * const ASCollectionInvalidUpdateException; */ @interface ASDataController : NSObject -- (instancetype)initWithDataSource:(id)dataSource node:(nullable id)node eventLog:(nullable ASEventLog *)eventLog NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithDataSource:(id)dataSource node:(nullable id)node NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; @@ -227,13 +220,6 @@ AS_EXTERN NSString * const ASCollectionInvalidUpdateException; */ @property (nonatomic, readonly) BOOL initialReloadDataHasBeenCalled; -#if ASEVENTLOG_ENABLE -/* - * @abstract The primitive event tracing object. You shouldn't directly use it to log event. Use the ASDataControllerLogEvent macro instead. - */ -@property (nonatomic, readonly) ASEventLog *eventLog; -#endif - /** @name Data Updating */ - (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet; diff --git a/Source/Details/ASDataController.mm b/Source/Details/ASDataController.mm index 07388f4c6..d1862f1fd 100644 --- a/Source/Details/ASDataController.mm +++ b/Source/Details/ASDataController.mm @@ -88,7 +88,7 @@ @implementation ASDataController #pragma mark - Lifecycle -- (instancetype)initWithDataSource:(id)dataSource node:(nullable id)node eventLog:(ASEventLog *)eventLog +- (instancetype)initWithDataSource:(id)dataSource node:(nullable id)node { if (!(self = [super init])) { return nil; @@ -103,10 +103,6 @@ - (instancetype)initWithDataSource:(id)dataSource node:( _dataSourceFlags.constrainedSizeForNodeAtIndexPath = [_dataSource respondsToSelector:@selector(dataController:constrainedSizeForNodeAtIndexPath:)]; _dataSourceFlags.constrainedSizeForSupplementaryNodeOfKindAtIndexPath = [_dataSource respondsToSelector:@selector(dataController:constrainedSizeForSupplementaryNodeOfKind:atIndexPath:)]; _dataSourceFlags.contextForSection = [_dataSource respondsToSelector:@selector(dataController:contextForSection:)]; - -#if ASEVENTLOG_ENABLE - _eventLog = eventLog; -#endif self.visibleMap = self.pendingMap = [[ASElementMap alloc] init]; @@ -582,18 +578,6 @@ - (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet [self invalidateDataSourceItemCounts]; - // Log events -#if ASEVENTLOG_ENABLE - ASDataControllerLogEvent(self, @"updateWithChangeSet waited on previous update for %fms. changeSet: %@", - transactionQueueFlushDuration * 1000.0f, changeSet); - NSTimeInterval changeSetStartTime = CACurrentMediaTime(); - NSString *changeSetDescription = ASObjectDescriptionMakeTiny(changeSet); - [changeSet addCompletionHandler:^(BOOL finished) { - ASDataControllerLogEvent(self, @"finishedUpdate in %fms: %@", - (CACurrentMediaTime() - changeSetStartTime) * 1000.0f, changeSetDescription); - }]; -#endif - // Attempt to mark the update completed. This is when update validation will occur inside the changeset. // If an invalid update exception is thrown, we catch it and inject our "validationErrorSource" object, // which is the table/collection node's data source, into the exception reason to help debugging. diff --git a/Source/Details/ASEventLog.h b/Source/Details/ASEventLog.h deleted file mode 100644 index 9a147f259..000000000 --- a/Source/Details/ASEventLog.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// ASEventLog.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#ifndef ASEVENTLOG_CAPACITY -#define ASEVENTLOG_CAPACITY 5 -#endif - -#ifndef ASEVENTLOG_ENABLE -#define ASEVENTLOG_ENABLE 0 -#endif - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASEventLog : NSObject - -/** - * Create a new event log. - * - * @param anObject The object whose events we are logging. This object is not retained. - */ -- (instancetype)initWithObject:(id)anObject; - -- (void)logEventWithBacktrace:(nullable NSArray *)backtrace format:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3); - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASEventLog.mm b/Source/Details/ASEventLog.mm deleted file mode 100644 index 25ecc2996..000000000 --- a/Source/Details/ASEventLog.mm +++ /dev/null @@ -1,121 +0,0 @@ -// -// ASEventLog.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -@implementation ASEventLog { - AS::RecursiveMutex __instanceLock__; - - // The index of the most recent log entry. -1 until first entry. - NSInteger _eventLogHead; - - // A description of the object we're logging for. This is immutable. - NSString *_objectDescription; -} - -/** - * Even just when debugging, all these events can take up considerable memory. - * Store them in a shared NSCache to limit the total consumption. - */ -+ (NSCache *> *)contentsCache -{ - static NSCache *cache; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - cache = [[NSCache alloc] init]; - }); - return cache; -} - -- (instancetype)initWithObject:(id)anObject -{ - if ((self = [super init])) { - _objectDescription = ASObjectDescriptionMakeTiny(anObject); - _eventLogHead = -1; - } - return self; -} - -- (instancetype)init -{ - // This method is marked unavailable so the compiler won't let them call it. - ASDisplayNodeFailAssert(@"Failed to call initWithObject:"); - return nil; -} - -- (void)logEventWithBacktrace:(NSArray *)backtrace format:(NSString *)format, ... -{ - va_list args; - va_start(args, format); - ASTraceEvent *event = [[ASTraceEvent alloc] initWithBacktrace:backtrace - format:format - arguments:args]; - va_end(args); - - AS::MutexLocker l(__instanceLock__); - NSCache *cache = [ASEventLog contentsCache]; - NSMutableArray *events = [cache objectForKey:self]; - if (events == nil) { - events = [NSMutableArray arrayWithObject:event]; - [cache setObject:events forKey:self]; - _eventLogHead = 0; - return; - } - - // Increment the head index. - _eventLogHead = (_eventLogHead + 1) % ASEVENTLOG_CAPACITY; - if (_eventLogHead < events.count) { - [events replaceObjectAtIndex:_eventLogHead withObject:event]; - } else { - [events insertObject:event atIndex:_eventLogHead]; - } -} - -- (NSArray *)events -{ - NSMutableArray *events = [[ASEventLog contentsCache] objectForKey:self]; - if (events == nil) { - return nil; - } - - AS::MutexLocker l(__instanceLock__); - NSUInteger tail = (_eventLogHead + 1); - NSUInteger count = events.count; - - NSMutableArray *result = [NSMutableArray array]; - - // Start from `tail` and go through array, wrapping around when we exceed end index. - for (NSUInteger actualIndex = 0; actualIndex < ASEVENTLOG_CAPACITY; actualIndex++) { - NSInteger ringIndex = (tail + actualIndex) % ASEVENTLOG_CAPACITY; - if (ringIndex < count) { - [result addObject:events[ringIndex]]; - } - } - return result; -} - -- (NSString *)description -{ - /** - * This description intentionally doesn't follow the standard description format. - * Since this is a log, it's important for the description to look a certain way, and - * the formal description style doesn't allow for newlines and has a ton of punctuation. - */ - NSArray *events = [self events]; - if (events == nil) { - return [NSString stringWithFormat:@"Event log for %@ was purged to conserve memory.", _objectDescription]; - } else { - return [NSString stringWithFormat:@"Event log for %@. Events: %@", _objectDescription, events]; - } -} - -@end diff --git a/Source/Details/ASTraceEvent.h b/Source/Details/ASTraceEvent.h deleted file mode 100644 index 8ca7b32fa..000000000 --- a/Source/Details/ASTraceEvent.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ASTraceEvent.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASTraceEvent : NSObject - -/** - * This method is dealloc safe. - */ -- (instancetype)initWithBacktrace:(nullable NSArray *)backtrace - format:(NSString *)format - arguments:(va_list)arguments NS_FORMAT_FUNCTION(2,0); - -// Will be nil unless AS_SAVE_EVENT_BACKTRACES=1 (default=0) -@property (nonatomic, nullable, readonly) NSArray *backtrace; -@property (nonatomic, readonly) NSString *message; -@property (nonatomic, readonly) NSTimeInterval timestamp; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASTraceEvent.mm b/Source/Details/ASTraceEvent.mm deleted file mode 100644 index c80986559..000000000 --- a/Source/Details/ASTraceEvent.mm +++ /dev/null @@ -1,67 +0,0 @@ -// -// ASTraceEvent.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -static NSString *const ASTraceEventThreadDescriptionKey = @"ASThreadTraceEventDescription"; - -@interface ASTraceEvent () -@property (nonatomic, readonly) NSString *objectDescription; -@property (nonatomic, readonly) NSString *threadDescription; -@end - -@implementation ASTraceEvent - -- (instancetype)initWithBacktrace:(NSArray *)backtrace format:(NSString *)format arguments:(va_list)args -{ - self = [super init]; - if (self != nil) { - static NSTimeInterval refTime; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - refTime = CACurrentMediaTime(); - }); - - // Create the format string passed to us. - _message = [[NSString alloc] initWithFormat:format arguments:args]; - - NSThread *thread = [NSThread currentThread]; - NSString *threadDescription = thread.name; - if (threadDescription.length == 0) { - if ([thread isMainThread]) { - threadDescription = @"Main"; - } else { - // If the bg thread has no name, we cache a 4-character ptr string to identify it by - // inside the thread dictionary. - NSMutableDictionary *threadDict = thread.threadDictionary; - threadDescription = threadDict[ASTraceEventThreadDescriptionKey]; - if (threadDescription == nil) { - // Want these to be 4-chars to line up with "Main". It's possible that a collision could happen - // here but it's so unbelievably likely to impact development, the risk is acceptable. - NSString *ptrString = [NSString stringWithFormat:@"%p", thread]; - threadDescription = [ptrString substringFromIndex:MAX(0, ptrString.length - 4)]; - threadDict[ASTraceEventThreadDescriptionKey] = threadDescription; - } - } - } - _threadDescription = threadDescription; - - _backtrace = backtrace; - _timestamp = CACurrentMediaTime() - refTime; - } - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<(%@) t=%7.3f: %@>", _threadDescription, _timestamp, _message]; -} - -@end diff --git a/Source/Private/ASDisplayNodeInternal.h b/Source/Private/ASDisplayNodeInternal.h index 5477da956..f19cba3a5 100644 --- a/Source/Private/ASDisplayNodeInternal.h +++ b/Source/Private/ASDisplayNodeInternal.h @@ -145,11 +145,6 @@ static constexpr CACornerMask kASCACornerAllCorners = ASDisplayNodeMethodOverrides _methodOverrides; UIEdgeInsets _hitTestSlop; - -#if ASEVENTLOG_ENABLE - ASEventLog *_eventLog; -#endif - // Layout support ASLayoutElementStyle *_style; diff --git a/Source/Private/ASLayoutTransition.mm b/Source/Private/ASLayoutTransition.mm index 2fea2b8ad..e8d62edc8 100644 --- a/Source/Private/ASLayoutTransition.mm +++ b/Source/Private/ASLayoutTransition.mm @@ -103,7 +103,6 @@ - (void)applySubnodeInsertionsAndMoves return; } - ASDisplayNodeLogEvent(_node, @"insertSubnodes: %@", _insertedSubnodes); NSUInteger i = 0; NSUInteger j = 0; for (auto const &move : _subnodeMoves) { @@ -139,7 +138,6 @@ - (void)applySubnodeRemovals return; } - ASDisplayNodeLogEvent(_node, @"removeSubnodes: %@", _removedSubnodes); for (ASDisplayNode *subnode in _removedSubnodes) { // In this case we should only remove the subnode if it's still a subnode of the _node that executes a layout transition. // It can happen that a node already did a layout transition and added this subnode, in this case the subnode From eaa1d829e2b1752a9f539e4f41209a6923da465b Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 19 Apr 2019 14:02:46 -0700 Subject: [PATCH 2/7] See ya! --- Source/ASCollectionNode.mm | 2 +- Source/ASCollectionView.mm | 4 ++-- Source/ASDisplayNode.h | 2 +- Source/ASImageNode.mm | 2 -- Source/ASTableNode.mm | 2 +- Source/ASTableView.mm | 4 ++-- Source/ASTableViewInternal.h | 2 -- Tests/ASCALayerTests.mm | 11 +++++++++++ Tests/ASTableViewTests.mm | 2 +- 9 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Source/ASCollectionNode.mm b/Source/ASCollectionNode.mm index 51cb7d330..30f1c6e41 100644 --- a/Source/ASCollectionNode.mm +++ b/Source/ASCollectionNode.mm @@ -156,7 +156,7 @@ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionVi __weak __typeof__(self) weakSelf = self; [self setViewBlock:^{ __typeof__(self) strongSelf = weakSelf; - return [[[strongSelf collectionViewClass] alloc] _initWithFrame:frame collectionViewLayout:strongSelf->_pendingState.collectionViewLayout layoutFacilitator:layoutFacilitator owningNode:strongSelf eventLog:ASDisplayNodeGetEventLog(strongSelf)]; + return [[[strongSelf collectionViewClass] alloc] _initWithFrame:frame collectionViewLayout:strongSelf->_pendingState.collectionViewLayout layoutFacilitator:layoutFacilitator owningNode:strongSelf]; }]; } return self; diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index 376bf25bd..3198c1425 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -267,7 +267,7 @@ - (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout { - return [self _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil owningNode:nil eventLog:nil]; + return [self _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil owningNode:nil]; } - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id)layoutFacilitator owningNode:(ASCollectionNode *)owningNode @@ -290,7 +290,7 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV _rangeController.delegate = self; _rangeController.layoutController = _layoutController; - _dataController = [[ASDataController alloc] initWithDataSource:self node:owningNode eventLog:eventLog]; + _dataController = [[ASDataController alloc] initWithDataSource:self node:owningNode]; _dataController.delegate = _rangeController; _batchContext = [[ASBatchContext alloc] init]; diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 964ddc50d..9380a6317 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -681,7 +681,7 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; @property (nullable) id contents; // default=nil @property CGRect contentsRect; // default={0,0,1,1}. @see CALayer.h for details. @property CGRect contentsCenter; // default={0,0,1,1}. @see CALayer.h for details. -@property CGFloat contentsScale; // default=1.0f. See @contentsScaleForDisplay for details. +@property CGFloat contentsScale; // default=main screen scale. @property CGFloat rasterizationScale; // default=1.0f. @property CGPoint anchorPoint; // default={0.5, 0.5} diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index 0513d511f..b472deae7 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -163,8 +163,6 @@ - (instancetype)init if (!(self = [super init])) return nil; - // TODO can this be removed? - self.contentsScale = ASScreenScale(); self.contentMode = UIViewContentModeScaleAspectFill; self.opaque = NO; self.clipsToBounds = YES; diff --git a/Source/ASTableNode.mm b/Source/ASTableNode.mm index 7ef33d138..496942017 100644 --- a/Source/ASTableNode.mm +++ b/Source/ASTableNode.mm @@ -119,7 +119,7 @@ - (instancetype)initWithStyle:(UITableViewStyle)style [self setViewBlock:^{ // Variable will be unused if event logging is off. __unused __typeof__(self) strongSelf = weakSelf; - return [[ASTableView alloc] _initWithFrame:CGRectZero style:style dataControllerClass:nil owningNode:strongSelf eventLog:ASDisplayNodeGetEventLog(strongSelf)]; + return [[ASTableView alloc] _initWithFrame:CGRectZero style:style dataControllerClass:nil owningNode:strongSelf]; }]; } return self; diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 7362fec6a..7a0ae3b83 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -304,7 +304,7 @@ + (Class)dataControllerClass - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { - return [self _initWithFrame:frame style:style dataControllerClass:nil owningNode:nil eventLog:nil]; + return [self _initWithFrame:frame style:style dataControllerClass:nil owningNode:nil]; } - (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode @@ -325,7 +325,7 @@ - (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataC _rangeController.dataSource = self; _rangeController.delegate = self; - _dataController = [[dataControllerClass alloc] initWithDataSource:self node:tableNode eventLog:eventLog]; + _dataController = [[dataControllerClass alloc] initWithDataSource:self node:tableNode]; _dataController.delegate = _rangeController; _leadingScreensForBatching = 2.0; diff --git a/Source/ASTableViewInternal.h b/Source/ASTableViewInternal.h index 161b1118e..fd6a116e5 100644 --- a/Source/ASTableViewInternal.h +++ b/Source/ASTableViewInternal.h @@ -28,8 +28,6 @@ * @param style A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants. * * @param dataControllerClass A controller class injected to and used to create a data controller for the table view. - * - * @param eventLog An event log passed through to the data controller. */ - (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode diff --git a/Tests/ASCALayerTests.mm b/Tests/ASCALayerTests.mm index 2b30da28f..2a01b96f6 100644 --- a/Tests/ASCALayerTests.mm +++ b/Tests/ASCALayerTests.mm @@ -104,4 +104,15 @@ - (void)testDirtyHierarchyIsLaidOutTopDown [layer verify]; } +// Fails on iOS 11.4 +- (void)testThatLayerDelegateIsActuallyWeak { + id del NS_VALID_UNTIL_END_OF_SCOPE; + del = [[NSObject alloc] init]; + CALayer *l = [CALayer layer]; + l.delegate = del; + XCTAssertNotNil(l.delegate); + del = nil; + XCTAssertNil(l.delegate); +} + @end diff --git a/Tests/ASTableViewTests.mm b/Tests/ASTableViewTests.mm index 7295b20ba..e367b0b76 100644 --- a/Tests/ASTableViewTests.mm +++ b/Tests/ASTableViewTests.mm @@ -57,7 +57,7 @@ @implementation ASTestTableView - (instancetype)__initWithFrame:(CGRect)frame style:(UITableViewStyle)style { - return [super _initWithFrame:frame style:style dataControllerClass:[ASTestDataController class] owningNode:nil eventLog:nil]; + return [super _initWithFrame:frame style:style dataControllerClass:[ASTestDataController class] owningNode:nil]; } - (ASTestDataController *)testDataController From 94706e32dae13a8c6cf9ea9b2705c96fb6455546 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 19 Apr 2019 14:55:27 -0700 Subject: [PATCH 3/7] Hello semicolon --- Source/ASTableViewInternal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ASTableViewInternal.h b/Source/ASTableViewInternal.h index fd6a116e5..35a55d4ef 100644 --- a/Source/ASTableViewInternal.h +++ b/Source/ASTableViewInternal.h @@ -29,7 +29,7 @@ * * @param dataControllerClass A controller class injected to and used to create a data controller for the table view. */ -- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode +- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode; /// Set YES and we'll log every time we call [super insertRows…] etc @property (nonatomic) BOOL test_enableSuperUpdateCallLogging; From 667aae75c581b889a7efa35c30494af54920b43b Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 19 Apr 2019 14:57:22 -0700 Subject: [PATCH 4/7] Remove refs to gone tree methods --- Source/ASDisplayNode.mm | 4 ++-- Source/Details/_ASDisplayView.mm | 2 +- Source/Private/ASDisplayNodeInternal.h | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/ASDisplayNode.mm b/Source/ASDisplayNode.mm index a5519bd61..dc30c17f0 100644 --- a/Source/ASDisplayNode.mm +++ b/Source/ASDisplayNode.mm @@ -2153,8 +2153,8 @@ - (void)_insertSubnode:(ASDisplayNode *)subnode atSubnodeIndex:(NSInteger)subnod [subnode __incrementVisibilityNotificationsDisabled]; } - [subnode _removeFromSupernode]; - [oldSubnode _removeFromSupernode]; + [subnode removeFromSupernode]; + [oldSubnode removeFromSupernode]; __instanceLock__.lock(); if (_subnodes == nil) { diff --git a/Source/Details/_ASDisplayView.mm b/Source/Details/_ASDisplayView.mm index 9d0af059c..6fea48a30 100644 --- a/Source/Details/_ASDisplayView.mm +++ b/Source/Details/_ASDisplayView.mm @@ -268,7 +268,7 @@ - (void)didMoveToSuperview if (needsSupernodeRemoval) { // The node will only disconnect from its supernode, not removeFromSuperview, in this condition. // FIXME: Needs rethinking if automaticallyManagesSubnodes=YES - [node _removeFromSupernode]; + [node removeFromSupernode]; } } } diff --git a/Source/Private/ASDisplayNodeInternal.h b/Source/Private/ASDisplayNodeInternal.h index f19cba3a5..b2d56b3e6 100644 --- a/Source/Private/ASDisplayNodeInternal.h +++ b/Source/Private/ASDisplayNodeInternal.h @@ -308,13 +308,11 @@ static constexpr CACornerMask kASCACornerAllCorners = * Internal method to add / replace / insert subnode and remove from supernode without checking if * node has automaticallyManagesSubnodes set to YES. */ -- (void)_addSubnode:(ASDisplayNode *)subnode; - (void)_replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode *)replacementSubnode; - (void)_insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below; - (void)_insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above; - (void)_insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx; - (void)_removeFromSupernodeIfEqualTo:(ASDisplayNode *)supernode; -- (void)_removeFromSupernode; // Private API for helper functions / unit tests. Use ASDisplayNodeDisableHierarchyNotifications() to control this. - (BOOL)__visibilityNotificationsDisabled; From cc8fb840fa77b45b32d57fe1ee8ead076631ae01 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 19 Apr 2019 14:57:52 -0700 Subject: [PATCH 5/7] Fix --- Source/Details/_ASDisplayView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Details/_ASDisplayView.mm b/Source/Details/_ASDisplayView.mm index 6fea48a30..ddbfc75dd 100644 --- a/Source/Details/_ASDisplayView.mm +++ b/Source/Details/_ASDisplayView.mm @@ -207,7 +207,7 @@ - (void)willMoveToSuperview:(UIView *)newSuperview if (needsSupernodeUpdate) { // -removeFromSupernode is called by -addSubnode:, if it is needed. // FIXME: Needs rethinking if automaticallyManagesSubnodes=YES - [newSuperview.asyncdisplaykit_node _addSubnode:node]; + [newSuperview.asyncdisplaykit_node addSubnode:node]; } } } From fc1f3962bee36f2101ec9a9d589f2f0210887193 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 19 Apr 2019 18:37:50 -0700 Subject: [PATCH 6/7] Remove irrelevant change, kick CI --- Tests/ASCALayerTests.mm | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Tests/ASCALayerTests.mm b/Tests/ASCALayerTests.mm index 2a01b96f6..2b30da28f 100644 --- a/Tests/ASCALayerTests.mm +++ b/Tests/ASCALayerTests.mm @@ -104,15 +104,4 @@ - (void)testDirtyHierarchyIsLaidOutTopDown [layer verify]; } -// Fails on iOS 11.4 -- (void)testThatLayerDelegateIsActuallyWeak { - id del NS_VALID_UNTIL_END_OF_SCOPE; - del = [[NSObject alloc] init]; - CALayer *l = [CALayer layer]; - l.delegate = del; - XCTAssertNotNil(l.delegate); - del = nil; - XCTAssertNil(l.delegate); -} - @end From 241ecfc851786697eed050dd190f19496eac96a7 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Mon, 22 Apr 2019 09:31:55 -0700 Subject: [PATCH 7/7] Clean up --- Source/ASDisplayNode.h | 2 +- Source/ASImageNode.mm | 2 ++ Source/Private/ASDisplayNodeInternal.h | 6 +----- Source/Private/ASLayoutTransition.mm | 10 +++++----- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index 9380a6317..964ddc50d 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -681,7 +681,7 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; @property (nullable) id contents; // default=nil @property CGRect contentsRect; // default={0,0,1,1}. @see CALayer.h for details. @property CGRect contentsCenter; // default={0,0,1,1}. @see CALayer.h for details. -@property CGFloat contentsScale; // default=main screen scale. +@property CGFloat contentsScale; // default=1.0f. See @contentsScaleForDisplay for details. @property CGFloat rasterizationScale; // default=1.0f. @property CGPoint anchorPoint; // default={0.5, 0.5} diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index b472deae7..0513d511f 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -163,6 +163,8 @@ - (instancetype)init if (!(self = [super init])) return nil; + // TODO can this be removed? + self.contentsScale = ASScreenScale(); self.contentMode = UIViewContentModeScaleAspectFill; self.opaque = NO; self.clipsToBounds = YES; diff --git a/Source/Private/ASDisplayNodeInternal.h b/Source/Private/ASDisplayNodeInternal.h index b2d56b3e6..caf329ec7 100644 --- a/Source/Private/ASDisplayNodeInternal.h +++ b/Source/Private/ASDisplayNodeInternal.h @@ -305,13 +305,9 @@ static constexpr CACornerMask kASCACornerAllCorners = - (void)__layout; /** - * Internal method to add / replace / insert subnode and remove from supernode without checking if - * node has automaticallyManagesSubnodes set to YES. + * Internal tree modification methods. */ - (void)_replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode *)replacementSubnode; -- (void)_insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below; -- (void)_insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above; -- (void)_insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx; - (void)_removeFromSupernodeIfEqualTo:(ASDisplayNode *)supernode; // Private API for helper functions / unit tests. Use ASDisplayNodeDisableHierarchyNotifications() to control this. diff --git a/Source/Private/ASLayoutTransition.mm b/Source/Private/ASLayoutTransition.mm index e8d62edc8..7b4289be4 100644 --- a/Source/Private/ASLayoutTransition.mm +++ b/Source/Private/ASLayoutTransition.mm @@ -12,7 +12,7 @@ #import #import -#import // Required for _insertSubnode... / _removeFromSupernode. +#import // Required for _removeFromSupernodeIfEqualTo: #import #import @@ -113,18 +113,18 @@ - (void)applySubnodeInsertionsAndMoves NSUInteger p = _insertedSubnodePositions[i]; NSUInteger q = _subnodeMoves[j].second; if (p < q) { - [_node _insertSubnode:_insertedSubnodes[i] atIndex:p]; + [_node insertSubnode:_insertedSubnodes[i] atIndex:p]; i++; } else { - [_node _insertSubnode:_subnodeMoves[j].first atIndex:q]; + [_node insertSubnode:_subnodeMoves[j].first atIndex:q]; j++; } } for (; i < _insertedSubnodePositions.size(); ++i) { - [_node _insertSubnode:_insertedSubnodes[i] atIndex:_insertedSubnodePositions[i]]; + [_node insertSubnode:_insertedSubnodes[i] atIndex:_insertedSubnodePositions[i]]; } for (; j < _subnodeMoves.size(); ++j) { - [_node _insertSubnode:_subnodeMoves[j].first atIndex:_subnodeMoves[j].second]; + [_node insertSubnode:_subnodeMoves[j].first atIndex:_subnodeMoves[j].second]; } }