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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_store_file.h

Issue 910953002: Move SafeBrowsing to the blocking pool via an experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: chrome/browser/safe_browsing/safe_browsing_store_file.h
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.h b/chrome/browser/safe_browsing/safe_browsing_store_file.h
index 2c2e04cef76f3194d64a166e2bd53d2fbaa1960f..45aa290121ed56ebfcc4af8dadeed497ffd8d218 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file.h
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file.h
@@ -13,6 +13,7 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/files/scoped_file.h"
+#include "base/sequenced_task_runner.h"
#include "base/threading/non_thread_safe.h"
gab 2015/02/19 14:38:23 rm this include
Alexei Svitkine (slow) 2015/02/20 15:42:44 Done.
// Implement SafeBrowsingStore in terms of a flat file. The file
@@ -123,10 +124,10 @@
// - Delete original file.
// - Rename temp file to original filename.
-class SafeBrowsingStoreFile : public SafeBrowsingStore,
- public base::NonThreadSafe {
+class SafeBrowsingStoreFile : public SafeBrowsingStore {
public:
- SafeBrowsingStoreFile();
+ explicit SafeBrowsingStoreFile(
+ scoped_refptr<base::SequencedTaskRunner> task_runner);
~SafeBrowsingStoreFile() override;
void Init(const base::FilePath& filename,
@@ -183,6 +184,10 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore,
static bool DeleteStore(const base::FilePath& basename);
private:
+ // Checks whether the current thread is part of the sequenced task runner
+ // this object was initialized with.
+ bool CalledOnValidThread();
+
// Does the actual update for FinishUpdate(), so that FinishUpdate() can clean
// up correctly in case of error.
virtual bool DoUpdate(safe_browsing::PrefixSetBuilder* builder,
@@ -229,6 +234,10 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore,
base::hash_set<int32>().swap(sub_del_cache_);
}
+ // The sequenced task runner for this object, used to verify that its state
+ // is only ever accessed in sequence via the runner.
gab 2015/02/19 14:38:23 s/in sequence via the runner/from the runner
Alexei Svitkine (slow) 2015/02/20 15:42:44 Done.
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+
// Buffers for collecting data between BeginChunk() and
// FinishChunk().
SBAddPrefixes add_prefixes_;

Powered by Google App Engine
This is Rietveld 408576698