From 1143429887f61d8b3c74a4c3a1fafca632eb4b87 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 25 May 2017 20:59:43 +0200 Subject: Filter code refactoring --- src/webengine/urlinterceptor.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/webengine/urlinterceptor.cpp') diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp index da2925c..3ffcb44 100644 --- a/src/webengine/urlinterceptor.cpp +++ b/src/webengine/urlinterceptor.cpp @@ -19,7 +19,11 @@ ******************************************************************************/ #include "urlinterceptor.h" -#include "blocker/filtercollection.h" +#include "filter/filtercollection.h" + +#ifdef DEBUG_VERBOSE +#include +#endif UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) : QWebEngineUrlRequestInterceptor(parent) @@ -29,7 +33,9 @@ UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) : void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) { #ifdef DEBUG_VERBOSE + QTime time; qDebug("%s --> [%i] %s", qUtf8Printable(info.firstPartyUrl().toString()), info.resourceType(), qUtf8Printable(info.requestUrl().toString())); + time.start(); #endif for(auto s : m_manager->subscriptions()) { @@ -37,11 +43,15 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) if(r.match) { info.block(r.block); #ifdef DEBUG_VERBOSE - qDebug(">> matched [%s] [%s]", r.block ? "blocked" : "allowed", qUtf8Printable(r.pattern)); + qDebug(">> matched [%s] [%s] in %i ms", r.block ? "blocked" : "allowed", qUtf8Printable(r.pattern), time.elapsed()); #endif return; } } + +#ifdef DEBUG_VERBOSE + qDebug(">> passed in %i ms", time.elapsed()); +#endif } void UrlRequestInterceptor::setSubscription(BlockerManager *manager) -- cgit v1.2.1