No issue - add API to tell Profile Timeline Recording state to JS engine

Based-on: m-c 1342070/5
This commit is contained in:
Martok 2023-01-21 22:48:18 +01:00 committed by roytam1
commit 531906eb87
3 changed files with 37 additions and 0 deletions

View file

@ -1276,6 +1276,20 @@ JS::detail::ComputeThis(JSContext* cx, Value* vp)
return thisv;
}
static bool gProfileTimelineRecordingEnabled = false;
JS_PUBLIC_API(void)
JS::SetProfileTimelineRecordingEnabled(bool enabled)
{
gProfileTimelineRecordingEnabled = enabled;
}
JS_PUBLIC_API(bool)
JS::IsProfileTimelineRecordingEnabled()
{
return gProfileTimelineRecordingEnabled;
}
JS_PUBLIC_API(void*)
JS_malloc(JSContext* cx, size_t nbytes)
{

View file

@ -1545,6 +1545,22 @@ JS_DefineProfilingFunctions(JSContext* cx, JS::HandleObject obj);
extern JS_PUBLIC_API(bool)
JS_DefineDebuggerObject(JSContext* cx, JS::HandleObject obj);
namespace JS {
/**
* Tell JS engine whether Profile Timeline Recording is enabled or not.
* If Profile Timeline Recording is enabled, data shown there like stack won't
* be optimized out.
* This is global state and not associated with specific runtime or context.
*/
extern JS_PUBLIC_API(void)
SetProfileTimelineRecordingEnabled(bool enabled);
extern JS_PUBLIC_API(bool)
IsProfileTimelineRecordingEnabled();
} // namespace JS
#ifdef JS_HAS_CTYPES
/**
* Initialize the 'ctypes' object on a global variable 'obj'. The 'ctypes'