-Renamed an internal only method for clarity
-Tweaked WebDataSource for notification purposes with the new expiring icons
-Fixed a bug with the ICONDEBUG flag
* Misc/WebIconDatabase.m:
(-[WebIconDatabase init]):
(-[WebIconDatabase iconForURL:withSize:cache:]): #ifdef bug fixed
(-[WebIconDatabase _hasEntryForIconURL:]): Renamed for clarity
* Misc/WebIconDatabasePrivate.h:
* WebView/WebDataSource.m:
(-[WebDataSource _updateIconDatabaseWithURL:]):
(-[WebDataSource _notifyIconChanged:]):
(-[WebDataSource _loadIcon]):
(-[WebDataSource _iconLoaderReceivedPageIcon:]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15950
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-08-21 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Anders
+
+ -Renamed an internal only method for clarity
+ -Tweaked WebDataSource for notification purposes with the new expiring icons
+ -Fixed a bug with the ICONDEBUG flag
+
+ * Misc/WebIconDatabase.m:
+ (-[WebIconDatabase init]):
+ (-[WebIconDatabase iconForURL:withSize:cache:]): #ifdef bug fixed
+ (-[WebIconDatabase _hasEntryForIconURL:]): Renamed for clarity
+ * Misc/WebIconDatabasePrivate.h:
+ * WebView/WebDataSource.m:
+ (-[WebDataSource _updateIconDatabaseWithURL:]):
+ (-[WebDataSource _notifyIconChanged:]):
+ (-[WebDataSource _loadIcon]):
+ (-[WebDataSource _iconLoaderReceivedPageIcon:]):
+
2006-08-17 Maciej Stachowiak <mjs@apple.com>
Reviewed by Brady.
// FIXME - Once the new iconDB is the only game in town, we need to remove any of the WebFileDatabase code
// that is threaded and expects certain files to exist - certain files we rip right out from underneath it
// in the _convertToWebCoreFormat method
-#ifdef ICONDEBUG
+#ifndef ICONDEBUG
// Retain icons on disk then release them once clean-up has begun.
// This gives the client the opportunity to retain them before they are erased.
[self _retainOriginalIconsOnDisk];
#ifdef ICONDEBUG
NSImage* image = [_private->databaseBridge iconForPageURL:URL withSize:size];
- if (image)
- LOG(IconDatabase, "NewDB has image for %@", URL);
- else
- LOG(IconDatabase, "NewDB has no image for %@", URL);
// FIXME - We currently don't embed the default icon in the new WebCore IconDB, so we'll return the old version of it;
return image ? image : [self defaultIconWithSize:size];
[self _updateFileDatabase];
}
-- (BOOL)_hasIconForIconURL:(NSString *)iconURL;
+- (BOOL)_hasEntryForIconURL:(NSString *)iconURL;
{
ASSERT([self _isEnabled]);
#ifdef ICONDEBUG
- BOOL result = [_private->databaseBridge _hasIconForIconURL:iconURL];
+ BOOL result = [_private->databaseBridge _hasEntryForIconURL:iconURL];
if (result)
LOG(IconDatabase, "NewDB has icon for IconURL %@", iconURL);
else
// 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;
+- (BOOL)_hasEntryForIconURL:(NSString *)iconURL;
- (void)_sendNotificationForURL:(NSString *)URL;
- (void)loadIconFromURL:(NSString *)iconURL;
// Bind the URL of the original request and the final URL to the icon URL.
[iconDB _setIconURL:[iconURL _web_originalDataAsString] forURL:[[self _URL] _web_originalDataAsString]];
- [iconDB _setIconURL:[iconURL _web_originalDataAsString] forURL:[[[self _originalRequest] URL] _web_originalDataAsString]];
-
+ [iconDB _setIconURL:[iconURL _web_originalDataAsString] forURL:[[[self _originalRequest] URL] _web_originalDataAsString]];
+}
+
+- (void)_notifyIconChanged:(NSURL *)iconURL
+{
+ ASSERT([[WebIconDatabase sharedIconDatabase] _isEnabled]);
if ([self webFrame] == [[self _webView] mainFrame])
[[self _webView] _willChangeValueForKey:_WebMainFrameIconKey];
- NSImage *icon = [iconDB iconForURL:[[self _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
+ NSImage *icon = [[WebIconDatabase sharedIconDatabase] iconForURL:[[self _URL] _web_originalDataAsString] withSize:WebIconSmallSize];
+
[[[self _webView] _frameLoadDelegateForwarder] webView:[self _webView]
didReceiveIcon:icon
forFrame:[self webFrame]];
// If we have the icon already, we'll still see if we're manually reloading or if the icon is expired
// If so, kick off a reload of the icon
// If we don't have the icon already, kick off the initial load
- if ([[WebIconDatabase sharedIconDatabase] _hasIconForIconURL:[_private->iconURL _web_originalDataAsString]]) {
+ if ([[WebIconDatabase sharedIconDatabase] _hasEntryForIconURL:[_private->iconURL _web_originalDataAsString]]) {
+ [self _updateIconDatabaseWithURL:_private->iconURL];
if ([[self webFrame] _loadType] == WebFrameLoadTypeReload || [[WebIconDatabase sharedIconDatabase] isIconExpiredForIconURL:[_private->iconURL _web_originalDataAsString]])
[[WebIconDatabase sharedIconDatabase] loadIconFromURL:[_private->iconURL _web_originalDataAsString]];
- [self _updateIconDatabaseWithURL:_private->iconURL];
+ else
+ [self _notifyIconChanged:_private->iconURL];
} else {
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:_private->iconURL];
[[self webFrame] _addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:NO];
- (void)_iconLoaderReceivedPageIcon:(WebIconLoader *)iconLoader
{
[self _updateIconDatabaseWithURL:_private->iconURL];
+ [self _notifyIconChanged:_private->iconURL];
}
- (void)_setIconURL:(NSURL *)URL