Commit f7a75591 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

css: Count usages of StyleSheetList's named getter that do not return null.

The anonymous named getter is not part of the spec, and we are trying to
figure out how much it is actually used. The existing counter is triggered
whenever code tries to access a named property, this second counter is
triggered only when a property is found and should give us a better idea of
when named properties are not accessed by accident.

Bug: 689687
Change-Id: I7f255593d2a998a83a62ca60d814751b938db0af
Reviewed-on: https://chromium-review.googlesource.com/596975Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#491378}
parent 3907c969
......@@ -68,7 +68,12 @@ CSSStyleSheet* StyleSheetList::AnonymousNamedGetter(const AtomicString& name) {
HTMLStyleElement* item = GetNamedItem(name);
if (!item)
return nullptr;
return item->sheet();
CSSStyleSheet* sheet = item->sheet();
if (sheet) {
UseCounter::Count(*GetDocument(),
WebFeature::kStyleSheetListNonNullAnonymousNamedGetter);
}
return sheet;
}
DEFINE_TRACE(StyleSheetList) {
......
......@@ -1601,6 +1601,7 @@ enum WebFeature {
kPresentationRequestStartSecureOrigin = 2063,
kPresentationRequestStartInsecureOrigin = 2064,
kPersistentClientHintHeader = 2065,
kStyleSheetListNonNullAnonymousNamedGetter = 2066,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -15990,6 +15990,7 @@ uploading your change for review. These are checked by presubmit scripts.
<int value="2063" label="PresentationRequestStartSecureOrigin"/>
<int value="2064" label="PresentationRequestStartInsecureOrigin"/>
<int value="2065" label="PersistentClientHintHeader"/>
<int value="2066" label="StyleSheetListNonNullAnonymousNamedGetter"/>
</enum>
<enum name="FeedbackSource">
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