adium 3133:d1c1aaf94dfb: This was still getting called on the ma...
commits at adium.im
commits at adium.im
Thu Feb 18 13:01:37 UTC 2010
details: http://hg.adium.im/adium/rev/d1c1aaf94dfb
revision: 3133:d1c1aaf94dfb
author: Stephen Holt <sholt at adium.im>
date: Thu Feb 18 07:57:17 2010 -0500
This was still getting called on the main thread. D'OH!
Though, building the string for the log viewer to display in AILogViewerWindowController can still take a long time and potentially block UI (ex: long twitter timelines, IRC logs, multiple logs at once). Revisit that.
diffs (52 lines):
diff -r 8eb163d36221 -r d1c1aaf94dfb Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m Thu Feb 18 01:11:10 2010 -0500
+++ b/Source/AILoggerPlugin.m Thu Feb 18 07:57:17 2010 -0500
@@ -448,9 +448,11 @@
*/
- (void)showLogViewerAndReindex:(id)sender
{
- [self dirtyAllLogs];
-
[AILogViewerWindowController openForContact:nil plugin:self];
+ [[[self class] operationQueue] addOperation:
+ [[NSInvocationOperation alloc] initWithTarget:self
+ selector:@selector(dirtyAllLogs)
+ object:nil]];
}
/*!
@@ -1104,12 +1106,9 @@
}
//Load the contentIndex immediately; this will clear dirtyLogSet if necessary
- [[[self class] operationQueue] addOperation:
- [[NSInvocationOperation alloc] initWithTarget:self
- selector:@selector(logContentIndex)
- object:nil]];
- [[[self class] operationQueue] waitUntilAllOperationsAreFinished];
-
+ NSInvocationOperation *indexOp = [[NSInvocationOperation alloc] initWithTarget:self
+ selector:@selector(logContentIndex)
+ object:nil];
indexingAllowed = YES;
NSInvocationOperation *op;
if (reindex) {
@@ -1121,6 +1120,8 @@
selector:@selector(cleanDirtyLogs)
object:nil];
}
+ [op addDependency:indexOp];
+ [[[self class] operationQueue] addOperation:indexOp];
[[[self class] operationQueue] addOperation:op];
}
@@ -1241,7 +1242,9 @@
AILogWithSignature(@"Created a new log index %x at %@ with textAnalysisProperties %@. Will reindex all logs.",newIndex,logIndexPathURL,textAnalysisProperties);
//Clear the dirty log set in case it was loaded (this can happen if the user mucks with the cache directory)
[[NSFileManager defaultManager] removeItemAtPath:[self _dirtyLogSetPath] error:NULL];
+ [dirtyLogLock lock];
[dirtyLogSet removeAllObjects];
+ [dirtyLogLock unlock];
} else {
AILogWithSignature(@"AILoggerPlugin warning: SKIndexCreateWithURL() returned NULL");
}
More information about the commits
mailing list