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..0c35f2eb90247ee3eb75e5ff2b0429a55f1b3484 100644 |
--- a/content/browser/download/base_file.cc |
+++ b/content/browser/download/base_file.cc |
@@ -18,7 +18,6 @@ |
#include "content/browser/download/download_interrupt_reasons_impl.h" |
#include "content/browser/download/download_net_log_parameters.h" |
#include "content/browser/download/download_stats.h" |
-#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/content_browser_client.h" |
#include "content/public/common/quarantine.h" |
#include "crypto/secure_hash.h" |
@@ -28,10 +27,12 @@ |
namespace content { |
-BaseFile::BaseFile(const net::NetLogWithSource& net_log) : net_log_(net_log) {} |
+BaseFile::BaseFile(const net::NetLogWithSource& net_log) : net_log_(net_log) { |
+ DETACH_FROM_SEQUENCE(sequence_checker_); |
+} |
BaseFile::~BaseFile() { |
- DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (detached_) |
Close(); |
else |
@@ -46,7 +47,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 +128,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 +173,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 +189,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 +277,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 +340,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 +427,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()); |