зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1202706 - Part 3: Hook up worker use counters to WebIDL bindings; r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D53749 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ab7bcaf8da
Коммит
a8a12bf5b1
|
@ -3880,6 +3880,13 @@ void SetUseCounter(JSObject* aObject, UseCounter aUseCounter) {
|
|||
}
|
||||
}
|
||||
|
||||
void SetUseCounter(UseCounterWorker aUseCounter) {
|
||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
workerPrivate->SetUseCounter(aUseCounter);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
#define DEPRECATED_OPERATION(_op) #_op,
|
||||
|
|
|
@ -50,6 +50,7 @@ class nsGenericHTMLElement;
|
|||
namespace mozilla {
|
||||
|
||||
enum UseCounter : int16_t;
|
||||
enum class UseCounterWorker : int16_t;
|
||||
|
||||
namespace dom {
|
||||
class CustomElementReactionsStack;
|
||||
|
@ -3097,6 +3098,7 @@ already_AddRefed<Element> CreateXULOrHTMLElement(
|
|||
JS::Handle<JSObject*> aGivenProto, ErrorResult& aRv);
|
||||
|
||||
void SetUseCounter(JSObject* aObject, UseCounter aUseCounter);
|
||||
void SetUseCounter(UseCounterWorker aUseCounter);
|
||||
|
||||
// Warnings
|
||||
void DeprecationWarning(JSContext* aCx, JSObject* aObject,
|
||||
|
|
|
@ -8095,7 +8095,33 @@ class CGPerSignatureCall(CGThing):
|
|||
|
||||
if useCounterName:
|
||||
# Generate a telemetry call for when [UseCounter] is used.
|
||||
code = "SetUseCounter(obj, eUseCounter_%s);\n" % useCounterName
|
||||
windowCode = fill(
|
||||
"""
|
||||
SetUseCounter(obj, eUseCounter_${useCounterName});
|
||||
""",
|
||||
useCounterName = useCounterName)
|
||||
workerCode = fill(
|
||||
"""
|
||||
SetUseCounter(UseCounterWorker::${useCounterName});
|
||||
""",
|
||||
useCounterName = useCounterName)
|
||||
code = ""
|
||||
if idlNode.isExposedInWindow() and idlNode.isExposedInAnyWorker():
|
||||
code += fill(
|
||||
"""
|
||||
if (NS_IsMainThread()) {
|
||||
${windowCode}
|
||||
} else {
|
||||
${workerCode}
|
||||
}
|
||||
""",
|
||||
windowCode=windowCode,
|
||||
workerCode=workerCode)
|
||||
elif idlNode.isExposedInWindow():
|
||||
code += windowCode
|
||||
elif idlNode.isExposedInAnyWorker():
|
||||
code += workerCode
|
||||
|
||||
cgThings.append(CGGeneric(code))
|
||||
|
||||
self.cgRoot = CGList(cgThings)
|
||||
|
|
Загрузка…
Ссылка в новой задаче