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

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

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.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d5b54478a8d5c5f73a4801a630a7a73b443047e5
--- /dev/null
+++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/workers/WorkerOrWorkletGlobalScope.h"
+
+#include "core/frame/Deprecation.h"
+#include "core/inspector/ConsoleMessage.h"
+#include "core/workers/WorkerReportingProxy.h"
+#include "core/workers/WorkerThread.h"
+
+namespace blink {
+
+WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope()
+ : m_deprecationWarningBits(UseCounter::NumberOfFeatures) {}
+
+WorkerOrWorkletGlobalScope::~WorkerOrWorkletGlobalScope() {}
+
+void WorkerOrWorkletGlobalScope::addDeprecationMessage(
+ UseCounter::Feature feature) {
+ DCHECK_NE(UseCounter::OBSOLETE_PageDestruction, feature);
+ DCHECK_GT(UseCounter::NumberOfFeatures, feature);
+
+ // For each deprecated feature, send console message at most once
+ // per worker lifecycle.
+ if (m_deprecationWarningBits.quickGet(feature))
+ return;
+ m_deprecationWarningBits.quickSet(feature);
+ DCHECK(!Deprecation::deprecationMessage(feature).isEmpty());
+ addConsoleMessage(
+ ConsoleMessage::create(DeprecationMessageSource, WarningMessageLevel,
+ Deprecation::deprecationMessage(feature)));
haraken 2016/12/05 11:37:27 Instead of maintaining m_deprecationWarningBits pe
nhiroki 2016/12/06 02:22:04 I'd prefer to keep this as is because: (1) Depreca
haraken 2016/12/06 02:28:55 Ah, makes sense. I was misunderstanding that the d
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698