Beter table/collection update history (#2562)

- Introduce thread-safe ASEventLog
- ASCollectionNode and ASTableNode share their event log with their ASDataController. The controller uses it to log change set submitting and finishing events.
- ASCollectionNode and ASTableNode print their data source and delegate in their debug description.
This commit is contained in:
Huy Nguyen
2016-11-09 00:44:49 +00:00
committed by Adlai Holler
parent 06f5754b37
commit fb6d1830a0
22 changed files with 366 additions and 111 deletions

View File

@@ -10,7 +10,7 @@
#import "ASDisplayNode.h"
#import "ASLayoutRangeType.h"
#import "ASTraceEvent.h"
#import "ASEventLog.h"
NS_ASSUME_NONNULL_BEGIN
@@ -19,20 +19,18 @@ void ASPerformBlockOnMainThread(void (^block)());
void ASPerformBlockOnBackgroundThread(void (^block)()); // DISPATCH_QUEUE_PRIORITY_DEFAULT
ASDISPLAYNODE_EXTERN_C_END
#ifndef ASDISPLAYNODE_EVENTLOG_CAPACITY
#define ASDISPLAYNODE_EVENTLOG_CAPACITY 20
#endif
#ifndef ASDISPLAYNODE_EVENTLOG_ENABLE
#define ASDISPLAYNODE_EVENTLOG_ENABLE DEBUG
#endif
#if ASDISPLAYNODE_EVENTLOG_ENABLE
#define ASDisplayNodeLogEvent(node, ...) [node _logEventWithBacktrace:[NSThread callStackSymbols] format:__VA_ARGS__]
#if ASEVENTLOG_ENABLE
#define ASDisplayNodeLogEvent(node, ...) [node.eventLog logEventWithBacktrace:[NSThread callStackSymbols] 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.
*/
@@ -94,6 +92,13 @@ typedef struct {
*/
@property (nonatomic, assign, 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, strong, readonly) ASEventLog *eventLog;
#endif
/**
* @abstract Currently used by ASNetworkImageNode and ASMultiplexImageNode to allow their placeholders to stay if they are loading an image from the network.
* Otherwise, a display pass is scheduled and completes, but does not actually draw anything - and ASDisplayNode considers the element finished.
@@ -118,20 +123,6 @@ typedef struct {
*/
+ (void)setRangeModeForMemoryWarnings:(ASLayoutRangeMode)rangeMode;
#if ASDISPLAYNODE_EVENTLOG_ENABLE
/**
* The primitive event tracing method. You shouldn't call this. Use the ASDisplayNodeLogEvent macro instead.
*/
- (void)_logEventWithBacktrace:(NSArray<NSString *> *)backtrace format:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3);
/**
* @abstract The most recent trace events for this node. Max count is ASDISPLAYNODE_EVENTLOG_CAPACITY.
*/
@property (readonly, copy) NSArray *eventLog;
#endif
@end
NS_ASSUME_NONNULL_END