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

Unified Diff: components/autofill/browser/autocheckout/whitelist_manager.cc

Issue 14060013: Add UMA stats to track whitelist download latency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename variables and update comments. Created 7 years, 8 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: components/autofill/browser/autocheckout/whitelist_manager.cc
diff --git a/components/autofill/browser/autocheckout/whitelist_manager.cc b/components/autofill/browser/autocheckout/whitelist_manager.cc
index aeb60f113393bfbe12ee93af31708c6632f2588a..583c7e33e1554a7bc7d2cb6147234963b1cce925 100644
--- a/components/autofill/browser/autocheckout/whitelist_manager.cc
+++ b/components/autofill/browser/autocheckout/whitelist_manager.cc
@@ -55,6 +55,10 @@ void WhitelistManager::Init(net::URLRequestContextGetter* context_getter) {
ScheduleDownload(kInitialDownloadDelaySeconds);
}
+const AutofillMetrics& WhitelistManager::GetMetricLogger() const {
+ return metrics_logger_;
+}
Ilya Sherman 2013/04/17 05:01:48 nit: Please order this so that its sorted the same
benquan 2013/04/17 05:48:18 Done.
+
void WhitelistManager::ScheduleDownload(size_t interval_seconds) {
if (!experimental_form_filling_enabled_) {
// The feature is not enabled: do not do the request.
@@ -77,6 +81,8 @@ void WhitelistManager::StartDownloadTimer(size_t interval_seconds) {
void WhitelistManager::TriggerDownload() {
callback_is_pending_ = true;
+ request_started_timestamp_ = base::Time::Now();
+
request_.reset(net::URLFetcher::Create(
0, GURL(kWhitelistUrl), net::URLFetcher::GET, this));
request_->SetRequestContext(context_getter_);
@@ -99,9 +105,16 @@ void WhitelistManager::OnURLFetchComplete(
DCHECK_EQ(source, old_request.get());
if (source->GetResponseCode() == net::HTTP_OK) {
+ GetMetricLogger().LogAutocheckoutWhitelistDownloadDuration(
+ base::Time::Now() - request_started_timestamp_,
+ AutofillMetrics::AUTOCHECKOUT_WHITELIST_DOWNLOAD_SUCCEEDED);
std::string data;
source->GetResponseAsString(&data);
BuildWhitelist(data);
+ } else {
+ GetMetricLogger().LogAutocheckoutWhitelistDownloadDuration(
+ base::Time::Now() - request_started_timestamp_,
+ AutofillMetrics::AUTOCHECKOUT_WHITELIST_DOWNLOAD_FAILED);
}
ScheduleDownload(kDownloadIntervalSeconds);

Powered by Google App Engine
This is Rietveld 408576698