Bug 1880233 - Add names to MainThreadWorkerRunnable derived runnables. r=dom-worker-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D201812
This commit is contained in:
Jens Stutte 2024-02-14 16:13:24 +00:00
parent 143dc3245c
commit a4a855b0e3
5 changed files with 23 additions and 13 deletions

View file

@ -74,7 +74,7 @@ class ContinueConsumeBodyRunnable final : public MainThreadWorkerRunnable {
ContinueConsumeBodyRunnable(BodyConsumer* aBodyConsumer, ContinueConsumeBodyRunnable(BodyConsumer* aBodyConsumer,
WorkerPrivate* aWorkerPrivate, nsresult aStatus, WorkerPrivate* aWorkerPrivate, nsresult aStatus,
uint32_t aLength, uint8_t* aResult) uint32_t aLength, uint8_t* aResult)
: MainThreadWorkerRunnable(aWorkerPrivate), : MainThreadWorkerRunnable(aWorkerPrivate, "ContinueConsumeBodyRunnable"),
mBodyConsumer(aBodyConsumer), mBodyConsumer(aBodyConsumer),
mStatus(aStatus), mStatus(aStatus),
mLength(aLength), mLength(aLength),
@ -159,7 +159,8 @@ class ContinueConsumeBlobBodyRunnable final : public MainThreadWorkerRunnable {
ContinueConsumeBlobBodyRunnable(BodyConsumer* aBodyConsumer, ContinueConsumeBlobBodyRunnable(BodyConsumer* aBodyConsumer,
WorkerPrivate* aWorkerPrivate, WorkerPrivate* aWorkerPrivate,
BlobImpl* aBlobImpl) BlobImpl* aBlobImpl)
: MainThreadWorkerRunnable(aWorkerPrivate), : MainThreadWorkerRunnable(aWorkerPrivate,
"ContinueConsumeBlobBodyRunnable"),
mBodyConsumer(aBodyConsumer), mBodyConsumer(aBodyConsumer),
mBlobImpl(aBlobImpl) { mBlobImpl(aBlobImpl) {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());

View file

@ -792,7 +792,7 @@ class WorkerFetchResponseRunnable final : public MainThreadWorkerRunnable {
WorkerFetchResponseRunnable(WorkerPrivate* aWorkerPrivate, WorkerFetchResponseRunnable(WorkerPrivate* aWorkerPrivate,
WorkerFetchResolver* aResolver, WorkerFetchResolver* aResolver,
SafeRefPtr<InternalResponse> aResponse) SafeRefPtr<InternalResponse> aResponse)
: MainThreadWorkerRunnable(aWorkerPrivate), : MainThreadWorkerRunnable(aWorkerPrivate, "WorkerFetchResponseRunnable"),
mResolver(aResolver), mResolver(aResolver),
mInternalResponse(std::move(aResponse)) { mInternalResponse(std::move(aResponse)) {
MOZ_ASSERT(mResolver); MOZ_ASSERT(mResolver);
@ -848,7 +848,8 @@ class WorkerDataAvailableRunnable final : public MainThreadWorkerRunnable {
public: public:
WorkerDataAvailableRunnable(WorkerPrivate* aWorkerPrivate, WorkerDataAvailableRunnable(WorkerPrivate* aWorkerPrivate,
WorkerFetchResolver* aResolver) WorkerFetchResolver* aResolver)
: MainThreadWorkerRunnable(aWorkerPrivate), mResolver(aResolver) {} : MainThreadWorkerRunnable(aWorkerPrivate, "WorkerDataAvailableRunnable"),
mResolver(aResolver) {}
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override { bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
MOZ_ASSERT(aWorkerPrivate); MOZ_ASSERT(aWorkerPrivate);
@ -888,7 +889,8 @@ class WorkerFetchResponseEndRunnable final : public MainThreadWorkerRunnable,
WorkerFetchResponseEndRunnable(WorkerPrivate* aWorkerPrivate, WorkerFetchResponseEndRunnable(WorkerPrivate* aWorkerPrivate,
WorkerFetchResolver* aResolver, WorkerFetchResolver* aResolver,
FetchDriverObserver::EndReason aReason) FetchDriverObserver::EndReason aReason)
: MainThreadWorkerRunnable(aWorkerPrivate), : MainThreadWorkerRunnable(aWorkerPrivate,
"WorkerFetchResponseEndRunnable"),
WorkerFetchResponseEndBase(aResolver), WorkerFetchResponseEndBase(aResolver),
mReason(aReason) {} mReason(aReason) {}

View file

@ -307,8 +307,10 @@ nsresult CheckScope(nsIPrincipal* aPrincipal, const nsACString& aScope,
// thread. // thread.
class NotificationWorkerRunnable : public MainThreadWorkerRunnable { class NotificationWorkerRunnable : public MainThreadWorkerRunnable {
protected: protected:
explicit NotificationWorkerRunnable(WorkerPrivate* aWorkerPrivate) explicit NotificationWorkerRunnable(
: MainThreadWorkerRunnable(aWorkerPrivate) {} WorkerPrivate* aWorkerPrivate,
const char* aName = "NotificationWorkerRunnable")
: MainThreadWorkerRunnable(aWorkerPrivate, aName) {}
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override { bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
aWorkerPrivate->AssertIsOnWorkerThread(); aWorkerPrivate->AssertIsOnWorkerThread();
@ -336,7 +338,8 @@ class NotificationEventWorkerRunnable final
public: public:
NotificationEventWorkerRunnable(Notification* aNotification, NotificationEventWorkerRunnable(Notification* aNotification,
const nsString& aEventName) const nsString& aEventName)
: NotificationWorkerRunnable(aNotification->mWorkerPrivate), : NotificationWorkerRunnable(aNotification->mWorkerPrivate,
"NotificationEventWorkerRunnable"),
mNotification(aNotification), mNotification(aNotification),
mEventName(aEventName) {} mEventName(aEventName) {}
@ -350,7 +353,8 @@ class ReleaseNotificationRunnable final : public NotificationWorkerRunnable {
public: public:
explicit ReleaseNotificationRunnable(Notification* aNotification) explicit ReleaseNotificationRunnable(Notification* aNotification)
: NotificationWorkerRunnable(aNotification->mWorkerPrivate), : NotificationWorkerRunnable(aNotification->mWorkerPrivate,
"ReleaseNotificationRunnable"),
mNotification(aNotification) {} mNotification(aNotification) {}
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override { bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
@ -1052,7 +1056,8 @@ class NotificationClickWorkerRunnable final
NotificationClickWorkerRunnable( NotificationClickWorkerRunnable(
Notification* aNotification, Notification* aNotification,
const nsMainThreadPtrHandle<nsPIDOMWindowInner>& aWindow) const nsMainThreadPtrHandle<nsPIDOMWindowInner>& aWindow)
: NotificationWorkerRunnable(aNotification->mWorkerPrivate), : NotificationWorkerRunnable(aNotification->mWorkerPrivate,
"NotificationClickWorkerRunnable"),
mNotification(aNotification), mNotification(aNotification),
mWindow(aWindow) { mWindow(aWindow) {
MOZ_ASSERT_IF(mWorkerPrivate->IsServiceWorker(), !mWindow); MOZ_ASSERT_IF(mWorkerPrivate->IsServiceWorker(), !mWindow);
@ -1695,7 +1700,7 @@ class WorkerGetResultRunnable final : public NotificationWorkerRunnable {
WorkerGetResultRunnable(WorkerPrivate* aWorkerPrivate, WorkerGetResultRunnable(WorkerPrivate* aWorkerPrivate,
PromiseWorkerProxy* aPromiseProxy, PromiseWorkerProxy* aPromiseProxy,
nsTArray<NotificationStrings>&& aStrings) nsTArray<NotificationStrings>&& aStrings)
: NotificationWorkerRunnable(aWorkerPrivate), : NotificationWorkerRunnable(aWorkerPrivate, "WorkerGetResultRunnable"),
mPromiseProxy(aPromiseProxy), mPromiseProxy(aPromiseProxy),
mStrings(std::move(aStrings)) {} mStrings(std::move(aStrings)) {}

View file

@ -2639,7 +2639,8 @@ namespace {
class CancelRunnable final : public MainThreadWorkerRunnable { class CancelRunnable final : public MainThreadWorkerRunnable {
public: public:
CancelRunnable(ThreadSafeWorkerRef* aWorkerRef, WebSocketImpl* aImpl) CancelRunnable(ThreadSafeWorkerRef* aWorkerRef, WebSocketImpl* aImpl)
: MainThreadWorkerRunnable(aWorkerRef->Private()), mImpl(aImpl) {} : MainThreadWorkerRunnable(aWorkerRef->Private(), "CancelRunnable"),
mImpl(aImpl) {}
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override { bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
aWorkerPrivate->AssertIsOnWorkerThread(); aWorkerPrivate->AssertIsOnWorkerThread();

View file

@ -19,7 +19,8 @@ namespace {
class WorkerCSPEventRunnable final : public MainThreadWorkerRunnable { class WorkerCSPEventRunnable final : public MainThreadWorkerRunnable {
public: public:
WorkerCSPEventRunnable(WorkerPrivate* aWorkerPrivate, const nsAString& aJSON) WorkerCSPEventRunnable(WorkerPrivate* aWorkerPrivate, const nsAString& aJSON)
: MainThreadWorkerRunnable(aWorkerPrivate), mJSON(aJSON) {} : MainThreadWorkerRunnable(aWorkerPrivate, "WorkerCSPEventRunnable"),
mJSON(aJSON) {}
private: private:
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) { bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) {