Index: content/browser/download/base_file.cc |
diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc |
index 1d5d1e2e1ba3318bd7ae74a51a152d1d9508acbe..9de9538c5e351d18965702f7d97649d4e0d6e1c0 100644 |
--- a/content/browser/download/base_file.cc |
+++ b/content/browser/download/base_file.cc |
@@ -265,7 +265,7 @@ net::Error BaseFile::Initialize() { |
net::Error BaseFile::AppendDataToFile(const char* data, size_t data_len) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
- DCHECK(!detached_); |
+ if (detached_) return net::ERR_INVALID_HANDLE; |
Randy Smith (Not in Mondays)
2012/09/11 18:36:53
You didn't respond on the other CL, so I'll ask ag
benjhayden
2012/09/13 15:18:16
I had found a race that meant that there might be
|
// NOTE(benwells): The above DCHECK won't be present in release builds, |
// so we log any occurences to see how common this error is in the wild. |
@@ -402,7 +402,7 @@ void BaseFile::Detach() { |
void BaseFile::Cancel() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
- DCHECK(!detached_); |
+ if (detached_) return; |
bound_net_log_.AddEvent(net::NetLog::TYPE_CANCELLED); |
@@ -425,7 +425,7 @@ void BaseFile::Finish() { |
} |
bool BaseFile::GetHash(std::string* hash) { |
- DCHECK(!detached_); |
+ if (detached_) return false; |
hash->assign(reinterpret_cast<const char*>(sha256_hash_), |
sizeof(sha256_hash_)); |
return (calculate_hash_ && !in_progress()); |
@@ -460,7 +460,7 @@ bool BaseFile::IsEmptyHash(const std::string& hash) { |
void BaseFile::AnnotateWithSourceInformation() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
- DCHECK(!detached_); |
+ if (detached_) return; |
#if defined(OS_WIN) |
// Sets the Zone to tell Windows that this file comes from the internet. |