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

Unified Diff: content/browser/browsing_data/clear_site_data_throttle.cc

Issue 2274853002: Add metrics for the Clear-Site-Data header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 years, 4 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 | « content/browser/browsing_data/clear_site_data_throttle.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browsing_data/clear_site_data_throttle.cc
diff --git a/content/browser/browsing_data/clear_site_data_throttle.cc b/content/browser/browsing_data/clear_site_data_throttle.cc
index ca040a49e8e5ba8e435da0a734fd7b5f7e7994ce..c036a988df0c571e099a7db379e0994bf1e725e8 100644
--- a/content/browser/browsing_data/clear_site_data_throttle.cc
+++ b/content/browser/browsing_data/clear_site_data_throttle.cc
@@ -8,6 +8,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_string_value_serializer.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -50,6 +51,13 @@ bool AreExperimentalFeaturesEnabled() {
switches::kEnableExperimentalWebPlatformFeatures);
}
+// Represents the parameters as a single number to be recorded in a histogram.
+int ParametersMask(bool clear_cookies, bool clear_storage, bool clear_cache) {
+ return static_cast<int>(clear_cookies) * (1 << 0) +
+ static_cast<int>(clear_storage) * (1 << 1) +
+ static_cast<int>(clear_cache) * (1 << 2);
+}
+
} // namespace
// static
@@ -138,6 +146,11 @@ void ClearSiteDataThrottle::HandleHeader() {
return;
}
+ // Record the call parameters.
+ UMA_HISTOGRAM_ENUMERATION(
+ "Navigation.ClearSiteData.Parameters",
+ ParametersMask(clear_cookies, clear_storage, clear_cache), (1 << 3));
+
// If the header is valid, clear the data for this browser context and origin.
BrowserContext* browser_context =
navigation_handle()->GetWebContents()->GetBrowserContext();
@@ -150,6 +163,7 @@ void ClearSiteDataThrottle::HandleHeader() {
}
clearing_in_progress_ = true;
+ clearing_started_ = base::TimeTicks::Now();
GetContentClient()->browser()->ClearSiteData(
browser_context, origin, clear_cookies, clear_storage, clear_cache,
base::Bind(&ClearSiteDataThrottle::TaskFinished,
@@ -256,6 +270,12 @@ bool ClearSiteDataThrottle::ParseHeader(const std::string& header,
void ClearSiteDataThrottle::TaskFinished() {
DCHECK(clearing_in_progress_);
clearing_in_progress_ = false;
+
+ UMA_HISTOGRAM_CUSTOM_TIMES("Navigation.ClearSiteData.Duration",
+ base::TimeTicks::Now() - clearing_started_,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(1), 50);
+
navigation_handle()->Resume();
}
« no previous file with comments | « content/browser/browsing_data/clear_site_data_throttle.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698