Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: components/safe_browsing_db/database_manager.cc

Issue 1821873002: Instantiate and destroy v4 update manager with IO thread start/stop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git fetch && git rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/safe_browsing_db/database_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « components/safe_browsing_db/database_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698