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

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

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/download/drag_download_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_stats.cc
diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc
index 7831a4db32af2e31dc6b2339db06a9bd099b0ae6..c743970964f5490017e355c4f389573c218375f3 100644
--- a/content/browser/download/download_stats.cc
+++ b/content/browser/download/download_stats.cc
@@ -8,6 +8,7 @@
#include "base/strings/string_util.h"
#include "content/browser/download/download_resource_handler.h"
#include "content/public/browser/download_interrupt_reasons.h"
+#include "net/base/net_errors.h"
#include "net/http/http_content_disposition.h"
namespace content {
@@ -178,7 +179,7 @@ void RecordDownloadWriteLoopCount(int count) {
void RecordAcceptsRanges(const std::string& accepts_ranges,
int64 download_len,
- const std::string& etag) {
+ bool has_strong_validator) {
int64 max = 1024 * 1024 * 1024; // One Terabyte.
download_len /= 1024; // In Kilobytes
static const int kBuckets = 50;
@@ -195,9 +196,7 @@ void RecordAcceptsRanges(const std::string& accepts_ranges,
1,
max,
kBuckets);
- // ETags that start with "W/" are considered weak ETags which don't imply
- // byte-wise equality.
- if (!StartsWithASCII(etag, "w/", false))
+ if (has_strong_validator)
RecordDownloadCount(STRONG_ETAG_AND_ACCEPTS_RANGES);
} else {
UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesMissingOrInvalid.KBytes",
@@ -453,6 +452,12 @@ void RecordFileBandwidth(size_t length,
disk_write_time_ms * 100 / elapsed_time_ms);
}
+void RecordNetErrorForNetworkFailed(int net_error) {
+ UMA_HISTOGRAM_CUSTOM_ENUMERATION("Download.MapErrorNetworkFailed",
+ std::abs(net_error),
+ net::GetAllErrorCodesForUma());
+}
+
void RecordSavePackageEvent(SavePackageEvent event) {
UMA_HISTOGRAM_ENUMERATION("Download.SavePackage",
event,
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/download/drag_download_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698