Bug 1377222 - Eliminate nsITimer::InitWithFuncCallback in favor of InitWithNamedFuncCallback (r=froydnj)
authorBill McCloskey <billm@mozilla.com>
Thu, 29 Jun 2017 12:13:25 -0700
changeset 367198 99566b93d105c2fb5fcc09d39875854ed6ab92e2
parent 367197 ca52840495166f1d15460ac281de809a4bfcaf9a
child 367199 568e147a74acc74cbfe1f49ce5fb21e94a07a96f
push id32125
push usercbook@mozilla.com
push dateTue, 04 Jul 2017 08:48:50 +0000
treeherdermozilla-central@fef489e8c2a1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1377222
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377222 - Eliminate nsITimer::InitWithFuncCallback in favor of InitWithNamedFuncCallback (r=froydnj) MozReview-Commit-ID: 9zN9aAd7daA
dom/base/nsJSEnvironment.cpp
dom/gamepad/windows/WindowsGamepad.cpp
dom/indexedDB/ActorsParent.cpp
dom/media/ChannelMediaDecoder.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/quota/ActorsParent.cpp
dom/workers/RuntimeService.cpp
gfx/thebes/gfxPlatformMac.cpp
hal/cocoa/CocoaSensor.mm
ipc/glue/BackgroundImpl.cpp
media/mtransport/transportlayerdtls.cpp
media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
widget/cocoa/TextInputHandler.mm
widget/cocoa/nsMacDockSupport.mm
widget/windows/nsFilePicker.cpp
xpcom/threads/nsITimer.idl
xpcom/threads/nsTimerImpl.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -296,18 +296,19 @@ public:
     if (!mTimer) {
       mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
     } else {
       mTimer->Cancel();
     }
 
     if (mTimer) {
       mTimer->SetTarget(mTarget);
-      mTimer->InitWithFuncCallback(TimedOut, this, aDelay,
-                                   nsITimer::TYPE_ONE_SHOT);
+      mTimer->InitWithNamedFuncCallback(TimedOut, this, aDelay,
+                                        nsITimer::TYPE_ONE_SHOT,
+                                        "CollectorRunner");
       mTimerActive = true;
     }
   }
 
   nsresult Cancel() override
   {
     CancelTimer();
     mTimer = nullptr;
@@ -355,18 +356,19 @@ public:
             return;
           }
         } else {
           mScheduleTimer->Cancel();
         }
 
         // We weren't allowed to do idle dispatch immediately, do it after a
         // short timeout.
-        mScheduleTimer->InitWithFuncCallback(ScheduleTimedOut, this, 16,
-                                             nsITimer::TYPE_ONE_SHOT_LOW_PRIORITY);
+        mScheduleTimer->InitWithNamedFuncCallback(ScheduleTimedOut, this, 16,
+                                                  nsITimer::TYPE_ONE_SHOT_LOW_PRIORITY,
+                                                  "CollectorRunner");
       }
     }
   }
 
 private:
   explicit CollectorRunner(CollectorRunnerCallback aCallback,
                            uint32_t aDelay, int64_t aBudget,
                            bool aRepeating, void* aData)
