| 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..e4cc777c32b40548757033b4e8f35da4af962ca3 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,27 +15,32 @@ 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(
|
| net::URLRequestContextGetter* request_context_getter,
|
| const V4ProtocolConfig& config) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| - // Instantiate a V4GetHashProtocolManager.
|
| if (request_context_getter) {
|
| + // Instantiate a V4GetHashProtocolManager.
|
| v4_get_hash_protocol_manager_ = V4GetHashProtocolManager::Create(
|
| request_context_getter, config);
|
| + // Instantiate a V4UpdateProtocolManager.
|
| + v4_update_protocol_manager_ = V4UpdateProtocolManager::Create(
|
| + 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 +48,12 @@ void SafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) {
|
| delete v4_get_hash_protocol_manager_;
|
| v4_get_hash_protocol_manager_ = NULL;
|
| }
|
| +
|
| + // This cancels any in-flight update request.
|
| + if (v4_update_protocol_manager_) {
|
| + delete v4_update_protocol_manager_;
|
| + v4_update_protocol_manager_ = NULL;
|
| + }
|
| }
|
|
|
| void SafeBrowsingDatabaseManager::CheckApiBlacklistUrl(const GURL& url,
|
|
|