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

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

Issue 2598773002: [Downloads] Deprecate incorrect metrics. (Closed)
Patch Set: . Created 4 years 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_request_core.h ('k') | content/browser/download/download_stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_request_core.cc
diff --git a/content/browser/download/download_request_core.cc b/content/browser/download/download_request_core.cc
index 8af8fe2368edf52b0e83f5b6327c2b57fb1f0032..b5c504baa06ed3f21ab3dc0619a719d8fc04218c 100644
--- a/content/browser/download/download_request_core.cc
+++ b/content/browser/download/download_request_core.cc
@@ -202,7 +202,6 @@ DownloadRequestCore::DownloadRequestCore(net::URLRequest* request,
: delegate_(delegate),
request_(request),
download_id_(DownloadItem::kInvalidId),
- last_buffer_size_(0),
bytes_read_(0),
pause_count_(0),
was_deferred_(false),
@@ -234,9 +233,6 @@ DownloadRequestCore::~DownloadRequestCore() {
// Remove output stream callback if a stream exists.
if (stream_writer_)
stream_writer_->RegisterCallback(base::Closure());
-
- UMA_HISTOGRAM_TIMES("SB2.DownloadDuration",
- base::TimeTicks::Now() - download_start_time_);
}
std::unique_ptr<DownloadCreateInfo>
@@ -366,7 +362,6 @@ bool DownloadRequestCore::OnWillRead(scoped_refptr<net::IOBuffer>* buf,
DCHECK(!read_buffer_.get());
*buf_size = min_size < 0 ? kReadBufSize : min_size;
- last_buffer_size_ = *buf_size;
read_buffer_ = new net::IOBuffer(*buf_size);
*buf = read_buffer_.get();
return true;
@@ -377,20 +372,6 @@ bool DownloadRequestCore::OnReadCompleted(int bytes_read, bool* defer) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(read_buffer_.get());
- base::TimeTicks now(base::TimeTicks::Now());
- if (!last_read_time_.is_null()) {
- double seconds_since_last_read = (now - last_read_time_).InSecondsF();
- if (now == last_read_time_)
- // Use 1/10 ms as a "very small number" so that we avoid
- // divide-by-zero error and still record a very high potential bandwidth.
- seconds_since_last_read = 0.00001;
-
- double actual_bandwidth = (bytes_read) / seconds_since_last_read;
- double potential_bandwidth = last_buffer_size_ / seconds_since_last_read;
- RecordBandwidth(actual_bandwidth, potential_bandwidth);
- }
- last_read_time_ = now;
-
if (!bytes_read)
return true;
bytes_read_ += bytes_read;
@@ -401,7 +382,7 @@ bool DownloadRequestCore::OnReadCompleted(int bytes_read, bool* defer) {
if (!stream_writer_->Write(read_buffer_, bytes_read)) {
PauseRequest();
*defer = was_deferred_ = true;
- last_stream_pause_time_ = now;
+ last_stream_pause_time_ = base::TimeTicks::Now();
}
read_buffer_ = NULL; // Drop our reference.
« no previous file with comments | « content/browser/download/download_request_core.h ('k') | content/browser/download/download_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698