[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:32:53 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b0881b5d5f1780a757b21082ef60354eca9ef446
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Apr 1 00:51:32 2003 +0000

            Reviewed by Chris.
    
    	- fixed 3210813 - REGRESSION: full size stock chart on etrade shows up empty after viewing mini stock chart
    
    	I fixed this by adding a "negative cache" of icon URLs that loaded
    	something but failed to yield an icon. This prevents us from
    	asking for the site icon over and over, which was messing up the
    	session cookie.
    
            * Misc.subproj/WebIconDatabase.m:
            (-[WebIconDatabase init]):
            (-[WebIconDatabase iconForURL:withSize:cache:]):
            (-[WebIconDatabase _updateFileDatabase]):
            (-[WebIconDatabase _iconsForIconURLString:]):
            (-[WebIconDatabase _setHaveNoIconForIconURL:]):
            (-[WebIconDatabase _releaseIconForIconURLString:]):
            * Misc.subproj/WebIconDatabasePrivate.h:
            * Misc.subproj/WebIconLoader.h:
            * Misc.subproj/WebIconLoader.m:
            (-[WebIconLoader startLoading]):
            (-[WebIconLoader connectionDidFinishLoading:]):
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _iconLoaderReceivedPageIcon:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3980 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9deae87..fad04eb 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,29 @@
+2003-03-31  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Chris.
+
+	- fixed 3210813 - REGRESSION: full size stock chart on etrade shows up empty after viewing mini stock chart
+
+	I fixed this by adding a "negative cache" of icon URLs that loaded
+	something but failed to yield an icon. This prevents us from
+	asking for the site icon over and over, which was messing up the
+	session cookie.
+	
+        * Misc.subproj/WebIconDatabase.m:
+        (-[WebIconDatabase init]):
+        (-[WebIconDatabase iconForURL:withSize:cache:]):
+        (-[WebIconDatabase _updateFileDatabase]):
+        (-[WebIconDatabase _iconsForIconURLString:]):
+        (-[WebIconDatabase _setHaveNoIconForIconURL:]):
+        (-[WebIconDatabase _releaseIconForIconURLString:]):
+        * Misc.subproj/WebIconDatabasePrivate.h:
+        * Misc.subproj/WebIconLoader.h:
+        * Misc.subproj/WebIconLoader.m:
+        (-[WebIconLoader startLoading]):
+        (-[WebIconLoader connectionDidFinishLoading:]):
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _iconLoaderReceivedPageIcon:]):
+
 2003-03-31  Darin Adler  <darin at apple.com>
 
         * English.lproj/InfoPlist.strings: Changed "1.0 Beta" to "1.0 Beta 2".
diff --git a/WebKit/Misc.subproj/WebIconDatabase.m b/WebKit/Misc.subproj/WebIconDatabase.m
index 2553bfa..3cdb4c8 100644
--- a/WebKit/Misc.subproj/WebIconDatabase.m
+++ b/WebKit/Misc.subproj/WebIconDatabase.m
@@ -83,6 +83,7 @@ NSSize WebIconLargeSize = {128, 128};
 
     _private->iconsToEraseWithURLs = 	[[NSMutableSet set] retain];
     _private->iconsToSaveWithURLs = 	[[NSMutableSet set] retain];
+    _private->iconURLsWithNoIcons = 	[[NSMutableSet set] retain];
     
     [[NSNotificationCenter defaultCenter] addObserver:self
                                              selector:@selector(applicationWillTerminate:)
@@ -118,7 +119,9 @@ NSSize WebIconLargeSize = {128, 128};
 
     NSMutableDictionary *icons = [self _iconsForIconURLString:iconURLString];
     if (!icons) {
-        ERROR("WebIconDatabase said it had %@, but it doesn't.", iconURLString);
+	if (![_private->iconURLsWithNoIcons containsObject:iconURLString]) {
+	    ERROR("WebIconDatabase said it had %@, but it doesn't.", iconURLString);
+	}
         return [self defaultIconWithSize:size];
     }        
 
@@ -322,7 +325,10 @@ NSSize WebIconLargeSize = {128, 128};
                 [fileDB setObject:iconData forKey:iconURLString];
                 [_private->iconsOnDiskWithURLs addObject:iconURLString];
             }
