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

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

Issue 10451023: Avoid double calling OnResponseStarted from BufferedResourceHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to LKGR. Created 8 years, 7 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/download_resource_handler.cc
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index 84ab673c9cd59120e2757d50d579c76167f62092..757e274a830b96730950d0e119a69879fc84637b 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();
« no previous file with comments | « content/browser/download/download_resource_handler.h ('k') | content/browser/renderer_host/buffered_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698