| 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 f424c1430b58935699917abd1a4a054bb88f957c..79272a3075bb1af7a4b11567b0cf8e1fbf853488 100644
|
| --- a/third_party/WebKit/Source/core/frame/UseCounter.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp
|
| @@ -1125,6 +1125,7 @@ void UseCounter::recordMeasurement(Feature feature) {
|
| TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.feature_usage"),
|
| "FeatureFirstUsed", "feature", feature);
|
| featuresHistogram().count(feature);
|
| + notifyFeatureCounted(feature);
|
| }
|
| m_featuresRecorded.quickSet(feature);
|
| }
|
| @@ -1143,6 +1144,10 @@ bool UseCounter::hasRecordedMeasurement(Feature feature) const {
|
| return m_featuresRecorded.quickGet(feature);
|
| }
|
|
|
| +DEFINE_TRACE(UseCounter) {
|
| + visitor->trace(m_observers);
|
| +}
|
| +
|
| void UseCounter::didCommitLoad(KURL url) {
|
| m_legacyCounter.updateMeasurements();
|
|
|
| @@ -1193,6 +1198,11 @@ bool UseCounter::isCounted(CSSPropertyID unresolvedProperty) {
|
| return m_CSSRecorded.quickGet(unresolvedProperty);
|
| }
|
|
|
| +void UseCounter::addObserver(Observer* observer) {
|
| + DCHECK(!m_observers.contains(observer));
|
| + m_observers.insert(observer);
|
| +}
|
| +
|
| bool UseCounter::isCounted(Document& document, const String& string) {
|
| Frame* frame = document.frame();
|
| if (!frame)
|
| @@ -1249,6 +1259,17 @@ void UseCounter::count(Feature feature) {
|
| recordMeasurement(feature);
|
| }
|
|
|
| +void UseCounter::notifyFeatureCounted(Feature feature) {
|
| + DCHECK(!m_muteCount);
|
| + DCHECK(!m_disableReporting);
|
| + HeapHashSet<Member<Observer>> toBeRemoved;
|
| + for (auto observer : m_observers) {
|
| + if (observer->onCountFeature(feature))
|
| + toBeRemoved.insert(observer);
|
| + }
|
| + m_observers.removeAll(toBeRemoved);
|
| +}
|
| +
|
| EnumerationHistogram& UseCounter::featuresHistogram() const {
|
| // Every SVGImage has it's own Page instance, and multiple web pages can
|
| // share the usage of a single SVGImage. Ideally perhaps we'd delegate
|
|
|