Chromium Code Reviews| 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 |