--- a/dom/gamepad/windows/WindowsGamepad.cpp
+++ b/dom/gamepad/windows/WindowsGamepad.cpp
@@ -337,19 +337,20 @@ DirectInputMessageLoopOnceCallback(nsITi
   MOZ_ASSERT(NS_GetCurrentThread() == gMonitorThread);
   MSG msg;
   while (PeekMessageW(&msg, sHWnd, 0, 0, PM_REMOVE) > 0) {
     TranslateMessage(&msg);
     DispatchMessage(&msg);
   }
   aTimer->Cancel();
   if (!sIsShutdown) {
-    aTimer->InitWithFuncCallback(DirectInputMessageLoopOnceCallback,
-                                 nullptr, kWindowsGamepadPollInterval,
-                                 nsITimer::TYPE_ONE_SHOT);
+    aTimer->InitWithNamedFuncCallback(DirectInputMessageLoopOnceCallback,
+                                      nullptr, kWindowsGamepadPollInterval,
+                                      nsITimer::TYPE_ONE_SHOT,
+                                      "DirectInputMessageLoopOnceCallback");
   }
 }
 
 class WindowsGamepadService
 {
  public:
   WindowsGamepadService()
   {
@@ -362,19 +363,20 @@ class WindowsGamepadService
     Cleanup();
   }
 
   void DevicesChanged(bool aIsStablizing);
 
   void StartMessageLoop()
   {
     MOZ_ASSERT(mDirectInputTimer);
-    mDirectInputTimer->InitWithFuncCallback(DirectInputMessageLoopOnceCallback,
-                                            nullptr, kWindowsGamepadPollInterval,
-                                            nsITimer::TYPE_ONE_SHOT);
+    mDirectInputTimer->InitWithNamedFuncCallback(DirectInputMessageLoopOnceCallback,
+                                                 nullptr, kWindowsGamepadPollInterval,
+                                                 nsITimer::TYPE_ONE_SHOT,
+                                                 "DirectInputMessageLoopOnceCallback");
   }
 
   void Startup();
   void Shutdown();
   // Parse gamepad input from a WM_INPUT message.
   bool HandleRawInput(HRAWINPUT handle);
 
   static void XInputMessageLoopOnceCallback(nsITimer *aTimer, void* aClosure);
@@ -439,18 +441,19 @@ void
 WindowsGamepadService::XInputMessageLoopOnceCallback(nsITimer *aTimer,
                                                      void* aService)
 {
   MOZ_ASSERT(aService);
   WindowsGamepadService* self = static_cast<WindowsGamepadService*>(aService);
   self->PollXInput();
   if (self->mIsXInputMonitoring) {
     aTimer->Cancel();
-    aTimer->InitWithFuncCallback(XInputMessageLoopOnceCallback, self,
-                                 kWindowsGamepadPollInterval, nsITimer::TYPE_ONE_SHOT);
+    aTimer->InitWithNamedFuncCallback(XInputMessageLoopOnceCallback, self,
+                                      kWindowsGamepadPollInterval, nsITimer::TYPE_ONE_SHOT,
+                                      "XInputMessageLoopOnceCallback");
   }
 }
 
 // static
 void
 WindowsGamepadService::DevicesChangeCallback(nsITimer *aTimer, void* aService)
 {
   MOZ_ASSERT(aService);
@@ -528,19 +531,20 @@ WindowsGamepadService::ScanForDevices()
 
   if (mHID) {
     ScanForRawInputDevices();
   }
   if (mXInput) {
     mXInputTimer->Cancel();
     if (ScanForXInputDevices()) {
       mIsXInputMonitoring = true;
-      mXInputTimer->InitWithFuncCallback(XInputMessageLoopOnceCallback, this,
-                                         kWindowsGamepadPollInterval,
-                                         nsITimer::TYPE_ONE_SHOT);
+      mXInputTimer->InitWithNamedFuncCallback(XInputMessageLoopOnceCallback, this,
+                                              kWindowsGamepadPollInterval,
+                                              nsITimer::TYPE_ONE_SHOT,
+                                              "XInputMessageLoopOnceCallback");
     } else {
       mIsXInputMonitoring = false;
     }
   }
 
   // Look for devices that are no longer present and remove them.
   for (int i = mGamepads.Length() - 1; i >= 0; i--) {
     if (!mGamepads[i].present) {
@@ -938,19 +942,20 @@ WindowsGamepadService::Cleanup()
   mGamepads.Clear();
 }
 
 void
 WindowsGamepadService::DevicesChanged(bool aIsStablizing)
 {
   if (aIsStablizing) {
     mDeviceChangeTimer->Cancel();
-    mDeviceChangeTimer->InitWithFuncCallback(DevicesChangeCallback, this,
-                                             kDevicesChangedStableDelay,
-                                             nsITimer::TYPE_ONE_SHOT);
+    mDeviceChangeTimer->InitWithNamedFuncCallback(DevicesChangeCallback, this,
+                                                  kDevicesChangedStableDelay,
+                                                  nsITimer::TYPE_ONE_SHOT,
+                                                  "DevicesChangeCallback");
   } else {
     ScanForDevices();
   }
 }
 
 bool
 RegisterRawInput(HWND hwnd, bool enable)
 {
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -12458,20 +12458,21 @@ ConnectionPool::AdjustIdleTimer()
     uint32_t delay;
     if (delta > 0) {
       delay = uint32_t(std::min(delta, double(UINT32_MAX)));
     } else {
       delay = 0;
     }
 
     MOZ_ALWAYS_SUCCEEDS(
-      mIdleTimer->InitWithFuncCallback(IdleTimerCallback,
-                                       this,
-                                       delay,
-                                       nsITimer::TYPE_ONE_SHOT));
+      mIdleTimer->InitWithNamedFuncCallback(IdleTimerCallback,
+                                            this,
+                                            delay,
+                                            nsITimer::TYPE_ONE_SHOT,
+                                            "ConnectionPool::IdleTimerCallback"));
 
     mTargetIdleTime = newTargetIdleTime;
   }
 }
 
 void
 ConnectionPool::CancelIdleTimer()
 {
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -86,18 +86,19 @@ ChannelMediaDecoder::ResourceCallback::N
   if (mTimerArmed) {
     return;
   }
   // In situations where these notifications come from stochastic network
   // activity, we can save significant computation by throttling the
   // calls to MediaDecoder::NotifyDataArrived() which will update the buffer
   // ranges of the reader.
   mTimerArmed = true;
-  mTimer->InitWithFuncCallback(
-    TimerCallback, this, sDelay, nsITimer::TYPE_ONE_SHOT);
+  mTimer->InitWithNamedFuncCallback(
+    TimerCallback, this, sDelay, nsITimer::TYPE_ONE_SHOT,
+    "ChannelMediaDecoder::ResourceCallback::TimerCallback");
 }
 
 void
 ChannelMediaDecoder::ResourceCallback::NotifyDataEnded(nsresult aStatus)
 {
   RefPtr<ResourceCallback> self = this;
   nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
     "ChannelMediaDecoder::ResourceCallback::NotifyDataEnded",
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1414,18 +1414,19 @@ void nsPluginInstanceOwner::AddToCARefre
   sCARefreshListeners->AppendElement(this);
 
   if (!sCATimer) {
     sCATimer = new nsCOMPtr<nsITimer>();
   }
 
   if (sCARefreshListeners->Length() == 1) {
     *sCATimer = do_CreateInstance("@mozilla.org/timer;1");
-    (*sCATimer)->InitWithFuncCallback(CARefresh, nullptr,
-                   DEFAULT_REFRESH_RATE, nsITimer::TYPE_REPEATING_SLACK);
+    (*sCATimer)->InitWithNamedFuncCallback(CARefresh, nullptr,
+                                           DEFAULT_REFRESH_RATE, nsITimer::TYPE_REPEATING_SLACK,
+                                           "nsPluginInstanceOwner::CARefresh");
   }
 }
 
 void nsPluginInstanceOwner::RemoveFromCARefreshTimer() {
   if (!sCARefreshListeners || sCARefreshListeners->Contains(this) == false) {
     return;
   }
 
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -3629,20 +3629,21 @@ QuotaManager::Shutdown()
   if (gShutdown.exchange(true)) {
     NS_ERROR("Shutdown more than once?!");
   }
 
   StopIdleMaintenance();
 
   // Kick off the shutdown timer.
   MOZ_ALWAYS_SUCCEEDS(
-    mShutdownTimer->InitWithFuncCallback(&ShutdownTimerCallback,
-                                         this,
-                                         DEFAULT_SHUTDOWN_TIMER_MS,
-                                         nsITimer::TYPE_ONE_SHOT));
+    mShutdownTimer->InitWithNamedFuncCallback(&ShutdownTimerCallback,
+                                              this,
+                                              DEFAULT_SHUTDOWN_TIMER_MS,
+                                              nsITimer::TYPE_ONE_SHOT,
+                                              "QuotaManager::ShutdownTimerCallback"));
 
   // Each client will spin the event loop while we wait on all the threads
   // to close. Our timer may fire during that loop.
   for (uint32_t index = 0; index < Client::TYPE_MAX; index++) {
     mClients[index]->ShutdownWorkThreads();
   }
 
   // Cancel the timer regardless of whether it actually fired.
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -1980,20 +1980,21 @@ RuntimeService::ShutdownIdleThreads(nsIT
   }
 
   if (!nextExpiration.IsNull()) {
     TimeDuration delta = nextExpiration - TimeStamp::NowLoRes();
     uint32_t delay(delta > TimeDuration(0) ? delta.ToMilliseconds() : 0);
 
     // Reschedule the timer.
     MOZ_ALWAYS_SUCCEEDS(
-      aTimer->InitWithFuncCallback(ShutdownIdleThreads,
-                                   nullptr,
-                                   delay,
-                                   nsITimer::TYPE_ONE_SHOT));
+      aTimer->InitWithNamedFuncCallback(ShutdownIdleThreads,
+                                        nullptr,
+                                        delay,
+                                        nsITimer::TYPE_ONE_SHOT,
+                                        "RuntimeService::ShutdownIdleThreads"));
   }
 
   for (uint32_t index = 0; index < expiredThreads.Length(); index++) {
     if (NS_FAILED(expiredThreads[index]->Shutdown())) {
       NS_WARNING("Failed to shutdown thread!");
     }
   }
 }
