diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-04-08 14:52:40 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-04-08 14:52:40 +0200 |
commit | badceb8dfa8b54ff6da55e9a2188da53ad1aa8e8 (patch) | |
tree | 5332436d7e74723db680d7430adf3b483e3daaae /src/webengine/urlinterceptor.h | |
parent | Add FeatureSummary to CMakeLists (diff) | |
download | smolbote-badceb8dfa8b54ff6da55e9a2188da53ad1aa8e8.tar.xz |
Multithreading UrlRequestInterceptor
- Add parse() free function to UrlRequestInterceptor
- hostlists are loaded in parallel via QtConcurrent
Diffstat (limited to 'src/webengine/urlinterceptor.h')
-rw-r--r-- | src/webengine/urlinterceptor.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/webengine/urlinterceptor.h b/src/webengine/urlinterceptor.h index b34d9ff..af15f99 100644 --- a/src/webengine/urlinterceptor.h +++ b/src/webengine/urlinterceptor.h @@ -10,6 +10,7 @@ #define URLREQUESTINTERCEPTOR_H #include <QWebEngineUrlRequestInterceptor> +#include <QMutex> class UrlRequestInterceptor : public QWebEngineUrlRequestInterceptor { @@ -20,15 +21,15 @@ public: }; explicit UrlRequestInterceptor(const QString &path, QObject *parent = nullptr); - ~UrlRequestInterceptor(); + ~UrlRequestInterceptor() override; - void interceptRequest(QWebEngineUrlRequestInfo &info); - -public slots: - int parseHostfile(const QString &filename); + void interceptRequest(QWebEngineUrlRequestInfo &info) override; private: - QHash<QString, HostRule *> m_rules; + QHash<QString, HostRule> rules; + QMutex rulesLock; }; +QHash<QString, UrlRequestInterceptor::HostRule> parse(const QString &filename); + #endif // URLREQUESTINTERCEPTOR_H |