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

Unified Diff: Source/core/frame/UseCounter.h

Issue 901143002: Support deprecation warnings in shared/service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/UseCounter.h
diff --git a/Source/core/frame/UseCounter.h b/Source/core/frame/UseCounter.h
index d24753fa4d53b2b9c947732c11be03021f26fbcb..04a0fef0eba98ee192ad561da671a51aa727b870 100644
--- a/Source/core/frame/UseCounter.h
+++ b/Source/core/frame/UseCounter.h
@@ -654,8 +654,8 @@ public:
// deprecation warnings when we're actively interested in removing them from
// the platform.
//
- // The ExecutionContext* overload doesn't work for shared workers and
- // service workers.
+ // For shared workers and service workers, the ExecutionContext* overload
+ // doesn't count the usage but only sends a console warning.
static void countDeprecation(const LocalFrame*, Feature);
static void countDeprecation(ExecutionContext*, Feature);
static void countDeprecation(const Document&, Feature);
@@ -663,7 +663,7 @@ public:
// if you don't want to count metrics in private scripts. You should use
// countDeprecationIfNotPrivateScript() in a binding layer.
static void countDeprecationIfNotPrivateScript(v8::Isolate*, ExecutionContext*, Feature);
- String deprecationMessage(Feature);
+ static String deprecationMessage(Feature);
void didCommitLoad();
@@ -676,30 +676,38 @@ public:
static void muteForInspector();
static void unmuteForInspector();
-private:
- static int m_muteCount;
-
- bool recordMeasurement(Feature feature)
- {
- if (UseCounter::m_muteCount)
- return false;
- ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor.
- ASSERT(feature < NumberOfFeatures);
- if (!m_countBits) {
- m_countBits = adoptPtr(new BitVector(NumberOfFeatures));
- m_countBits->clearAll();
+ class CountBits {
+ public:
+ bool recordMeasurement(Feature feature)
+ {
+ if (UseCounter::m_muteCount)
+ return false;
+ ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor.
+ ASSERT(feature < NumberOfFeatures);
+ if (!m_bits) {
+ m_bits = adoptPtr(new BitVector(NumberOfFeatures));
+ m_bits->clearAll();
+ }
+
+ if (m_bits->quickGet(feature))
+ return false;
+
+ m_bits->quickSet(feature);
+ return true;
}
+ void updateMeasurements();
- if (m_countBits->quickGet(feature))
- return false;
+ private:
+ OwnPtr<BitVector> m_bits;
+ };
- m_countBits->quickSet(feature);
- return true;
- }
+private:
+ static int m_muteCount;
+ bool recordMeasurement(Feature feature) { return m_countBits.recordMeasurement(feature); }
void updateMeasurements();
- OwnPtr<BitVector> m_countBits;
+ CountBits m_countBits;
BitVector m_CSSFeatureBits;
};
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698