@@ -2617,20 +2618,21 @@ RuntimeService::NoteIdleThread(WorkerThr
   MOZ_ASSERT_IF(shutdownThread, !scheduleTimer);
   MOZ_ASSERT_IF(scheduleTimer, !shutdownThread);
 
   // Too many idle threads, just shut this one down.
   if (shutdownThread) {
     MOZ_ALWAYS_SUCCEEDS(aThread->Shutdown());
   } else if (scheduleTimer) {
     MOZ_ALWAYS_SUCCEEDS(
-      mIdleThreadTimer->InitWithFuncCallback(ShutdownIdleThreads,
-                                             nullptr,
-                                             IDLE_THREAD_TIMEOUT_SEC * 1000,
-                                             nsITimer::TYPE_ONE_SHOT));
+      mIdleThreadTimer->InitWithNamedFuncCallback(ShutdownIdleThreads,
+                                                  nullptr,
+                                                  IDLE_THREAD_TIMEOUT_SEC * 1000,
+                                                  nsITimer::TYPE_ONE_SHOT,
+                                                  "RuntimeService::ShutdownIdleThreads"));
   }
 }
 
 void
 RuntimeService::UpdateAllWorkerContextOptions()
 {
   BROADCAST_ALL_WORKERS(UpdateContextOptions, sDefaultJSSettings.contextOptions);
 }
