Changeset 9156
- Timestamp:
- Sep 21, 2009, 12:55:04 PM (13 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/InfoWindowController.h
r9153 r9156 79 79 80 80 NSCache * fTrackerIconCache; 81 NSMutableSet * fTrackerIconLoad ed;81 NSMutableSet * fTrackerIconLoading; 82 82 83 83 NSString * fInitialString; -
trunk/macosx/InfoWindowController.m
r9154 r9156 196 196 { 197 197 fTrackerIconCache = [[NSCache alloc] init]; 198 fTrackerIconLoad ed= [[NSMutableSet alloc] init];198 fTrackerIconLoading = [[NSMutableSet alloc] init]; 199 199 } 200 200 else … … 239 239 240 240 [fTrackerIconCache release]; 241 [fTrackerIconLoad edrelease];241 [fTrackerIconLoading release]; 242 242 243 243 [fPreviewPanel release]; … … 930 930 931 931 //let's try getting the favicon without using any subdomains 932 NS URL * favIconUrl;932 NSString * baseAddress; 933 933 if ([hostComponents count] > 1) 934 favIconUrl = [NSURL URLWithString: [NSString stringWithFormat: @"%@://%@.%@/favicon.ico", [address scheme],935 [hostComponents objectAtIndex: [hostComponents count] - 2], [hostComponents lastObject]] ];934 baseAddress = [NSString stringWithFormat: @"%@://%@.%@", [address scheme], 935 [hostComponents objectAtIndex: [hostComponents count] - 2], [hostComponents lastObject]]; 936 936 else 937 favIconUrl = [NSURL URLWithString: [NSString stringWithFormat: @"%@://%@/favicon.ico", [address scheme],938 [hostComponents lastObject]]];939 940 NSImage * icon = nil;941 if ([fTrackerIconLoaded containsObject: favIconUrl])942 icon = [fTrackerIconCache objectForKey: favIconUrl];943 else944 [NSThread detachNewThreadSelector: @selector(loadTrackerIcon:) toTarget: self withObject: favIconUrl];945 946 return icon;937 baseAddress = [NSString stringWithFormat: @"%@://%@", [address scheme], [hostComponents lastObject]]; 938 939 id icon = [fTrackerIconCache objectForKey: baseAddress]; 940 if (!icon && ![fTrackerIconLoading containsObject: baseAddress]) 941 { 942 [fTrackerIconLoading addObject: baseAddress]; 943 [NSThread detachNewThreadSelector: @selector(loadTrackerIcon:) toTarget: self withObject: baseAddress]; 944 } 945 946 return (icon && icon != [NSNull null]) ? icon : nil; 947 947 } 948 948 if ([ident isEqualToString: @"Address"]) … … 954 954 } 955 955 956 - (void) loadTrackerIcon: (NS URL *) favIconUrl956 - (void) loadTrackerIcon: (NSString *) baseAddress 957 957 { 958 958 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 959 959 960 [fTrackerIconLoaded addObject: favIconUrl]; 961 960 NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingString: @"/favicon.ico"]]; 962 961 NSImage * icon = [[NSImage alloc] initWithContentsOfURL: favIconUrl]; 963 962 if (icon) 964 963 { 965 [fTrackerIconCache setObject: icon forKey: favIconUrl];964 [fTrackerIconCache setObject: icon forKey: baseAddress]; 966 965 [icon release]; 967 966 } 968 967 else 968 [fTrackerIconCache setObject: [NSNull null] forKey: baseAddress]; 969 970 [fTrackerIconLoading removeObject: baseAddress]; 971 969 972 [pool drain]; 970 973 }
Note: See TracChangeset
for help on using the changeset viewer.