Bug 1947313 - Instrument the ChannelEvent queue with flows. r=valentin,necko-reviewers CLOSED TREE

This lets us track network events back to the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D237643
This commit is contained in:
Jeff Muizelaar
2025-02-11 14:33:15 +00:00
parent 52a79d9c33
commit ee624f9ac1
2 changed files with 12 additions and 0 deletions

View File

@@ -12,6 +12,7 @@
#include "nsIChannel.h"
#include "mozilla/dom/Document.h"
#include "nsThreadUtils.h"
#include "mozilla/FlowMarkers.h"
namespace mozilla {
namespace net {
@@ -79,6 +80,8 @@ void ChannelEventQueue::FlushQueue() {
}
{
MutexAutoUnlock unlock(mMutex);
AUTO_PROFILER_TERMINATING_FLOW_MARKER("ChannelEvent", NETWORK,
Flow::FromPointer(event.get()));
event->Run();
}
} // end of while(true)

View File

@@ -17,6 +17,7 @@
#include "mozilla/RecursiveMutex.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "mozilla/FlowMarkers.h"
class nsISupports;
@@ -232,6 +233,8 @@ inline void ChannelEventQueue::RunOrEnqueue(ChannelEvent* aCallback,
// c. an event is currently flushed/executed from the queue
// d. queue is non-empty (pending events on remote thread targets)
if (enqueue) {
PROFILER_MARKER("ChannelEventQueue::Enqueue", NETWORK, {}, FlowMarker,
Flow::FromPointer(event.get()));
mEventQueue.AppendElement(std::move(event));
return;
}
@@ -255,6 +258,10 @@ inline void ChannelEventQueue::RunOrEnqueue(ChannelEvent* aCallback,
// call CompleteResume to flush the queue. All the events are run
// synchronously in their respective target threads.
SuspendInternal();
PROFILER_MARKER("ChannelEventQueue::Enqueue", NETWORK, {}, FlowMarker,
Flow::FromPointer(event.get()));
mEventQueue.AppendElement(std::move(event));
ResumeInternal();
return;
@@ -262,6 +269,8 @@ inline void ChannelEventQueue::RunOrEnqueue(ChannelEvent* aCallback,
}
MOZ_RELEASE_ASSERT(!aAssertionWhenNotQueued);
AUTO_PROFILER_TERMINATING_FLOW_MARKER("ChannelEvent", OTHER,
Flow::FromPointer(event.get()));
// execute the event synchronously if we are not queuing it and
// the target thread is the current thread
event->Run();