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

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

Issue 2894063002: Expose UseCounter::Feature enum out of blink as WebFeature (Closed)
Patch Set: Rebase Created 3 years, 7 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 a776b7476ecae707a061b2410297131216d3d9c0..f0ca055e1c44e0f6febd51946ebf087b643a3513 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.cpp
+++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp
@@ -1114,39 +1114,39 @@ void UseCounter::UnmuteForInspector() {
mute_count_--;
}
-void UseCounter::RecordMeasurement(Feature feature) {
+void UseCounter::RecordMeasurement(WebFeature feature) {
if (mute_count_)
return;
// PageDestruction is reserved as a scaling factor.
- DCHECK_NE(kOBSOLETE_PageDestruction, feature);
- DCHECK_NE(kPageVisits, feature);
- DCHECK_GE(kNumberOfFeatures, feature);
+ DCHECK_NE(WebFeature::kOBSOLETE_PageDestruction, feature);
+ DCHECK_NE(WebFeature::kPageVisits, feature);
+ DCHECK_GE(WebFeature::kNumberOfFeatures, feature);
- if (!features_recorded_.QuickGet(feature)) {
+ if (!features_recorded_.QuickGet(static_cast<int>(feature))) {
// Note that HTTPArchive tooling looks specifically for this event - see
// https://github.com/HTTPArchive/httparchive/issues/59
if (context_ != kDisabledContext) {
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.feature_usage"),
- "FeatureFirstUsed", "feature", feature);
+ "FeatureFirstUsed", "feature", static_cast<int>(feature));
FeaturesHistogram().Count(feature);
NotifyFeatureCounted(feature);
}
- features_recorded_.QuickSet(feature);
+ features_recorded_.QuickSet(static_cast<int>(feature));
}
legacy_counter_.CountFeature(feature);
}
-bool UseCounter::HasRecordedMeasurement(Feature feature) const {
+bool UseCounter::HasRecordedMeasurement(WebFeature feature) const {
if (mute_count_)
return false;
// PageDestruction is reserved as a scaling factor.
- DCHECK_NE(kOBSOLETE_PageDestruction, feature);
- DCHECK_NE(kPageVisits, feature);
- DCHECK_GE(kNumberOfFeatures, feature);
+ DCHECK_NE(WebFeature::kOBSOLETE_PageDestruction, feature);
+ DCHECK_NE(WebFeature::kPageVisits, feature);
+ DCHECK_GE(WebFeature::kNumberOfFeatures, feature);
- return features_recorded_.QuickGet(feature);
+ return features_recorded_.QuickGet(static_cast<int>(feature));
}
DEFINE_TRACE(UseCounter) {
@@ -1181,7 +1181,7 @@ void UseCounter::DidCommitLoad(KURL url) {
}
}
-void UseCounter::Count(const Frame* frame, Feature feature) {
+void UseCounter::Count(const Frame* frame, WebFeature feature) {
if (!frame)
return;
Page* page = frame->GetPage();
@@ -1191,7 +1191,7 @@ void UseCounter::Count(const Frame* frame, Feature feature) {
page->GetUseCounter().Count(feature);
}
-void UseCounter::Count(const Document& document, Feature feature) {
+void UseCounter::Count(const Document& document, WebFeature feature) {
Count(document.GetFrame(), feature);
}
@@ -1222,15 +1222,17 @@ bool UseCounter::IsCounted(Document& document, const String& string) {
return page->GetUseCounter().IsCounted(unresolved_property);
}
-void UseCounter::Count(ExecutionContext* context, Feature feature) {
+void UseCounter::Count(ExecutionContext* context, WebFeature feature) {
if (!context)
return;
if (context->IsDocument()) {
Count(*ToDocument(context), feature);
return;
}
- if (context->IsWorkerOrWorkletGlobalScope())
- ToWorkerOrWorkletGlobalScope(context)->CountFeature(feature);
+ if (context->IsWorkerOrWorkletGlobalScope()) {
+ ToWorkerOrWorkletGlobalScope(context)->CountFeature(
+ static_cast<Feature>(feature));
+ }
}
void UseCounter::CountCrossOriginIframe(const Document& document,
@@ -1260,7 +1262,7 @@ void UseCounter::Count(CSSParserMode css_parser_mode, CSSPropertyID property) {
legacy_counter_.CountCSS(property);
}
-void UseCounter::Count(Feature feature) {
+void UseCounter::Count(WebFeature feature) {
RecordMeasurement(feature);
}
@@ -1306,7 +1308,7 @@ void UseCounter::CountAnimatedCSS(CSSPropertyID property) {
}
}
-void UseCounter::NotifyFeatureCounted(Feature feature) {
+void UseCounter::NotifyFeatureCounted(WebFeature feature) {
DCHECK(!mute_count_);
DCHECK_NE(kDisabledContext, context_);
HeapHashSet<Member<Observer>> to_be_removed;
@@ -1393,8 +1395,8 @@ UseCounter::LegacyCounter::~LegacyCounter() {
UpdateMeasurements();
}
-void UseCounter::LegacyCounter::CountFeature(Feature feature) {
- feature_bits_.QuickSet(feature);
+void UseCounter::LegacyCounter::CountFeature(WebFeature feature) {
+ feature_bits_.QuickSet(static_cast<int>(feature));
}
void UseCounter::LegacyCounter::CountCSS(CSSPropertyID property) {

Powered by Google App Engine
This is Rietveld 408576698