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

Unified Diff: content/browser/download/base_file.cc

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Add a missing mock expectation. Created 3 years, 6 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: content/browser/download/base_file.cc
diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc
index 7c05f8deac393f8141a7006a039a758341635663..090d709b1061e465e06108caa9f4314fa76f7046 100644
--- a/content/browser/download/base_file.cc
+++ b/content/browser/download/base_file.cc
@@ -31,7 +31,7 @@ namespace content {
BaseFile::BaseFile(const net::NetLogWithSource& net_log) : net_log_(net_log) {}
BaseFile::~BaseFile() {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (detached_)
Close();
else
@@ -46,7 +46,7 @@ DownloadInterruptReason BaseFile::Initialize(
const std::string& hash_so_far,
std::unique_ptr<crypto::SecureHash> hash_state,
bool is_sparse_file) {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!detached_);
if (full_path.empty()) {
@@ -127,7 +127,7 @@ DownloadInterruptReason BaseFile::WriteDataToFile(int64_t offset,
}
DownloadInterruptReason BaseFile::Rename(const base::FilePath& new_path) {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DownloadInterruptReason rename_result = DOWNLOAD_INTERRUPT_REASON_NONE;
// If the new path is same as the old one, there is no need to perform the
@@ -172,7 +172,7 @@ void BaseFile::Detach() {
}
void BaseFile::Cancel() {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!detached_);
net_log_.AddEvent(net::NetLogEventType::CANCELLED);
@@ -188,7 +188,7 @@ void BaseFile::Cancel() {
}
std::unique_ptr<crypto::SecureHash> BaseFile::Finish() {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// TODO(qinmin): verify that all the holes have been filled.
if (is_sparse_file_)
@@ -276,7 +276,7 @@ DownloadInterruptReason BaseFile::CalculatePartialHash(
}
DownloadInterruptReason BaseFile::Open(const std::string& hash_so_far) {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!detached_);
DCHECK(!full_path_.empty());
@@ -339,7 +339,7 @@ DownloadInterruptReason BaseFile::Open(const std::string& hash_so_far) {
}
void BaseFile::Close() {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (file_.IsValid()) {
// Currently we don't really care about the return value, since if it fails
@@ -426,7 +426,7 @@ DownloadInterruptReason BaseFile::AnnotateWithSourceInformation(
const std::string& client_guid,
const GURL& source_url,
const GURL& referrer_url) {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!detached_);
DCHECK(!full_path_.empty());

Powered by Google App Engine
This is Rietveld 408576698