summaryrefslogtreecommitdiff
path: root/src/adblock/adblockmanager.h
diff options
context:
space:
mode:
authorPaul Rohrbach <p.b.r@gmx.net>2013-07-30 21:53:23 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-07-30 21:53:23 +0200
commitb715a3c6a64f96706ea5d186c60647040d7e91d3 (patch)
treeb2770e1f92da0bf88330325094781e47cd074c92 /src/adblock/adblockmanager.h
parentMove autoscroll timer interval from 100ms to 16ms (diff)
downloadrekonq-b715a3c6a64f96706ea5d186c60647040d7e91d3.tar.xz
Load the adblock settings in background.
If you open rekonq and start typing immediately, there is a small lag (about half a second). This is caused by the AdBlockManager::loadSettings function reading the adblock rules. It is called with a one second delay to make the startup faster. With this patch, the function is called in a separate thread using QtConcurrent::run to eliminate the lag. To make this safe, the adblocker is enabled after the settings are loaded, which means, that the first site loaded could be partially with ads. But this is no change in behavior, as the adblocker in current master is disabled for a whole second. The only times this blocks now is in situations, where it is necessary that the settings are loaded (showSettings and addCustomRule), but I guess that no normal user will use those in under a second after startup :) REVIEW: 111712 REVIEWED-BY: adjam
Diffstat (limited to 'src/adblock/adblockmanager.h')
-rw-r--r--src/adblock/adblockmanager.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h
index f65abe71..4a1f9be8 100644
--- a/src/adblock/adblockmanager.h
+++ b/src/adblock/adblockmanager.h
@@ -137,6 +137,7 @@
#include <QObject>
#include <QStringList>
#include <QByteArray>
+#include <QFuture>
// Forward Includes
class QNetworkRequest;
@@ -205,6 +206,7 @@ private:
AdBlockElementHiding _elementHiding;
KSharedConfig::Ptr _adblockConfig;
+ QFuture<void> _settingsLoaded;
static QWeakPointer<AdBlockManager> s_adBlockManager;
};