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 4a513d9c4e91b640be7c4201a7a0a2dfc52a851a..02998abbd6e43f9675523009010d4a35632682bc 100644 |
| --- a/third_party/WebKit/Source/core/frame/UseCounter.cpp |
| +++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp |
| @@ -34,7 +34,7 @@ |
| #include "core/frame/LocalFrame.h" |
| #include "core/inspector/ConsoleMessage.h" |
| #include "core/workers/WorkerGlobalScope.h" |
| -#include "public/platform/Platform.h" |
| +#include "platform/Histogram.h" |
| namespace blink { |
| @@ -568,6 +568,12 @@ int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id) |
| static int maximumCSSSampleId() { return 518; } |
| +static EnumerationHistogram& featureObserverHistogram() |
| +{ |
| + DEFINE_STATIC_LOCAL(EnumerationHistogram, histogram, ("WebCore.FeatureObserver", UseCounter::NumberOfFeatures)); |
|
esprehn
2016/02/05 19:09:07
Do we not use UseCounters on workers? I think this
dtapuska
2016/02/05 19:25:32
I see Page is the only user of UseCounter. Are Pag
|
| + return histogram; |
| +} |
| + |
| void UseCounter::muteForInspector() |
| { |
| UseCounter::m_muteCount++; |
| @@ -587,16 +593,17 @@ UseCounter::UseCounter() |
| UseCounter::~UseCounter() |
| { |
| // We always log PageDestruction so that we have a scale for the rest of the features. |
| - Platform::current()->histogramEnumeration("WebCore.FeatureObserver", PageDestruction, NumberOfFeatures); |
| + featureObserverHistogram().count(PageDestruction); |
| updateMeasurements(); |
| } |
| void UseCounter::CountBits::updateMeasurements() |
| { |
| + EnumerationHistogram& featureHistogram = featureObserverHistogram(); |
| for (unsigned i = 0; i < NumberOfFeatures; ++i) { |
| if (m_bits.quickGet(i)) |
| - Platform::current()->histogramEnumeration("WebCore.FeatureObserver", i, NumberOfFeatures); |
| + featureHistogram.count(i); |
| } |
| // Clearing count bits is timing sensitive. |
| m_bits.clearAll(); |
| @@ -604,23 +611,24 @@ void UseCounter::CountBits::updateMeasurements() |
| void UseCounter::updateMeasurements() |
| { |
| - Platform::current()->histogramEnumeration("WebCore.FeatureObserver", PageVisits, NumberOfFeatures); |
| + featureObserverHistogram().count(PageVisits); |
| m_countBits.updateMeasurements(); |
| // FIXME: Sometimes this function is called more than once per page. The following |
| // bool guards against incrementing the page count when there are no CSS |
| // bits set. https://crbug.com/236262. |
| + DEFINE_STATIC_LOCAL(EnumerationHistogram, cssPropertiesHistogram, ("WebCore.FeatureObserver.CSSProperties", maximumCSSSampleId())); |
| bool needsPagesMeasuredUpdate = false; |
| for (int i = firstCSSProperty; i <= lastUnresolvedCSSProperty; ++i) { |
| if (m_CSSFeatureBits.quickGet(i)) { |
| int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i); |
| - Platform::current()->histogramEnumeration("WebCore.FeatureObserver.CSSProperties", cssSampleId, maximumCSSSampleId()); |
| + cssPropertiesHistogram.count(cssSampleId); |
| needsPagesMeasuredUpdate = true; |
| } |
| } |
| if (needsPagesMeasuredUpdate) |
| - Platform::current()->histogramEnumeration("WebCore.FeatureObserver.CSSProperties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId()); |
| + cssPropertiesHistogram.count(totalPagesMeasuredCSSSampleId()); |
| m_CSSFeatureBits.clearAll(); |
| } |