From cd9d469eda44479fb22d09b0da8627efaf019969 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sun, 28 Mar 2010 17:15:23 -0600 Subject: [PATCH] Use NSOperation's maxConcurrentOperationCount --- PBGitHistoryList.h | 1 - PBGitHistoryList.m | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/PBGitHistoryList.h b/PBGitHistoryList.h index c3e3a0b..4cf55e0 100644 --- a/PBGitHistoryList.h +++ b/PBGitHistoryList.h @@ -31,7 +31,6 @@ PBGitHistoryGrapher *grapher; NSOperationQueue *graphQueue; - NSInvocationOperation *lastOperation; NSMutableArray *commits; BOOL isUpdating; diff --git a/PBGitHistoryList.m b/PBGitHistoryList.m index 17140f5..584dbe1 100644 --- a/PBGitHistoryList.m +++ b/PBGitHistoryList.m @@ -131,8 +131,8 @@ if (graphQueue) [graphQueue removeObserver:self forKeyPath:@"operations"]; graphQueue = [[NSOperationQueue alloc] init]; + [graphQueue setMaxConcurrentOperationCount:1]; [graphQueue addObserver:self forKeyPath:@"operations" options:0 context:@"operations"]; - lastOperation = nil; grapher = [self grapher]; } @@ -140,12 +140,7 @@ - (NSInvocationOperation *) operationForCommits:(NSArray *)newCommits { - NSInvocationOperation *graphOperation = [[NSInvocationOperation alloc] initWithTarget:grapher selector:@selector(graphCommits:) object:newCommits]; - if (lastOperation) - [graphOperation addDependency:lastOperation]; - lastOperation = graphOperation; - - return graphOperation; + return [[NSInvocationOperation alloc] initWithTarget:grapher selector:@selector(graphCommits:) object:newCommits]; }