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

Unified Diff: components/safe_browsing_db/v4_store.cc

Issue 2425703004: Destroy store on task runner. That's where all store operations happen. (Closed)
Patch Set: shess@feedback. WaitForTasksOnTaskRunner at the end of the test that calls ApplyUpdate and expects … Created 4 years, 2 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/v4_store.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/v4_store.cc
diff --git a/components/safe_browsing_db/v4_store.cc b/components/safe_browsing_db/v4_store.cc
index 81f30ec7cc066c162c19f28f9f5c048ea9fde9ac..299f6d803ede1deae04d214d9e41c77c6d917d32 100644
--- a/components/safe_browsing_db/v4_store.cc
+++ b/components/safe_browsing_db/v4_store.cc
@@ -194,7 +194,9 @@ V4Store::V4Store(const scoped_refptr<base::SequencedTaskRunner>& task_runner,
const base::FilePath& store_path)
: store_path_(store_path), task_runner_(task_runner) {}
-V4Store::~V4Store() {}
+V4Store::~V4Store() {
+ DCHECK(task_runner_->RunsTasksOnCurrentThread());
+}
std::string V4Store::DebugString() const {
std::string state_base64;
@@ -204,6 +206,14 @@ std::string V4Store::DebugString() const {
store_path_.value().c_str(), state_base64.c_str());
}
+// static
+void V4Store::Destroy(std::unique_ptr<V4Store> v4_store) {
+ V4Store* v4_store_raw = v4_store.release();
+ if (v4_store_raw) {
+ v4_store_raw->task_runner_->DeleteSoon(FROM_HERE, v4_store_raw);
+ }
+}
+
void V4Store::Reset() {
expected_checksum_.clear();
hash_prefix_map_.clear();
« no previous file with comments | « components/safe_browsing_db/v4_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698