Add `MOZ_ASSERT_IF(XRE_IsParentProcess(), NS_IsMainThread())` in `StreamMetaJSCustomObject()`
Categories
(Core :: Gecko Profiler, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox97 | --- | fixed |
People
(Reporter: mozbugz, Assigned: mozbugz)
Details
Attachments
(1 file)
If a developer tries to generate a profile from a non-main thread, it looks like it works fine, but the profile is actually incomplete, because we don't include all the necessary data in that case, which normally happens in child processes where such redundant data is not needed: https://searchfox.org/mozilla-central/rev/9028b0458cc1f432870d2996b186b0938dda734a/tools/profiler/core/platform.cpp#2640-2650
To avoid this confusing situation, it may be worth adding a hard check like MOZ_ASSERT_IF(XRE_IsParentProcess(), NS_IsMainThread())
, with some explanations, so that it will be immediately obvious that this is the wrong thing to do, and such call should be dispatched to the main thread.
(This main-thread limitation is due to the need to call some APIs that only work from the main thread, like services::GetObserverService()
.)
Assignee | ||
Comment 1•2 years ago
|
||
This is to avoid situations where a developer may call this from another thread, and get a confusingly incomplete profile.
Updated•2 years ago
|
Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/23777ea03332 In the parent process, assert that profiles are only generated on the main thread - r=mstange
Comment 3•2 years ago
|
||
bugherder |
Description
•