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

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: diff from https://codereview.chromium.org/2251633002/#ps40001 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
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 6170731e33d4d0923c154d7d6fa641b6d1f14109..a2e61492b8064090da209018f59626daaf254036 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -305,11 +305,12 @@ ServiceWorkerVersion::ServiceWorkerVersion(
registration_id_(registration->id()),
script_url_(script_url),
scope_(registration->pattern()),
+ site_for_uma_(ServiceWorkerMetrics::SiteFromURL(scope_, base::nullopt)),
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_);
@@ -409,6 +410,17 @@ ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() {
return info;
}
+void ServiceWorkerVersion::set_has_fetch_handler(bool has_fetch_handler) {
+ DCHECK(!has_fetch_handler_);
+ has_fetch_handler_ = has_fetch_handler;
+ if (site_for_uma_ != ServiceWorkerMetrics::Site::OTHER)
shimazu 2016/08/18 06:53:24 How about using SiteFromURL for keeping consistenc
horo 2016/08/21 08:39:58 I removed FetchHandlerExistence from the arguments
shimazu 2016/08/22 02:48:02 Sure.
+ return;
+ if (has_fetch_handler)
+ 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(

Powered by Google App Engine
This is Rietveld 408576698