Chromium Code Reviews| 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..eebae4bd6a329a0cb9ca5bd79c7326b5e674fbbe 100644 |
| --- a/third_party/WebKit/Source/core/frame/UseCounter.cpp |
| +++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp |
| @@ -1143,6 +1143,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(); |
| @@ -1173,6 +1177,12 @@ void UseCounter::count(const Frame* frame, Feature feature) { |
| return; |
| host->useCounter().count(feature); |
| + HeapHashSet<Member<Observer>> toBeRemoved; |
|
Rick Byers
2017/02/11 15:01:51
IIRC, this code path isn't triggered on the deprec
nhiroki
2017/02/13 04:35:07
Good point. This is because both countFeature() an
|
| + for (auto observer : host->useCounter().m_observers) { |
| + if (observer->onCountFeature(feature)) |
| + toBeRemoved.insert(observer); |
| + } |
| + host->useCounter().m_observers.removeAll(toBeRemoved); |
| } |
| void UseCounter::count(const Document& document, Feature feature) { |
| @@ -1193,6 +1203,16 @@ bool UseCounter::isCounted(CSSPropertyID unresolvedProperty) { |
| return m_CSSRecorded.quickGet(unresolvedProperty); |
| } |
| +void UseCounter::addObserver(Document& document, Observer* observer) { |
| + Frame* frame = document.frame(); |
| + if (!frame) |
| + return; |
| + FrameHost* host = frame->host(); |
| + if (!host) |
| + return; |
| + host->useCounter().m_observers.insert(observer); |
| +} |
| + |
| bool UseCounter::isCounted(Document& document, const String& string) { |
| Frame* frame = document.frame(); |
| if (!frame) |