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

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

Issue 2857583003: Worker: Avoid sending IPC messages for features already counted (Closed)
Patch Set: wip 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
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 322045ff9d0d74ff9a424546656b0cdee47509eb..8743d587960f8145e9fd6db7cd6e97f53abcee2f 100644
--- a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
@@ -17,24 +17,33 @@
namespace blink {
WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope()
- : deprecation_warning_bits_(UseCounter::kNumberOfFeatures) {}
+ : used_features_(UseCounter::kNumberOfFeatures) {}
WorkerOrWorkletGlobalScope::~WorkerOrWorkletGlobalScope() = default;
-void WorkerOrWorkletGlobalScope::AddDeprecationMessage(
- UseCounter::Feature feature) {
+void WorkerOrWorkletGlobalScope::CountFeature(UseCounter::Feature feature) {
DCHECK_NE(UseCounter::kOBSOLETE_PageDestruction, feature);
DCHECK_GT(UseCounter::kNumberOfFeatures, feature);
+ if (used_features_.QuickGet(feature))
+ return;
+ used_features_.QuickSet(feature);
+ ReportFeature(feature);
+}
- // For each deprecated feature, send console message at most once
- // per worker lifecycle.
- if (deprecation_warning_bits_.QuickGet(feature))
+void WorkerOrWorkletGlobalScope::CountDeprecation(UseCounter::Feature feature) {
+ DCHECK_NE(UseCounter::kOBSOLETE_PageDestruction, feature);
+ DCHECK_GT(UseCounter::kNumberOfFeatures, feature);
+ if (used_features_.QuickGet(feature))
return;
- deprecation_warning_bits_.QuickSet(feature);
+ used_features_.QuickSet(feature);
+
+ // Adds a deprecation message to the console.
DCHECK(!Deprecation::DeprecationMessage(feature).IsEmpty());
AddConsoleMessage(
ConsoleMessage::Create(kDeprecationMessageSource, kWarningMessageLevel,
Deprecation::DeprecationMessage(feature)));
+
+ ReportDeprecation(feature);
}
void WorkerOrWorkletGlobalScope::PostTask(
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698