Index: components/safe_browsing_db/database_manager.cc |
diff --git a/components/safe_browsing_db/database_manager.cc b/components/safe_browsing_db/database_manager.cc |
index ba9ea16812d7d4c44552c5161d6241450201349c..2e92c9093566c3d6b6c27ce785f2a341672d6e54 100644 |
--- a/components/safe_browsing_db/database_manager.cc |
+++ b/components/safe_browsing_db/database_manager.cc |
@@ -5,6 +5,7 @@ |
#include "components/safe_browsing_db/database_manager.h" |
#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" |
+#include "components/safe_browsing_db/v4_update_protocol_manager.h" |
#include "content/public/browser/browser_thread.h" |
#include "net/url_request/url_request_context_getter.h" |
#include "url/gurl.h" |
@@ -14,11 +15,13 @@ using content::BrowserThread; |
namespace safe_browsing { |
SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager() |
- : v4_get_hash_protocol_manager_(NULL) { |
+ : v4_get_hash_protocol_manager_(NULL), |
+ v4_update_protocol_manager_(NULL) { |
} |
SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { |
DCHECK(v4_get_hash_protocol_manager_ == NULL); |
+ DCHECK(v4_update_protocol_manager_ == NULL); |
} |
void SafeBrowsingDatabaseManager::StartOnIOThread( |
@@ -30,11 +33,17 @@ void SafeBrowsingDatabaseManager::StartOnIOThread( |
v4_get_hash_protocol_manager_ = V4GetHashProtocolManager::Create( |
request_context_getter, config); |
} |
+ |
+ // Instantiate a V4UpdateProtocolManager. |
+ if (request_context_getter) { |
+ v4_update_protocol_manager_ = V4UpdateProtocolManager::Create( |
kcarattini
2016/03/22 00:41:43
Why not just put this in the same if statement abo
|
+ request_context_getter, config); |
+ } |
} |
-// |shutdown| not used. Destroys the v4 protocol manager. This may be called |
-// multiple times during the life of the DatabaseManager. Must be called on IO |
-// thread. |
+// |shutdown| not used. Destroys the v4 protocol managers. This may be called |
+// multiple times during the life of the DatabaseManager. |
+// Must be called on IO thread. |
void SafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
// This cancels all in-flight GetHash requests. |
@@ -42,6 +51,12 @@ void SafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) { |
delete v4_get_hash_protocol_manager_; |
v4_get_hash_protocol_manager_ = NULL; |
} |
+ |
+ // This cancels all in-flight update requests. |
+ if (v4_update_protocol_manager_) { |
+ delete v4_update_protocol_manager_; |
+ v4_update_protocol_manager_ = NULL; |
+ } |
} |
void SafeBrowsingDatabaseManager::CheckApiBlacklistUrl(const GURL& url, |