From badceb8dfa8b54ff6da55e9a2188da53ad1aa8e8 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 8 Apr 2018 14:52:40 +0200 Subject: Multithreading UrlRequestInterceptor - Add parse() free function to UrlRequestInterceptor - hostlists are loaded in parallel via QtConcurrent --- src/webengine/urlinterceptor.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/webengine/urlinterceptor.h') 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 +#include 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 m_rules; + QHash rules; + QMutex rulesLock; }; +QHash parse(const QString &filename); + #endif // URLREQUESTINTERCEPTOR_H -- cgit v1.2.1