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

@@ -47,7 +47,7 @@
[_changeSet addCompletionHandler:completion];
if (_changeSetBatchUpdateCounter == 0) {
void (^batchCompletion)(BOOL finished) = _changeSet.completionHandler;
void (^batchCompletion)(BOOL) = _changeSet.completionHandler;
/**
* If the initial reloadData has not been called, just bail because we don't have
@@ -66,6 +66,8 @@
[self invalidateDataSourceItemCounts];
[_changeSet markCompletedWithNewItemCounts:[self itemCountsFromDataSource]];
ASDataControllerLogEvent(self, @"triggeredUpdate: %@", _changeSet);
[super beginUpdates];
for (_ASHierarchyItemChange *change in [_changeSet itemChangesOfType:_ASHierarchyChangeTypeDelete]) {
@@ -84,6 +86,16 @@
[super insertRowsAtIndexPaths:change.indexPaths withAnimationOptions:change.animationOptions];
}
#if ASEVENTLOG_ENABLE
NSString *changeSetDescription = ASObjectDescriptionMakeTiny(_changeSet);
batchCompletion = ^(BOOL finished) {
if (batchCompletion != nil) {
batchCompletion(finished);
}
ASDataControllerLogEvent(self, @"finishedUpdate: %@", changeSetDescription);
};
#endif
[super endUpdatesAnimated:animated completion:batchCompletion];
_changeSet = nil;