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

Unified Diff: trunk/src/content/browser/download/base_file_win.cc

Issue 342233002: Revert 278483 "[Downloads] Retry renames after transient failures." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 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: trunk/src/content/browser/download/base_file_win.cc
===================================================================
--- trunk/src/content/browser/download/base_file_win.cc (revision 278536)
+++ trunk/src/content/browser/download/base_file_win.cc (working copy)
@@ -10,7 +10,6 @@
#include <shellapi.h>
#include "base/file_util.h"
-#include "base/files/file.h"
#include "base/guid.h"
#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
@@ -26,8 +25,6 @@
const int kAllSpecialShFileOperationCodes[] = {
// Should be kept in sync with the case statement below.
ERROR_ACCESS_DENIED,
- ERROR_SHARING_VIOLATION,
- ERROR_INVALID_PARAMETER,
0x71,
0x72,
0x73,
@@ -72,27 +69,12 @@
// above.
switch (code) {
// Not a pre-Win32 error code; here so that this particular
- // case shows up in our histograms.
+ // case shows up in our histograms. This is redundant with the
+ // mapping function net::MapSystemError used later.
case ERROR_ACCESS_DENIED: // Access is denied.
- result = DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR;
+ result = DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED;
break;
- // This isn't documented but returned from SHFileOperation. Sharing
- // violations indicate that another process had the file open while we were
- // trying to rename. Anti-virus is believed to be the cause of this error in
- // the wild. Treated as a transient error on the assumption that the file
- // will be made available for renaming at a later time.
- case ERROR_SHARING_VIOLATION:
- result = DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR;
- break;
-
- // This is also not a documented return value of SHFileOperation, but has
- // been observed in the wild. We are treating it as a transient error based
- // on the cases we have seen so far. See http://crbug.com/368455.
- case ERROR_INVALID_PARAMETER:
- result = DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR;
- break;
-
// The source and destination files are the same file.
// DE_SAMEFILE == 0x71
case 0x71:
@@ -268,20 +250,12 @@
arraysize(kAllSpecialShFileOperationCodes)));
}
- if (result == DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR) {
- UMA_HISTOGRAM_CUSTOM_ENUMERATION(
- "Download.MapWinShErrorTransientError", code,
- base::CustomHistogram::ArrayToCustomRanges(
- kAllSpecialShFileOperationCodes,
- arraysize(kAllSpecialShFileOperationCodes)));
- }
-
if (result != DOWNLOAD_INTERRUPT_REASON_NONE)
return result;
// If not one of the above codes, it should be a standard Windows error code.
- return ConvertFileErrorToInterruptReason(
- base::File::OSErrorToFileError(code));
+ return ConvertNetErrorToInterruptReason(
+ net::MapSystemError(code), DOWNLOAD_INTERRUPT_FROM_DISK);
}
// Maps a return code from ScanAndSaveDownloadedFile() to a
« no previous file with comments | « trunk/src/content/browser/download/base_file_unittest.cc ('k') | trunk/src/content/browser/download/download_file_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698