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

Side by Side Diff: chrome/browser/download/download_manager.cc

Issue 7237031: Revert 89600 - Treat ERR_CONNECTION_CLOSED as a succesful download. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverted experiment to gather statistics on ERR_CONNECTION_CLOSED occurrences. Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/download_manager.h" 5 #include "chrome/browser/download/download_manager.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 void DownloadManager::OnResponseCompleted(int32 download_id, 634 void DownloadManager::OnResponseCompleted(int32 download_id,
635 int64 size, 635 int64 size,
636 int os_error, 636 int os_error,
637 const std::string& hash) { 637 const std::string& hash) {
638 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 638 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
639 // ERR_CONNECTION_CLOSED is allowed since a number of servers in the wild 639 // ERR_CONNECTION_CLOSED is allowed since a number of servers in the wild
640 // advertise a larger Content-Length than the amount of bytes in the message 640 // advertise a larger Content-Length than the amount of bytes in the message
641 // body, and then close the connection. Other browsers - IE8, Firefox 4.0.1, 641 // body, and then close the connection. Other browsers - IE8, Firefox 4.0.1,
642 // and Safari 5.0.4 - treat the download as complete in this case, so we 642 // and Safari 5.0.4 - treat the download as complete in this case, so we
643 // follow their lead. 643 // follow their lead.
644 // EXPERIMENT(ahendrickson) -- Treat ERR_CONNECTION_CLOSED as an error to 644 if (os_error == 0 || os_error == net::ERR_CONNECTION_CLOSED) {
645 // gather statistics. To be reverted in a few days.
646 if (os_error == 0) {
647 OnAllDataSaved(download_id, size, hash); 645 OnAllDataSaved(download_id, size, hash);
648 } else { 646 } else {
649 OnDownloadError(download_id, size, os_error); 647 OnDownloadError(download_id, size, os_error);
650 } 648 }
651 } 649 }
652 650
653 void DownloadManager::OnAllDataSaved(int32 download_id, 651 void DownloadManager::OnAllDataSaved(int32 download_id,
654 int64 size, 652 int64 size,
655 const std::string& hash) { 653 const std::string& hash) {
656 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id 654 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 observed_download_manager_->RemoveObserver(this); 1358 observed_download_manager_->RemoveObserver(this);
1361 } 1359 }
1362 1360
1363 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { 1361 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() {
1364 observing_download_manager_->NotifyModelChanged(); 1362 observing_download_manager_->NotifyModelChanged();
1365 } 1363 }
1366 1364
1367 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { 1365 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() {
1368 observed_download_manager_ = NULL; 1366 observed_download_manager_ = NULL;
1369 } 1367 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698