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

Unified Diff: third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h

Issue 2535093003: Worker: Connect UseCounter to workers and worklets (Closed)
Patch Set: remove 'const' qualifiers Created 4 years 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/workers/WorkerOrWorkletGlobalScope.h
diff --git a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h
index 348dd1fcb9211c0d13092411bf4fac44acd8224c..6a91b68eba8aa252d044e7225238c53526c93423 100644
--- a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h
+++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h
@@ -6,6 +6,7 @@
#define WorkerOrWorkletGlobalScope_h
#include "core/dom/ExecutionContext.h"
+#include "core/frame/UseCounter.h"
namespace blink {
@@ -15,6 +16,12 @@ class WorkerThread;
class CORE_EXPORT WorkerOrWorkletGlobalScope : public ExecutionContext {
public:
+ WorkerOrWorkletGlobalScope();
+ virtual ~WorkerOrWorkletGlobalScope();
+
+ // ExecutionContext
+ bool isWorkerOrWorkletGlobalScope() const final { return true; }
+
virtual ScriptWrappable* getScriptWrappable() const = 0;
virtual WorkerOrWorkletScriptController* scriptController() = 0;
@@ -28,9 +35,23 @@ class CORE_EXPORT WorkerOrWorkletGlobalScope : public ExecutionContext {
// sub-classes to perform any cleanup needed.
virtual void dispose() = 0;
+ // Called from UseCounter to record API use in this execution context.
+ virtual void countFeature(UseCounter::Feature) = 0;
+
+ // Called from UseCounter to record deprecated API use in this execution
+ // context. Sub-classes should call addDeprecationMessage() in this function.
+ virtual void countDeprecation(UseCounter::Feature) = 0;
+
// May return nullptr if this global scope is not threaded (i.e.,
// MainThreadWorkletGlobalScope) or after dispose() is called.
virtual WorkerThread* thread() const = 0;
+
+ protected:
+ // Adds a deprecation message to the console.
+ void addDeprecationMessage(UseCounter::Feature);
+
+ private:
+ BitVector m_deprecationWarningBits;
};
DEFINE_TYPE_CASTS(

Powered by Google App Engine
This is Rietveld 408576698