Changeset 13151


Ignore:
Timestamp:
Jan 9, 2012, 12:57:50 AM (10 years ago)
Author:
livings124
Message:

concurrent enumeration when generating a torrent's file list

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/NSImageAdditions.m

    r13021 r13151  
    3434   
    3535    [color set];
    36     NSRectFillUsingOperation(NSMakeRect(0.0, 0.0, [coloredImage size].width, [coloredImage size].height), NSCompositeSourceAtop);
     36   
     37    const NSSize size = [coloredImage size];
     38    NSRectFillUsingOperation(NSMakeRect(0.0, 0.0, size.width, size.height), NSCompositeSourceAtop);
    3739   
    3840    [coloredImage unlockFocus];
  • trunk/macosx/Torrent.m

    r13070 r13151  
    17621762    if (isFolder)
    17631763    {
    1764         for (node in [parent children])
    1765             if ([[node name] isEqualToString: name] && [node isFolder])
    1766                 break;
     1764        const NSUInteger nodeIndex = [[parent children] indexOfObjectWithOptions: NSEnumerationConcurrent passingTest: ^BOOL(FileListNode * searchNode, NSUInteger idx, BOOL * stop) {
     1765            return [[searchNode name] isEqualToString: name] && [searchNode isFolder];
     1766        }];
     1767        if (nodeIndex != NSNotFound)
     1768            node = [[parent children] objectAtIndex: nodeIndex];
    17671769    }
    17681770   
     
    17971799    [fileNodes sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
    17981800   
    1799     for (FileListNode * node in fileNodes)
     1801    [fileNodes enumerateObjectsWithOptions: NSEnumerationConcurrent usingBlock: ^(FileListNode * node, NSUInteger idx, BOOL * stop) {
    18001802        if ([node isFolder])
    18011803            [self sortFileList: [node children]];
     1804    }];
    18021805}
    18031806
Note: See TracChangeset for help on using the changeset viewer.