-        }
+        } else if ([_private->iconURLsWithNoIcons containsObject:iconURLString]) {
+	    [fileDB setObject:[NSNull null] forKey:iconURLString];
+	    [_private->iconsOnDiskWithURLs addObject:iconURLString];
+	}
     }
     
     [_private->iconsToEraseWithURLs removeAllObjects];
@@ -337,6 +343,7 @@ NSSize WebIconLargeSize = {128, 128};
 - (BOOL)_hasIconForIconURL:(NSString *)iconURL;
 {
     return (([_private->iconURLToIcons objectForKey:iconURL] ||
+	     [_private->iconURLsWithNoIcons containsObject:iconURL] ||
              [_private->iconsOnDiskWithURLs containsObject:iconURL]) &&
             [_private->iconURLToRetainCount objectForKey:iconURL]);
 }
@@ -344,31 +351,44 @@ NSSize WebIconLargeSize = {128, 128};
 - (NSMutableDictionary *)_iconsForIconURLString:(NSString *)iconURLString
 {
     ASSERT(iconURLString);
+
+    if ([_private->iconURLsWithNoIcons containsObject:iconURLString]) {
+	return nil;
+    }
     
     NSMutableDictionary *icons = [_private->iconURLToIcons objectForKey:iconURLString];
+
+    if (icons) {
+	return icons;
+    }
+	
+    // Not in memory, check disk
+    if(![_private->iconsOnDiskWithURLs containsObject:iconURLString]){
+        return nil;
+    }
+
     
-    if(!icons){
-        // Not in memory, check disk
-        if([_private->iconsOnDiskWithURLs containsObject:iconURLString]){
-            
 #if LOG_ENABLED         
-            double start = CFAbsoluteTimeGetCurrent();
+    double start = CFAbsoluteTimeGetCurrent();
 #endif
-            NSData *iconData = [_private->fileDatabase objectForKey:iconURLString];
-            
-            if(iconData){
-                NSImage *icon = [[NSImage alloc] initWithData:iconData];
-                icons = [self _iconsBySplittingRepresentationsOfIcon:icon];
+    NSData *iconData = [_private->fileDatabase objectForKey:iconURLString];
 
-                if(icons){
+    if ([iconData isKindOfClass:[NSNull class]]) {
+	[_private->iconURLsWithNoIcons addObject:iconURLString];
+	return nil;
+    }
+    
+    if (iconData) {
+	NSImage *icon = [[NSImage alloc] initWithData:iconData];
+	icons = [self _iconsBySplittingRepresentationsOfIcon:icon];
+	
+	if(icons){
 #if LOG_ENABLED 
-                    double duration = CFAbsoluteTimeGetCurrent() - start;
-                    LOG(Timing, "loading and creating icon %@ took %f seconds", iconURLString, duration);
+	    double duration = CFAbsoluteTimeGetCurrent() - start;
+	    LOG(Timing, "loading and creating icon %@ took %f seconds", iconURLString, duration);
 #endif
-                    [_private->iconURLToIcons setObject:icons forKey:iconURLString];
-                }
-            }
-        }
+	    [_private->iconURLToIcons setObject:icons forKey:iconURLString];
+	}
     }
     
     return icons;
@@ -425,6 +445,21 @@ NSSize WebIconLargeSize = {128, 128};
     [self performSelector:@selector(_releaseIconForIconURLString:) withObject:iconURL afterDelay:0];
 }
 
+- (void)_setHaveNoIconForIconURL:(NSString *)iconURL
+{
+    ASSERT(iconURL);
+
+    [_private->iconURLsWithNoIcons addObject:iconURL];
+
+    [self _retainIconForIconURLString:iconURL];
+    
+    // Release the newly created icon much like an autorelease.
+    // This gives the client enough time to retain it.
+    // FIXME: Should use an actual autorelease here using a proxy object instead.
+    [self performSelector:@selector(_releaseIconForIconURLString:) withObject:iconURL afterDelay:0];
+}
+
+
 - (void)_setIconURL:(NSString *)iconURL forURL:(NSString *)URL
 {
     ASSERT(iconURL);
@@ -504,7 +539,10 @@ NSSize WebIconLargeSize = {128, 128};
 
         // Remove the icon's images
         [_private->iconURLToIcons removeObjectForKey:iconURLString];
-        
+
+        // Remove negative cache item for icon, if any
+	[_private->iconURLsWithNoIcons removeObject:iconURLString];
+
         // Remove the icon's retain count
         [_private->iconURLToRetainCount removeObjectForKey:iconURLString];
 
diff --git a/WebKit/Misc.subproj/WebIconDatabasePrivate.h b/WebKit/Misc.subproj/WebIconDatabasePrivate.h
index acc590f..90525d9 100644
--- a/WebKit/Misc.subproj/WebIconDatabasePrivate.h
+++ b/WebKit/Misc.subproj/WebIconDatabasePrivate.h
@@ -25,6 +25,7 @@
     NSMutableSet *iconsOnDiskWithURLs;
     NSMutableSet *iconsToEraseWithURLs;
     NSMutableSet *iconsToSaveWithURLs;
+    NSMutableSet *iconURLsWithNoIcons;
     
     int cleanupCount;
 
@@ -41,10 +42,11 @@
 
 // Called by WebIconLoader after loading an icon.
 - (void)_setIcon:(NSImage *)icon forIconURL:(NSString *)iconURL;
+- (void)_setHaveNoIconForIconURL:(NSString *)iconURL;
 
 // Called by WebDataSource to bind a web site URL to a icon URL and icon image.
 - (void)_setIconURL:(NSString *)iconURL forURL:(NSString *)URL;
 
 - (BOOL)_hasIconForIconURL:(NSString *)iconURL;
 
- at end
\ No newline at end of file
+ at end
diff --git a/WebKit/Misc.subproj/WebIconLoader.h b/WebKit/Misc.subproj/WebIconLoader.h
index 9c7964f..154e84f 100644
--- a/WebKit/Misc.subproj/WebIconLoader.h
+++ b/WebKit/Misc.subproj/WebIconLoader.h
@@ -58,5 +58,5 @@
 @end
 
 @interface NSObject(WebIconLoaderDelegate)
-- (void)iconLoader:(WebIconLoader *)iconLoader receivedPageIcon:(NSImage *)image;
- at end;
\ No newline at end of file
+- (void)_iconLoaderReceivedPageIcon:(WebIconLoader *)iconLoader;
+ at end;
diff --git a/WebKit/Misc.subproj/WebIconLoader.m b/WebKit/Misc.subproj/WebIconLoader.m
index 55a73fd..29e9d91 100644
--- a/WebKit/Misc.subproj/WebIconLoader.m
+++ b/WebKit/Misc.subproj/WebIconLoader.m
@@ -86,7 +86,6 @@
     }
     
     NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:_private->URL];
