Commit 43bb8676 authored by shishir@chromium.org's avatar shishir@chromium.org

Adding metrics for Instant URL blacklist events.

BUG=167991


Review URL: https://chromiumcodereview.appspot.com/11788034

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175619 0039d316-1c4b-4281-b951-d872f2087c98
parent b9dcf43a
...@@ -48,6 +48,20 @@ const int kMaxInstantSupportFailures = 10; ...@@ -48,6 +48,20 @@ const int kMaxInstantSupportFailures = 10;
// reloaded so that the page does not become stale. // reloaded so that the page does not become stale.
const int kStaleLoaderTimeoutMS = 3 * 3600 * 1000; 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, void AddSessionStorageHistogram(bool extended_enabled,
const content::WebContents* tab1, const content::WebContents* tab1,
const content::WebContents* tab2) { const content::WebContents* tab2) {
...@@ -811,9 +825,13 @@ void InstantController::InstantSupportDetermined( ...@@ -811,9 +825,13 @@ void InstantController::InstantSupportDetermined(
if (loader_ && loader_->contents() == contents) { if (loader_ && loader_->contents() == contents) {
if (supports_instant) { 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 { } else {
++blacklisted_urls_[loader_->instant_url()]; ++blacklisted_urls_[loader_->instant_url()];
RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_ADDED_TO_BLACKLIST);
HideInternal(); HideInternal();
delete loader_->ReleaseContents(); delete loader_->ReleaseContents();
MessageLoop::current()->DeleteSoon(FROM_HERE, loader_.release()); MessageLoop::current()->DeleteSoon(FROM_HERE, loader_.release());
...@@ -1207,8 +1225,10 @@ bool InstantController::GetInstantURL(const TemplateURL* template_url, ...@@ -1207,8 +1225,10 @@ bool InstantController::GetInstantURL(const TemplateURL* template_url,
std::map<std::string, int>::const_iterator iter = std::map<std::string, int>::const_iterator iter =
blacklisted_urls_.find(*instant_url); blacklisted_urls_.find(*instant_url);
if (iter != blacklisted_urls_.end() && if (iter != blacklisted_urls_.end() &&
iter->second > kMaxInstantSupportFailures) iter->second > kMaxInstantSupportFailures) {
RecordEventHistogram(INSTANT_CONTROLLER_EVENT_URL_BLOCKED_BY_BLACKLIST);
return false; return false;
}
return true; return true;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment