mirror of
https://github.com/TextureGroup/Texture.git
synced 2026-04-07 19:17:39 +00:00
Remove ASEventLog (#1460)
* Remove ASEventLog. We'll focus on ASLog for the future, possibly making it triggerable on a per-node basis * See ya! * Hello semicolon * Remove refs to gone tree methods * Fix * Remove irrelevant change, kick CI * Clean up
This commit is contained in:
@@ -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 = "<group>"; };
|
||||
6959433D1D70815300B0EE1F /* ASDisplayNodeLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDisplayNodeLayout.h; sourceTree = "<group>"; };
|
||||
695BE2541DC1245C008E6EA5 /* ASWrapperSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASWrapperSpecSnapshotTests.mm; sourceTree = "<group>"; };
|
||||
696F01EA1DD2AF450049FBD5 /* ASEventLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEventLog.h; sourceTree = "<group>"; };
|
||||
696F01EB1DD2AF450049FBD5 /* ASEventLog.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEventLog.mm; sourceTree = "<group>"; };
|
||||
696FCB301D6E46050093471E /* ASBackgroundLayoutSpecSnapshotTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = ASBackgroundLayoutSpecSnapshotTests.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
6977965D1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASLayoutSpec+Subclasses.h"; sourceTree = "<group>"; };
|
||||
6977965E1D8AC8D3007E93D7 /* ASLayoutSpec+Subclasses.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "ASLayoutSpec+Subclasses.mm"; sourceTree = "<group>"; };
|
||||
@@ -891,8 +885,6 @@
|
||||
CC4981B21D1A02BE004E13CC /* ASTableViewThrashTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASTableViewThrashTests.mm; sourceTree = "<group>"; };
|
||||
CC4981BA1D1C7F65004E13CC /* NSIndexSet+ASHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSIndexSet+ASHelpers.h"; sourceTree = "<group>"; };
|
||||
CC4981BB1D1C7F65004E13CC /* NSIndexSet+ASHelpers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSIndexSet+ASHelpers.mm"; sourceTree = "<group>"; };
|
||||
CC4C2A751D88E3BF0039ACAB /* ASTraceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTraceEvent.h; sourceTree = "<group>"; };
|
||||
CC4C2A761D88E3BF0039ACAB /* ASTraceEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASTraceEvent.mm; sourceTree = "<group>"; };
|
||||
CC512B841DAC45C60054848E /* ASTableView+Undeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASTableView+Undeprecated.h"; sourceTree = "<group>"; };
|
||||
CC54A81B1D70077A00296A24 /* ASDispatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASDispatch.h; sourceTree = "<group>"; };
|
||||
CC54A81D1D7008B300296A24 /* ASDispatchTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = ASDispatchTests.mm; sourceTree = "<group>"; 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 */,
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
__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;
|
||||
|
||||
@@ -267,10 +267,10 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
|
||||
- (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<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator owningNode:(ASCollectionNode *)owningNode eventLog:(ASEventLog *)eventLog
|
||||
- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator owningNode:(ASCollectionNode *)owningNode
|
||||
{
|
||||
if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
|
||||
return nil;
|
||||
@@ -290,7 +290,7 @@ static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier";
|
||||
_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];
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#import <AsyncDisplayKit/ASAvailability.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode.h>
|
||||
#import <AsyncDisplayKit/ASLayoutRangeType.h>
|
||||
#import <AsyncDisplayKit/ASEventLog.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -137,7 +137,6 @@ ASLayoutElementStyleExtensibilityForwarding
|
||||
AS::UniqueLock l(__instanceLock__);
|
||||
if (ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(traitCollection, _primitiveTraitCollection) == NO) {
|
||||
_primitiveTraitCollection = traitCollection;
|
||||
ASDisplayNodeLogEvent(self, @"asyncTraitCollectionDidChange: %@", NSStringFromASPrimitiveTraitCollection(traitCollection));
|
||||
|
||||
l.unlock();
|
||||
[self asyncTraitCollectionDidChange];
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
// 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 @@
|
||||
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]) {
|
||||
|
||||
+2
-67
@@ -313,10 +313,6 @@ __attribute__((constructor)) static void ASLoadFrameworkInitializer(void)
|
||||
{
|
||||
[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 @@ __attribute__((constructor)) static void ASLoadFrameworkInitializer(void)
|
||||
_automaticallyRelayoutOnLayoutMarginsChanges = NO;
|
||||
|
||||
[self baseDidInit];
|
||||
ASDisplayNodeLogEvent(self, @"init");
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
@@ -595,7 +590,6 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__);
|
||||
{
|
||||
ASDisplayNodeAssertMainThread();
|
||||
DISABLED_ASAssertUnlocked(__instanceLock__);
|
||||
ASDisplayNodeLogEvent(self, @"didLoad");
|
||||
as_log_verbose(ASNodeLog(), "didLoad %@", self);
|
||||
TIME_SCOPED(_debugTimeForDidLoad);
|
||||
|
||||
@@ -1164,8 +1158,6 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__);
|
||||
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
|
||||
{
|
||||
__ASDisplayNodeCheckForLayoutMethodOverrides;
|
||||
|
||||
ASDisplayNodeLogEvent(self, @"calculateSizeThatFits: with constrainedSize: %@", NSStringFromCGSize(constrainedSize));
|
||||
|
||||
return ASIsCGSizeValidForSize(constrainedSize) ? constrainedSize : CGSizeZero;
|
||||
}
|
||||
@@ -1781,7 +1773,6 @@ static void _recursivelySetDisplaySuspended(ASDisplayNode *node, CALayer *layer,
|
||||
{
|
||||
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 @@ static void _recursivelySetDisplaySuspended(ASDisplayNode *node, CALayer *layer,
|
||||
{
|
||||
ASDisplayNodeAssertMainThread();
|
||||
|
||||
ASDisplayNodeLogEvent(self, @"displayDidFinish");
|
||||
[self _pendingNodeDidDisplay:self];
|
||||
|
||||
__instanceLock__.lock();
|
||||
@@ -2034,7 +2024,6 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
|
||||
if (supernodeDidChange) {
|
||||
ASDisplayNodeLogEvent(self, @"supernodeDidChange: %@, oldValue = %@", ASObjectDescriptionMakeTiny(newSupernode), ASObjectDescriptionMakeTiny(oldSupernode));
|
||||
// Hierarchy state
|
||||
ASHierarchyState stateToEnterOrExit = (newSupernode ? newSupernode.hierarchyState
|
||||
: oldSupernode.hierarchyState);
|
||||
@@ -2164,8 +2153,8 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
[subnode __incrementVisibilityNotificationsDisabled];
|
||||
}
|
||||
|
||||
[subnode _removeFromSupernode];
|
||||
[oldSubnode _removeFromSupernode];
|
||||
[subnode removeFromSupernode];
|
||||
[oldSubnode removeFromSupernode];
|
||||
|
||||
__instanceLock__.lock();
|
||||
if (_subnodes == nil) {
|
||||
@@ -2226,13 +2215,6 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
|
||||
- (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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
|
||||
- (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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
|
||||
- (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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
|
||||
- (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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
|
||||
- (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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
|
||||
- (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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
{
|
||||
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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
{
|
||||
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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
}
|
||||
}
|
||||
|
||||
ASDisplayNodeLogEvent(self, @"setHierarchyState: %@", NSStringFromASHierarchyStateChange(oldState, newState));
|
||||
as_log_verbose(ASNodeLog(), "%s%@ %@", sel_getName(_cmd), NSStringFromASHierarchyStateChange(oldState, newState), self);
|
||||
}
|
||||
|
||||
@@ -2963,7 +2907,6 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
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 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
|
||||
|
||||
#pragma mark - Debugging (Private)
|
||||
|
||||
#if ASEVENTLOG_ENABLE
|
||||
- (ASEventLog *)eventLog
|
||||
{
|
||||
return _eventLog;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (NSMutableArray<NSDictionary *> *)propertiesForDescription
|
||||
{
|
||||
NSMutableArray<NSDictionary *> *result = [NSMutableArray array];
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
[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;
|
||||
|
||||
@@ -304,10 +304,10 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
|
||||
|
||||
- (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 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;
|
||||
@@ -325,7 +325,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
|
||||
_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;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
@class ASDataController;
|
||||
@class ASTableNode;
|
||||
@class ASRangeController;
|
||||
@class ASEventLog;
|
||||
|
||||
@interface ASTableView (Internal)
|
||||
|
||||
@@ -29,10 +28,8 @@
|
||||
* @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 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;
|
||||
|
||||
@@ -101,7 +101,6 @@
|
||||
#import <AsyncDisplayKit/ASControlNode+Subclasses.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
|
||||
#import <AsyncDisplayKit/ASEqualityHelpers.h>
|
||||
#import <AsyncDisplayKit/ASEventLog.h>
|
||||
#import <AsyncDisplayKit/ASHashing.h>
|
||||
#import <AsyncDisplayKit/ASHighlightOverlayLayer.h>
|
||||
#import <AsyncDisplayKit/ASImageContainerProtocolCategories.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
|
||||
|
||||
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class ASRangeController;
|
||||
|
||||
@interface ASCollectionView ()
|
||||
- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator owningNode:(nullable ASCollectionNode *)owningNode eventLog:(nullable ASEventLog *)eventLog;
|
||||
- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator owningNode:(nullable ASCollectionNode *)owningNode;
|
||||
|
||||
@property (nonatomic, weak) ASCollectionNode *collectionNode;
|
||||
@property (nonatomic, readonly) ASDataController *dataController;
|
||||
|
||||
@@ -12,19 +12,12 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <AsyncDisplayKit/ASBlockTypes.h>
|
||||
#import <AsyncDisplayKit/ASDimension.h>
|
||||
#import <AsyncDisplayKit/ASEventLog.h>
|
||||
#ifdef __cplusplus
|
||||
#import <vector>
|
||||
#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<ASDataControllerSource>)dataSource node:(nullable id<ASRangeManagingNode>)node eventLog:(nullable ASEventLog *)eventLog NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithDataSource:(id<ASDataControllerSource>)dataSource node:(nullable id<ASRangeManagingNode>)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;
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef void (^ASDataControllerSynchronizationBlock)();
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)initWithDataSource:(id<ASDataControllerSource>)dataSource node:(nullable id<ASRangeManagingNode>)node eventLog:(ASEventLog *)eventLog
|
||||
- (instancetype)initWithDataSource:(id<ASDataControllerSource>)dataSource node:(nullable id<ASRangeManagingNode>)node
|
||||
{
|
||||
if (!(self = [super init])) {
|
||||
return nil;
|
||||
@@ -103,10 +103,6 @@ typedef void (^ASDataControllerSynchronizationBlock)();
|
||||
_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 @@ typedef void (^ASDataControllerSynchronizationBlock)();
|
||||
|
||||
[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.
|
||||
|
||||
@@ -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 <Foundation/Foundation.h>
|
||||
#import <AsyncDisplayKit/ASBaseDefines.h>
|
||||
|
||||
#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<NSString *> *)backtrace format:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3);
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -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 <AsyncDisplayKit/ASEventLog.h>
|
||||
#import <AsyncDisplayKit/ASThread.h>
|
||||
#import <AsyncDisplayKit/ASTraceEvent.h>
|
||||
#import <AsyncDisplayKit/ASObjectDescriptionHelpers.h>
|
||||
|
||||
@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<ASEventLog *, NSMutableArray<ASTraceEvent *> *> *)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<NSString *> *)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<ASTraceEvent *> *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<ASTraceEvent *> *)events
|
||||
{
|
||||
NSMutableArray<ASTraceEvent *> *events = [[ASEventLog contentsCache] objectForKey:self];
|
||||
if (events == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
AS::MutexLocker l(__instanceLock__);
|
||||
NSUInteger tail = (_eventLogHead + 1);
|
||||
NSUInteger count = events.count;
|
||||
|
||||
NSMutableArray<ASTraceEvent *> *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
|
||||
@@ -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 <Foundation/Foundation.h>
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
AS_SUBCLASSING_RESTRICTED
|
||||
@interface ASTraceEvent : NSObject
|
||||
|
||||
/**
|
||||
* This method is dealloc safe.
|
||||
*/
|
||||
- (instancetype)initWithBacktrace:(nullable NSArray<NSString *> *)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<NSString *> *backtrace;
|
||||
@property (nonatomic, readonly) NSString *message;
|
||||
@property (nonatomic, readonly) NSTimeInterval timestamp;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -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 <AsyncDisplayKit/ASTraceEvent.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
static NSString *const ASTraceEventThreadDescriptionKey = @"ASThreadTraceEventDescription";
|
||||
|
||||
@interface ASTraceEvent ()
|
||||
@property (nonatomic, readonly) NSString *objectDescription;
|
||||
@property (nonatomic, readonly) NSString *threadDescription;
|
||||
@end
|
||||
|
||||
@implementation ASTraceEvent
|
||||
|
||||
- (instancetype)initWithBacktrace:(NSArray<NSString *> *)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
|
||||
@@ -207,7 +207,7 @@ static _ASDisplayViewMethodOverrides GetASDisplayViewMethodOverrides(Class c)
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ static _ASDisplayViewMethodOverrides GetASDisplayViewMethodOverrides(Class c)
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,11 +145,6 @@ static constexpr CACornerMask kASCACornerAllCorners =
|
||||
ASDisplayNodeMethodOverrides _methodOverrides;
|
||||
|
||||
UIEdgeInsets _hitTestSlop;
|
||||
|
||||
#if ASEVENTLOG_ENABLE
|
||||
ASEventLog *_eventLog;
|
||||
#endif
|
||||
|
||||
|
||||
// Layout support
|
||||
ASLayoutElementStyle *_style;
|
||||
@@ -310,16 +305,10 @@ 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)_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;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#import <AsyncDisplayKit/NSArray+Diffing.h>
|
||||
|
||||
#import <AsyncDisplayKit/ASLayout.h>
|
||||
#import <AsyncDisplayKit/ASDisplayNodeInternal.h> // Required for _insertSubnode... / _removeFromSupernode.
|
||||
#import <AsyncDisplayKit/ASDisplayNodeInternal.h> // Required for _removeFromSupernodeIfEqualTo:
|
||||
#import <AsyncDisplayKit/ASLog.h>
|
||||
|
||||
#import <queue>
|
||||
@@ -103,7 +103,6 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
||||
return;
|
||||
}
|
||||
|
||||
ASDisplayNodeLogEvent(_node, @"insertSubnodes: %@", _insertedSubnodes);
|
||||
NSUInteger i = 0;
|
||||
NSUInteger j = 0;
|
||||
for (auto const &move : _subnodeMoves) {
|
||||
@@ -114,18 +113,18 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +138,6 @@ static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) {
|
||||
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
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
- (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
|
||||
|
||||
Reference in New Issue
Block a user