Permalink
Browse files

Remove debug code for #2163

Issue last seen with NB 4644 on 2016-01-21. Seems to be fixed.
  • Loading branch information...
dmoagx committed Jul 9, 2016
1 parent bfc53dc commit 33f6a7afddd8e17edca1559c0aa120f30e216c2f
Showing with 0 additions and 57 deletions.
  1. +0 −3 Source/SPDataStorage.h
  2. +0 −54 Source/SPDataStorage.m
@@ -47,9 +47,6 @@
NSUInteger numberOfColumns;
NSUInteger editedRowCount;
NSString *_debugInfo;
uint64_t _debugTime;
}
/* Setting result store */
@@ -37,13 +37,9 @@
@interface SPDataStorage (Private_API)
- (void) _checkNewRow:(NSMutableArray *)aRow;
- (void)_recordClearingUnloadedColumnsAt:(uint64_t)now from:(NSArray *)callStack;
- (void)_assesUnloadedColumnsIsSet;
@end
static uint64_t _elapsedMilliSecondsSinceAbsoluteTime(uint64_t comparisonTime);
@implementation SPDataStorage
static inline NSMutableArray* SPDataStorageGetEditedRow(NSPointerArray* rowStore, NSUInteger rowIndex)
@@ -129,7 +125,6 @@ - (NSMutableArray *) rowContentsAtIndex:(NSUInteger)anIndex
NSMutableArray *dataArray = SPMySQLResultStoreGetRow(dataStorage, anIndex);
// Modify unloaded cells as appropriate
[self _assesUnloadedColumnsIsSet];
for (NSUInteger i = 0; i < numberOfColumns; i++) {
if (unloadedColumns[i]) {
CFArraySetValueAtIndex((CFMutableArrayRef)dataArray, i, notLoaded);
@@ -162,7 +157,6 @@ - (id) cellDataAtRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex
}
// If the specified column is not loaded, return a SPNotLoaded reference
[self _assesUnloadedColumnsIsSet];
if (unloadedColumns[columnIndex]) {
return notLoaded;
}
@@ -199,7 +193,6 @@ - (id) cellPreviewAtRow:(NSUInteger)rowIndex column:(NSUInteger)columnIndex prev
}
// If the specified column is not loaded, return a SPNotLoaded reference
[self _assesUnloadedColumnsIsSet];
if (unloadedColumns[columnIndex]) {
return notLoaded;
}
@@ -229,8 +222,6 @@ - (BOOL) cellIsNullOrUnloadedAtRow:(NSUInteger)rowIndex column:(NSUInteger)colum
[NSException raise:NSRangeException format:@"Requested storage column (col %llu) beyond bounds (%llu)", (unsigned long long)columnIndex, (unsigned long long)numberOfColumns];
}
[self _assesUnloadedColumnsIsSet];
if (unloadedColumns[columnIndex]) {
return YES;
}
@@ -268,7 +259,6 @@ - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state object
targetRow = SPMySQLResultStoreGetRow(dataStorage, state->state);
// Modify unloaded cells as appropriate
[self _assesUnloadedColumnsIsSet];
for (NSUInteger i = 0; i < numberOfColumns; i++) {
if (unloadedColumns[i]) {
CFArraySetValueAtIndex((CFMutableArrayRef)targetRow, i, notLoaded);
@@ -442,7 +432,6 @@ - (void) setColumnAsUnloaded:(NSUInteger)columnIndex
if (columnIndex >= numberOfColumns) {
[NSException raise:NSRangeException format:@"Invalid column set as unloaded; requested column index (%llu) beyond bounds (%llu)", (unsigned long long)columnIndex, (unsigned long long)numberOfColumns];
}
[self _assesUnloadedColumnsIsSet];
unloadedColumns[columnIndex] = YES;
}
}
@@ -506,9 +495,6 @@ - (id) init
numberOfColumns = 0;
editedRowCount = 0;
_debugInfo = nil;
_debugTime = mach_absolute_time();
}
return self;
}
@@ -519,16 +505,9 @@ - (void) dealloc
SPClear(dataStorage);
SPClear(editedRows);
if (unloadedColumns) {
[self _recordClearingUnloadedColumnsAt:mach_absolute_time() from:[NSThread callStackSymbols]];
free(unloadedColumns), unloadedColumns = NULL;
}
}
// this is very very unlikely, but if another thread had been waiting on the lock
// right before we free'd unloadedColumns, it should get it before we can release
// _debugInfo, too.
@synchronized(self) {
SPClear(_debugInfo);
}
[super dealloc];
}
@@ -545,37 +524,4 @@ - (void) _checkNewRow:(NSMutableArray *)aRow
}
}
// DO NOT CALL THIS METHOD UNLESS YOU CURRENTLY HAVE A LOCK ON SELF!!!
- (void)_recordClearingUnloadedColumnsAt:(uint64_t)now from:(NSArray *)callStack
{
_debugTime = now;
SPClear(_debugInfo);
_debugInfo = [[NSString alloc] initWithFormat:@"Thread: %@, Stack: %@",[NSThread currentThread],callStack];
}
// DO NOT CALL THIS METHOD UNLESS YOU CURRENTLY HAVE A LOCK ON SELF!!!
- (void)_assesUnloadedColumnsIsSet
{
if(unloadedColumns != NULL)
return;
uint64_t timeDiff = _elapsedMilliSecondsSinceAbsoluteTime(_debugTime);
NSString *msg;
if(!_debugInfo)
msg = [NSString stringWithFormat:@"unloadedColumns is not set and never has been since the object was created %llums ago.",timeDiff];
else
msg = [NSString stringWithFormat:@"unloadedColumns was last cleared %llums ago at %@",timeDiff,_debugInfo];
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:msg userInfo:nil];
}
@end
static uint64_t _elapsedMilliSecondsSinceAbsoluteTime(uint64_t comparisonTime)
{
uint64_t elapsedTime_t = mach_absolute_time() - comparisonTime;
Nanoseconds elapsedTime = AbsoluteToNanoseconds(*(AbsoluteTime *)&(elapsedTime_t));
return (UnsignedWideToUInt64(elapsedTime) / 1000000ULL);
}

0 comments on commit 33f6a7a

Please sign in to comment.