Bug 1339289 - Give names to a lot of common runnables (r=ehsan)
authorBill McCloskey <billm@mozilla.com>
Fri, 10 Feb 2017 22:11:48 -0800
changeset 372213 6ea3593a23e443f50f877ece94e14e9b3f6ffdf2
parent 372212 68b195e78af058066e43991485085482c1af802c
child 372214 c64f0271649030394d2a29872513c9ec36521fa0
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1339289
milestone54.0a1
Bug 1339289 - Give names to a lot of common runnables (r=ehsan) MozReview-Commit-ID: 5IdvK6kgoAW
dom/audiochannel/AudioChannelService.cpp
dom/base/FragmentOrElement.cpp
dom/base/nsObjectLoadingContent.cpp
dom/events/IMEContentObserver.h
dom/ipc/TabChild.cpp
dom/media/MediaResource.cpp
dom/media/MediaStreamGraph.cpp
dom/storage/Storage.cpp
dom/xbl/nsBindingManager.cpp
gfx/layers/client/ClientLayerManager.cpp
image/DecodePool.cpp
image/IDecodingTask.cpp
image/ProgressTracker.cpp
image/RasterImage.cpp
image/VectorImage.cpp
image/imgRequestProxy.cpp
image/imgRequestProxy.h
js/xpconnect/src/XPCJSContext.cpp
layout/base/PresShell.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/style/ErrorReporter.cpp
layout/style/FontFaceSet.cpp
netwerk/base/nsAsyncRedirectVerifyHelper.cpp
toolkit/components/finalizationwitness/FinalizationWitnessService.cpp
widget/PuppetWidget.h
xpcom/base/CycleCollectedJSContext.cpp
xpcom/base/DebuggerOnGCRunnable.h
xpcom/components/nsCategoryManager.cpp
xpcom/threads/ThrottledEventQueue.cpp
xpcom/threads/nsThreadPool.cpp
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -43,17 +43,18 @@ bool sAudioChannelMutedByDefault = false
 bool sAudioChannelCompeting = false;
 bool sXPCOMShuttingDown = false;
 
 class NotifyChannelActiveRunnable final : public Runnable
 {
 public:
   NotifyChannelActiveRunnable(uint64_t aWindowID, AudioChannel aAudioChannel,
                               bool aActive)
-    : mWindowID(aWindowID)
+    : Runnable("NotifyChannelActiveRunnable")
+    , mWindowID(aWindowID)
     , mAudioChannel(aAudioChannel)
     , mActive(aActive)
   {}
 
   NS_IMETHOD Run() override
   {
     nsCOMPtr<nsIObserverService> observerService =
       services::GetObserverService();
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -1232,16 +1232,17 @@ FragmentOrElement::FireNodeInserted(nsID
 // nsISupports implementation
 
 #define SUBTREE_UNBINDINGS_PER_RUNNABLE 500
 
 class ContentUnbinder : public Runnable
 {
 public:
   ContentUnbinder()
+    : Runnable("ContentUnbinder")
   {
     mLast = this;
   }
 
   ~ContentUnbinder()
   {
     Run();
   }
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -179,17 +179,17 @@ nsAsyncInstantiateEvent::Run()
 
 // Checks to see if the content for a plugin instance should be unloaded
 // (outside an active document) or stopped (in a document but unrendered). This
 // is used to allow scripts to move a plugin around the document hierarchy
 // without re-instantiating it.
 class CheckPluginStopEvent : public Runnable {
 public:
   explicit CheckPluginStopEvent(nsObjectLoadingContent* aContent)
-  : mContent(aContent) {}
+  : Runnable("CheckPluginStopEvent"), mContent(aContent) {}
 
   ~CheckPluginStopEvent() override = default;
 
   NS_IMETHOD Run() override;
 
 private:
   nsCOMPtr<nsIObjectLoadingContent> mContent;
 };
--- a/dom/events/IMEContentObserver.h
+++ b/dom/events/IMEContentObserver.h
@@ -213,18 +213,20 @@ private:
     {
       eChangeEventType_Focus,
       eChangeEventType_Selection,
       eChangeEventType_Text,
       eChangeEventType_Position,
       eChangeEventType_CompositionEventHandled
     };
 
-    explicit AChangeEvent(IMEContentObserver* aIMEContentObserver)
-      : mIMEContentObserver(aIMEContentObserver)
+    explicit AChangeEvent(const char* aName,
+                          IMEContentObserver* aIMEContentObserver)
+      : Runnable(aName)
+      , mIMEContentObserver(aIMEContentObserver)
     {
       MOZ_ASSERT(mIMEContentObserver);
     }
 
     RefPtr<IMEContentObserver> mIMEContentObserver;
 
     /**
      * CanNotifyIME() checks if mIMEContentObserver can and should notify IME.
@@ -236,17 +238,17 @@ private:
      */
     bool IsSafeToNotifyIME(ChangeEventType aChangeEventType) const;
   };
 
   class IMENotificationSender: public AChangeEvent
   {
   public:
     explicit IMENotificationSender(IMEContentObserver* aIMEContentObserver)
-      : AChangeEvent(aIMEContentObserver)
+      : AChangeEvent("IMENotificationSender", aIMEContentObserver)
       , mIsRunning(false)
     {
     }
     NS_IMETHOD Run() override;
 
   private:
     void SendFocusSet();
     void SendSelectionChange();
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -292,17 +292,18 @@ ContentListener::HandleEvent(nsIDOMEvent
 
 class TabChild::DelayedDeleteRunnable final
   : public Runnable
 {
     RefPtr<TabChild> mTabChild;
 
 public:
     explicit DelayedDeleteRunnable(TabChild* aTabChild)
-      : mTabChild(aTabChild)
+      : Runnable("TabChild::DelayedDeleteRunnable")
+      , mTabChild(aTabChild)
     {
         MOZ_ASSERT(NS_IsMainThread());
         MOZ_ASSERT(aTabChild);
     }
 
 private:
     ~DelayedDeleteRunnable()
     {
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -859,17 +859,18 @@ ChannelMediaResource::CacheClientNotifyD
   NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
   // NOTE: this can be called with the media cache lock held, so don't
   // block or do anything which might try to acquire a lock!
 
   if (mDataReceivedEvent.IsPending())
     return;
 
   mDataReceivedEvent =
-    NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
+    NewNonOwningRunnableMethod("ChannelMediaResource::DoNotifyDataReceived",
+                               this, &ChannelMediaResource::DoNotifyDataReceived);
   NS_DispatchToMainThread(mDataReceivedEvent.get());
 }
 
 void
 ChannelMediaResource::CacheClientNotifyDataEnded(nsresult aStatus)
 {
   MOZ_ASSERT(NS_IsMainThread());
   mCallback->NotifyDataEnded(aStatus);
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1621,17 +1621,18 @@ public:
 private:
   RefPtr<MediaStreamGraphImpl> mGraph;
 };
 
 class MediaStreamGraphStableStateRunnable : public Runnable {
 public:
   explicit MediaStreamGraphStableStateRunnable(MediaStreamGraphImpl* aGraph,
                                                bool aSourceIsMSG)
-    : mGraph(aGraph)
+    : Runnable("MediaStreamGraphStableStateRunnable")
+    , mGraph(aGraph)
     , mSourceIsMSG(aSourceIsMSG)
   {
   }
   NS_IMETHOD Run() override
   {
     if (mGraph) {
       mGraph->RunInStableState(mSourceIsMSG);
     }
--- a/dom/storage/Storage.cpp
+++ b/dom/storage/Storage.cpp
@@ -175,17 +175,20 @@ Storage::Clear(nsIPrincipal& aSubjectPri
 
 namespace {
 
 class StorageNotifierRunnable : public Runnable
 {
 public:
   StorageNotifierRunnable(nsISupports* aSubject, const char16_t* aType,
                           bool aPrivateBrowsing)
-    : mSubject(aSubject), mType(aType), mPrivateBrowsing(aPrivateBrowsing)
+    : Runnable("StorageNotifierRunnable")
+    , mSubject(aSubject)
+    , mType(aType)
+    , mPrivateBrowsing(aPrivateBrowsing)
   { }
 
   NS_DECL_NSIRUNNABLE
 
 private:
   nsCOMPtr<nsISupports> mSubject;
   const char16_t* mType;
   const bool mPrivateBrowsing;
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -346,17 +346,18 @@ nsBindingManager::AddToAttachedQueue(nsX
   return NS_OK;
 
 }
 
 void
 nsBindingManager::PostProcessAttachedQueueEvent()
 {
   mProcessAttachedQueueEvent =
-    NewRunnableMethod(this, &nsBindingManager::DoProcessAttachedQueue);
+    NewRunnableMethod("nsBindingManager::DoProcessAttachedQueue",
+                      this, &nsBindingManager::DoProcessAttachedQueue);
   nsresult rv = NS_DispatchToCurrentThread(mProcessAttachedQueueEvent);
   if (NS_SUCCEEDED(rv) && mDocument) {
     mDocument->BlockOnload();
   }
 }
 
 // static
 void
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -137,17 +137,19 @@ ClientLayerManager::Destroy()
 
   if (mTransactionIdAllocator) {
     // Make sure to notify the refresh driver just in case it's waiting on a
     // pending transaction. Do this at the top of the event loop so we don't
     // cause a paint to occur during compositor shutdown.
     RefPtr<TransactionIdAllocator> allocator = mTransactionIdAllocator;
     uint64_t id = mLatestTransactionId;
 
-    RefPtr<Runnable> task = NS_NewRunnableFunction([allocator, id] () -> void {
+    RefPtr<Runnable> task = NS_NewRunnableFunction(
+      "TransactionIdAllocator::NotifyTransactionCompleted",
+      [allocator, id] () -> void {
       allocator->NotifyTransactionCompleted(id);
     });
     NS_DispatchToMainThread(task.forget());
   }
 
   // Forget the widget pointer in case we outlive our owning widget.
   mWidget = nullptr;
 }
--- a/image/DecodePool.cpp
+++ b/image/DecodePool.cpp
@@ -60,17 +60,18 @@ public:
     , mShuttingDown(false)
   { }
 
   /// Shut down the provided decode pool thread.
   static void ShutdownThread(nsIThread* aThisThread)
   {
     // Threads have to be shut down from another thread, so we'll ask the
     // main thread to do it for us.
-    NS_DispatchToMainThread(NewRunnableMethod(aThisThread, &nsIThread::Shutdown));
+    NS_DispatchToMainThread(NewRunnableMethod("DecodePoolImpl::ShutdownThread",
+                                              aThisThread, &nsIThread::Shutdown));
   }
 
   /**
    * Requests shutdown. New work items will be dropped on the floor, and all
    * decode pool threads will be shut down once existing work items have been
    * processed.
    */
   void RequestShutdown()
--- a/image/IDecodingTask.cpp
+++ b/image/IDecodingTask.cpp
@@ -45,17 +45,19 @@ IDecodingTask::NotifyProgress(NotNull<Ra
   if (NS_IsMainThread() && !(decoderFlags & DecoderFlags::ASYNC_NOTIFY)) {
     aImage->NotifyProgress(progress, invalidRect, frameCount,
                            decoderFlags, surfaceFlags);
     return;
   }
 
   // We're forced to notify asynchronously.
   NotNull<RefPtr<RasterImage>> image = aImage;
-  NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
+  NS_DispatchToMainThread(NS_NewRunnableFunction(
+                            "IDecodingTask::NotifyProgress",
+                            [=]() -> void {
     image->NotifyProgress(progress, invalidRect, frameCount,
                           decoderFlags, surfaceFlags);
   }));
 }
 
 /* static */ void
 IDecodingTask::NotifyDecodeComplete(NotNull<RasterImage*> aImage,
                                     NotNull<Decoder*> aDecoder)
@@ -78,17 +80,19 @@ IDecodingTask::NotifyDecodeComplete(NotN
     aImage->NotifyDecodeComplete(finalStatus, metadata, telemetry, progress,
                                  invalidRect, frameCount, decoderFlags,
                                  surfaceFlags);
     return;
   }
 
   // We're forced to notify asynchronously.
   NotNull<RefPtr<RasterImage>> image = aImage;
-  NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
+  NS_DispatchToMainThread(NS_NewRunnableFunction(
+                            "IDecodingTask::NotifyDecodeComplete",
+                            [=]() -> void {
     image->NotifyDecodeComplete(finalStatus, metadata, telemetry, progress,
                                 invalidRect, frameCount, decoderFlags,
                                 surfaceFlags);
   }));
 }
 
 
 ///////////////////////////////////////////////////////////////////////////////
--- a/image/ProgressTracker.cpp
+++ b/image/ProgressTracker.cpp
@@ -118,17 +118,18 @@ ProgressTracker::GetImageStatus() const
 }
 
 // A helper class to allow us to call SyncNotify asynchronously.
 class AsyncNotifyRunnable : public Runnable
 {
   public:
     AsyncNotifyRunnable(ProgressTracker* aTracker,
                         IProgressObserver* aObserver)
-      : mTracker(aTracker)
+     : Runnable("ProgressTracker::AsyncNotifyRunnable")
+     , mTracker(aTracker)
     {
       MOZ_ASSERT(NS_IsMainThread(), "Should be created on the main thread");
       MOZ_ASSERT(aTracker, "aTracker should not be null");
       MOZ_ASSERT(aObserver, "aObserver should not be null");
       mObservers.AppendElement(aObserver);
     }
 
     NS_IMETHOD Run() override
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -419,17 +419,18 @@ RasterImage::WillDrawOpaqueNow()
   return true;
 }
 
 void
 RasterImage::OnSurfaceDiscarded()
 {
   MOZ_ASSERT(mProgressTracker);
 
-  NS_DispatchToMainThread(NewRunnableMethod(mProgressTracker, &ProgressTracker::OnDiscard));
+  NS_DispatchToMainThread(NewRunnableMethod("ProgressTracker::OnDiscard",
+                                            mProgressTracker, &ProgressTracker::OnDiscard));
 }
 
 //******************************************************************************
 NS_IMETHODIMP
 RasterImage::GetAnimated(bool* aAnimated)
 {
   if (mError) {
     return NS_ERROR_FAILURE;
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -994,17 +994,19 @@ VectorImage::CreateSurfaceAndShow(const 
 
   // Send out an invalidation so that surfaces that are still in use get
   // re-locked. See the discussion of the UnlockSurfaces call above.
   if (!(aParams.flags & FLAG_ASYNC_NOTIFY)) {
     mProgressTracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,
                                          GetMaxSizedIntRect());
   } else {
     NotNull<RefPtr<VectorImage>> image = WrapNotNull(this);
-    NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void {
+    NS_DispatchToMainThread(NS_NewRunnableFunction(
+                              "ProgressTracker::SyncNotifyProgress",
+                              [=]() -> void {
       RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
       if (tracker) {
         tracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE,
                                     GetMaxSizedIntRect());
       }
     }));
   }
 }
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -344,17 +344,18 @@ imgRequestProxy::CancelAndForgetObserver
 
   if (GetOwner()) {
     GetOwner()->RemoveProxy(this, aStatus);
   }
 
   mIsInLoadGroup = oldIsInLoadGroup;
 
   if (mIsInLoadGroup) {
-    NS_DispatchToCurrentThread(NewRunnableMethod(this, &imgRequestProxy::DoRemoveFromLoadGroup));
+    NS_DispatchToCurrentThread(NewRunnableMethod("imgRequestProxy::DoRemoveFromLoadGroup",
+                                                 this, &imgRequestProxy::DoRemoveFromLoadGroup));
   }
 
   NullOutListener();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/image/imgRequestProxy.h
+++ b/image/imgRequestProxy.h
@@ -137,17 +137,17 @@ protected:
 
   class imgCancelRunnable;
   friend class imgCancelRunnable;
 
   class imgCancelRunnable : public mozilla::Runnable
   {
     public:
       imgCancelRunnable(imgRequestProxy* owner, nsresult status)
-        : mOwner(owner), mStatus(status)
+        : Runnable("imgCancelRunnable"), mOwner(owner), mStatus(status)
       { }
 
       NS_IMETHOD Run() override {
         mOwner->DoCancel(mStatus);
         return NS_OK;
       }
 
     private:
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -174,17 +174,21 @@ public:
           mContinuation = aContinuation;
       }
       mPurge = aPurge;
       if (!mActive && NS_SUCCEEDED(NS_DispatchToCurrentThread(this))) {
           mActive = true;
       }
   }
 
-  AsyncFreeSnowWhite() : mContinuation(false), mActive(false), mPurge(false) {}
+  AsyncFreeSnowWhite()
+    : Runnable("AsyncFreeSnowWhite")
+    , mContinuation(false)
+    , mActive(false)
+    , mPurge(false) {}
 
 public:
   bool mContinuation;
   bool mActive;
   bool mPurge;
 };
 
 namespace xpc {
@@ -3604,17 +3608,17 @@ XPCJSContext::BeforeProcessTask(bool aMi
     if (aMightBlock) {
         if (Promise::PerformMicroTaskCheckpoint()) {
             // If any microtask was processed, we post a dummy event in order to
             // force the ProcessNextEvent call not to block.  This is required
             // to support nested event loops implemented using a pattern like
             // "while (condition) thread.processNextEvent(true)", in case the
             // condition is triggered here by a Promise "then" callback.
 
-            NS_DispatchToMainThread(new Runnable());
+            NS_DispatchToMainThread(new Runnable("Empty_microtask_runnable"));
         }
     }
 
     // Start the slow script timer.
     mSlowScriptCheckpoint = mozilla::TimeStamp::NowLoRes();
     mSlowScriptSecondHalf = false;
     mSlowScriptActualWait = mozilla::TimeDuration();
     mTimeoutAccumulated = false;
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -2030,17 +2030,18 @@ PresShell::ResizeReflowIgnoreOverride(ns
       if (mAsyncResizeEventTimer) {
         mAsyncResizeTimerIsActive = true;
         mAsyncResizeEventTimer->InitWithFuncCallback(AsyncResizeEventCallback,
                                                      this, 15,
                                                      nsITimer::TYPE_ONE_SHOT);
       }
     } else {
       RefPtr<nsRunnableMethod<PresShell> > resizeEvent =
-        NewRunnableMethod(this, &PresShell::FireResizeEvent);
+        NewRunnableMethod("PresShell::FireResizeEvent",
+                          this, &PresShell::FireResizeEvent);
       if (NS_SUCCEEDED(NS_DispatchToCurrentThread(resizeEvent))) {
         mResizeEvent = resizeEvent;
         SetNeedStyleFlush();
       }
     }
   }
 
   return NS_OK; //XXX this needs to be real. MMP
@@ -6241,17 +6242,18 @@ PresShell::ScheduleApproximateFrameVisib
     return;
   }
 
   if (mUpdateApproximateFrameVisibilityEvent.IsPending()) {
     return;
   }
 
   RefPtr<nsRunnableMethod<PresShell> > ev =
-    NewRunnableMethod(this, &PresShell::UpdateApproximateFrameVisibility);
+    NewRunnableMethod("PresShell::UpdateApproximateFrameVisibility",
+                      this, &PresShell::UpdateApproximateFrameVisibility);
   if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
     mUpdateApproximateFrameVisibilityEvent = ev;
   }
 }
 
 void
 PresShell::EnsureFrameInApproximatelyVisibleList(nsIFrame* aFrame)
 {
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -450,17 +450,17 @@ private:
 };
 
 }
 
 class nsDocumentShownDispatcher : public Runnable
 {
 public:
   explicit nsDocumentShownDispatcher(nsCOMPtr<nsIDocument> aDocument)
-  : mDocument(aDocument) {}
+    : Runnable("nsDocumentShownDispatcher"), mDocument(aDocument) {}
 
   NS_IMETHOD Run() override;
 
 private:
   nsCOMPtr<nsIDocument> mDocument;
 };
 
 
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -114,17 +114,18 @@ public:
 
 namespace {
 
 class CharSetChangingRunnable : public Runnable
 {
 public:
   CharSetChangingRunnable(nsPresContext* aPresContext,
                           const nsCString& aCharSet)
-    : mPresContext(aPresContext),
+    : Runnable("CharSetChangingRunnable"),
+      mPresContext(aPresContext),
       mCharSet(aCharSet)
   {
   }
 
   NS_IMETHOD Run() override
   {
     mPresContext->DoChangeCharSet(mCharSet);
     return NS_OK;
@@ -2084,17 +2085,18 @@ nsPresContext::MediaFeatureValuesChanged
 void
 nsPresContext::PostMediaFeatureValuesChangedEvent()
 {
   // FIXME: We should probably replace this event with use of
   // nsRefreshDriver::AddStyleFlushObserver (except the pres shell would
   // need to track whether it's been added).
   if (!mPendingMediaFeatureValuesChanged && mShell) {
     nsCOMPtr<nsIRunnable> ev =
-      NewRunnableMethod(this, &nsPresContext::HandleMediaFeatureValuesChangedEvent);
+      NewRunnableMethod("nsPresContext::HandleMediaFeatureValuesChangedEvent",
+                        this, &nsPresContext::HandleMediaFeatureValuesChangedEvent);
     if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
       mPendingMediaFeatureValuesChanged = true;
       mShell->SetNeedStyleFlush();
     }
   }
 }
 
 void
@@ -2276,17 +2278,18 @@ nsPresContext::RebuildCounterStyles()
   }
 
   mCounterStylesDirty = true;
   if (mShell) {
     mShell->SetNeedStyleFlush();
   }
   if (!mPostedFlushCounterStyles) {
     nsCOMPtr<nsIRunnable> ev =
-      NewRunnableMethod(this, &nsPresContext::HandleRebuildCounterStyles);
+      NewRunnableMethod("nsPresContext::HandleRebuildCounterStyles",
+                        this, &nsPresContext::HandleRebuildCounterStyles);
     if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
       mPostedFlushCounterStyles = true;
     }
   }
 }
 
 void
 nsPresContext::NotifyMissingFonts()
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -1580,17 +1580,19 @@ protected:
   void InitApplyPluginGeometryTimer();
   /**
    * Cancel the timer that ensures we eventually run ApplyPluginGeometryUpdates.
    */
   void CancelApplyPluginGeometryTimer();
 
   class RunWillPaintObservers : public mozilla::Runnable {
   public:
-    explicit RunWillPaintObservers(nsRootPresContext* aPresContext) : mPresContext(aPresContext) {}
+    explicit RunWillPaintObservers(nsRootPresContext* aPresContext)
+      : Runnable("nsPresContextType::RunWillPaintObservers")
+      , mPresContext(aPresContext) {}
     void Revoke() { mPresContext = nullptr; }
     NS_IMETHOD Run() override
     {
       if (mPresContext) {
         mPresContext->FlushWillPaintObservers();
       }
       return NS_OK;
     }
--- a/layout/style/ErrorReporter.cpp
+++ b/layout/style/ErrorReporter.cpp
@@ -23,17 +23,19 @@
 
 #ifdef CSS_REPORT_PARSE_ERRORS
 
 using namespace mozilla;
 
 namespace {
 class ShortTermURISpecCache : public Runnable {
 public:
-  ShortTermURISpecCache() : mPending(false) {}
+  ShortTermURISpecCache()
+   : Runnable("ShortTermURISpecCache")
+   , mPending(false) {}
 
   nsString const& GetSpec(nsIURI* aURI) {
     if (mURI != aURI) {
       mURI = aURI;
 
       nsAutoCString cSpec;
       nsresult rv = mURI->GetSpec(cSpec);
       if (NS_FAILED(rv)) {
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -1463,17 +1463,18 @@ FontFaceSet::OnFontFaceStatusChanged(Fon
     // relevant elements in the document.  We want to wait until the reflow
     // request has been done before the FontFaceSet is marked as Loaded so
     // that we don't briefly set the FontFaceSet to Loaded and then Loading
     // again once the reflow is pending.  So we go around the event loop
     // and call CheckLoadingFinished() after the reflow has been queued.
     if (!mDelayedLoadCheck) {
       mDelayedLoadCheck = true;
       nsCOMPtr<nsIRunnable> checkTask =
-        NewRunnableMethod(this, &FontFaceSet::CheckLoadingFinishedAfterDelay);
+        NewRunnableMethod("FontFaceSet::CheckLoadingFinishedAfterDelay",
+                          this, &FontFaceSet::CheckLoadingFinishedAfterDelay);
       NS_DispatchToMainThread(checkTask);
     }
   }
 }
 
 void
 FontFaceSet::DidRefresh()
 {
--- a/netwerk/base/nsAsyncRedirectVerifyHelper.cpp
+++ b/netwerk/base/nsAsyncRedirectVerifyHelper.cpp
@@ -24,18 +24,19 @@ static LazyLogModule gRedirectLog("nsRed
 NS_IMPL_ISUPPORTS(nsAsyncRedirectVerifyHelper,
                   nsIAsyncVerifyRedirectCallback,
                   nsIRunnable)
 
 class nsAsyncVerifyRedirectCallbackEvent : public Runnable {
 public:
     nsAsyncVerifyRedirectCallbackEvent(nsIAsyncVerifyRedirectCallback *cb,
                                        nsresult result)
-        : mCallback(cb), mResult(result) {
-    }
+        : Runnable("nsAsyncVerifyRedirectCallbackEvent")
+        , mCallback(cb)
+        , mResult(result) {}
 
     NS_IMETHOD Run() override
     {
         LOG(("nsAsyncVerifyRedirectCallbackEvent::Run() "
              "callback to %p with result %x",
              mCallback.get(), mResult));
        (void) mCallback->OnRedirectVerifyCallback(mResult);
        return NS_OK;
--- a/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp
+++ b/toolkit/components/finalizationwitness/FinalizationWitnessService.cpp
@@ -32,17 +32,18 @@ namespace {
  * Important note: we maintain the invariant that these private data
  * slots are already addrefed.
  */
 class FinalizationEvent final: public Runnable
 {
 public:
   FinalizationEvent(const char* aTopic,
                   const char16_t* aValue)
-    : mTopic(aTopic)
+    : Runnable("FinalizationEvent")
+    , mTopic(aTopic)
     , mValue(aValue)
   { }
 
   NS_IMETHOD Run() override {
     nsCOMPtr<nsIObserverService> observerService =
       mozilla::services::GetObserverService();
     if (!observerService) {
       // This is either too early or, more likely, too late for notifications.
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -310,17 +310,18 @@ private:
   bool GetCaretRect(LayoutDeviceIntRect& aCaretRect, uint32_t aCaretOffset);
   uint32_t GetCaretOffset();
 
   nsIWidgetListener* GetCurrentWidgetListener();
 
   class PaintTask : public Runnable {
   public:
     NS_DECL_NSIRUNNABLE
-    explicit PaintTask(PuppetWidget* widget) : mWidget(widget) {}
+    explicit PaintTask(PuppetWidget* widget)
+     : Runnable("PuppetWidget::PaintTask"), mWidget(widget) {}
     void Revoke() { mWidget = nullptr; }
   private:
     PuppetWidget* mWidget;
   };
 
   class MemoryPressureObserver : public nsIObserver {
   public:
     NS_DECL_ISUPPORTS
--- a/xpcom/base/CycleCollectedJSContext.cpp
+++ b/xpcom/base/CycleCollectedJSContext.cpp
@@ -1474,17 +1474,18 @@ CycleCollectedJSContext::RunInMetastable
   }
 #endif
 
   mMetastableStateEvents.AppendElement(Move(data));
 }
 
 IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(CycleCollectedJSContext* aCx,
                                                          DeferredFinalizerTable& aFinalizers)
-  : mContext(aCx)
+  : Runnable("IncrementalFinalizeRunnable")
+  , mContext(aCx)
   , mFinalizeFunctionToRun(0)
   , mReleasing(false)
 {
   for (auto iter = aFinalizers.Iter(); !iter.Done(); iter.Next()) {
     DeferredFinalizeFunction& function = iter.Key();
     void*& data = iter.Data();
 
     DeferredFinalizeFunctionHolder* holder =
--- a/xpcom/base/DebuggerOnGCRunnable.h
+++ b/xpcom/base/DebuggerOnGCRunnable.h
@@ -15,17 +15,17 @@
 namespace mozilla {
 
 // Runnable to fire the SpiderMonkey Debugger API's onGarbageCollection hook.
 class DebuggerOnGCRunnable : public CancelableRunnable
 {
   JS::dbg::GarbageCollectionEvent::Ptr mGCData;
 
   explicit DebuggerOnGCRunnable(JS::dbg::GarbageCollectionEvent::Ptr&& aGCData)
-    : mGCData(Move(aGCData))
+    : CancelableRunnable("DebuggerOnGCRunnable"), mGCData(Move(aGCData))
   { }
 
 public:
   static nsresult Enqueue(JSContext* aCx, const JS::GCDescription& aDesc);
 
   NS_DECL_NSIRUNNABLE
   nsresult Cancel() override;
 };
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -477,17 +477,18 @@ nsCategoryManager::SizeOfIncludingThis(m
 namespace {
 
 class CategoryNotificationRunnable : public Runnable
 {
 public:
   CategoryNotificationRunnable(nsISupports* aSubject,
                                const char* aTopic,
                                const char* aData)
-    : mSubject(aSubject)
+    : Runnable("CategoryNotificationRunnable")
+    , mSubject(aSubject)
     , mTopic(aTopic)
     , mData(aData)
   {
   }
 
   NS_DECL_NSIRUNNABLE
 
 private:
--- a/xpcom/threads/ThrottledEventQueue.cpp
+++ b/xpcom/threads/ThrottledEventQueue.cpp
@@ -200,17 +200,18 @@ class ThrottledEventQueue::Inner final :
     Unused << event->Run();
     --mExecutionDepth;
 
     // If shutdown was started and the queue is now empty we can now
     // finalize the shutdown.  This is performed separately at the end
     // of the method in order to wait for the event to finish running.
     if (shouldShutdown) {
       MOZ_ASSERT(IsEmpty());
-      NS_DispatchToMainThread(NewRunnableMethod(this, &Inner::ShutdownComplete));
+      NS_DispatchToMainThread(NewRunnableMethod("ThrottledEventQueue::Inner::ShutdownComplete",
+                                                this, &Inner::ShutdownComplete));
     }
   }
 
   void
   ShutdownComplete()
   {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(IsEmpty());
@@ -278,17 +279,18 @@ public:
     // We are marked for shutdown now, but we are still processing runnables.
     // Return for now.  The shutdown will be completed once the queue is
     // drained.
     if (mExecutor) {
       return;
     }
 
     // The queue is empty, so we can complete immediately.
-    NS_DispatchToMainThread(NewRunnableMethod(this, &Inner::ShutdownComplete));
+    NS_DispatchToMainThread(NewRunnableMethod("ThrottledEventQueue::Inner::ShutdownComplete",
+                                              this, &Inner::ShutdownComplete));
   }
 
   bool
   IsEmpty() const
   {
     // Any thread
     return Length() == 0;
   }
--- a/xpcom/threads/nsThreadPool.cpp
+++ b/xpcom/threads/nsThreadPool.cpp
@@ -141,17 +141,17 @@ nsThreadPool::ShutdownThread(nsIThread* 
   // such a way that the newly created thread is no longer necessary.
   // In the first case, we must go to another thread to shut aThread down
   // (because it is the current thread).  In the second case, we cannot
   // synchronously shut down the current thread (because then Dispatch() would
   // spin the event loop, and that could blow up the world), and asynchronous
   // shutdown requires this thread have an event loop (and it may not, see bug
   // 10204784).  The simplest way to cover all cases is to asynchronously
   // shutdown aThread from the main thread.
-  NS_DispatchToMainThread(NewRunnableMethod(aThread,
+  NS_DispatchToMainThread(NewRunnableMethod("nsIThread::AsyncShutdown", aThread,
                                             &nsIThread::AsyncShutdown));
 }
 
 NS_IMETHODIMP
 nsThreadPool::Run()
 {
   LOG(("THRD-P(%p) enter %s\n", this, mName.BeginReading()));