summaryrefslogtreecommitdiff
path: root/src/adblock/adblockrule.cpp
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2010-08-18 04:44:22 +0200
committerBenjamin Poulain <benjamin.poulain@nokia.com>2010-08-18 05:04:39 +0200
commit95c71246916f0986101f08ee362429b505cbcd3d (patch)
tree36009aaacd3c83baf288e5019a097c3c24a0212c /src/adblock/adblockrule.cpp
parentSplit AdBlock rule in two classes to move the implementation out of it (diff)
downloadrekonq-95c71246916f0986101f08ee362429b505cbcd3d.tar.xz
Add a primitive text machter as an AdBlockRule implementations
About 30% of the filter of easylist are just simple text matching. This new AdBlockRule implementation detects the simple occurences of this to match the url directly. On Qt 4.7, this reduce the time spend in AdBlock by around 20%.
Diffstat (limited to 'src/adblock/adblockrule.cpp')
-rw-r--r--src/adblock/adblockrule.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/adblock/adblockrule.cpp b/src/adblock/adblockrule.cpp
index 8236f920..1cb6773a 100644
--- a/src/adblock/adblockrule.cpp
+++ b/src/adblock/adblockrule.cpp
@@ -56,8 +56,12 @@
#include "adblockrule.h"
#include "adblockrulefallbackimpl.h"
+#include "adblockruletextmatchimpl.h"
AdBlockRule::AdBlockRule(const QString &filter)
{
- m_implementation = QSharedPointer<AdBlockRuleImpl>(new AdBlockRuleFallbackImpl(filter));
+ if (AdBlockRuleTextMatchImpl::isTextMatchFilter(filter))
+ m_implementation = QSharedPointer<AdBlockRuleImpl>(new AdBlockRuleTextMatchImpl(filter));
+ else
+ m_implementation = QSharedPointer<AdBlockRuleImpl>(new AdBlockRuleFallbackImpl(filter));
}