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

Unified Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 303123006: Add SBClientDownload.DownloadRequestNetworkDuration and DownloadRequestTimeoutDuration histograms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index a6cfef7d23d095c8454e1cda793e2e148c9a5178..1d8e127723a876100f0278d3eb0ada101bfdf39a 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -355,6 +355,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
// Request has already been cancelled.
return;
}
+ timeout_start_time_ = base::TimeTicks::Now();
BrowserThread::PostDelayedTask(
BrowserThread::UI,
FROM_HERE,
@@ -733,6 +734,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
fetcher_->SetRequestContext(service_->request_context_getter_.get());
fetcher_->SetUploadData("application/octet-stream",
client_download_request_data_);
+ request_start_time_ = base::TimeTicks::Now();
UMA_HISTOGRAM_COUNTS("SBClientDownload.DownloadRequestPayloadSize",
client_download_request_data_.size());
fetcher_->Start();
@@ -757,6 +759,14 @@ class DownloadProtectionService::CheckClientDownloadRequest
// Ensure the timeout task is cancelled while we still have a non-zero
// refcount. (crbug.com/240449)
weakptr_factory_.InvalidateWeakPtrs();
+ if (!timeout_start_time_.is_null()) {
+ UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestTimeoutDuration",
+ base::TimeTicks::Now() - timeout_start_time_);
+ }
+ if (!request_start_time_.is_null()) {
+ UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestNetworkDuration",
+ base::TimeTicks::Now() - request_start_time_);
+ }
if (service_) {
VLOG(2) << "SafeBrowsing download verdict for: "
<< item_->DebugString(true) << " verdict:" << reason;
@@ -847,6 +857,8 @@ class DownloadProtectionService::CheckClientDownloadRequest
CancelableRequestConsumer request_consumer_; // For HistoryService lookup.
base::WeakPtrFactory<CheckClientDownloadRequest> weakptr_factory_;
base::TimeTicks start_time_; // Used for stats.
+ base::TimeTicks timeout_start_time_;
+ base::TimeTicks request_start_time_;
DISALLOW_COPY_AND_ASSIGN(CheckClientDownloadRequest);
};
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698