Beef up the logging

This commit is contained in:
Adlai Holler
2017-12-01 14:27:15 +00:00
committed by Huy Nguyen
parent 0c6cbafd1d
commit e312125eb4
5 changed files with 31 additions and 1 deletions
+1
View File
@@ -85,6 +85,7 @@
layout = [self calculateLayoutThatFits:constrainedSize
restrictedToSize:self.style.size
relativeToParentSize:parentSize];
as_log_verbose(ASLayoutLog(), "Established pending layout for %@ in %s", self, sel_getName(_cmd));
_pendingDisplayNodeLayout = std::make_shared<ASDisplayNodeLayout>(layout, constrainedSize, parentSize, version);
ASDisplayNodeAssertNotNil(layout, @"-[ASDisplayNode layoutThatFits:parentSize:] newly calculated layout should not be nil! %@", self);
}
+2 -1
View File
@@ -2762,7 +2762,8 @@ ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) {
}
}
ASDisplayNodeLogEvent(self, @"setHierarchyState: oldState = %@, newState = %@", NSStringFromASHierarchyState(oldState), NSStringFromASHierarchyState(newState));
ASDisplayNodeLogEvent(self, @"setHierarchyState: %@", NSStringFromASHierarchyStateChange(oldState, newState));
as_log_verbose(ASNodeLog(), "%s%@ %@", sel_getName(_cmd), NSStringFromASHierarchyStateChange(oldState, newState), self);
}
- (void)willEnterHierarchy
+2
View File
@@ -25,6 +25,7 @@
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
#import <AsyncDisplayKit/ASObjectDescriptionHelpers.h>
#import <AsyncDisplayKit/ASLog.h>
@implementation _ASDisplayLayer
{
@@ -93,6 +94,7 @@
- (void)setNeedsLayout
{
ASDisplayNodeAssertMainThread();
as_log_verbose(ASNodeLog(), "%s on %@", sel_getName(_cmd), self);
[super setNeedsLayout];
}
#endif
@@ -99,6 +99,29 @@ __unused static NSString * _Nonnull NSStringFromASHierarchyState(ASHierarchyStat
return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]];
}
#define HIERARCHY_STATE_DELTA(Name) ({ \
if ((oldState & ASHierarchyState##Name) != (newState & ASHierarchyState##Name)) { \
[changes appendFormat:@"%c%s ", (newState & ASHierarchyState##Name ? '+' : '-'), #Name]; \
} \
})
__unused static NSString * _Nonnull NSStringFromASHierarchyStateChange(ASHierarchyState oldState, ASHierarchyState newState)
{
if (oldState == newState) {
return @"{ }";
}
NSMutableString *changes = [NSMutableString stringWithString:@"{ "];
HIERARCHY_STATE_DELTA(Rasterized);
HIERARCHY_STATE_DELTA(RangeManaged);
HIERARCHY_STATE_DELTA(TransitioningSupernodes);
HIERARCHY_STATE_DELTA(LayoutPending);
[changes appendString:@"}"];
return changes;
}
#undef HIERARCHY_STATE_DELTA
@interface ASDisplayNode () <ASDescriptionProvider, ASDebugDescriptionProvider>
{
@protected
+3
View File
@@ -248,9 +248,11 @@
// Injected block will get run on main after bg layout calculate starts, but before measurementCompletion
__block BOOL injectedMainThreadWorkDone = NO;
injectedMainThreadWork = ^{
as_log_verbose(OS_LOG_DEFAULT, "Begin injectedMainThreadWork");
injectedMainThreadWorkDone = YES;
[fixture4 apply];
as_log_verbose(OS_LOG_DEFAULT, "Did apply new fixture");
if (enforceCorrectBehavior) {
// Correct measurement behavior here is unclear, may depend on whether the layouts which
@@ -261,6 +263,7 @@
OCMExpect([nodeC.mock calculateLayoutThatFits:ASSizeRangeMake(cPendingSize)]).onMainThread();
}
[window layoutIfNeeded];
as_log_verbose(OS_LOG_DEFAULT, "End injectedMainThreadWork");
};
measurementCompletionBlock = ^{