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

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

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.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc
index 47c3f9efafd73e8fb954b0a5130230f3fd2f2b0b..358ecf684e754b115dff07d7d37cd4b24e91b264 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc
@@ -554,16 +554,25 @@ bool ReadDbStateHelper(const base::FilePath& filename,
} // namespace
-SafeBrowsingStoreFile::SafeBrowsingStoreFile()
- : chunks_written_(0), empty_(false), corruption_seen_(false) {}
+SafeBrowsingStoreFile::SafeBrowsingStoreFile(
+ scoped_refptr<base::SequencedTaskRunner> task_runner)
+ : task_runner_(task_runner),
+ chunks_written_(0),
+ empty_(false),
+ corruption_seen_(false) {
+}
SafeBrowsingStoreFile::~SafeBrowsingStoreFile() {
// Thread-checking is disabled in the destructor due to crbug.com/338486.
- DetachFromThread();
+ task_runner_ = nullptr;
gab 2015/02/19 14:38:23 No need to do this, just have a commented out: //
Alexei Svitkine (slow) 2015/02/20 15:42:44 The issue is that Close() has that check.
Close();
}
+bool SafeBrowsingStoreFile::CalledOnValidThread() {
+ return !task_runner_ || task_runner_->RunsTasksOnCurrentThread();
gab 2015/02/19 14:38:23 You can get rid of this I think and just inline D
Alexei Svitkine (slow) 2015/02/20 15:42:44 I prefer keeping it a separate method, which doesn
+}
+
bool SafeBrowsingStoreFile::Delete() {
DCHECK(CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698