mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Improved performance of WebHistoryInterface
Use std::set to search in logarithmic time.
This commit is contained in:
parent
8e9ea139db
commit
acbd04dd3d
|
@ -26,10 +26,10 @@ WebHistoryInterface::WebHistoryInterface(QObject* parent)
|
||||||
|
|
||||||
void WebHistoryInterface::addHistoryEntry(const QString &url)
|
void WebHistoryInterface::addHistoryEntry(const QString &url)
|
||||||
{
|
{
|
||||||
m_clickedLinks.append(url);
|
m_clickedLinks.insert(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebHistoryInterface::historyContains(const QString &url) const
|
bool WebHistoryInterface::historyContains(const QString &url) const
|
||||||
{
|
{
|
||||||
return m_clickedLinks.contains(url);
|
return m_clickedLinks.find(url) != m_clickedLinks.end();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#define WEBHISTORYINTERFACE_H
|
#define WEBHISTORYINTERFACE_H
|
||||||
|
|
||||||
#include <QWebHistoryInterface>
|
#include <QWebHistoryInterface>
|
||||||
#include <QStringList>
|
#include <set>
|
||||||
|
|
||||||
#include "qz_namespace.h"
|
#include "qz_namespace.h"
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public:
|
||||||
bool historyContains(const QString &url) const;
|
bool historyContains(const QString &url) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_clickedLinks;
|
std::set<QString> m_clickedLinks;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user