| 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 383f0723f01a99f0ed9db84c091198423fa87d0e..78052d4a17487c9c7482ba396ac719f7129dd3e0 100644
|
| --- a/third_party/WebKit/Source/core/frame/UseCounter.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp
|
| @@ -37,6 +37,7 @@
|
| #include "core/workers/WorkerOrWorkletGlobalScope.h"
|
| #include "platform/Histogram.h"
|
| #include "platform/instrumentation/tracing/TraceEvent.h"
|
| +#include "platform/weborigin/SchemeRegistry.h"
|
|
|
| namespace {
|
|
|
| @@ -1083,6 +1084,7 @@ int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(
|
|
|
| UseCounter::UseCounter(Context context)
|
| : m_muteCount(0),
|
| + m_mutedByLoad(false),
|
| m_context(context),
|
| m_featuresRecorded(NumberOfFeatures),
|
| m_CSSRecorded(lastUnresolvedCSSProperty + 1) {}
|
| @@ -1127,14 +1129,29 @@ bool UseCounter::hasRecordedMeasurement(Feature feature) const {
|
| return m_featuresRecorded.quickGet(feature);
|
| }
|
|
|
| -void UseCounter::didCommitLoad() {
|
| +void UseCounter::didCommitLoad(KURL url) {
|
| m_legacyCounter.updateMeasurements();
|
|
|
| - // TODO: Is didCommitLoad really the right time to do this? crbug.com/608040
|
| + if (m_mutedByLoad) {
|
| + m_muteCount--;
|
| + m_mutedByLoad = false;
|
| + }
|
| +
|
| + // Use the protocol of the document being loaded into the main frame to
|
| + // decide whether this page is interesting from a metrics perspective.
|
| + // Note that SVGImage cases always have an about:blank URL
|
| + if (m_context == DefaultContext &&
|
| + !SchemeRegistry::shouldTrackUsageMetricsForScheme(url.protocol())) {
|
| + m_muteCount++;
|
| + m_mutedByLoad = true;
|
| + }
|
| +
|
| m_featuresRecorded.clearAll();
|
| - featuresHistogram().count(PageVisits);
|
| m_CSSRecorded.clearAll();
|
| - cssHistogram().count(totalPagesMeasuredCSSSampleId());
|
| + if (!m_muteCount) {
|
| + featuresHistogram().count(PageVisits);
|
| + cssHistogram().count(totalPagesMeasuredCSSSampleId());
|
| + }
|
| }
|
|
|
| void UseCounter::count(const Frame* frame, Feature feature) {
|
|
|