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

Unified Diff: chrome/browser/instant/instant_controller.cc

Issue 11788034: Adding metrics for Instant URL blacklist events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_controller.cc
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 5077a873b6697cf30061c950983e2165d720ee16..933010dd3ad8e0cb9b36111ec0ebf62906b859e5 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -48,6 +48,20 @@ const int kMaxInstantSupportFailures = 10;
// reloaded so that the page does not become stale.
const int kStaleLoaderTimeoutMS = 3 * 3600 * 1000;
+// For reporting events of interest.
+enum InstantControllerEvent {
+ INSTANT_CONTROLLER_EVENT_URL_ADDED_TO_BLACKLIST = 0,
+ INSTANT_CONTROLLER_EVENT_URL_REMOVED_FROM_BLACKLIST = 1,
+ INSTANT_CONTROLLER_EVENT_URL_BLOCKED_BY_BLACKLIST = 2,
+ INSTANT_CONTROLLER_EVENT_MAX = 3,
+};
+
+void RecordEventHistogram(InstantControllerEvent event) {
+ UMA_HISTOGRAM_ENUMERATION("Instant.InstantControllerEvent",
+ event,
+ INSTANT_CONTROLLER_EVENT_MAX);
+}
+
void AddSessionStorageHistogram(bool extended_enabled,
const content::WebContents* tab1,
const content::WebContents* tab2) {
@@ -811,9 +825,13 @@ void InstantController::InstantSupportDetermined(
if (loader_ && loader_->contents() == contents) {
if (supports_instant) {
- blacklisted_urls_.erase(loader_->instant_url());
+ if (blacklisted_urls_.erase(loader_->instant_url())) {
+ RecordEventHistogram(
+ INSTANT_CONTROLLER_EVENT_URL_REMOVED_FROM_BLACKLIST);
+ }
} else {
++blacklisted_urls_[loader_->instant_url()];
+ RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_ADDED_TO_BLACKLIST);
HideInternal();
delete loader_->ReleaseContents();
MessageLoop::current()->DeleteSoon(FROM_HERE, loader_.release());
@@ -1201,8 +1219,10 @@ bool InstantController::GetInstantURL(const TemplateURL* template_url,
std::map<std::string, int>::const_iterator iter =
blacklisted_urls_.find(*instant_url);
if (iter != blacklisted_urls_.end() &&
- iter->second > kMaxInstantSupportFailures)
+ iter->second > kMaxInstantSupportFailures) {
+ RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_BLOCKED_BY_BLACKLIST);
return false;
+ }
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698