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

Unified Diff: components/safe_browsing_db/v4_database.h

Issue 2649643002: [S] Use a weak_factory for V4Database callbacks + test (Closed)
Patch Set: Nit: s/weak_factory_/weak_factory_on_io_ Created 3 years, 11 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 | « no previous file | components/safe_browsing_db/v4_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/v4_database.h
diff --git a/components/safe_browsing_db/v4_database.h b/components/safe_browsing_db/v4_database.h
index 19fee93a53b304007a69fef142473b93c5826ba2..cc07d4e308a8be28944a2ba2e84e0d7eaae50fde 100644
--- a/components/safe_browsing_db/v4_database.h
+++ b/components/safe_browsing_db/v4_database.h
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
#include "components/safe_browsing_db/v4_protocol_manager_util.h"
@@ -205,6 +206,10 @@ class V4Database {
// accessed on the IO thread.
int pending_store_updates_;
+ // Only meant to be dereferenced and invalidated on the IO thread and hence
+ // named. For details, see the comment at the top of weak_ptr.h
+ base::WeakPtrFactory<V4Database> weak_factory_on_io_;
+
DISALLOW_COPY_AND_ASSIGN(V4Database);
};
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698