Index: third_party/WebKit/Source/core/frame/UseCounter.cpp |
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.cpp b/third_party/WebKit/Source/core/frame/UseCounter.cpp |
index f22e26496e27b6b235f94578af12d291d9f673f8..00951c4f95096e49f2e8fcd4ea6e523744ff4917 100644 |
--- a/third_party/WebKit/Source/core/frame/UseCounter.cpp |
+++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp |
@@ -1099,7 +1099,8 @@ UseCounter::UseCounter(Context context) |
m_disableReporting(false), |
m_context(context), |
m_featuresRecorded(NumberOfFeatures), |
- m_CSSRecorded(numCSSPropertyIDs) {} |
+ m_CSSRecorded(numCSSPropertyIDs), |
+ m_animatedCSSRecorded(numCSSPropertyIDs) {} |
void UseCounter::muteForInspector() { |
m_muteCount++; |
@@ -1164,9 +1165,11 @@ void UseCounter::didCommitLoad(KURL url) { |
m_featuresRecorded.clearAll(); |
m_CSSRecorded.clearAll(); |
+ m_animatedCSSRecorded.clearAll(); |
if (!m_disableReporting && !m_muteCount) { |
featuresHistogram().count(PageVisits); |
cssHistogram().count(totalPagesMeasuredCSSSampleId()); |
+ animatedCSSHistogram().count(totalPagesMeasuredCSSSampleId()); |
} |
} |
@@ -1236,6 +1239,7 @@ void UseCounter::countCrossOriginIframe(const Document& document, |
} |
void UseCounter::count(CSSParserMode cssParserMode, CSSPropertyID property) { |
+ // FIXME(suzyh): Count custom properties as well as named properties |
DCHECK(isCSSPropertyIDWithName(property)); |
if (!isUseCounterEnabledForMode(cssParserMode) || m_muteCount) |
@@ -1259,6 +1263,54 @@ void UseCounter::count(Feature feature) { |
recordMeasurement(feature); |
} |
+bool UseCounter::isCountedAnimatedCSS(CSSPropertyID unresolvedProperty) { |
+ return m_animatedCSSRecorded.quickGet(unresolvedProperty); |
+} |
+ |
+bool UseCounter::isCountedAnimatedCSS(Document& document, |
+ const String& string) { |
+ Frame* frame = document.frame(); |
+ if (!frame) |
+ return false; |
+ FrameHost* host = frame->host(); |
+ if (!host) |
+ return false; |
+ |
+ CSSPropertyID unresolvedProperty = unresolvedCSSPropertyID(string); |
+ if (unresolvedProperty == CSSPropertyInvalid) |
+ return false; |
+ return host->useCounter().isCountedAnimatedCSS(unresolvedProperty); |
+} |
+ |
+void UseCounter::countAnimatedCSS(const Document& document, |
+ CSSPropertyID property) { |
+ const Frame* frame = document.frame(); |
+ if (!frame) |
+ return; |
+ FrameHost* host = frame->host(); |
+ if (!host) |
+ return; |
+ |
+ host->useCounter().countAnimatedCSS(property); |
+} |
+ |
+void UseCounter::countAnimatedCSS(CSSPropertyID property) { |
+ DCHECK(isCSSPropertyIDWithName(property) || property == CSSPropertyVariable); |
+ |
+ if (m_muteCount) |
+ return; |
+ |
+ if (!m_animatedCSSRecorded.quickGet(property)) { |
+ int sampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(property); |
+ if (!m_disableReporting) { |
+ TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.feature_usage"), |
+ "AnimatedCSSFirstUsed", "feature", sampleId); |
Rick Byers
2017/02/25 15:10:57
Note if you'd like to get this data into HTTP Arch
|
+ animatedCSSHistogram().count(sampleId); |
+ } |
+ m_animatedCSSRecorded.quickSet(property); |
+ } |
+} |
+ |
void UseCounter::notifyFeatureCounted(Feature feature) { |
DCHECK(!m_muteCount); |
DCHECK(!m_disableReporting); |
@@ -1297,6 +1349,17 @@ EnumerationHistogram& UseCounter::cssHistogram() const { |
return m_context == SVGImageContext ? svgHistogram : histogram; |
} |
+EnumerationHistogram& UseCounter::animatedCSSHistogram() const { |
+ DEFINE_STATIC_LOCAL( |
+ blink::EnumerationHistogram, histogram, |
+ ("Blink.UseCounter.AnimatedCSSProperties", kMaximumCSSSampleId)); |
+ DEFINE_STATIC_LOCAL( |
+ blink::EnumerationHistogram, svgHistogram, |
+ ("Blink.UseCounter.SVGImage.AnimatedCSSProperties", kMaximumCSSSampleId)); |
+ |
+ return m_context == SVGImageContext ? svgHistogram : histogram; |
+} |
+ |
/* |
* |
* LEGACY metrics support - WebCore.FeatureObserver is to be superceded by |