See engine.cpp and JS::SetJobQueue().
| 964 | |
| 965 | // See engine.cpp and JS::SetJobQueue(). |
| 966 | bool GjsContextPrivate::enqueuePromiseJob(JSContext* cx [[maybe_unused]], |
| 967 | JS::HandleObject promise, |
| 968 | JS::HandleObject job, |
| 969 | JS::HandleObject allocation_site, |
| 970 | JS::HandleObject incumbent_global |
| 971 | [[maybe_unused]]) { |
| 972 | g_assert(cx == m_cx); |
| 973 | g_assert(from_cx(cx) == this); |
| 974 | |
| 975 | gjs_debug(GJS_DEBUG_MAINLOOP, |
| 976 | "Enqueue job %s, promise=%s, allocation site=%s", |
| 977 | gjs_debug_object(job).c_str(), gjs_debug_object(promise).c_str(), |
| 978 | gjs_debug_object(allocation_site).c_str()); |
| 979 | |
| 980 | if (!m_job_queue.append(job)) { |
| 981 | JS_ReportOutOfMemory(m_cx); |
| 982 | return false; |
| 983 | } |
| 984 | |
| 985 | JS::JobQueueMayNotBeEmpty(m_cx); |
| 986 | m_dispatcher.start(); |
| 987 | return true; |
| 988 | } |
| 989 | |
| 990 | // Override of JobQueue::runJobs(). Called by js::RunJobs(), and when execution |
| 991 | // of the job queue was interrupted by the debugger and is resuming. |
nothing calls this directly
no test coverage detected