1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Merge branch 'Falkon/3.1'

This commit is contained in:
David Rosca 2019-06-01 10:28:17 +02:00
commit 721d203366
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 8 additions and 0 deletions

View File

@ -187,6 +187,8 @@ QImage IconProvider::imageForUrl(const QUrl &url, bool allowNull)
return allowNull ? QImage() : IconProvider::emptyWebImage();
}
QMutexLocker locker(&instance()->m_iconCacheMutex);
const QByteArray encodedUrl = encodeUrl(url);
if (QImage *img = instance()->m_urlImageCache.object(encodedUrl)) {
@ -224,6 +226,8 @@ QImage IconProvider::imageForDomain(const QUrl &url, bool allowNull)
return allowNull ? QImage() : IconProvider::emptyWebImage();
}
QMutexLocker locker(&instance()->m_iconCacheMutex);
foreach (const BufferedIcon &ic, instance()->m_iconBuffer) {
if (ic.first.host() == url.host()) {
return ic.second;
@ -249,6 +253,8 @@ IconProvider* IconProvider::instance()
void IconProvider::saveIconsToDatabase()
{
QMutexLocker locker(&instance()->m_iconCacheMutex);
foreach (const BufferedIcon &ic, m_iconBuffer) {
QByteArray ba;
QBuffer buffer(&ba);

View File

@ -23,6 +23,7 @@
#include <QImage>
#include <QUrl>
#include <QCache>
#include <QMutex>
#include <functional>
@ -82,6 +83,7 @@ private:
QIcon m_bookmarkIcon;
QVector<BufferedIcon> m_iconBuffer;
QCache<QByteArray, QImage> m_urlImageCache;
QMutex m_iconCacheMutex;
AutoSaver* m_autoSaver;
};