Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1350)

Unified Diff: third_party/WebKit/Source/core/frame/UseCounter.cpp

Issue 1652983005: Remove Enumeration Histograms from the Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms_5a
Patch Set: Rebase two new histograms were added today Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ 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();
}

Powered by Google App Engine
This is Rietveld 408576698