Commit bf408599 authored by Takayoshi Kochi's avatar Takayoshi Kochi Committed by Commit Bot

Opt-in DocumentRegisterElement to UKM

Use UKM for document.registerElement() to help investigate
which site is actively using Custom Elements V0 API.
The motivation is to drive usage down, by outreaching those
users.

As of today the usage is around 5% so we sample this feature
as well as the existing kElementCreateShadowRoot.
https://www.chromestatus.com/metrics/feature/timeline/popularity/457

Bug: 843080
Change-Id: I8a94fdcf2d0c905a3a978cb78673c0544b2155a2
Reviewed-on: https://chromium-review.googlesource.com/1059100
Commit-Queue: Takayoshi Kochi <kochi@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559425}
parent b6ec484f
......@@ -30,6 +30,7 @@ bool IsAllowedUkmFeature(blink::mojom::WebFeature feature) {
WebFeature::kHTMLImports, WebFeature::kHTMLImportsHasStyleSheets,
WebFeature::kElementCreateShadowRoot,
WebFeature::kPaymentRequestInvalidCurrencyCode,
WebFeature::kDocumentRegisterElement,
}));
return opt_in_features.count(feature);
}
......@@ -54,12 +54,14 @@ void UseCounterPageLoadMetricsObserver::OnFeaturesUsageObserved(
UMA_HISTOGRAM_ENUMERATION(internal::kFeaturesHistogramName, feature,
WebFeature::kNumberOfFeatures);
features_recorded_.set(static_cast<size_t>(feature));
// TODO(kochi): https://crbug.com/806671 as ElementCreateShadowRoot is
// ~12% as of April, 2018, and to meet the UKM's data volume expectation,
// reduce the data size by sampling. Revisit and remove this code once
// Shadow DOM V0 is removed.
// TODO(kochi): https://crbug.com/806671 https://843080
// as ElementCreateShadowRoot is ~8% and
// DocumentRegisterElement is ~5% as of May, 2018, to meet UKM's data
// volume expectation, reduce the data size by sampling. Revisit and
// remove this code once Shadow DOM V0 and Custom Elements V0 are removed.
const int kSamplingFactor = 10;
if (feature == WebFeature::kElementCreateShadowRoot &&
if ((feature == WebFeature::kElementCreateShadowRoot ||
feature == WebFeature::kDocumentRegisterElement) &&
base::RandGenerator(kSamplingFactor) != 0)
continue;
if (IsAllowedUkmFeature(feature)) {
......
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