Clean up uses of JS_DefineProfilingFunctions
Categories
(Core :: XPConnect, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox69 | --- | fixed |
People
(Reporter: mccr8, Assigned: bzbarsky)
References
Details
Attachments
(2 files)
In his review comment for bug 1559263, bz said: "We should really kill the non-working JProfFunctions thing and find a less sprinkly way of doing JS_DefineProfilingFunctions for all our globals."
Reporter | ||
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
So in particular, we call JS_DefineProfilingFunctions
in the following:
nsJSContext::InitClasses
WorkerPrivate::RegisterBindings
XPCShellEnvironment::Init
mozJSComponentLoader::CreateLoaderGlobal
XRE_XPCShellMain
#5, #4, #3 all create the global via xpc::InitClassesWithNewWrappedGlobal
. They are also the only callers of that method, so we could just move the JS_DefineProfilingFunctions
call into there, I would think.
#2 creates the global via a WrapGlobalObject
call on one of the WorkerGlobalScope implementations. Those eventually land in dom::CreateGlobal
via binding Wrap
methods.
#1 creates the global via CreateNativeGlobalForInner
(except when it's getting a window out of bfcache, in which case it will try to define this stuff a second time??), which calls Window_Binding::Wrap
, which lands in dom::CreateGlobal
.
The only other callers of dom::CreateGlobal
are AudioWorkletGlobalScope_Binding::Wrap
, PaintWorkletGlobalScope_Binding::Wrap
, and WorkerDebuggerGlobalScope_Binding::Wrap
. Should those globals have profiling functions? If yes, we can just move the call into dom::CreateGlobal
. If not, we could maybe add specializations of CreateGlobalOptions
that indicate whether profiling functions are desired...
(My gut feeling is that we do want them in worklets; no idea about the worker debugger global.)
Assignee | ||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
Profiling functions look useful for worklets also, yes.
I can't answer for WorkerDebuggerGlobalScope, but, even if not useful, would there be any harm in having the methods?
Assignee | ||
Comment 4•5 years ago
|
||
All callers of InitClassesWithNewWrappedGlobal already call it.
Assignee | ||
Comment 5•5 years ago
|
||
Vairious callers either already call it or should but are forgetting to. The exception is WorkerDebuggerGlobalScope_Binding::Wrap, but it should be OK to set up the profiling functions there too. r=mcr8
Pushed by bzbarsky@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/14b069bf9799 part 1. Move JS_DefineProfilingFunctions into InitClassesWithNewWrappedGlobal. r=mccr8 https://hg.mozilla.org/integration/autoland/rev/740f7d999d04 part 2. Move JS_DefineProfilingFunctions into dom::CreateGlobal. r=mccr8
Comment 7•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/14b069bf9799
https://hg.mozilla.org/mozilla-central/rev/740f7d999d04
Updated•5 years ago
|
Description
•