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

Unified Diff: content/browser/service_worker/service_worker_version.cc

Issue 2250623003: Keep ServiceWorkerMetrics::Site in ServiceWorkerVersion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/service_worker/service_worker_version.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index c7c40556b0d9f20d45043857c3926b05a294325e..13f1305c6966e2bd2b31f80ee933473ebea0e7fb 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -306,11 +306,12 @@ ServiceWorkerVersion::ServiceWorkerVersion(
script_url_(script_url),
scope_(registration->pattern()),
fetch_handler_existence_(FetchHandlerExistence::UNKNOWN),
+ site_for_uma_(ServiceWorkerMetrics::SiteFromURL(scope_)),
context_(context),
script_cache_map_(this, context),
ping_controller_(new PingController(this)),
should_exclude_from_uma_(
- ServiceWorkerMetrics::ShouldExcludeURLFromHistogram(scope_)),
+ ServiceWorkerMetrics::ShouldExcludeSiteFromHistogram(site_for_uma_)),
weak_factory_(this) {
DCHECK_NE(kInvalidServiceWorkerVersionId, version_id);
DCHECK(context_);
@@ -411,6 +412,19 @@ ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() {
return info;
}
+void ServiceWorkerVersion::set_fetch_handler_existence(
+ FetchHandlerExistence existence) {
+ DCHECK_EQ(fetch_handler_existence_, FetchHandlerExistence::UNKNOWN);
+ DCHECK_NE(existence, FetchHandlerExistence::UNKNOWN);
+ fetch_handler_existence_ = existence;
+ if (site_for_uma_ != ServiceWorkerMetrics::Site::OTHER)
+ return;
+ if (existence == FetchHandlerExistence::EXISTS)
+ site_for_uma_ = ServiceWorkerMetrics::Site::WITH_FETCH_HANDLER;
+ else
+ site_for_uma_ = ServiceWorkerMetrics::Site::WITHOUT_FETCH_HANDLER;
+}
+
void ServiceWorkerVersion::StartWorker(ServiceWorkerMetrics::EventType purpose,
const StatusCallback& callback) {
TRACE_EVENT_INSTANT2(
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698