Changed the safe browsing code to be less interruptive.

Sun, 27 Aug 2017 14:06:10 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 27 Aug 2017 14:06:10 +0200
changeset 5853
e45a570528a4
parent 5852
3aad40446c29
child 5854
be976799b8c0

Changed the safe browsing code to be less interruptive.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
PluginManager/PluginManager.py file | annotate | diff | comparison | revisions
WebBrowser/SafeBrowsing/SafeBrowsingCache.py file | annotate | diff | comparison | revisions
WebBrowser/SafeBrowsing/SafeBrowsingManager.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/PluginManager/PluginManager.py	Sun Aug 27 12:28:30 2017 +0200
+++ b/PluginManager/PluginManager.py	Sun Aug 27 14:06:10 2017 +0200
@@ -1314,7 +1314,7 @@
         Plugins supporting this functionality must support the module function
         clearPrivateData() and have the module level attribute pluginType.
         
-        @param type_ type of the plugin to be activated (string)
+        @param type_ type of the plugin to clear private data for (string)
         """
         for name, module in \
             list(self.__onDemandActiveModules.items()) + \
--- a/WebBrowser/SafeBrowsing/SafeBrowsingCache.py	Sun Aug 27 12:28:30 2017 +0200
+++ b/WebBrowser/SafeBrowsing/SafeBrowsingCache.py	Sun Aug 27 14:06:10 2017 +0200
@@ -182,6 +182,8 @@
     """
     drop_full_hash_value_idx = """DROP INDEX IF EXISTS idx_full_hash_value"""
     
+    maxProcessEventsTime = 500
+    
     def __init__(self, dbPath, parent=None):
         """
         Constructor
@@ -299,6 +301,8 @@
                     threatList = ThreatList(threatType, platformType,
                                             threatEntryType)
                     output.append((threatList, hasExpired))
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -343,6 +347,8 @@
                     threatList = ThreatList(threatType, platformType,
                                             threatEntryType)
                     output.append((threatList, fullHash, negativeCacheExpired))
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -520,6 +526,8 @@
                     threatList = ThreatList(threatType, platformType,
                                             threatEntryType)
                     output.append((threatList, clientState))
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -640,7 +648,8 @@
                 
                 while query.next():
                     sha256Hash.addData(query.value(0))
-                    QCoreApplication.processEvents(QEventLoop.AllEvents, 200)
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -680,6 +689,8 @@
                     query.addBindValue(threatList.threatEntryType)
                     query.exec_()
                     del query
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
             finally:
                 db.commit()
     
@@ -721,6 +732,8 @@
                         prefix = bytes(query.value(0))
                         output.append(prefix)
                     index += 1
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -766,5 +779,7 @@
                                                QSql.In | QSql.Binary)
                         query.exec_()
                         del query
+                        QCoreApplication.processEvents(
+                            QEventLoop.AllEvents, self.maxProcessEventsTime)
                 finally:
                     db.commit()
--- a/WebBrowser/SafeBrowsing/SafeBrowsingManager.py	Sun Aug 27 12:28:30 2017 +0200
+++ b/WebBrowser/SafeBrowsing/SafeBrowsingManager.py	Sun Aug 27 14:06:10 2017 +0200
@@ -240,6 +240,7 @@
         
         # step 1: remove expired hashes
         self.__cache.cleanupFullHashes()
+        QCoreApplication.processEvents()
         
         # step 2: update threat lists
         threatListsForRemove = {}

eric ide

mercurial