-    [request HTTPSetPageNotFoundCacheLifetime:WebIconLoaderWeeksWorthOfSeconds];
     _private->handle = [[NSURLConnection alloc] initWithRequest:request];
     [_private->handle loadWithDelegate:self];
     [request release];
@@ -104,9 +103,11 @@
     NSImage *icon = [[NSImage alloc] initWithData:_private->resourceData];
     if (icon) {
         [[WebIconDatabase sharedIconDatabase] _setIcon:icon forIconURL:[_private->URL absoluteString]];
-        [_private->delegate iconLoader:self receivedPageIcon:icon];
-        [icon release];
+    } else {
+	[[WebIconDatabase sharedIconDatabase] _setHaveNoIconForIconURL:[_private->URL absoluteString]];
     }
+    [_private->delegate _iconLoaderReceivedPageIcon:self];
+    [icon release];
 }
 
 - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index a3822dd..d2ef348 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -570,7 +570,7 @@
     [[_private->controller _locationChangeDelegateForwarder] webView: _private->controller receivedPageIcon:icon forDataSource:self];
 }
 
-- (void)iconLoader:(WebIconLoader *)iconLoader receivedPageIcon:(NSImage *)icon;
+- (void)_iconLoaderReceivedPageIcon:(WebIconLoader *)iconLoader
 {
     [self _updateIconDatabaseWithURL:[iconLoader URL]];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list