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

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: 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..788be8bf27e29fb9fb7e3a31de878cb155024551 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.h"
Ilya Sherman 2016/08/24 22:27:56 nit: Please #include histogram_macros instead.
msramek 2016/08/25 08:56:09 Done.
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -50,6 +51,14 @@ 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 +147,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 +164,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 +271,10 @@ bool ClearSiteDataThrottle::ParseHeader(const std::string& header,
void ClearSiteDataThrottle::TaskFinished() {
DCHECK(clearing_in_progress_);
clearing_in_progress_ = false;
+
+ UMA_HISTOGRAM_TIMES("Navigation.ClearSiteData.Duration",
+ base::TimeTicks::Now() - clearing_started_);
Ilya Sherman 2016/08/24 22:27:56 Do you have a guess for roughly how long a "typica
clamy 2016/08/24 23:15:01 IIUC, you're blocking the navigation during the ti
msramek 2016/08/25 08:56:09 Clearing browsing data *can* potentially take a lo
clamy 2016/08/25 17:53:47 The median Page Load Time on Android is 2.5s right
msramek 2016/08/25 18:39:44 I lowered it to 50 buckets per 1 second. That's 20
+
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