summaryrefslogtreecommitdiffstats
path: root/content/browser/download
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/download')
-rw-r--r--content/browser/download/download_resource_handler.cc7
-rw-r--r--content/browser/download/download_resource_handler.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index 84ab673..757e274 100644
--- a/content/browser/download/download_resource_handler.cc
+++ b/content/browser/download/download_resource_handler.cc
@@ -72,7 +72,8 @@ DownloadResourceHandler::DownloadResourceHandler(
last_buffer_size_(0),
bytes_read_(0),
pause_count_(0),
- was_deferred_(false) {
+ was_deferred_(false),
+ on_response_started_called_(false) {
download_stats::RecordDownloadCount(download_stats::UNTHROTTLED_COUNT);
}
@@ -96,6 +97,10 @@ bool DownloadResourceHandler::OnResponseStarted(
int request_id,
content::ResourceResponse* response,
bool* defer) {
+ // There can be only one (call)
+ DCHECK(!on_response_started_called_);
+ on_response_started_called_ = true;
+
VLOG(20) << __FUNCTION__ << "()" << DebugString()
<< " request_id = " << request_id;
download_start_time_ = base::TimeTicks::Now();
diff --git a/content/browser/download/download_resource_handler.h b/content/browser/download/download_resource_handler.h
index 6cb273c..66b69b7 100644
--- a/content/browser/download/download_resource_handler.h
+++ b/content/browser/download/download_resource_handler.h
@@ -138,6 +138,9 @@ class DownloadResourceHandler : public ResourceHandler {
int pause_count_;
bool was_deferred_;
+ // For DCHECKing
+ bool on_response_started_called_;
+
static const int kReadBufSize = 32768; // bytes
static const int kThrottleTimeMs = 200; // milliseconds