Global IconDatabase should be returned by reference, not as a pointer
Reviewed by Darin Adler.
../WebCore:
* history/HistoryItem.cpp:
(WebCore::HistoryItem::HistoryItem):
(WebCore::HistoryItem::~HistoryItem):
(WebCore::HistoryItem::reset):
(WebCore::HistoryItem::icon):
(WebCore::HistoryItem::setURLString):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::startIconLoader):
(WebCore::FrameLoader::commitIconURLToIconDatabase):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* loader/icon/IconDatabase.cpp:
(WebCore::iconDatabase):
* loader/icon/IconDatabase.h:
* loader/icon/IconDatabaseNone.cpp:
(WebCore::iconDatabase):
* loader/icon/wince/IconDatabaseWinCE.cpp:
(WebCore::iconDatabase):
* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::finishLoading):
../WebKit/efl:
* ewk/ewk_settings.cpp:
(ewk_settings_icon_database_path_set):
(ewk_settings_icon_database_path_get):
(ewk_settings_icon_database_clear):
(ewk_settings_icon_database_icon_surface_get):
(ewk_settings_icon_database_icon_object_add):
../WebKit/gtk:
* webkit/webkitglobals.cpp:
(closeIconDatabaseOnExit):
(WebKit::setIconDatabaseEnabled):
* webkit/webkitwebview.cpp:
(webkit_web_view_get_icon_uri):
../WebKit/mac:
* Misc/WebCoreStatistics.mm:
(+[WebCoreStatistics iconPageURLMappingCount]):
(+[WebCoreStatistics iconRetainedPageURLCount]):
(+[WebCoreStatistics iconRecordCount]):
(+[WebCoreStatistics iconsWithDataCount]):
* Misc/WebIconDatabase.mm:
(-[WebIconDatabase init]):
(-[WebIconDatabase iconForURL:withSize:cache:]):
(-[WebIconDatabase iconURLForURL:]):
(-[WebIconDatabase defaultIconWithSize:]):
(-[WebIconDatabase retainIconForURL:]):
(-[WebIconDatabase releaseIconForURL:]):
(-[WebIconDatabase isEnabled]):
(-[WebIconDatabase setEnabled:]):
(-[WebIconDatabase removeAllIcons]):
(+[WebIconDatabase _checkIntegrityBeforeOpening]):
(-[WebIconDatabase _startUpIconDatabase]):
(-[WebIconDatabase _applicationWillTerminate:]):
(-[WebIconDatabase _resetCachedWebPreferences:]):
(importToWebCoreFormat):
* WebView/WebView.mm:
(-[WebView _dispatchDidReceiveIconFromWebFrame:]):
../WebKit/qt:
* Api/qwebsettings.cpp:
(QWebSettings::setIconDatabasePath):
(QWebSettings::iconDatabasePath):
(QWebSettings::clearIconDatabase):
(QWebSettings::iconForUrl):
../WebKit/win:
* WebCoreStatistics.cpp:
(WebCoreStatistics::iconPageURLMappingCount):
(WebCoreStatistics::iconRetainedPageURLCount):
(WebCoreStatistics::iconRecordCount):
(WebCoreStatistics::iconsWithDataCount):
* WebIconDatabase.cpp:
(WebIconDatabase::init):
(WebIconDatabase::startUpIconDatabase):
(WebIconDatabase::iconForURL):
(WebIconDatabase::retainIconForURL):
(WebIconDatabase::releaseIconForURL):
(WebIconDatabase::removeAllIcons):
(WebIconDatabase::iconURLForURL):
(WebIconDatabase::isEnabled):
(WebIconDatabase::setEnabled):
(WebIconDatabase::hasIconForURL):
(WebIconDatabase::getOrCreateDefaultIconBitmap):
* WebKitDLL.cpp:
(shutDownWebKit):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80299
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-03-03 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55721
+ Global IconDatabase should be returned by reference, not as a pointer
+
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::HistoryItem):
+ (WebCore::HistoryItem::~HistoryItem):
+ (WebCore::HistoryItem::reset):
+ (WebCore::HistoryItem::icon):
+ (WebCore::HistoryItem::setURLString):
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::startIconLoader):
+ (WebCore::FrameLoader::commitIconURLToIconDatabase):
+
+ * loader/archive/cf/LegacyWebArchive.cpp:
+ (WebCore::LegacyWebArchive::create):
+
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::iconDatabase):
+ * loader/icon/IconDatabase.h:
+ * loader/icon/IconDatabaseNone.cpp:
+ (WebCore::iconDatabase):
+ * loader/icon/wince/IconDatabaseWinCE.cpp:
+ (WebCore::iconDatabase):
+
+ * loader/icon/IconLoader.cpp:
+ (WebCore::IconLoader::finishLoading):
+
2011-03-03 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Martin Robinson.
, m_next(0)
, m_prev(0)
{
- iconDatabase()->retainIconForPageURL(m_urlString);
+ iconDatabase().retainIconForPageURL(m_urlString);
}
HistoryItem::HistoryItem(const String& urlString, const String& title, const String& alternateTitle, double time)
, m_next(0)
, m_prev(0)
{
- iconDatabase()->retainIconForPageURL(m_urlString);
+ iconDatabase().retainIconForPageURL(m_urlString);
}
HistoryItem::HistoryItem(const KURL& url, const String& target, const String& parent, const String& title)
, m_next(0)
, m_prev(0)
{
- iconDatabase()->retainIconForPageURL(m_urlString);
+ iconDatabase().retainIconForPageURL(m_urlString);
}
HistoryItem::~HistoryItem()
{
ASSERT(!m_cachedPage);
- iconDatabase()->releaseIconForPageURL(m_urlString);
+ iconDatabase().releaseIconForPageURL(m_urlString);
#if PLATFORM(ANDROID)
if (m_bridge)
m_bridge->detachHistoryItem();
void HistoryItem::reset()
{
- iconDatabase()->releaseIconForPageURL(m_urlString);
+ iconDatabase().releaseIconForPageURL(m_urlString);
m_urlString = String();
m_originalURLString = String();
Image* HistoryItem::icon() const
{
- Image* result = iconDatabase()->iconForPageURL(m_urlString, IntSize(16, 16));
- return result ? result : iconDatabase()->defaultIcon(IntSize(16, 16));
+ Image* result = iconDatabase().iconForPageURL(m_urlString, IntSize(16, 16));
+ return result ? result : iconDatabase().defaultIcon(IntSize(16, 16));
}
double HistoryItem::lastVisitedTime() const
void HistoryItem::setURLString(const String& urlString)
{
if (m_urlString != urlString) {
- iconDatabase()->releaseIconForPageURL(m_urlString);
+ iconDatabase().releaseIconForPageURL(m_urlString);
m_urlString = urlString;
- iconDatabase()->retainIconForPageURL(m_urlString);
+ iconDatabase().retainIconForPageURL(m_urlString);
}
notifyHistoryItemChanged(this);
if (!isLoadingMainFrame())
return;
- if (!iconDatabase() || !iconDatabase()->isEnabled())
+ if (!iconDatabase().isEnabled())
return;
KURL url(iconURL());
// If we're not reloading and the icon database doesn't say to load now then bail before we actually start the load
if (loadType() != FrameLoadTypeReload && loadType() != FrameLoadTypeReloadFromOrigin) {
- IconLoadDecision decision = iconDatabase()->loadDecisionForIconURL(urlString, m_documentLoader.get());
+ IconLoadDecision decision = iconDatabase().loadDecisionForIconURL(urlString, m_documentLoader.get());
if (decision == IconLoadNo) {
LOG(IconDatabase, "FrameLoader::startIconLoader() - Told not to load this icon, committing iconURL %s to database for pageURL mapping", urlString.ascii().data());
commitIconURLToIconDatabase(url);
// If the icon data hasn't been read in from disk yet, kick off the read of the icon from the database to make sure someone
// has done it. This is after registering for the notification so the WebView can call the appropriate delegate method.
// Otherwise if the icon data *is* available, notify the delegate
- if (!iconDatabase()->iconDataKnownForIconURL(urlString)) {
+ if (!iconDatabase().iconDataKnownForIconURL(urlString)) {
LOG(IconDatabase, "Told not to load icon %s but icon data is not yet available - registering for notification and requesting load from disk", urlString.ascii().data());
m_client->registerForIconNotification();
- iconDatabase()->iconForPageURL(m_frame->document()->url().string(), IntSize(0, 0));
- iconDatabase()->iconForPageURL(originalRequestURL().string(), IntSize(0, 0));
+ iconDatabase().iconForPageURL(m_frame->document()->url().string(), IntSize(0, 0));
+ iconDatabase().iconForPageURL(originalRequestURL().string(), IntSize(0, 0));
} else
m_client->dispatchDidReceiveIcon();
void FrameLoader::commitIconURLToIconDatabase(const KURL& icon)
{
- ASSERT(iconDatabase());
LOG(IconDatabase, "Committing iconURL %s to database for pageURLs %s and %s", icon.string().ascii().data(), m_frame->document()->url().string().ascii().data(), originalRequestURL().string().ascii().data());
- iconDatabase()->setIconURLForPageURL(icon.string(), m_frame->document()->url().string());
- iconDatabase()->setIconURLForPageURL(icon.string(), originalRequestURL().string());
+ iconDatabase().setIconURLForPageURL(icon.string(), m_frame->document()->url().string());
+ iconDatabase().setIconURLForPageURL(icon.string(), originalRequestURL().string());
}
void FrameLoader::finishedParsing()
}
// Add favicon if one exists for this page, if we are archiving the entire page.
- if (nodesSize && nodes[0]->isDocumentNode() && iconDatabase() && iconDatabase()->isEnabled()) {
- const String& iconURL = iconDatabase()->iconURLForPageURL(responseURL);
- if (!iconURL.isEmpty() && iconDatabase()->iconDataKnownForIconURL(iconURL)) {
- if (Image* iconImage = iconDatabase()->iconForPageURL(responseURL, IntSize(16, 16))) {
+ if (nodesSize && nodes[0]->isDocumentNode() && iconDatabase().isEnabled()) {
+ const String& iconURL = iconDatabase().iconURLForPageURL(responseURL);
+ if (!iconURL.isEmpty() && iconDatabase().iconDataKnownForIconURL(iconURL)) {
+ if (Image* iconImage = iconDatabase().iconForPageURL(responseURL, IntSize(16, 16))) {
if (RefPtr<ArchiveResource> resource = ArchiveResource::create(iconImage->data(), KURL(ParsedURLString, iconURL), "image/x-icon", "", ""))
subresources.append(resource.release());
}
return defaultClient;
}
-IconDatabase* iconDatabase()
+IconDatabase& iconDatabase()
{
if (!sharedIconDatabase) {
ScriptController::initializeThreading();
sharedIconDatabase = new IconDatabase;
}
- return sharedIconDatabase;
+ return *sharedIconDatabase;
}
// ************************
private:
IconDatabase();
~IconDatabase();
- friend IconDatabase* iconDatabase();
+ friend IconDatabase& iconDatabase();
#if ENABLE(ICONDATABASE)
static void notifyPendingLoadDecisionsOnMainThread(void*);
};
// Function to obtain the global icon database.
-IconDatabase* iconDatabase();
+IconDatabase& iconDatabase();
} // namespace WebCore
return defaultDatabaseFilename.threadsafeCopy();
}
-IconDatabase* iconDatabase()
+IconDatabase& iconDatabase()
{
if (!sharedIconDatabase)
sharedIconDatabase = new IconDatabase;
- return sharedIconDatabase;
+ return *sharedIconDatabase;
}
IconDatabase::IconDatabase()
// Setting the icon data only after committing to the database ensures that the data is
// kept in memory (so it does not have to be read from the database asynchronously), since
// there is a page URL referencing it.
- iconDatabase()->setIconDataForIconURL(data, iconURL.string());
+ iconDatabase().setIconDataForIconURL(data, iconURL.string());
m_frame->loader()->client()->dispatchDidReceiveIcon();
}
namespace WebCore {
+static IconDatabase* sharedIconDatabase = 0;
+
// Function to obtain the global icon database.
-IconDatabase* iconDatabase() { return 0; }
+IconDatabase& iconDatabase()
+{
+ if (!sharedIconDatabase)
+ sharedIconDatabase = new IconDatabase;
+ return *sharedIconDatabase;
+}
IconDatabase::IconDatabase() {}
IconDatabase::~IconDatabase() {}
+2011-03-03 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55721
+ Global IconDatabase should be returned by reference, not as a pointer
+
+ * ewk/ewk_settings.cpp:
+ (ewk_settings_icon_database_path_set):
+ (ewk_settings_icon_database_path_get):
+ (ewk_settings_icon_database_clear):
+ (ewk_settings_icon_database_icon_surface_get):
+ (ewk_settings_icon_database_icon_object_add):
+
2011-03-03 Alexey Proskuryakov <ap@apple.com>
Removing an include of WebCoreKeyboardUIMode.h that Ive just added. It's already included
*/
Eina_Bool ewk_settings_icon_database_path_set(const char *directory)
{
- WebCore::iconDatabase()->delayDatabaseCleanup();
+ WebCore::iconDatabase().delayDatabaseCleanup();
if (directory) {
struct stat st;
return EINA_FALSE;
}
- WebCore::iconDatabase()->setEnabled(true);
- WebCore::iconDatabase()->open(WTF::String::fromUTF8(directory));
+ WebCore::iconDatabase().setEnabled(true);
+ WebCore::iconDatabase().open(WTF::String::fromUTF8(directory));
if (!_ewk_icon_database_path)
_ewk_icon_database_path = eina_stringshare_add(directory);
else
eina_stringshare_replace(&_ewk_icon_database_path, directory);
} else {
- WebCore::iconDatabase()->setEnabled(false);
- WebCore::iconDatabase()->close();
+ WebCore::iconDatabase().setEnabled(false);
+ WebCore::iconDatabase().close();
if (_ewk_icon_database_path) {
eina_stringshare_del(_ewk_icon_database_path);
_ewk_icon_database_path = 0;
*/
const char* ewk_settings_icon_database_path_get(void)
{
- if (!WebCore::iconDatabase()->isEnabled())
+ if (!WebCore::iconDatabase().isEnabled())
return 0;
- if (!WebCore::iconDatabase()->isOpen())
+ if (!WebCore::iconDatabase().isOpen())
return 0;
return _ewk_icon_database_path;
*/
Eina_Bool ewk_settings_icon_database_clear(void)
{
- if (!WebCore::iconDatabase()->isEnabled())
+ if (!WebCore::iconDatabase().isEnabled())
return EINA_FALSE;
- if (!WebCore::iconDatabase()->isOpen())
+ if (!WebCore::iconDatabase().isOpen())
return EINA_FALSE;
- WebCore::iconDatabase()->removeAllIcons();
+ WebCore::iconDatabase().removeAllIcons();
return EINA_TRUE;
}
EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
- WebCore::Image *icon = WebCore::iconDatabase()->iconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
+ WebCore::Image *icon = WebCore::iconDatabase().iconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
if (!icon) {
ERR("no icon for url %s", url);
EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
- WebCore::Image* icon = WebCore::iconDatabase()->iconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
+ WebCore::Image* icon = WebCore::iconDatabase().iconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
cairo_surface_t* surface;
if (!icon) {
+2011-03-03 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55721
+ Global IconDatabase should be returned by reference, not as a pointer
+
+ * webkit/webkitglobals.cpp:
+ (closeIconDatabaseOnExit):
+ (WebKit::setIconDatabaseEnabled):
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_get_icon_uri):
+
2011-03-03 Alexey Proskuryakov <ap@apple.com>
Removing an include of WebCoreKeyboardUIMode.h that Ive just added. It's already included
static void closeIconDatabaseOnExit()
{
- iconDatabase()->close();
+ iconDatabase().close();
}
void webkitInit()
}
if (enabled) {
- iconDatabase()->setEnabled(true);
+ iconDatabase().setEnabled(true);
GOwnPtr<gchar> iconDatabasePath(g_build_filename(g_get_user_data_dir(), "webkit", "icondatabase", NULL));
- iconDatabase()->open(iconDatabasePath.get());
+ iconDatabase().open(iconDatabasePath.get());
return;
}
- iconDatabase()->setEnabled(false);
- iconDatabase()->close();
+ iconDatabase().setEnabled(false);
+ iconDatabase().close();
}
G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
- String iconURL = iconDatabase()->iconURLForPageURL(core(webView)->mainFrame()->document()->url().prettyURL());
+ String iconURL = iconDatabase().iconURLForPageURL(core(webView)->mainFrame()->document()->url().prettyURL());
webView->priv->iconURI = iconURL.utf8();
return webView->priv->iconURI.data();
}
+2011-03-03 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55721
+ Global IconDatabase should be returned by reference, not as a pointer
+
+ * Misc/WebCoreStatistics.mm:
+ (+[WebCoreStatistics iconPageURLMappingCount]):
+ (+[WebCoreStatistics iconRetainedPageURLCount]):
+ (+[WebCoreStatistics iconRecordCount]):
+ (+[WebCoreStatistics iconsWithDataCount]):
+ * Misc/WebIconDatabase.mm:
+ (-[WebIconDatabase init]):
+ (-[WebIconDatabase iconForURL:withSize:cache:]):
+ (-[WebIconDatabase iconURLForURL:]):
+ (-[WebIconDatabase defaultIconWithSize:]):
+ (-[WebIconDatabase retainIconForURL:]):
+ (-[WebIconDatabase releaseIconForURL:]):
+ (-[WebIconDatabase isEnabled]):
+ (-[WebIconDatabase setEnabled:]):
+ (-[WebIconDatabase removeAllIcons]):
+ (+[WebIconDatabase _checkIntegrityBeforeOpening]):
+ (-[WebIconDatabase _startUpIconDatabase]):
+ (-[WebIconDatabase _applicationWillTerminate:]):
+ (-[WebIconDatabase _resetCachedWebPreferences:]):
+ (importToWebCoreFormat):
+ * WebView/WebView.mm:
+ (-[WebView _dispatchDidReceiveIconFromWebFrame:]):
+
2011-03-03 Jessie Berlin <jberlin@apple.com>
Reviewed by Adam Roben.
+ (size_t)iconPageURLMappingCount
{
- return iconDatabase()->pageURLMappingCount();
+ return iconDatabase().pageURLMappingCount();
}
+ (size_t)iconRetainedPageURLCount
{
- return iconDatabase()->retainedPageURLCount();
+ return iconDatabase().retainedPageURLCount();
}
+ (size_t)iconRecordCount
{
- return iconDatabase()->iconRecordCount();
+ return iconDatabase().iconRecordCount();
}
+ (size_t)iconsWithDataCount
{
- return iconDatabase()->iconRecordCountWithData();
+ return iconDatabase().iconRecordCountWithData();
}
+ (size_t)cachedFontDataCount
[defaults registerDefaults:initialDefaults];
[initialDefaults release];
BOOL enabled = [defaults boolForKey:WebIconDatabaseEnabledDefaultsKey];
- iconDatabase()->setEnabled(enabled);
+ iconDatabase().setEnabled(enabled);
if (enabled)
[self _startUpIconDatabase];
return self;
if ([URL _webkit_isFileURL])
return [self _iconForFileURL:URL withSize:size];
- if (Image* image = iconDatabase()->iconForPageURL(URL, IntSize(size)))
+ if (Image* image = iconDatabase().iconForPageURL(URL, IntSize(size)))
if (NSImage *icon = webGetNSImage(image, size))
return icon;
return [self defaultIconForURL:URL withSize:size];
return nil;
ASSERT_MAIN_THREAD();
- return iconDatabase()->iconURLForPageURL(URL);
+ return iconDatabase().iconURLForPageURL(URL);
}
- (NSImage *)defaultIconWithSize:(NSSize)size
ASSERT(size.width);
ASSERT(size.height);
- Image* image = iconDatabase()->defaultIcon(IntSize(size));
+ Image* image = iconDatabase().defaultIcon(IntSize(size));
return image ? image->getNSImage() : nil;
}
if (![self isEnabled])
return;
- iconDatabase()->retainIconForPageURL(URL);
+ iconDatabase().retainIconForPageURL(URL);
}
- (void)releaseIconForURL:(NSString *)pageURL
if (![self isEnabled])
return;
- iconDatabase()->releaseIconForPageURL(pageURL);
+ iconDatabase().releaseIconForPageURL(pageURL);
}
+ (void)delayDatabaseCleanup
- (BOOL)isEnabled
{
- return iconDatabase()->isEnabled();
+ return iconDatabase().isEnabled();
}
- (void)setEnabled:(BOOL)flag
{
BOOL currentlyEnabled = [self isEnabled];
if (currentlyEnabled && !flag) {
- iconDatabase()->setEnabled(false);
+ iconDatabase().setEnabled(false);
[self _shutDownIconDatabase];
} else if (!currentlyEnabled && flag) {
- iconDatabase()->setEnabled(true);
+ iconDatabase().setEnabled(true);
[self _startUpIconDatabase];
}
}
return;
// Via the IconDatabaseClient interface, removeAllIcons() will send the WebIconDatabaseDidRemoveAllIconsNotification
- iconDatabase()->removeAllIcons();
+ iconDatabase().removeAllIcons();
}
@end
+ (void)_checkIntegrityBeforeOpening
{
- iconDatabase()->checkIntegrityBeforeOpening();
+ iconDatabase().checkIntegrityBeforeOpening();
}
@end
- (void)_startUpIconDatabase
{
- iconDatabase()->setClient(defaultClient());
+ iconDatabase().setClient(defaultClient());
// Figure out the directory we should be using for the icon.db
NSString *databaseDirectory = [self _databaseDirectory];
NSString *legacyDB = [databaseDirectory stringByAppendingPathComponent:@"icon.db"];
NSFileManager *defaultManager = [NSFileManager defaultManager];
if ([defaultManager fileExistsAtPath:legacyDB isDirectory:&isDirectory] && !isDirectory) {
- NSString *newDB = [databaseDirectory stringByAppendingPathComponent:iconDatabase()->defaultDatabaseFilename()];
+ NSString *newDB = [databaseDirectory stringByAppendingPathComponent:iconDatabase().defaultDatabaseFilename()];
if (![defaultManager fileExistsAtPath:newDB])
rename([legacyDB fileSystemRepresentation], [newDB fileSystemRepresentation]);
}
// Set the private browsing pref then open the WebCore icon database
- iconDatabase()->setPrivateBrowsingEnabled([[WebPreferences standardPreferences] privateBrowsingEnabled]);
- if (!iconDatabase()->open(databaseDirectory))
+ iconDatabase().setPrivateBrowsingEnabled([[WebPreferences standardPreferences] privateBrowsingEnabled]);
+ if (!iconDatabase().open(databaseDirectory))
LOG_ERROR("Unable to open icon database");
// Register for important notifications
- (void)_applicationWillTerminate:(NSNotification *)notification
{
- iconDatabase()->close();
+ iconDatabase().close();
}
- (NSImage *)_iconForFileURL:(NSString *)file withSize:(NSSize)size
- (void)_resetCachedWebPreferences:(NSNotification *)notification
{
BOOL privateBrowsingEnabledNow = [[WebPreferences standardPreferences] privateBrowsingEnabled];
- iconDatabase()->setPrivateBrowsingEnabled(privateBrowsingEnabledNow);
+ iconDatabase().setPrivateBrowsingEnabled(privateBrowsingEnabledNow);
}
- (NSImage *)_largestIconFromDictionary:(NSMutableDictionary *)icons
iconURL = [pageURLToIconURL objectForKey:url];
if (!iconURL)
continue;
- iconDatabase()->importIconURLForPageURL(iconURL, url);
- if (iconDatabase()->shouldStopThreadActivity())
+ iconDatabase().importIconURLForPageURL(iconURL, url);
+ if (iconDatabase().shouldStopThreadActivity())
return false;
}
while ((url = [enumerator nextObject]) != nil) {
iconData = iconDataFromPathForIconURL(databaseDirectory, url);
if (iconData)
- iconDatabase()->importIconDataForIconURL(SharedBuffer::wrapNSData(iconData), url);
+ iconDatabase().importIconDataForIconURL(SharedBuffer::wrapNSData(iconData), url);
else {
// This really *shouldn't* happen, so it'd be good to track down why it might happen in a debug build
// however, we do know how to handle it gracefully in release
LOG_ERROR("%@ is marked as having an icon on disk, but we couldn't get the data for it", url);
- iconDatabase()->importIconDataForIconURL(0, url);
+ iconDatabase().importIconDataForIconURL(0, url);
}
- if (iconDatabase()->shouldStopThreadActivity())
+ if (iconDatabase().shouldStopThreadActivity())
return false;
}
NSFileManager *fileManager = [NSFileManager defaultManager];
enumerator = [[fileManager contentsOfDirectoryAtPath:databaseDirectory error:NULL] objectEnumerator];
- NSString *databaseFilename = iconDatabase()->defaultDatabaseFilename();
+ NSString *databaseFilename = iconDatabase().defaultDatabaseFilename();
BOOL foundIconDB = NO;
NSString *file;
WebFrameLoadDelegateImplementationCache* cache = &_private->frameLoadDelegateImplementations;
if (cache->didReceiveIconForFrameFunc) {
- Image* image = iconDatabase()->iconForPageURL(core(webFrame)->document()->url().string(), IntSize(16, 16));
+ Image* image = iconDatabase().iconForPageURL(core(webFrame)->document()->url().string(), IntSize(16, 16));
if (NSImage *icon = webGetNSImage(image, NSMakeSize(16, 16)))
CallFrameLoadDelegate(cache->didReceiveIconForFrameFunc, self, @selector(webView:didReceiveIcon:forFrame:), icon, webFrame);
}
*/
void QWebSettings::setIconDatabasePath(const QString& path)
{
- WebCore::iconDatabase()->delayDatabaseCleanup();
+ WebCore::iconDatabase().delayDatabaseCleanup();
if (!path.isEmpty()) {
- WebCore::iconDatabase()->setEnabled(true);
+ WebCore::iconDatabase().setEnabled(true);
QFileInfo info(path);
if (info.isDir() && info.isWritable())
- WebCore::iconDatabase()->open(path);
+ WebCore::iconDatabase().open(path);
} else {
- WebCore::iconDatabase()->setEnabled(false);
- WebCore::iconDatabase()->close();
+ WebCore::iconDatabase().setEnabled(false);
+ WebCore::iconDatabase().close();
}
}
*/
QString QWebSettings::iconDatabasePath()
{
- if (WebCore::iconDatabase()->isEnabled() && WebCore::iconDatabase()->isOpen())
- return WebCore::iconDatabase()->databasePath();
+ if (WebCore::iconDatabase().isEnabled() && WebCore::iconDatabase().isOpen())
+ return WebCore::iconDatabase().databasePath();
else
return QString();
}
*/
void QWebSettings::clearIconDatabase()
{
- if (WebCore::iconDatabase()->isEnabled() && WebCore::iconDatabase()->isOpen())
- WebCore::iconDatabase()->removeAllIcons();
+ if (WebCore::iconDatabase().isEnabled() && WebCore::iconDatabase().isOpen())
+ WebCore::iconDatabase().removeAllIcons();
}
/*!
*/
QIcon QWebSettings::iconForUrl(const QUrl& url)
{
- WebCore::Image* image = WebCore::iconDatabase()->iconForPageURL(WebCore::KURL(url).string(),
+ WebCore::Image* image = WebCore::iconDatabase().iconForPageURL(WebCore::KURL(url).string(),
WebCore::IntSize(16, 16));
if (!image)
return QPixmap();
+2011-03-03 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55721
+ Global IconDatabase should be returned by reference, not as a pointer
+
+ * Api/qwebsettings.cpp:
+ (QWebSettings::setIconDatabasePath):
+ (QWebSettings::iconDatabasePath):
+ (QWebSettings::clearIconDatabase):
+ (QWebSettings::iconForUrl):
+
2011-03-03 Alexey Proskuryakov <ap@apple.com>
Removing an include of WebCoreKeyboardUIMode.h that Ive just added. It's already included
+2011-03-03 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=55721
+ Global IconDatabase should be returned by reference, not as a pointer
+
+ * WebCoreStatistics.cpp:
+ (WebCoreStatistics::iconPageURLMappingCount):
+ (WebCoreStatistics::iconRetainedPageURLCount):
+ (WebCoreStatistics::iconRecordCount):
+ (WebCoreStatistics::iconsWithDataCount):
+ * WebIconDatabase.cpp:
+ (WebIconDatabase::init):
+ (WebIconDatabase::startUpIconDatabase):
+ (WebIconDatabase::iconForURL):
+ (WebIconDatabase::retainIconForURL):
+ (WebIconDatabase::releaseIconForURL):
+ (WebIconDatabase::removeAllIcons):
+ (WebIconDatabase::iconURLForURL):
+ (WebIconDatabase::isEnabled):
+ (WebIconDatabase::setEnabled):
+ (WebIconDatabase::hasIconForURL):
+ (WebIconDatabase::getOrCreateDefaultIconBitmap):
+ * WebKitDLL.cpp:
+ (shutDownWebKit):
+
2011-03-03 Alexey Proskuryakov <ap@apple.com>
Removing an include of WebCoreKeyboardUIMode.h that Ive just added. It's already included
{
if (!count)
return E_POINTER;
- *count = (UINT) iconDatabase()->pageURLMappingCount();
+ *count = (UINT) iconDatabase().pageURLMappingCount();
return S_OK;
}
{
if (!count)
return E_POINTER;
- *count = (UINT) iconDatabase()->retainedPageURLCount();
+ *count = (UINT) iconDatabase().retainedPageURLCount();
return S_OK;
}
{
if (!count)
return E_POINTER;
- *count = (UINT) iconDatabase()->iconRecordCount();
+ *count = (UINT) iconDatabase().iconRecordCount();
return S_OK;
}
{
if (!count)
return E_POINTER;
- *count = (UINT) iconDatabase()->iconRecordCountWithData();
+ *count = (UINT) iconDatabase().iconRecordCountWithData();
return S_OK;
}
enabled = FALSE;
LOG_ERROR("Unable to get icon database enabled preference");
}
- iconDatabase()->setEnabled(!!enabled);
+ iconDatabase().setEnabled(!!enabled);
if (!(!!enabled))
return;
{
WebPreferences* standardPrefs = WebPreferences::sharedStandardPreferences();
- iconDatabase()->setClient(this);
+ iconDatabase().setClient(this);
BSTR prefDatabasePath = 0;
if (FAILED(standardPrefs->iconDatabaseLocation(&prefDatabasePath)))
LOG_ERROR("Failed to construct default icon database path");
}
- if (!iconDatabase()->open(databasePath))
+ if (!iconDatabase().open(databasePath))
LOG_ERROR("Failed to open icon database path");
}
Image* icon = 0;
if (url)
- icon = iconDatabase()->iconForPageURL(String(url, SysStringLen(url)), intSize);
+ icon = iconDatabase().iconForPageURL(String(url, SysStringLen(url)), intSize);
// Make sure we check for the case of an "empty image"
if (icon && icon->width()) {
HRESULT STDMETHODCALLTYPE WebIconDatabase::retainIconForURL(
/* [in] */ BSTR url)
{
- iconDatabase()->retainIconForPageURL(String(url, SysStringLen(url)));
+ iconDatabase().retainIconForPageURL(String(url, SysStringLen(url)));
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebIconDatabase::releaseIconForURL(
/* [in] */ BSTR url)
{
- iconDatabase()->releaseIconForPageURL(String(url, SysStringLen(url)));
+ iconDatabase().releaseIconForPageURL(String(url, SysStringLen(url)));
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebIconDatabase::removeAllIcons(void)
{
- iconDatabase()->removeAllIcons();
+ iconDatabase().removeAllIcons();
return S_OK;
}
{
if (!url || !iconURL)
return E_POINTER;
- BString iconURLBSTR(iconDatabase()->iconURLForPageURL(String(url, SysStringLen(url))));
+ BString iconURLBSTR(iconDatabase().iconURLForPageURL(String(url, SysStringLen(url))));
*iconURL = iconURLBSTR.release();
return S_OK;
}
HRESULT STDMETHODCALLTYPE WebIconDatabase::isEnabled(
/* [retval][out] */ BOOL *result)
{
- *result = iconDatabase()->isEnabled();
+ *result = iconDatabase().isEnabled();
return S_OK;
}
BOOL currentlyEnabled;
isEnabled(¤tlyEnabled);
if (currentlyEnabled && !flag) {
- iconDatabase()->setEnabled(false);
+ iconDatabase().setEnabled(false);
shutDownIconDatabase();
} else if (!currentlyEnabled && flag) {
- iconDatabase()->setEnabled(true);
+ iconDatabase().setEnabled(true);
startUpIconDatabase();
}
return S_OK;
// Passing a size parameter of 0, 0 means we don't care about the result of the image, we just
// want to make sure the read from disk to load the icon is kicked off.
- iconDatabase()->iconForPageURL(urlString, IntSize(0, 0));
+ iconDatabase().iconForPageURL(urlString, IntSize(0, 0));
// Check to see if we have a non-empty icon URL for the page, and if we do, we have an icon for
// the page.
- *result = !(iconDatabase()->iconURLForPageURL(urlString).isEmpty());
+ *result = !(iconDatabase().iconURLForPageURL(urlString).isEmpty());
return S_OK;
}
result = createDIB(size);
m_defaultIconMap.set(*size, result);
- if (!iconDatabase()->defaultIcon(*size)->getHBITMAPOfSize(result, size)) {
+ if (!iconDatabase().defaultIcon(*size)->getHBITMAPOfSize(result, size)) {
LOG_ERROR("Failed to draw Image to HBITMAP");
return 0;
}
void shutDownWebKit()
{
- WebCore::iconDatabase()->close();
+ WebCore::iconDatabase().close();
WebCore::PageGroup::closeLocalStorage();
}