--- a/gfx/thebes/gfxPlatformMac.cpp
+++ b/gfx/thebes/gfxPlatformMac.cpp
@@ -452,17 +452,18 @@ public:
         // bug 1144638 - When changing display configurations and getting
         // notifications from CGDisplayReconfigurationCallBack, the
         // callback gets called twice for each active display
         // so it's difficult to know when all displays are active.
         // Instead, try again soon. The delay is arbitrary. 100ms chosen
         // because on a late 2013 15" retina, it takes about that
         // long to come back up from sleep.
         uint32_t delay = 100;
-        mTimer->InitWithFuncCallback(RetryEnableVsync, this, delay, nsITimer::TYPE_ONE_SHOT);
+        mTimer->InitWithNamedFuncCallback(RetryEnableVsync, this, delay, nsITimer::TYPE_ONE_SHOT,
+                                          "RetryEnableVsync");
         return;
       }
 
       if (CVDisplayLinkSetOutputCallback(mDisplayLink, &VsyncCallback, this) != kCVReturnSuccess) {
         NS_WARNING("Could not set displaylink output callback");
         CVDisplayLinkRelease(mDisplayLink);
         mDisplayLink = nullptr;
         return;
--- a/hal/cocoa/CocoaSensor.mm
+++ b/hal/cocoa/CocoaSensor.mm
@@ -108,20 +108,21 @@ EnableSensorNotifications(SensorType aSe
     NS_WARNING("EnableSensorNotifications called on an unknown sensor type");
     return;
   }
   sActiveSensors[aSensor] = true;
 
   if (!sUpdateTimer) {
     CallCreateInstance("@mozilla.org/timer;1", &sUpdateTimer);
     if (sUpdateTimer) {
-        sUpdateTimer->InitWithFuncCallback(UpdateHandler,
-                                           nullptr,
-                                           DEFAULT_SENSOR_POLL,
-                                           nsITimer::TYPE_REPEATING_SLACK);
+        sUpdateTimer->InitWithNamedFuncCallback(UpdateHandler,
+                                                nullptr,
+                                                DEFAULT_SENSOR_POLL,
+                                                nsITimer::TYPE_REPEATING_SLACK,
+                                                "hal_impl::UpdateHandler");
     }
   }
 }
 void
 DisableSensorNotifications(SensorType aSensor)
 {
   if (!sActiveSensors[aSensor] || (aSensor != SENSOR_ACCELERATION && aSensor != SENSOR_LIGHT)) {
     return;
--- a/ipc/glue/BackgroundImpl.cpp
+++ b/ipc/glue/BackgroundImpl.cpp
@@ -1179,20 +1179,21 @@ ParentImpl::ShutdownBackgroundThread()
     MOZ_ASSERT_IF(!sShutdownHasStarted, !sLiveActorCount);
 
     if (sLiveActorCount) {
       // We need to spin the event loop while we wait for all the actors to be
       // cleaned up. We also set a timeout to force-kill any hanging actors.
       TimerCallbackClosure closure(thread, liveActors);
 
       MOZ_ALWAYS_SUCCEEDS(
-        shutdownTimer->InitWithFuncCallback(&ShutdownTimerCallback,
-                                            &closure,
-                                            kShutdownTimerDelayMS,
-                                            nsITimer::TYPE_ONE_SHOT));
+        shutdownTimer->InitWithNamedFuncCallback(&ShutdownTimerCallback,
+                                                 &closure,
+                                                 kShutdownTimerDelayMS,
+                                                 nsITimer::TYPE_ONE_SHOT,
+                                                 "ParentImpl::ShutdownTimerCallback"));
 
       SpinEventLoopUntil([&]() { return !sLiveActorCount; });
 
       MOZ_ASSERT(liveActors->IsEmpty());
 
       MOZ_ALWAYS_SUCCEEDS(shutdownTimer->Cancel());
     }
 
--- a/media/mtransport/transportlayerdtls.cpp
+++ b/media/mtransport/transportlayerdtls.cpp
@@ -845,20 +845,21 @@ void TransportLayerDtls::StateChange(Tra
     case TS_OPEN:
       MOZ_MTLOG(ML_ERROR,
                 LAYER_INFO << "Lower layer is now open; starting TLS");
       // Async, since the ICE layer might need to send a STUN response, and we
       // don't want the handshake to start until that is sent.
       TL_SET_STATE(TS_CONNECTING);
       timer_->Cancel();
       timer_->SetTarget(target_);
-      timer_->InitWithFuncCallback(TimerCallback,
-                                   this,
-                                   0,
-                                   nsITimer::TYPE_ONE_SHOT);
+      timer_->InitWithNamedFuncCallback(TimerCallback,
+                                        this,
+                                        0,
+                                        nsITimer::TYPE_ONE_SHOT,
+                                        "TransportLayerDtls::TimerCallback");
       break;
 
     case TS_CLOSED:
       MOZ_MTLOG(ML_ERROR, LAYER_INFO << "Lower layer is now closed");
       TL_SET_STATE(TS_CLOSED);
       break;
 
     case TS_ERROR:
@@ -907,19 +908,20 @@ void TransportLayerDtls::Handshake() {
         PRIntervalTime timeout;
         rv = DTLS_GetHandshakeTimeout(ssl_fd_.get(), &timeout);
         if (rv == SECSuccess) {
           uint32_t timeout_ms = PR_IntervalToMilliseconds(timeout);
 
           MOZ_MTLOG(ML_DEBUG,
                     LAYER_INFO << "Setting DTLS timeout to " << timeout_ms);
           timer_->SetTarget(target_);
-          timer_->InitWithFuncCallback(TimerCallback,
-                                       this, timeout_ms,
-                                       nsITimer::TYPE_ONE_SHOT);
+          timer_->InitWithNamedFuncCallback(TimerCallback,
+                                            this, timeout_ms,
+                                            nsITimer::TYPE_ONE_SHOT,
+                                            "TransportLayerDtls::TimerCallback");
         }
         break;
       default:
         const char *err_msg = PR_ErrorToName(err);
         MOZ_MTLOG(ML_ERROR, LAYER_INFO << "DTLS handshake error " << err << " ("
                   << err_msg << ")");
         TL_SET_STATE(TS_ERROR);
         break;
--- a/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
+++ b/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp
@@ -86,18 +86,19 @@ public:
     : AudioStreamTrack(new DOMMediaStream(nullptr, nullptr), 0, 1,
                        new FakeMediaStreamTrackSource())
     , mMutex("Fake AudioStreamTrack")
     , mStop(false)
     , mCount(0)
   {
     mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
     mTimer->SetTarget(test_utils->sts_target());
-    mTimer->InitWithFuncCallback(FakeAudioStreamTrackGenerateData, this, 20,
-                                 nsITimer::TYPE_REPEATING_SLACK);
+    mTimer->InitWithNamedFuncCallback(FakeAudioStreamTrackGenerateData, this, 20,
+                                      nsITimer::TYPE_REPEATING_SLACK,
+                                      "FakeAudioStreamTrack::FakeAudioStreamTrackGenerateData");
 
   }
 
   void Stop()
   {
     mozilla::MutexAutoLock lock(mMutex);
     mStop = true;
     mTimer->Cancel();
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -277,18 +277,19 @@ WebrtcVideoConduit::WebrtcVideoConduit(R
       }
     }
     if (self->mEngineReceiving && self->mRecvStream) {
       const auto& stats = self->mRecvStream->GetStats();
       self->mRecvStreamStats.Update(stats);
       self->mRecvPacketCounts = stats.rtcp_packet_type_counts;
     }
   };
-  mVideoStatsTimer->InitWithFuncCallback(
-    callback, this, 1000, nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP);
+  mVideoStatsTimer->InitWithNamedFuncCallback(
+    callback, this, 1000, nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP,
+    "WebrtcVideoConduit::WebrtcVideoConduit");
 }
 
 WebrtcVideoConduit::~WebrtcVideoConduit()
 {
   CSFLogDebug(logTag, "%s ", __FUNCTION__);
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
   if (mVideoStatsTimer) {
     CSFLogDebug(logTag, "canceling StreamStats for VideoConduit: %p", this);
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
@@ -365,18 +365,19 @@ PeerConnectionCtx::UpdateNetworkState(bo
 
 nsresult PeerConnectionCtx::Initialize() {
   initGMP();
 
   mTelemetryTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
   MOZ_ASSERT(mTelemetryTimer);
   nsresult rv = mTelemetryTimer->SetTarget(gMainThread);
   NS_ENSURE_SUCCESS(rv, rv);
-  mTelemetryTimer->InitWithFuncCallback(EverySecondTelemetryCallback_m, this, 1000,
-                                        nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP);
+  mTelemetryTimer->InitWithNamedFuncCallback(EverySecondTelemetryCallback_m, this, 1000,
+                                             nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP,
+                                             "EverySecondTelemetryCallback_m");
 
   if (XRE_IsContentProcess()) {
     WebrtcGlobalChild::Create();
   }
 
   return NS_OK;
 }
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -2518,18 +2518,19 @@ PeerConnectionImpl::InsertDTMF(mozilla::
       break;
     }
   }
 
   state->mTones = tones;
   state->mDuration = duration;
   state->mInterToneGap = interToneGap;
   if (!state->mTones.IsEmpty()) {
-    state->mSendTimer->InitWithFuncCallback(DTMFSendTimerCallback_m, state, 0,
-                                            nsITimer::TYPE_ONE_SHOT);
+    state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state, 0,
+                                                 nsITimer::TYPE_ONE_SHOT,
+                                                 "DTMFSendTimerCallback_m");
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PeerConnectionImpl::GetDTMFToneBuffer(mozilla::dom::RTCRtpSender& sender,
                                       nsAString& outToneBuffer) {
   PC_AUTO_ENTER_API_CALL(false);
@@ -4043,23 +4044,25 @@ PeerConnectionImpl::DTMFSendTimerCallbac
     uint16_t toneChar = state->mTones.CharAt(0);
     int tone = GetDTMFToneCode(toneChar);
 
     eventTone.Assign(toneChar);
 
     state->mTones.Cut(0, 1);
 
     if (tone == -1) {
-      state->mSendTimer->InitWithFuncCallback(DTMFSendTimerCallback_m, state,
-                                              2000, nsITimer::TYPE_ONE_SHOT);
+      state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state,
+                                                   2000, nsITimer::TYPE_ONE_SHOT,
+                                                   "DTMFSendTimerCallback_m");
     } else {
       // Reset delay if necessary
-      state->mSendTimer->InitWithFuncCallback(DTMFSendTimerCallback_m, state,
-                                              state->mDuration + state->mInterToneGap,
-                                              nsITimer::TYPE_ONE_SHOT);
+      state->mSendTimer->InitWithNamedFuncCallback(DTMFSendTimerCallback_m, state,
+                                                   state->mDuration + state->mInterToneGap,
+                                                   nsITimer::TYPE_ONE_SHOT,
+                                                   "DTMFSendTimerCallback_m");
 
       RefPtr<AudioSessionConduit> conduit =
         state->mPeerConnectionImpl->mMedia->GetAudioConduit(state->mLevel);
 
       if (conduit) {
         uint32_t duration = state->mDuration;
         state->mPeerConnectionImpl->mSTSThread->Dispatch(WrapRunnableNM([conduit, tone, duration] () {
             //Note: We default to channel 0, not inband, and 6dB attenuation.
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2949,18 +2949,19 @@ IMEInputHandler::ResetTimer()
   NS_ASSERTION(mPendingMethods != 0,
                "There are not pending methods, why this is called?");
   if (mTimer) {
     mTimer->Cancel();
   } else {
     mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
     NS_ENSURE_TRUE(mTimer, );
   }
-  mTimer->InitWithFuncCallback(FlushPendingMethods, this, 0,
-                               nsITimer::TYPE_ONE_SHOT);
+  mTimer->InitWithNamedFuncCallback(FlushPendingMethods, this, 0,
+                                    nsITimer::TYPE_ONE_SHOT,
+                                    "IMEInputHandler::FlushPendingMethods");
 }
 
 void
 IMEInputHandler::ExecutePendingMethods()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (mTimer) {
--- a/widget/cocoa/nsMacDockSupport.mm
+++ b/widget/cocoa/nsMacDockSupport.mm
@@ -104,18 +104,19 @@ nsMacDockSupport::SetProgressState(nsTas
   if (aMaxValue == 0) {
     mProgressFraction = 0;
   } else {
     mProgressFraction = (double)aCurrentValue / aMaxValue;
   }
 
   if (mProgressState == STATE_NORMAL || mProgressState == STATE_INDETERMINATE) {
     int perSecond = 8; // Empirically determined, see bug 848792 
-    mProgressTimer->InitWithFuncCallback(RedrawIconCallback, this, 1000 / perSecond,
-      nsITimer::TYPE_REPEATING_SLACK);
+    mProgressTimer->InitWithNamedFuncCallback(RedrawIconCallback, this, 1000 / perSecond,
+                                              nsITimer::TYPE_REPEATING_SLACK,
+                                              "nsMacDockSupport::RedrawIconCallback");
     return NS_OK;
   } else {
     mProgressTimer->Cancel();
     return RedrawIcon();
   }
 }
 
 // static
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -137,41 +137,45 @@ private:
   RefPtr<nsWindow> mWindow;
 };
 
 // Manages a simple callback timer
 class AutoTimerCallbackCancel
 {
 public:
   AutoTimerCallbackCancel(nsFilePicker* aTarget,
-                          nsTimerCallbackFunc aCallbackFunc) {
-    Init(aTarget, aCallbackFunc);
+                          nsTimerCallbackFunc aCallbackFunc,
+                          const char* aName)
+  {
+    Init(aTarget, aCallbackFunc, aName);
   }
 
   ~AutoTimerCallbackCancel() {
     if (mPickerCallbackTimer) {
       mPickerCallbackTimer->Cancel();
     }
   }
 
 private:
   void Init(nsFilePicker* aTarget,
-            nsTimerCallbackFunc aCallbackFunc) {
+            nsTimerCallbackFunc aCallbackFunc,
+            const char* aName)
+  {
     mPickerCallbackTimer = do_CreateInstance("@mozilla.org/timer;1");
     if (!mPickerCallbackTimer) {
       NS_WARNING("do_CreateInstance for timer failed??");
       return;
     }
-    mPickerCallbackTimer->InitWithFuncCallback(aCallbackFunc,
-                                               aTarget,
-                                               kDialogTimerTimeout,
-                                               nsITimer::TYPE_REPEATING_SLACK);
+    mPickerCallbackTimer->InitWithNamedFuncCallback(aCallbackFunc,
+                                                    aTarget,
+                                                    kDialogTimerTimeout,
+                                                    nsITimer::TYPE_REPEATING_SLACK,
+                                                    aName);
   }
   nsCOMPtr<nsITimer> mPickerCallbackTimer;
-    
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsIFilePicker
 
 nsFilePicker::nsFilePicker() :
   mSelectedType(1)
   , mDlgWnd(nullptr)
@@ -523,17 +527,18 @@ nsFilePicker::ShowFilePicker(const nsStr
     dialog->SetFileTypeIndex(mSelectedType);
   }
 
   // display
 
   {
     AutoDestroyTmpWindow adtw((HWND)(mParentWidget.get() ?
       mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
-    AutoTimerCallbackCancel atcc(this, PickerCallbackTimerFunc);
+    AutoTimerCallbackCancel atcc(this, PickerCallbackTimerFunc,
+                                 "nsFilePicker::PickerCallbackTimerFunc");
     AutoWidgetPickerState awps(mParentWidget);
 
     if (FAILED(dialog->Show(adtw.get()))) {
       dialog->Unadvise(mFDECookie);
       return false;
     }
     dialog->Unadvise(mFDECookie);
   }
--- a/xpcom/threads/nsITimer.idl
+++ b/xpcom/threads/nsITimer.idl
@@ -149,31 +149,16 @@ interface nsITimer : nsISupports
    * @param aType       timer type per TYPE* consts defined above
    */
   void init(in nsIObserver aObserver, in unsigned long aDelay,
             in unsigned long aType);
 
 
   /**
    * Initialize a timer to fire after the given millisecond interval.
-   * This version takes a function to call and a closure to pass to
-   * that function.
-   *
-   * @param aFunc      The function to invoke
-   * @param aClosure   An opaque pointer to pass to that function
-   * @param aDelay     The millisecond interval
-   * @param aType      Timer type per TYPE* consts defined above
-   */
-  [noscript] void initWithFuncCallback(in nsTimerCallbackFunc aCallback,
-                                       in voidPtr aClosure,
-                                       in unsigned long aDelay,
-                                       in unsigned long aType);
-
-  /**
-   * Initialize a timer to fire after the given millisecond interval.
    * This version takes a callback object.
    *
    * @param aFunc      nsITimerCallback interface to call when timer expires
    * @param aDelay     The millisecond interval
    * @param aType      Timer type per TYPE* consts defined above
    */
   void initWithCallback(in nsITimerCallback aCallback,
                         in unsigned long aDelay,
--- a/xpcom/threads/nsTimerImpl.cpp
+++ b/xpcom/threads/nsTimerImpl.cpp
@@ -248,26 +248,16 @@ nsTimerImpl::InitWithFuncCallbackCommon(
   cb.mClosure = aClosure;
   cb.mName = aName;
 
   MutexAutoLock lock(mMutex);
   return InitCommon(aDelay, aType, mozilla::Move(cb));
 }
 
 nsresult
-nsTimerImpl::InitWithFuncCallback(nsTimerCallbackFunc aFunc,
-                                  void* aClosure,
-                                  uint32_t aDelay,
-                                  uint32_t aType)
-{
-  Callback::Name name(Callback::Nothing);
-  return InitWithFuncCallbackCommon(aFunc, aClosure, aDelay, aType, name);
-}
-
-nsresult
 nsTimerImpl::InitWithNamedFuncCallback(nsTimerCallbackFunc aFunc,
                                        void* aClosure,
                                        uint32_t aDelay,
                                        uint32_t aType,
                                        const char* aNameString)
 {
   Callback::Name name(aNameString);
   return InitWithFuncCallbackCommon(aFunc, aClosure, aDelay, aType, name);