commit 13b332cedd5cb51ced0cf85c03681da7dc35ede3
parent d2eb173ceef986bbd712ee147c1738dde8bb7cad
Author: Matthew Gaudet <mgaudet@mozilla.com>
Date: Fri, 17 Oct 2025 21:24:03 +0000
Bug 1991164 - Support LogMicroTaskQueueEntry::Run for JS Micro Tasks r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D268618
Diffstat:
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp
@@ -981,6 +981,8 @@ static bool MOZ_CAN_RUN_SCRIPT
RunMicroTask(JSContext* aCx, JS::MutableHandle<JS::MicroTask> task) {
if (RefPtr<MicroTaskRunnable> runnable =
MaybeUnwrapTaskToOwnedRunnable(task)) {
+ LogMicroTaskRunnable::Run log(runnable);
+
AUTO_PROFILER_TERMINATING_FLOW_MARKER_FLOW_ONLY(
"RunMicroTaskRunnable", OTHER, Flow::FromPointer(runnable.get()));
AutoSlowOperation aso;
@@ -988,6 +990,12 @@ RunMicroTask(JSContext* aCx, JS::MutableHandle<JS::MicroTask> task) {
return true;
}
+ MOZ_ASSERT(task.isObject());
+
+ // Note this simply prints the address & does not hold on to it, so
+ // this is fine from a GC perspective.
+ LogJSMicroTask::Run log(&task.toObject());
+
// Avoid the overhead of GetFlowIdFromJSMicroTask in the common case
// of not having the profiler enabled.
mozilla::Maybe<AutoProfilerTerminatingFlowMarkerFlowOnly> terminatingMarker;
@@ -1204,9 +1212,6 @@ bool CycleCollectedJSContext::PerformMicroTaskCheckPoint(bool aForce) {
}
didProcess = true;
- // Bug 1991164: Need to support LogMicroTaskQueue Entry for
- // LogMicroTaskQueueEntry::Run log(job.get().get());
-
// Note: We're dropping the return value on the floor here. This is
// consistent with the previous implementation, which left the
// exception if it was there pending on the context, but likely should
diff --git a/xpcom/threads/nsThreadUtils.cpp b/xpcom/threads/nsThreadUtils.cpp
@@ -659,6 +659,7 @@ template class LogTaskBase<Task>;
template class LogTaskBase<PresShell>;
template class LogTaskBase<dom::FrameRequestCallback>;
template class LogTaskBase<dom::VideoFrameRequestCallback>;
+template class LogTaskBase<JSObject>;
MOZ_THREAD_LOCAL(nsISerialEventTarget*)
SerialEventTargetGuard::sCurrentThreadTLS;
diff --git a/xpcom/threads/nsThreadUtils.h b/xpcom/threads/nsThreadUtils.h
@@ -35,6 +35,7 @@
class MessageLoop;
class nsIThread;
+class JSObject;
//-----------------------------------------------------------------------------
// These methods are alternatives to the methods on nsIThreadManager, provided
@@ -1840,6 +1841,7 @@ typedef LogTaskBase<PresShell> LogPresShellObserver;
typedef LogTaskBase<dom::FrameRequestCallback> LogFrameRequestCallback;
typedef LogTaskBase<dom::VideoFrameRequestCallback>
LogVideoFrameRequestCallback;
+typedef LogTaskBase<JSObject> LogJSMicroTask;
// If you add new types don't forget to add:
// `template class LogTaskBase<YourType>;` to nsThreadUtils.cpp