Chromium Code Reviews| 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_; |