diff --git a/accessible/generic/Accessible.cpp b/accessible/generic/Accessible.cpp index f08318ed180c7..690d1608cec7d 100644 --- a/accessible/generic/Accessible.cpp +++ b/accessible/generic/Accessible.cpp @@ -1799,13 +1799,8 @@ Accessible::DoCommand(nsIContent *aContent, uint32_t aActionIndex) class Runnable final : public mozilla::Runnable { public: - Runnable(Accessible* aAcc, nsIContent* aContent, uint32_t aIdx) - : mozilla::Runnable("Runnable") - , mAcc(aAcc) - , mContent(aContent) - , mIdx(aIdx) - { - } + Runnable(Accessible* aAcc, nsIContent* aContent, uint32_t aIdx) : + mAcc(aAcc), mContent(aContent), mIdx(aIdx) { } NS_IMETHOD Run() override { diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp index 0c21507711ddf..ecba61c415497 100644 --- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -649,12 +649,9 @@ DocAccessible::ScrollPositionDidChange(nscoord aX, nscoord aY) mScrollWatchTimer = do_CreateInstance("@mozilla.org/timer;1"); if (mScrollWatchTimer) { NS_ADDREF_THIS(); // Kung fu death grip - mScrollWatchTimer->InitWithNamedFuncCallback( - ScrollTimerCallback, - this, - kScrollPosCheckWait, - nsITimer::TYPE_REPEATING_SLACK, - "a11y::DocAccessible::ScrollPositionDidChange"); + mScrollWatchTimer->InitWithFuncCallback(ScrollTimerCallback, this, + kScrollPosCheckWait, + nsITimer::TYPE_REPEATING_SLACK); } } mScrollPositionChangedTicks = 1; diff --git a/accessible/ipc/win/HandlerProvider.cpp b/accessible/ipc/win/HandlerProvider.cpp index f359feff3b8c6..0c76d5bba1b82 100644 --- a/accessible/ipc/win/HandlerProvider.cpp +++ b/accessible/ipc/win/HandlerProvider.cpp @@ -95,8 +95,7 @@ HandlerProvider::GetAndSerializePayload(const MutexAutoLock&) IA2Payload payload{}; - if (!mscom::InvokeOnMainThread("HandlerProvider::BuildIA2Data", - this, &HandlerProvider::BuildIA2Data, + if (!mscom::InvokeOnMainThread(this, &HandlerProvider::BuildIA2Data, &payload.mData) || !payload.mData.mUniqueId) { return; @@ -237,8 +236,7 @@ HandlerProvider::put_HandlerControl(long aPid, IHandlerControl* aCtrl) auto ptrProxy = mscom::ToProxyUniquePtr(aCtrl); - if (!mscom::InvokeOnMainThread("HandlerProvider::SetHandlerControlOnMainThread", - this, + if (!mscom::InvokeOnMainThread(this, &HandlerProvider::SetHandlerControlOnMainThread, static_cast(aPid), Move(ptrProxy))) { return E_FAIL; @@ -252,8 +250,7 @@ HandlerProvider::Refresh(IA2Data* aOutData) { MOZ_ASSERT(mscom::IsCurrentThreadMTA()); - if (!mscom::InvokeOnMainThread("HandlerProvider::BuildIA2Data", - this, &HandlerProvider::BuildIA2Data, + if (!mscom::InvokeOnMainThread(this, &HandlerProvider::BuildIA2Data, aOutData)) { return E_FAIL; } diff --git a/accessible/windows/msaa/AccessibleWrap.cpp b/accessible/windows/msaa/AccessibleWrap.cpp index e3e09bb59b56b..00bbcc38de10d 100644 --- a/accessible/windows/msaa/AccessibleWrap.cpp +++ b/accessible/windows/msaa/AccessibleWrap.cpp @@ -841,8 +841,7 @@ AccessibleWrap::accSelect( // is happening, so we dispatch TakeFocus from the main thread to // guarantee that we are outside any IPC. nsCOMPtr runnable = - mozilla::NewRunnableMethod("Accessible::TakeFocus", - this, &Accessible::TakeFocus); + mozilla::NewRunnableMethod(this, &Accessible::TakeFocus); NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL); return S_OK; } diff --git a/accessible/windows/msaa/LazyInstantiator.cpp b/accessible/windows/msaa/LazyInstantiator.cpp index fffb611dc51e8..04ce7d034c302 100644 --- a/accessible/windows/msaa/LazyInstantiator.cpp +++ b/accessible/windows/msaa/LazyInstantiator.cpp @@ -251,8 +251,7 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid) // Call GatherTelemetry on a background thread because it does I/O on // the executable file to retrieve version information. nsCOMPtr runnable( - NewRunnableMethod>("LazyInstantiator::GatherTelemetry", - this, + NewRunnableMethod>(this, &LazyInstantiator::GatherTelemetry, clientExe)); NS_NewThread(getter_AddRefs(mTelemetryThread), runnable); @@ -328,9 +327,7 @@ LazyInstantiator::GatherTelemetry(nsIFile* aClientExe) // Now that we've (possibly) obtained version info, send the resulting // string back to the main thread to accumulate in telemetry. - NS_DispatchToMainThread(NewNonOwningRunnableMethod( - "LazyInstantiator::AccumulateTelemetry", - this, + NS_DispatchToMainThread(NewNonOwningRunnableMethod(this, &LazyInstantiator::AccumulateTelemetry, value)); } diff --git a/accessible/xpcom/xpcAccessibilityService.cpp b/accessible/xpcom/xpcAccessibilityService.cpp index 49c5e1082501d..97c0d0e72124a 100644 --- a/accessible/xpcom/xpcAccessibilityService.cpp +++ b/accessible/xpcom/xpcAccessibilityService.cpp @@ -79,12 +79,8 @@ xpcAccessibilityService::Release(void) if (count == 1 && !mShutdownTimer) { mShutdownTimer = do_CreateInstance(NS_TIMER_CONTRACTID); if (mShutdownTimer) { - mShutdownTimer->InitWithNamedFuncCallback( - ShutdownCallback, - this, - 100, - nsITimer::TYPE_ONE_SHOT, - "xpcAccessibilityService::Release"); + mShutdownTimer->InitWithFuncCallback(ShutdownCallback, this, 100, + nsITimer::TYPE_ONE_SHOT); } } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 2c4de02d89d35..3d9689889cd06 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -454,12 +454,9 @@ nsPingListener::StartTimeout(DocGroup* aDocGroup) timer->SetTarget(aDocGroup->EventTargetFor(TaskCategory::Network)); if (timer) { - nsresult rv = - timer->InitWithNamedFuncCallback(OnPingTimeout, - mLoadGroup, - PING_TIMEOUT, - nsITimer::TYPE_ONE_SHOT, - "nsPingListener::StartTimeout"); + nsresult rv = timer->InitWithFuncCallback(OnPingTimeout, mLoadGroup, + PING_TIMEOUT, + nsITimer::TYPE_ONE_SHOT); if (NS_SUCCEEDED(rv)) { mTimer = timer; return NS_OK; @@ -1770,12 +1767,10 @@ nsDocShell::DispatchToTabGroup(const char* aName, NS_IMETHODIMP nsDocShell::DispatchLocationChangeEvent() { - return DispatchToTabGroup( - "nsDocShell::FireDummyOnLocationChange", - TaskCategory::Other, - NewRunnableMethod("nsDocShell::FireDummyOnLocationChange", - this, - &nsDocShell::FireDummyOnLocationChange)); + return DispatchToTabGroup("nsDocShell::FireDummyOnLocationChange", + TaskCategory::Other, + NewRunnableMethod(this, + &nsDocShell::FireDummyOnLocationChange)); } bool @@ -9649,20 +9644,13 @@ class InternalLoadEvent : public Runnable bool aLoadReplace, nsIURI* aReferrer, uint32_t aReferrerPolicy, nsIPrincipal* aTriggeringPrincipal, - nsIPrincipal* aPrincipalToInherit, - uint32_t aFlags, - const char* aTypeHint, - nsIInputStream* aPostData, - nsIInputStream* aHeadersData, - uint32_t aLoadType, - nsISHEntry* aSHEntry, - bool aFirstParty, - const nsAString& aSrcdoc, - nsIDocShell* aSourceDocShell, - nsIURI* aBaseURI, - bool aCheckForPrerender) - : mozilla::Runnable("InternalLoadEvent") - , mSrcdoc(aSrcdoc) + nsIPrincipal* aPrincipalToInherit, uint32_t aFlags, + const char* aTypeHint, nsIInputStream* aPostData, + nsIInputStream* aHeadersData, uint32_t aLoadType, + nsISHEntry* aSHEntry, bool aFirstParty, + const nsAString& aSrcdoc, nsIDocShell* aSourceDocShell, + nsIURI* aBaseURI, bool aCheckForPrerender) + : mSrcdoc(aSrcdoc) , mDocShell(aDocShell) , mURI(aURI) , mOriginalURI(aOriginalURI) @@ -14052,8 +14040,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler, bool aNoOpenerImplied, bool aIsTrusted, nsIPrincipal* aTriggeringPrincipal) - : mozilla::Runnable("OnLinkClickEvent") - , mHandler(aHandler) + : mHandler(aHandler) , mURI(aURI) , mTargetSpec(aTargetSpec) , mFileName(aFileName) diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index a48c0b9ce878c..83c74efabe212 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -777,11 +777,7 @@ class nsDocShell final { public: NS_DECL_NSIRUNNABLE - explicit RestorePresentationEvent(nsDocShell* aDs) - : mozilla::Runnable("nsDocShell::RestorePresentationEvent") - , mDocShell(aDs) - { - } + explicit RestorePresentationEvent(nsDocShell* aDs) : mDocShell(aDs) {} void Revoke() { mDocShell = nullptr; } private: RefPtr mDocShell; diff --git a/docshell/base/nsDocShellTreeOwner.cpp b/docshell/base/nsDocShellTreeOwner.cpp index 4871e2df7af83..5be73d5d34f29 100644 --- a/docshell/base/nsDocShellTreeOwner.cpp +++ b/docshell/base/nsDocShellTreeOwner.cpp @@ -1260,12 +1260,10 @@ ChromeTooltipListener::MouseMove(nsIDOMEvent* aMouseEvent) } } if (mPossibleTooltipNode) { - nsresult rv = mTooltipTimer->InitWithNamedFuncCallback( - sTooltipCallback, - this, + nsresult rv = mTooltipTimer->InitWithFuncCallback( + sTooltipCallback, this, LookAndFeel::GetInt(LookAndFeel::eIntID_TooltipDelay, 500), - nsITimer::TYPE_ONE_SHOT, - "ChromeTooltipListener::MouseMove"); + nsITimer::TYPE_ONE_SHOT); if (NS_FAILED(rv)) { mPossibleTooltipNode = nullptr; } diff --git a/docshell/shistory/nsSHEntryShared.cpp b/docshell/shistory/nsSHEntryShared.cpp index a469c86876674..8625fe88efee5 100644 --- a/docshell/shistory/nsSHEntryShared.cpp +++ b/docshell/shistory/nsSHEntryShared.cpp @@ -185,8 +185,7 @@ class DestroyViewerEvent : public mozilla::Runnable { public: DestroyViewerEvent(nsIContentViewer* aViewer, nsIDocument* aDocument) - : mozilla::Runnable("DestroyViewerEvent") - , mViewer(aViewer) + : mViewer(aViewer) , mDocument(aDocument) { } diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp index 60cd91de9e94f..846f21697f0c8 100644 --- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -1453,9 +1453,7 @@ Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag) DoFinishNotificationImmediately(); } else if (!mFinishNotificationTask.IsPending()) { RefPtr> runnable = - NewRunnableMethod("dom::Animation::DoFinishNotificationImmediately", - this, - &Animation::DoFinishNotificationImmediately); + NewRunnableMethod(this, &Animation::DoFinishNotificationImmediately); context->DispatchToMicroTask(do_AddRef(runnable)); mFinishNotificationTask = runnable.forget(); } diff --git a/dom/asmjscache/AsmJSCache.cpp b/dom/asmjscache/AsmJSCache.cpp index 24cf08ad69d2e..fa5a684e42aea 100644 --- a/dom/asmjscache/AsmJSCache.cpp +++ b/dom/asmjscache/AsmJSCache.cpp @@ -242,12 +242,11 @@ class FileDescriptorHolder : public Runnable { public: FileDescriptorHolder() - : Runnable("dom::asmjscache::FileDescriptorHolder") - , mQuotaObject(nullptr) - , mFileSize(INT64_MIN) - , mFileDesc(nullptr) - , mFileMap(nullptr) - , mMappedMemory(nullptr) + : mQuotaObject(nullptr), + mFileSize(INT64_MIN), + mFileDesc(nullptr), + mFileMap(nullptr), + mMappedMemory(nullptr) { } ~FileDescriptorHolder() override diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 4bf894c9dd6d7..a31934f5c0d9d 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -85,11 +85,9 @@ class NotifyChannelActiveRunnable final : public Runnable class AudioPlaybackRunnable final : public Runnable { public: - AudioPlaybackRunnable(nsPIDOMWindowOuter* aWindow, - bool aActive, + AudioPlaybackRunnable(nsPIDOMWindowOuter* aWindow, bool aActive, AudioChannelService::AudibleChangedReasons aReason) - : mozilla::Runnable("AudioPlaybackRunnable") - , mWindow(aWindow) + : mWindow(aWindow) , mActive(aActive) , mReason(aReason) {} @@ -876,9 +874,7 @@ AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop(nsPIDOMWindowOuter mShouldSendBlockStopEvent = false; // Can't use raw pointer for lamba variable capturing, use smart ptr. nsCOMPtr window = aWindow; - NS_DispatchToCurrentThread(NS_NewRunnableFunction( - "dom::AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop", - [window]() -> void { + NS_DispatchToCurrentThread(NS_NewRunnableFunction([window] () -> void { nsCOMPtr observerService = services::GetObserverService(); if (NS_WARN_IF(!observerService)) { @@ -888,7 +884,8 @@ AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop(nsPIDOMWindowOuter observerService->NotifyObservers(ToSupports(window), "audio-playback", u"blockStop"); - })); + }) + ); } void @@ -1052,19 +1049,18 @@ AudioChannelService::AudioChannelWindow::MaybeNotifyMediaBlockStart(AudioChannel if (!mShouldSendBlockStopEvent) { mShouldSendBlockStopEvent = true; - NS_DispatchToCurrentThread(NS_NewRunnableFunction( - "dom::AudioChannelService::AudioChannelWindow::" - "MaybeNotifyMediaBlockStart", - [window]() -> void { - nsCOMPtr observerService = - services::GetObserverService(); - if (NS_WARN_IF(!observerService)) { - return; - } - - observerService->NotifyObservers( - ToSupports(window), "audio-playback", u"blockStart"); - })); + NS_DispatchToCurrentThread(NS_NewRunnableFunction([window] () -> void { + nsCOMPtr observerService = + services::GetObserverService(); + if (NS_WARN_IF(!observerService)) { + return; + } + + observerService->NotifyObservers(ToSupports(window), + "audio-playback", + u"blockStart"); + }) + ); } } diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 18bc269ce48f3..c6eff39f12a1f 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -454,9 +454,8 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType // should be invoked prior to returning control back to script. // Create a script runner to process the top of the processing // stack as soon as it is safe to run script. - nsCOMPtr runnable = NS_NewRunnableFunction( - "dom::CustomElementRegistry::EnqueueLifecycleCallback", - &CustomElementRegistry::ProcessTopElementQueue); + nsCOMPtr runnable = + NS_NewRunnableFunction(&CustomElementRegistry::ProcessTopElementQueue); nsContentUtils::AddScriptRunner(runnable); } } diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index 6faf5c6463b82..1faf0af488bf1 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -243,11 +243,8 @@ class CustomElementReactionsStack private: class ProcessBackupQueueRunnable : public mozilla::Runnable { public: - explicit ProcessBackupQueueRunnable( - CustomElementReactionsStack* aReactionStack) - : Runnable( - "dom::CustomElementReactionsStack::ProcessBackupQueueRunnable") - , mReactionStack(aReactionStack) + explicit ProcessBackupQueueRunnable(CustomElementReactionsStack* aReactionStack) + : mReactionStack(aReactionStack) { MOZ_ASSERT(!mReactionStack->mIsBackupQueueProcessing, "mIsBackupQueueProcessing should be initially false"); diff --git a/dom/base/DOMRequest.cpp b/dom/base/DOMRequest.cpp index d6eee12adb349..ce6cd1dcdeaa3 100644 --- a/dom/base/DOMRequest.cpp +++ b/dom/base/DOMRequest.cpp @@ -299,10 +299,10 @@ DOMRequestService::FireDetailedError(nsIDOMDOMRequest* aRequest, class FireSuccessAsyncTask : public mozilla::Runnable { - FireSuccessAsyncTask(DOMRequest* aRequest, const JS::Value& aResult) - : mozilla::Runnable("FireSuccessAsyncTask") - , mReq(aRequest) - , mResult(RootingCx(), aResult) + FireSuccessAsyncTask(DOMRequest* aRequest, + const JS::Value& aResult) : + mReq(aRequest), + mResult(RootingCx(), aResult) { } @@ -336,10 +336,10 @@ class FireSuccessAsyncTask : public mozilla::Runnable class FireErrorAsyncTask : public mozilla::Runnable { public: - FireErrorAsyncTask(DOMRequest* aRequest, const nsAString& aError) - : mozilla::Runnable("FireErrorAsyncTask") - , mReq(aRequest) - , mError(aError) + FireErrorAsyncTask(DOMRequest* aRequest, + const nsAString& aError) : + mReq(aRequest), + mError(aError) { } diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 33acbcb191c15..3c6b7a3655754 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -613,9 +613,7 @@ Element::WrapObject(JSContext *aCx, JS::Handle aGivenProto) binding->ExecuteAttachedHandler(); } else { nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsXBLBinding::ExecuteAttachedHandler", - binding, - &nsXBLBinding::ExecuteAttachedHandler)); + NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler)); } } } @@ -1790,14 +1788,10 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent, return NS_OK; } -RemoveFromBindingManagerRunnable::RemoveFromBindingManagerRunnable( - nsBindingManager* aManager, - nsIContent* aContent, - nsIDocument* aDoc) - : mozilla::Runnable("dom::RemoveFromBindingManagerRunnable") - , mManager(aManager) - , mContent(aContent) - , mDoc(aDoc) +RemoveFromBindingManagerRunnable::RemoveFromBindingManagerRunnable(nsBindingManager* aManager, + nsIContent* aContent, + nsIDocument* aDoc): + mManager(aManager), mContent(aContent), mDoc(aDoc) {} RemoveFromBindingManagerRunnable::~RemoveFromBindingManagerRunnable() {} diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index 3911b71ba7bdf..518f048cf1cf3 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -391,9 +391,7 @@ EventSourceImpl::Close() // Asynchronously call CloseInternal to prevent EventSourceImpl from being // synchronously destoryed while dispatching DOM event. DebugOnly rv = - Dispatch(NewRunnableMethod("dom::EventSourceImpl::CloseInternal", - this, - &EventSourceImpl::CloseInternal), + Dispatch(NewRunnableMethod(this, &EventSourceImpl::CloseInternal), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); } @@ -685,9 +683,7 @@ EventSourceImpl::OnStartRequest(nsIRequest* aRequest, nsISupports* aCtxt) } } } - rv = Dispatch(NewRunnableMethod("dom::EventSourceImpl::AnnounceConnection", - this, - &EventSourceImpl::AnnounceConnection), + rv = Dispatch(NewRunnableMethod(this, &EventSourceImpl::AnnounceConnection), NS_DISPATCH_NORMAL); NS_ENSURE_SUCCESS(rv, rv); mStatus = PARSE_STATE_BEGIN_OF_STREAM; @@ -756,8 +752,7 @@ class DataAvailableRunnable final : public Runnable DataAvailableRunnable(EventSourceImpl* aEventSourceImpl, UniquePtr aData, uint32_t aLength) - : Runnable("dom::DataAvailableRunnable") - , mEventSourceImpl(aEventSourceImpl) + : mEventSourceImpl(aEventSourceImpl) , mData(Move(aData)) , mLength(aLength) { @@ -845,10 +840,9 @@ EventSourceImpl::OnStopRequest(nsIRequest* aRequest, nsresult rv = CheckHealthOfRequestCallback(aRequest); NS_ENSURE_SUCCESS(rv, rv); - rv = Dispatch(NewRunnableMethod("dom::EventSourceImpl::ReestablishConnection", - this, - &EventSourceImpl::ReestablishConnection), - NS_DISPATCH_NORMAL); + rv = Dispatch( + NewRunnableMethod(this, &EventSourceImpl::ReestablishConnection), + NS_DISPATCH_NORMAL); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; @@ -1251,12 +1245,9 @@ EventSourceImpl::SetReconnectionTimeout() NS_ENSURE_STATE(mTimer); } - nsresult rv = mTimer->InitWithNamedFuncCallback( - TimerCallback, - this, - mReconnectionTime, - nsITimer::TYPE_ONE_SHOT, - "dom::EventSourceImpl::SetReconnectionTimeout"); + nsresult rv = mTimer->InitWithFuncCallback(TimerCallback, this, + mReconnectionTime, + nsITimer::TYPE_ONE_SHOT); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; @@ -1350,9 +1341,7 @@ EventSourceImpl::DispatchFailConnection() if (NS_FAILED(rv)) { NS_WARNING("Failed to print to the console error"); } - rv = Dispatch(NewRunnableMethod("dom::EventSourceImpl::FailConnection", - this, - &EventSourceImpl::FailConnection), + rv = Dispatch(NewRunnableMethod(this, &EventSourceImpl::FailConnection), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); } @@ -1418,9 +1407,7 @@ EventSourceImpl::Thaw() nsresult rv; if (!mGoingToDispatchAllMessages && mMessagesToDispatch.GetSize() > 0) { nsCOMPtr event = - NewRunnableMethod("dom::EventSourceImpl::DispatchAllMessageEvents", - this, - &EventSourceImpl::DispatchAllMessageEvents); + NewRunnableMethod(this, &EventSourceImpl::DispatchAllMessageEvents); NS_ENSURE_STATE(event); mGoingToDispatchAllMessages = true; @@ -1481,9 +1468,7 @@ EventSourceImpl::DispatchCurrentMessageEvent() if (!mGoingToDispatchAllMessages) { nsCOMPtr event = - NewRunnableMethod("dom::EventSourceImpl::DispatchAllMessageEvents", - this, - &EventSourceImpl::DispatchAllMessageEvents); + NewRunnableMethod(this, &EventSourceImpl::DispatchAllMessageEvents); NS_ENSURE_STATE(event); mGoingToDispatchAllMessages = true; diff --git a/dom/base/ImageEncoder.cpp b/dom/base/ImageEncoder.cpp index b263222ee7515..8bed53cf74533 100644 --- a/dom/base/ImageEncoder.cpp +++ b/dom/base/ImageEncoder.cpp @@ -552,9 +552,9 @@ ImageEncoder::EnsureThreadPool() sThreadPool = threadPool; if (!NS_IsMainThread()) { - NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::ImageEncoder::EnsureThreadPool", - []() -> void { RegisterEncoderThreadPoolTerminatorObserver(); })); + NS_DispatchToMainThread(NS_NewRunnableFunction([]() -> void { + RegisterEncoderThreadPoolTerminatorObserver(); + })); } else { RegisterEncoderThreadPoolTerminatorObserver(); } diff --git a/dom/base/PostMessageEvent.cpp b/dom/base/PostMessageEvent.cpp index 06b2b55e0e2e6..3d562859a14e2 100644 --- a/dom/base/PostMessageEvent.cpp +++ b/dom/base/PostMessageEvent.cpp @@ -35,16 +35,14 @@ PostMessageEvent::PostMessageEvent(nsGlobalWindow* aSource, nsIPrincipal* aProvidedPrincipal, nsIDocument* aSourceDocument, bool aTrustedCaller) - : Runnable("dom::PostMessageEvent") - , StructuredCloneHolder(CloningSupported, - TransferringSupported, - StructuredCloneScope::SameProcessSameThread) - , mSource(aSource) - , mCallerOrigin(aCallerOrigin) - , mTargetWindow(aTargetWindow) - , mProvidedPrincipal(aProvidedPrincipal) - , mSourceDocument(aSourceDocument) - , mTrustedCaller(aTrustedCaller) +: StructuredCloneHolder(CloningSupported, TransferringSupported, + StructuredCloneScope::SameProcessSameThread), + mSource(aSource), + mCallerOrigin(aCallerOrigin), + mTargetWindow(aTargetWindow), + mProvidedPrincipal(aProvidedPrincipal), + mSourceDocument(aSourceDocument), + mTrustedCaller(aTrustedCaller) { } diff --git a/dom/base/ScreenOrientation.cpp b/dom/base/ScreenOrientation.cpp index 6d7d652120ac8..644e5145dbaf4 100644 --- a/dom/base/ScreenOrientation.cpp +++ b/dom/base/ScreenOrientation.cpp @@ -553,10 +553,8 @@ ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration) doc->SetOrientationPendingPromise(nullptr); } - nsCOMPtr runnable = - NewRunnableMethod("dom::ScreenOrientation::DispatchChangeEvent", - this, - &ScreenOrientation::DispatchChangeEvent); + nsCOMPtr runnable = NewRunnableMethod(this, + &ScreenOrientation::DispatchChangeEvent); rv = NS_DispatchToMainThread(runnable); NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed"); } @@ -642,10 +640,8 @@ ScreenOrientation::VisibleEventListener::HandleEvent(nsIDOMEvent* aEvent) doc->SetOrientationPendingPromise(nullptr); } - nsCOMPtr runnable = - NewRunnableMethod("dom::ScreenOrientation::DispatchChangeEvent", - orientation, - &ScreenOrientation::DispatchChangeEvent); + nsCOMPtr runnable = NewRunnableMethod(orientation, + &ScreenOrientation::DispatchChangeEvent); rv = NS_DispatchToMainThread(runnable); if (NS_WARN_IF(rv.Failed())) { return rv.StealNSResult(); diff --git a/dom/base/Selection.h b/dom/base/Selection.h index 980b3939a1cdb..da9a573d4daa3 100644 --- a/dom/base/Selection.h +++ b/dom/base/Selection.h @@ -323,13 +323,11 @@ class Selection final : public nsISelectionPrivate, nsIPresShell::ScrollAxis aVertical, nsIPresShell::ScrollAxis aHorizontal, int32_t aFlags) - : Runnable("dom::Selection::ScrollSelectionIntoViewEvent") - , mSelection(aSelection) - , mRegion(aRegion) - , mVerticalScroll(aVertical) - , mHorizontalScroll(aHorizontal) - , mFlags(aFlags) - { + : mSelection(aSelection), + mRegion(aRegion), + mVerticalScroll(aVertical), + mHorizontalScroll(aHorizontal), + mFlags(aFlags) { NS_ASSERTION(aSelection, "null parameter"); } void Revoke() { mSelection = nullptr; } diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index f98b09c2f5d2a..b7f2235a17bcb 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -268,8 +268,7 @@ class CallDispatchConnectionCloseEvents final : public CancelableRunnable { public: explicit CallDispatchConnectionCloseEvents(WebSocketImpl* aWebSocketImpl) - : CancelableRunnable("dom::CallDispatchConnectionCloseEvents") - , mWebSocketImpl(aWebSocketImpl) + : mWebSocketImpl(aWebSocketImpl) { aWebSocketImpl->AssertIsOnTargetThread(); } @@ -405,11 +404,9 @@ namespace { class CancelWebSocketRunnable final : public Runnable { public: - CancelWebSocketRunnable(nsIWebSocketChannel* aChannel, - uint16_t aReasonCode, + CancelWebSocketRunnable(nsIWebSocketChannel* aChannel, uint16_t aReasonCode, const nsACString& aReasonString) - : Runnable("dom::CancelWebSocketRunnable") - , mChannel(aChannel) + : mChannel(aChannel) , mReasonCode(aReasonCode) , mReasonString(aReasonString) {} @@ -461,8 +458,7 @@ class CloseConnectionRunnable final : public Runnable CloseConnectionRunnable(WebSocketImpl* aImpl, uint16_t aReasonCode, const nsACString& aReasonString) - : Runnable("dom::CloseConnectionRunnable") - , mImpl(aImpl) + : mImpl(aImpl) , mReasonCode(aReasonCode) , mReasonString(aReasonString) {} diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index c0d9fcc7df7c6..b98d89bfc9ce3 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -285,9 +285,8 @@ nsContentSink::ProcessHTTPHeaders(nsIChannel* aChannel) "Already dispatched an event?"); mProcessLinkHeaderEvent = - NewNonOwningRunnableMethod("nsContentSink::DoProcessLinkHeader", - this, - &nsContentSink::DoProcessLinkHeader); + NewNonOwningRunnableMethod(this, + &nsContentSink::DoProcessLinkHeader); rv = NS_DispatchToCurrentThread(mProcessLinkHeaderEvent.get()); if (NS_FAILED(rv)) { mProcessLinkHeaderEvent.Forget(); diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index e087282f2a1b0..f97909b431154 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -5322,16 +5322,12 @@ nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode, class AnonymousContentDestroyer : public Runnable { public: - explicit AnonymousContentDestroyer(nsCOMPtr* aContent) - : mozilla::Runnable("AnonymousContentDestroyer") - { + explicit AnonymousContentDestroyer(nsCOMPtr* aContent) { mContent.swap(*aContent); mParent = mContent->GetParent(); mDoc = mContent->OwnerDoc(); } - explicit AnonymousContentDestroyer(nsCOMPtr* aElement) - : mozilla::Runnable("AnonymousContentDestroyer") - { + explicit AnonymousContentDestroyer(nsCOMPtr* aElement) { mContent = aElement->forget(); mParent = mContent->GetParent(); mDoc = mContent->OwnerDoc(); @@ -10564,9 +10560,9 @@ nsContentUtils::UserInteractionObserver::Init() // started yet. It will have started by the time we have the chance to spin // the event loop. RefPtr self = this; - NS_DispatchToMainThread( - NS_NewRunnableFunction("nsContentUtils::UserInteractionObserver::Init", - [=]() { HangMonitor::RegisterAnnotator(*self); })); + NS_DispatchToMainThread(NS_NewRunnableFunction([=] () { + HangMonitor::RegisterAnnotator(*self); + })); } void diff --git a/dom/base/nsDOMMutationObserver.cpp b/dom/base/nsDOMMutationObserver.cpp index 2798d2eeee8cf..cd68948211397 100644 --- a/dom/base/nsDOMMutationObserver.cpp +++ b/dom/base/nsDOMMutationObserver.cpp @@ -867,7 +867,6 @@ nsDOMMutationObserver::HandleMutation() class AsyncMutationHandler : public mozilla::Runnable { public: - AsyncMutationHandler() : mozilla::Runnable("AsyncMutationHandler") {} NS_IMETHOD Run() override { nsDOMMutationObserver::HandleMutations(); diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 7465ed8c08006..df58093bcf21f 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1109,21 +1109,10 @@ nsDOMWindowUtils::SendNativeKeyEvent(int32_t aNativeKeyboardLayout, if (!widget) return NS_ERROR_FAILURE; - NS_DispatchToMainThread( - NewRunnableMethod("nsIWidget::SynthesizeNativeKeyEvent", - widget, - &nsIWidget::SynthesizeNativeKeyEvent, - aNativeKeyboardLayout, - aNativeKeyCode, - aModifiers, - aCharacters, - aUnmodifiedCharacters, - aObserver)); + NS_DispatchToMainThread(NewRunnableMethod + + (widget, &nsIWidget::SynthesizeNativeKeyEvent, aNativeKeyboardLayout, + aNativeKeyCode, aModifiers, aCharacters, aUnmodifiedCharacters, aObserver)); return NS_OK; } @@ -1140,15 +1129,11 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX, if (!widget) return NS_ERROR_FAILURE; - NS_DispatchToMainThread( - NewRunnableMethod( - "nsIWidget::SynthesizeNativeMouseEvent", - widget, - &nsIWidget::SynthesizeNativeMouseEvent, - LayoutDeviceIntPoint(aScreenX, aScreenY), - aNativeMessage, - aModifierFlags, - aObserver)); + NS_DispatchToMainThread(NewRunnableMethod + + (widget, &nsIWidget::SynthesizeNativeMouseEvent, + LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aModifierFlags, + aObserver)); return NS_OK; } @@ -1163,12 +1148,10 @@ nsDOMWindowUtils::SendNativeMouseMove(int32_t aScreenX, if (!widget) return NS_ERROR_FAILURE; - NS_DispatchToMainThread(NewRunnableMethod( - "nsIWidget::SynthesizeNativeMouseMove", - widget, - &nsIWidget::SynthesizeNativeMouseMove, - LayoutDeviceIntPoint(aScreenX, aScreenY), - aObserver)); + NS_DispatchToMainThread(NewRunnableMethod + + (widget, &nsIWidget::SynthesizeNativeMouseMove, + LayoutDeviceIntPoint(aScreenX, aScreenY), aObserver)); return NS_OK; } @@ -1190,25 +1173,11 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX, return NS_ERROR_FAILURE; } - NS_DispatchToMainThread(NewRunnableMethod( - "nsIWidget::SynthesizeNativeMouseScrollEvent", - widget, - &nsIWidget::SynthesizeNativeMouseScrollEvent, - LayoutDeviceIntPoint(aScreenX, aScreenY), - aNativeMessage, - aDeltaX, - aDeltaY, - aDeltaZ, - aModifierFlags, - aAdditionalFlags, - aObserver)); + NS_DispatchToMainThread(NewRunnableMethod + + (widget, &nsIWidget::SynthesizeNativeMouseScrollEvent, + LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aDeltaX, aDeltaY, + aDeltaZ, aModifierFlags, aAdditionalFlags, aObserver)); return NS_OK; } @@ -1230,21 +1199,12 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId, return NS_ERROR_INVALID_ARG; } - NS_DispatchToMainThread( - NewRunnableMethod("nsIWidget::SynthesizeNativeTouchPoint", - widget, - &nsIWidget::SynthesizeNativeTouchPoint, - aPointerId, - (nsIWidget::TouchPointerState)aTouchState, - LayoutDeviceIntPoint(aScreenX, aScreenY), - aPressure, - aOrientation, - aObserver)); + NS_DispatchToMainThread(NewRunnableMethod + + (widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId, + (nsIWidget::TouchPointerState)aTouchState, + LayoutDeviceIntPoint(aScreenX, aScreenY), + aPressure, aOrientation, aObserver)); return NS_OK; } @@ -1259,14 +1219,10 @@ nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX, return NS_ERROR_FAILURE; } - NS_DispatchToMainThread( - NewRunnableMethod( - "nsIWidget::SynthesizeNativeTouchTap", - widget, - &nsIWidget::SynthesizeNativeTouchTap, - LayoutDeviceIntPoint(aScreenX, aScreenY), - aLongTap, - aObserver)); + NS_DispatchToMainThread(NewRunnableMethod + + (widget, &nsIWidget::SynthesizeNativeTouchTap, + LayoutDeviceIntPoint(aScreenX, aScreenY), aLongTap, aObserver)); return NS_OK; } @@ -1278,11 +1234,8 @@ nsDOMWindowUtils::ClearNativeTouchSequence(nsIObserver* aObserver) return NS_ERROR_FAILURE; } - NS_DispatchToMainThread( - NewRunnableMethod("nsIWidget::ClearNativeTouchSequence", - widget, - &nsIWidget::ClearNativeTouchSequence, - aObserver)); + NS_DispatchToMainThread(NewRunnableMethod + (widget, &nsIWidget::ClearNativeTouchSequence, aObserver)); return NS_OK; } diff --git a/dom/base/nsDocElementCreatedNotificationRunner.h b/dom/base/nsDocElementCreatedNotificationRunner.h index 5568a37bbdaf5..1e53c3dd0ba72 100644 --- a/dom/base/nsDocElementCreatedNotificationRunner.h +++ b/dom/base/nsDocElementCreatedNotificationRunner.h @@ -18,8 +18,7 @@ class nsDocElementCreatedNotificationRunner : public mozilla::Runnable { public: explicit nsDocElementCreatedNotificationRunner(nsIDocument* aDoc) - : mozilla::Runnable("nsDocElementCreatedNotificationRunner") - , mDoc(aDoc) + : mDoc(aDoc) { } diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 57f80d4f200cd..379e35ce1f673 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -4434,10 +4434,8 @@ nsDocument::SetStyleSheetApplicableState(StyleSheet* aSheet, if (!mSSApplicableStateNotificationPending) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); - nsCOMPtr notification = - NewRunnableMethod("nsDocument::NotifyStyleSheetApplicableStateChanged", - this, - &nsDocument::NotifyStyleSheetApplicableStateChanged); + nsCOMPtr notification = NewRunnableMethod(this, + &nsDocument::NotifyStyleSheetApplicableStateChanged); mSSApplicableStateNotificationPending = NS_SUCCEEDED( Dispatch("nsDocument::NotifyStyleSheetApplicableStateChanged", @@ -5052,9 +5050,7 @@ nsDocument::MaybeEndOutermostXBLUpdate() } else if (!mInDestructor) { if (!mMaybeEndOutermostXBLUpdateRunner) { mMaybeEndOutermostXBLUpdateRunner = - NewRunnableMethod("nsDocument::MaybeEndOutermostXBLUpdate", - this, - &nsDocument::MaybeEndOutermostXBLUpdate); + NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate); } nsContentUtils::AddScriptRunner(mMaybeEndOutermostXBLUpdateRunner); } @@ -5385,9 +5381,7 @@ nsDocument::UnblockDOMContentLoaded() if (!mSynchronousDOMContentLoaded) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); nsCOMPtr ev = - NewRunnableMethod("nsDocument::DispatchContentLoadedEvents", - this, - &nsDocument::DispatchContentLoadedEvents); + NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents); Dispatch("nsDocument::DispatchContentLoadedEvents", TaskCategory::Other, ev.forget()); } else { DispatchContentLoadedEvents(); @@ -7025,9 +7019,7 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement) MOZ_RELEASE_ASSERT(NS_IsMainThread()); RefPtr> event = - NewNonOwningRunnableMethod("nsDocument::DoNotifyPossibleTitleChange", - this, - &nsDocument::DoNotifyPossibleTitleChange); + NewNonOwningRunnableMethod(this, &nsDocument::DoNotifyPossibleTitleChange); nsresult rv = Dispatch("nsDocument::DoNotifyPossibleTitleChange", TaskCategory::Other, do_AddRef(event)); if (NS_SUCCEEDED(rv)) { @@ -7177,9 +7169,7 @@ nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader) mInitializableFrameLoaders.AppendElement(aLoader); if (!mFrameLoaderRunner) { mFrameLoaderRunner = - NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders", - this, - &nsDocument::MaybeInitializeFinalizeFrameLoaders); + NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders); NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY); nsContentUtils::AddScriptRunner(mFrameLoaderRunner); } @@ -7197,9 +7187,7 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader, nsIRunnable* aFinalizer) mFrameLoaderFinalizers.AppendElement(aFinalizer); if (!mFrameLoaderRunner) { mFrameLoaderRunner = - NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders", - this, - &nsDocument::MaybeInitializeFinalizeFrameLoaders); + NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders); NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY); nsContentUtils::AddScriptRunner(mFrameLoaderRunner); } @@ -7223,9 +7211,7 @@ nsDocument::MaybeInitializeFinalizeFrameLoaders() (mInitializableFrameLoaders.Length() || mFrameLoaderFinalizers.Length())) { mFrameLoaderRunner = - NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders", - this, - &nsDocument::MaybeInitializeFinalizeFrameLoaders); + NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders); nsContentUtils::AddScriptRunner(mFrameLoaderRunner); } return; @@ -8802,8 +8788,8 @@ nsDocument::BlockOnload() // block onload only when there are no script blockers. ++mAsyncOnloadBlockCount; if (mAsyncOnloadBlockCount == 1) { - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "nsDocument::AsyncBlockOnload", this, &nsDocument::AsyncBlockOnload)); + nsContentUtils::AddScriptRunner( + NewRunnableMethod(this, &nsDocument::AsyncBlockOnload)); } return; } @@ -8860,11 +8846,7 @@ nsDocument::UnblockOnload(bool aFireSync) class nsUnblockOnloadEvent : public Runnable { public: - explicit nsUnblockOnloadEvent(nsDocument* aDoc) - : mozilla::Runnable("nsUnblockOnloadEvent") - , mDoc(aDoc) - { - } + explicit nsUnblockOnloadEvent(nsDocument* aDoc) : mDoc(aDoc) {} NS_IMETHOD Run() override { mDoc->DoUnblockOnload(); return NS_OK; @@ -9746,7 +9728,6 @@ class nsDelayedEventDispatcher : public Runnable { public: explicit nsDelayedEventDispatcher(nsTArray>& aDocuments) - : mozilla::Runnable("nsDelayedEventDispatcher") { mDocuments.SwapElements(aDocuments); } @@ -9993,9 +9974,7 @@ nsIDocument::RegisterPendingLinkUpdate(Link* aLink) if (!mHasLinksToUpdateRunnable) { nsCOMPtr event = - NewRunnableMethod("nsIDocument::FlushPendingLinkUpdatesFromRunnable", - this, - &nsIDocument::FlushPendingLinkUpdatesFromRunnable); + NewRunnableMethod(this, &nsIDocument::FlushPendingLinkUpdatesFromRunnable); // Do this work in a second in the worst case. nsresult rv = NS_IdleDispatchToCurrentThread(event.forget(), 1000); @@ -10917,10 +10896,7 @@ class nsCallExitFullscreen : public Runnable { public: explicit nsCallExitFullscreen(nsIDocument* aDoc) - : mozilla::Runnable("nsCallExitFullscreen") - , mDoc(aDoc) - { - } + : mDoc(aDoc) {} NS_IMETHOD Run() override final { @@ -11000,10 +10976,7 @@ class ExitFullscreenScriptRunnable : public Runnable { public: explicit ExitFullscreenScriptRunnable(nsCOMArray&& aDocuments) - : mozilla::Runnable("ExitFullscreenScriptRunnable") - , mDocuments(Move(aDocuments)) - { - } + : mDocuments(Move(aDocuments)) { } NS_IMETHOD Run() override { @@ -11197,10 +11170,7 @@ class nsCallRequestFullScreen : public Runnable { public: explicit nsCallRequestFullScreen(UniquePtr&& aRequest) - : mozilla::Runnable("nsCallRequestFullScreen") - , mRequest(Move(aRequest)) - { - } + : mRequest(Move(aRequest)) { } NS_IMETHOD Run() override { @@ -11930,8 +11900,7 @@ class PointerLockRequest final : public Runnable { public: PointerLockRequest(Element* aElement, bool aUserInputOrChromeCaller) - : mozilla::Runnable("PointerLockRequest") - , mElement(do_GetWeakReference(aElement)) + : mElement(do_GetWeakReference(aElement)) , mDocument(do_GetWeakReference(aElement->OwnerDoc())) , mUserInputOrChromeCaller(aUserInputOrChromeCaller) {} @@ -12282,9 +12251,7 @@ nsDocument::GetVisibilityState() const nsDocument::PostVisibilityUpdateEvent() { nsCOMPtr event = - NewRunnableMethod("nsDocument::UpdateVisibilityState", - this, - &nsDocument::UpdateVisibilityState); + NewRunnableMethod(this, &nsDocument::UpdateVisibilityState); Dispatch("nsDocument::UpdateVisibilityState", TaskCategory::Other, event.forget()); } @@ -12829,9 +12796,7 @@ nsDocument::ScheduleIntersectionObserverNotification() } MOZ_RELEASE_ASSERT(NS_IsMainThread()); nsCOMPtr notification = - NewRunnableMethod("nsDocument::NotifyIntersectionObservers", - this, - &nsDocument::NotifyIntersectionObservers); + NewRunnableMethod(this, &nsDocument::NotifyIntersectionObservers); Dispatch("nsDocument::IntersectionObserverNotification", TaskCategory::Other, notification.forget()); } @@ -13121,9 +13086,7 @@ nsIDocument::RebuildUserFontSet() if (!mPostedFlushUserFontSet) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); nsCOMPtr ev = - NewRunnableMethod("nsIDocument::HandleRebuildUserFontSet", - this, - &nsIDocument::HandleRebuildUserFontSet); + NewRunnableMethod(this, &nsIDocument::HandleRebuildUserFontSet); if (NS_SUCCEEDED(Dispatch("nsIDocument::HandleRebuildUserFontSet", TaskCategory::Other, ev.forget()))) { mPostedFlushUserFontSet = true; diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 2d0839b9d1a3a..210b77a2ffa26 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -2021,14 +2021,10 @@ nsFocusManager::Focus(nsPIDOMWindowOuter* aWindow, class FocusBlurEvent : public Runnable { public: - FocusBlurEvent(nsISupports* aTarget, - EventMessage aEventMessage, - nsPresContext* aContext, - bool aWindowRaised, - bool aIsRefocus, - EventTarget* aRelatedTarget) - : mozilla::Runnable("FocusBlurEvent") - , mTarget(aTarget) + FocusBlurEvent(nsISupports* aTarget, EventMessage aEventMessage, + nsPresContext* aContext, bool aWindowRaised, + bool aIsRefocus, EventTarget* aRelatedTarget) + : mTarget(aTarget) , mContext(aContext) , mEventMessage(aEventMessage) , mWindowRaised(aWindowRaised) @@ -2059,14 +2055,12 @@ class FocusBlurEvent : public Runnable class FocusInOutEvent : public Runnable { public: - FocusInOutEvent(nsISupports* aTarget, - EventMessage aEventMessage, - nsPresContext* aContext, - nsPIDOMWindowOuter* aOriginalFocusedWindow, - nsIContent* aOriginalFocusedContent, - EventTarget* aRelatedTarget) - : mozilla::Runnable("FocusInOutEvent") - , mTarget(aTarget) + FocusInOutEvent(nsISupports* aTarget, EventMessage aEventMessage, + nsPresContext* aContext, + nsPIDOMWindowOuter* aOriginalFocusedWindow, + nsIContent* aOriginalFocusedContent, + EventTarget* aRelatedTarget) + : mTarget(aTarget) , mContext(aContext) , mEventMessage(aEventMessage) , mOriginalFocusedWindow(aOriginalFocusedWindow) @@ -2270,8 +2264,8 @@ nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow) nsCOMPtr active(mActiveWindow); nsCOMPtr window(aWindow); RefPtr self(this); - NS_DispatchToCurrentThread(NS_NewRunnableFunction( - "nsFocusManager::RaiseWindow", [self, active, window]() -> void { + NS_DispatchToCurrentThread( + NS_NewRunnableFunction([self, active, window] () -> void { if (active) { self->WindowLowered(active); } @@ -3629,7 +3623,6 @@ class PointerUnlocker : public Runnable { public: PointerUnlocker() - : mozilla::Runnable("PointerUnlocker") { MOZ_ASSERT(!PointerUnlocker::sActiveUnlocker); PointerUnlocker::sActiveUnlocker = this; diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index eca46e193bd7c..9857ba3a50fc8 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -1985,11 +1985,7 @@ class nsFrameLoaderDestroyRunnable : public Runnable public: explicit nsFrameLoaderDestroyRunnable(nsFrameLoader* aFrameLoader) - : mozilla::Runnable("nsFrameLoaderDestroyRunnable") - , mFrameLoader(aFrameLoader) - , mPhase(eDestroyDocShell) - { - } + : mFrameLoader(aFrameLoader), mPhase(eDestroyDocShell) {} NS_IMETHOD Run() override; }; @@ -2074,10 +2070,9 @@ nsFrameLoader::StartDestroy() nsCOMPtr groupedSHistory; GetGroupedSHistory(getter_AddRefs(groupedSHistory)); if (groupedSHistory) { - NS_DispatchToCurrentThread(NS_NewRunnableFunction( - "nsFrameLoader::StartDestroy", [groupedSHistory]() { - groupedSHistory->CloseInactiveFrameLoaderOwners(); - })); + NS_DispatchToCurrentThread(NS_NewRunnableFunction([groupedSHistory] () { + groupedSHistory->CloseInactiveFrameLoaderOwners(); + })); } } @@ -3172,7 +3167,6 @@ class nsAsyncMessageToChild : public nsSameProcessAsyncMessageBase, JS::Handle aCpows, nsFrameLoader* aFrameLoader) : nsSameProcessAsyncMessageBase(aRootingCx, aCpows) - , mozilla::Runnable("nsAsyncMessageToChild") , mFrameLoader(aFrameLoader) { } diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index 18d6fc2e837e7..1047cf2fe4b58 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -1751,7 +1751,6 @@ class nsAsyncMessageToSameProcessChild : public nsSameProcessAsyncMessageBase, nsAsyncMessageToSameProcessChild(JS::RootingContext* aRootingCx, JS::Handle aCpows) : nsSameProcessAsyncMessageBase(aRootingCx, aCpows) - , mozilla::Runnable("nsAsyncMessageToSameProcessChild") { } NS_IMETHOD Run() override { diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 1b71b312ce831..82f9dd0c063c2 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -3034,8 +3034,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, happens, setting status isn't a big requirement, so don't. (Doesn't happen under normal circumstances, but bug 49615 describes a case.) */ - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "nsGlobalWindow::ClearStatus", this, &nsGlobalWindow::ClearStatus)); + nsContentUtils::AddScriptRunner( + NewRunnableMethod(this, &nsGlobalWindow::ClearStatus)); // Sometimes, WouldReuseInnerWindow() returns true even if there's no inner // window (see bug 776497). Be safe. @@ -3345,8 +3345,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, // up with the outer. See bug 969156. if (createdInnerWindow) { nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsGlobalWindow::FireOnNewGlobalObject", - newInnerWindow, + NewRunnableMethod(newInnerWindow, &nsGlobalWindow::FireOnNewGlobalObject)); } @@ -3360,9 +3359,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, nsContentUtils::IsSystemPrincipal(mDoc->NodePrincipal())) { newInnerWindow->mHasNotifiedGlobalCreated = true; nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsGlobalWindow::DispatchDOMWindowCreated", - this, - &nsGlobalWindow::DispatchDOMWindowCreated)); + NewRunnableMethod(this, &nsGlobalWindow::DispatchDOMWindowCreated)); } } @@ -6873,13 +6870,10 @@ class FullscreenTransitionTask : public Runnable { public: FullscreenTransitionTask(const FullscreenTransitionDuration& aDuration, - nsGlobalWindow* aWindow, - bool aFullscreen, - nsIWidget* aWidget, - nsIScreen* aScreen, + nsGlobalWindow* aWindow, bool aFullscreen, + nsIWidget* aWidget, nsIScreen* aScreen, nsISupports* aTransitionData) - : mozilla::Runnable("FullscreenTransitionTask") - , mWindow(aWindow) + : mWindow(aWindow) , mWidget(aWidget) , mScreen(aScreen) , mTransitionData(aTransitionData) @@ -9215,9 +9209,8 @@ class nsCloseEvent : public Runnable { RefPtr mWindow; bool mIndirect; - nsCloseEvent(nsGlobalWindow* aWindow, bool aIndirect) - : mozilla::Runnable("nsCloseEvent") - , mWindow(aWindow) + nsCloseEvent(nsGlobalWindow *aWindow, bool aIndirect) + : mWindow(aWindow) , mIndirect(aIndirect) {} @@ -9646,11 +9639,11 @@ struct BrowserCompartmentMatcher : public js::CompartmentFilter { class WindowDestroyedEvent final : public Runnable { public: - WindowDestroyedEvent(nsIDOMWindow* aWindow, uint64_t aID, const char* aTopic) - : mozilla::Runnable("WindowDestroyedEvent") - , mID(aID) - , mPhase(Phase::Destroying) - , mTopic(aTopic) + WindowDestroyedEvent(nsIDOMWindow* aWindow, uint64_t aID, + const char* aTopic) : + mID(aID), + mPhase(Phase::Destroying), + mTopic(aTopic) { mWindow = do_GetWeakReference(aWindow); } @@ -10140,12 +10133,7 @@ class ChildCommandDispatcher : public Runnable ChildCommandDispatcher(nsGlobalWindow* aWindow, nsITabChild* aTabChild, const nsAString& aAction) - : mozilla::Runnable("ChildCommandDispatcher") - , mWindow(aWindow) - , mTabChild(aTabChild) - , mAction(aAction) - { - } + : mWindow(aWindow), mTabChild(aTabChild), mAction(aAction) {} NS_IMETHOD Run() override { @@ -10174,11 +10162,7 @@ class CommandDispatcher : public Runnable public: CommandDispatcher(nsIDOMXULCommandDispatcher* aDispatcher, const nsAString& aAction) - : mozilla::Runnable("CommandDispatcher") - , mDispatcher(aDispatcher) - , mAction(aAction) - { - } + : mDispatcher(aDispatcher), mAction(aAction) {} NS_IMETHOD Run() override { @@ -10970,11 +10954,10 @@ nsGlobalWindow::PageHidden() class HashchangeCallback : public Runnable { public: - HashchangeCallback(const nsAString& aOldURL, - const nsAString& aNewURL, + HashchangeCallback(const nsAString &aOldURL, + const nsAString &aNewURL, nsGlobalWindow* aWindow) - : mozilla::Runnable("HashchangeCallback") - , mWindow(aWindow) + : mWindow(aWindow) { MOZ_ASSERT(mWindow); MOZ_ASSERT(mWindow->IsInnerWindow()); @@ -11587,11 +11570,8 @@ class NotifyIdleObserverRunnable : public Runnable uint32_t aTimeInS, bool aCallOnidle, nsGlobalWindow* aIdleWindow) - : mozilla::Runnable("NotifyIdleObserverRunnable") - , mIdleObserver(aIdleObserver) - , mTimeInS(aTimeInS) - , mIdleWindow(aIdleWindow) - , mCallOnidle(aCallOnidle) + : mIdleObserver(aIdleObserver), mTimeInS(aTimeInS), mIdleWindow(aIdleWindow), + mCallOnidle(aCallOnidle) { } NS_IMETHOD Run() override @@ -11699,12 +11679,10 @@ nsGlobalWindow::ScheduleNextIdleObserverCallback() } mIdleTimer->Cancel(); - rv = mIdleTimer->InitWithNamedFuncCallback( - IdleObserverTimerCallback, - this, - callbackTimeMS, - nsITimer::TYPE_ONE_SHOT, - "nsGlobalWindow::ScheduleNextIdleObserverCallback"); + rv = mIdleTimer->InitWithFuncCallback(IdleObserverTimerCallback, + this, + callbackTimeMS, + nsITimer::TYPE_ONE_SHOT); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; @@ -11746,12 +11724,10 @@ nsGlobalWindow::ScheduleActiveTimerCallback() mIdleTimer->Cancel(); uint32_t fuzzFactorInMS = GetFuzzTimeMS(); - nsresult rv = mIdleTimer->InitWithNamedFuncCallback( - IdleActiveTimerCallback, - this, - fuzzFactorInMS, - nsITimer::TYPE_ONE_SHOT, - "nsGlobalWindow::ScheduleActiveTimerCallback"); + nsresult rv = mIdleTimer->InitWithFuncCallback(IdleActiveTimerCallback, + this, + fuzzFactorInMS, + nsITimer::TYPE_ONE_SHOT); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; } @@ -12840,8 +12816,7 @@ class AutoUnblockScriptClosing ~AutoUnblockScriptClosing() { void (nsGlobalWindow::*run)() = &nsGlobalWindow::UnblockScriptedClosing; - nsCOMPtr caller = NewRunnableMethod( - "AutoUnblockScriptClosing::~AutoUnblockScriptClosing", mWin, run); + nsCOMPtr caller = NewRunnableMethod(mWin, run); mWin->Dispatch("nsGlobalWindow::UnblockScriptedClosing", TaskCategory::Other, caller.forget()); } diff --git a/dom/base/nsIGlobalObject.cpp b/dom/base/nsIGlobalObject.cpp index c3b5a51b922fe..6479c947b370d 100644 --- a/dom/base/nsIGlobalObject.cpp +++ b/dom/base/nsIGlobalObject.cpp @@ -43,7 +43,6 @@ class UnlinkHostObjectURIsRunnable final : public mozilla::Runnable { public: explicit UnlinkHostObjectURIsRunnable(nsTArray& aURIs) - : mozilla::Runnable("UnlinkHostObjectURIsRunnable") { mURIs.SwapElements(aURIs); } diff --git a/dom/base/nsInProcessTabChildGlobal.cpp b/dom/base/nsInProcessTabChildGlobal.cpp index ad80392b05ccb..2a0aeaf7b5667 100644 --- a/dom/base/nsInProcessTabChildGlobal.cpp +++ b/dom/base/nsInProcessTabChildGlobal.cpp @@ -309,15 +309,9 @@ nsInProcessTabChildGlobal::InitTabChildGlobal() class nsAsyncScriptLoad : public Runnable { public: - nsAsyncScriptLoad(nsInProcessTabChildGlobal* aTabChild, - const nsAString& aURL, - bool aRunInGlobalScope) - : mozilla::Runnable("nsAsyncScriptLoad") - , mTabChild(aTabChild) - , mURL(aURL) - , mRunInGlobalScope(aRunInGlobalScope) - { - } + nsAsyncScriptLoad(nsInProcessTabChildGlobal* aTabChild, const nsAString& aURL, + bool aRunInGlobalScope) + : mTabChild(aTabChild), mURL(aURL), mRunInGlobalScope(aRunInGlobalScope) {} NS_IMETHOD Run() override { diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index ed331ceb53162..0d8daf14bc18e 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -436,8 +436,7 @@ class ScriptErrorEvent : public Runnable JS::RootingContext* aRootingCx, xpc::ErrorReport* aReport, JS::Handle aError) - : mozilla::Runnable("ScriptErrorEvent") - , mWindow(aWindow) + : mWindow(aWindow) , mReport(aReport) , mError(aRootingCx, aError) {} @@ -2220,11 +2219,7 @@ class NotifyGCEndRunnable : public Runnable nsString mMessage; public: - explicit NotifyGCEndRunnable(const nsString& aMessage) - : mozilla::Runnable("NotifyGCEndRunnable") - , mMessage(aMessage) - { - } + explicit NotifyGCEndRunnable(const nsString& aMessage) : mMessage(aMessage) {} NS_DECL_NSIRUNNABLE }; @@ -2550,8 +2545,7 @@ class AsyncTaskRunnable final : public Runnable public: explicit AsyncTaskRunnable(JS::AsyncTask* aTask) - : mozilla::Runnable("AsyncTaskRunnable") - , mTask(aTask) + : mTask(aTask) { MOZ_ASSERT(mTask); } diff --git a/dom/base/nsJSEnvironment.h b/dom/base/nsJSEnvironment.h index 4fa39a1977c3f..65f09b3b8d945 100644 --- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -179,8 +179,7 @@ class AsyncErrorReporter final : public mozilla::Runnable public: // aWindow may be null if this error report is not associated with a window explicit AsyncErrorReporter(xpc::ErrorReport* aReport) - : Runnable("dom::AsyncErrorReporter") - , mReport(aReport) + : mReport(aReport) {} NS_IMETHOD Run() override diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 79185173e0854..2c839a2913532 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -279,8 +279,7 @@ class nsSimplePluginEvent : public Runnable { } nsSimplePluginEvent(nsIDocument* aTarget, const nsAString& aEvent) - : mozilla::Runnable("nsSimplePluginEvent") - , mTarget(aTarget) + : mTarget(aTarget) , mDocument(aTarget) , mEvent(aEvent) { @@ -290,8 +289,7 @@ class nsSimplePluginEvent : public Runnable { nsSimplePluginEvent(nsIContent* aTarget, nsIDocument* aDocument, const nsAString& aEvent) - : mozilla::Runnable("nsSimplePluginEvent") - , mTarget(aTarget) + : mTarget(aTarget) , mDocument(aDocument) , mEvent(aEvent) { diff --git a/dom/base/nsReferencedElement.h b/dom/base/nsReferencedElement.h index 9380d78da2c33..730a19610058c 100644 --- a/dom/base/nsReferencedElement.h +++ b/dom/base/nsReferencedElement.h @@ -129,12 +129,8 @@ class nsReferencedElement { { public: ChangeNotification(nsReferencedElement* aTarget, - Element* aFrom, - Element* aTo) - : mozilla::Runnable("nsReferencedElement::ChangeNotification") - , Notification(aTarget) - , mFrom(aFrom) - , mTo(aTo) + Element* aFrom, Element* aTo) + : Notification(aTarget), mFrom(aFrom), mTo(aTo) {} NS_DECL_ISUPPORTS_INHERITED diff --git a/dom/base/nsTextNode.cpp b/dom/base/nsTextNode.cpp index 7bf2cfa2510d7..25c2d35256785 100644 --- a/dom/base/nsTextNode.cpp +++ b/dom/base/nsTextNode.cpp @@ -273,8 +273,7 @@ nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument, // that if we get unbound while the event is up that's ok -- we'll just // have no grandparent when it fires, and will do nothing. void (nsAttributeTextNode::*update)() = &nsAttributeTextNode::UpdateText; - nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsAttributeTextNode::AttributeChanged", this, update)); + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update)); } } diff --git a/dom/cache/Context.cpp b/dom/cache/Context.cpp index ea49046f0c67b..66f56a8bcfe3a 100644 --- a/dom/cache/Context.cpp +++ b/dom/cache/Context.cpp @@ -736,10 +736,8 @@ Context::ThreadsafeHandle::AllowToClose() // Dispatch is guaranteed to succeed here because we block shutdown until // all Contexts have been destroyed. - nsCOMPtr runnable = NewRunnableMethod( - "dom::cache::Context::ThreadsafeHandle::AllowToCloseOnOwningThread", - this, - &ThreadsafeHandle::AllowToCloseOnOwningThread); + nsCOMPtr runnable = + NewRunnableMethod(this, &ThreadsafeHandle::AllowToCloseOnOwningThread); MOZ_ALWAYS_SUCCEEDS( mOwningEventTarget->Dispatch(runnable.forget(), nsIThread::DISPATCH_NORMAL)); } @@ -754,11 +752,8 @@ Context::ThreadsafeHandle::InvalidateAndAllowToClose() // Dispatch is guaranteed to succeed here because we block shutdown until // all Contexts have been destroyed. - nsCOMPtr runnable = NewRunnableMethod( - "dom::cache::Context::ThreadsafeHandle::" - "InvalidateAndAllowToCloseOnOwningThread", - this, - &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread); + nsCOMPtr runnable = + NewRunnableMethod(this, &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread); MOZ_ALWAYS_SUCCEEDS( mOwningEventTarget->Dispatch(runnable.forget(), nsIThread::DISPATCH_NORMAL)); } diff --git a/dom/cache/Manager.cpp b/dom/cache/Manager.cpp index b06abb073686f..357a8f0820e1c 100644 --- a/dom/cache/Manager.cpp +++ b/dom/cache/Manager.cpp @@ -912,10 +912,7 @@ class Manager::CachePutAllAction final : public DBAction // here since we are guaranteed the Action will survive until // CompleteOnInitiatingThread is called. nsCOMPtr runnable = NewNonOwningRunnableMethod( - "dom::cache::Manager::CachePutAllAction::OnAsyncCopyComplete", - this, - &CachePutAllAction::OnAsyncCopyComplete, - aRv); + this, &CachePutAllAction::OnAsyncCopyComplete, aRv); MOZ_ALWAYS_SUCCEEDS( mTarget->Dispatch(runnable.forget(), nsIThread::DISPATCH_NORMAL)); } @@ -1769,8 +1766,7 @@ Manager::~Manager() // Don't spin the event loop in the destructor waiting for the thread to // shutdown. Defer this to the main thread, instead. - MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod("nsIThread::Shutdown", - ioThread, &nsIThread::Shutdown))); + MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod(ioThread, &nsIThread::Shutdown))); } void diff --git a/dom/cache/PrincipalVerifier.cpp b/dom/cache/PrincipalVerifier.cpp index be27134d2f433..c92db4e788c21 100644 --- a/dom/cache/PrincipalVerifier.cpp +++ b/dom/cache/PrincipalVerifier.cpp @@ -65,8 +65,7 @@ PrincipalVerifier::RemoveListener(Listener* aListener) PrincipalVerifier::PrincipalVerifier(Listener* aListener, PBackgroundParent* aActor, const PrincipalInfo& aPrincipalInfo) - : Runnable("dom::cache::PrincipalVerifier") - , mActor(BackgroundParent::GetContentParent(aActor)) + : mActor(BackgroundParent::GetContentParent(aActor)) , mPrincipalInfo(aPrincipalInfo) , mInitiatingEventTarget(GetCurrentThreadSerialEventTarget()) , mResult(NS_OK) diff --git a/dom/cache/ReadStream.cpp b/dom/cache/ReadStream.cpp index e78377e953d65..70e41b31eddf0 100644 --- a/dom/cache/ReadStream.cpp +++ b/dom/cache/ReadStream.cpp @@ -132,8 +132,7 @@ class ReadStream::Inner::NoteClosedRunnable final : public CancelableRunnable { public: explicit NoteClosedRunnable(ReadStream::Inner* aStream) - : CancelableRunnable("dom::cache::ReadStream::Inner::NoteClosedRunnable") - , mStream(aStream) + : mStream(aStream) { } NS_IMETHOD Run() override @@ -168,8 +167,7 @@ class ReadStream::Inner::ForgetRunnable final : public CancelableRunnable { public: explicit ForgetRunnable(ReadStream::Inner* aStream) - : CancelableRunnable("dom::cache::ReadStream::Inner::ForgetRunnable") - , mStream(aStream) + : mStream(aStream) { } NS_IMETHOD Run() override diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 55b3b6e8ab626..a1fff6e21ecf6 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -1576,9 +1576,8 @@ CanvasRenderingContext2D::ScheduleStableStateCallback() mHasPendingStableStateCallback = true; nsContentUtils::RunInStableState( - NewRunnableMethod("dom::CanvasRenderingContext2D::OnStableState", - this, - &CanvasRenderingContext2D::OnStableState)); + NewRunnableMethod(this, &CanvasRenderingContext2D::OnStableState) + ); } void diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp index 9af236548061d..f6d5d86cf698e 100644 --- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -1076,8 +1076,7 @@ class FulfillImageBitmapPromiseTask final : public Runnable, { public: FulfillImageBitmapPromiseTask(Promise* aPromise, ImageBitmap* aImageBitmap) - : Runnable("dom::FulfillImageBitmapPromiseTask") - , FulfillImageBitmapPromise(aPromise, aImageBitmap) + : FulfillImageBitmapPromise(aPromise, aImageBitmap) { } @@ -1279,8 +1278,7 @@ class CreateImageBitmapFromBlobTask final : public Runnable, nsIGlobalObject* aGlobal, Blob& aBlob, const Maybe& aCropRect) - : Runnable("dom::CreateImageBitmapFromBlobTask") - , CreateImageBitmapFromBlob(aPromise, aGlobal, aBlob, aCropRect) + :CreateImageBitmapFromBlob(aPromise, aGlobal, aBlob, aCropRect) { } @@ -1734,18 +1732,12 @@ class MapDataIntoBufferSourceTask final : public Runnable, { public: MapDataIntoBufferSourceTask(JSContext* aCx, - Promise* aPromise, - ImageBitmap* aImageBitmap, + Promise *aPromise, + ImageBitmap *aImageBitmap, const T& aBuffer, int32_t aOffset, ImageBitmapFormat aFormat) - : Runnable("dom::MapDataIntoBufferSourceTask") - , MapDataIntoBufferSource(aCx, - aPromise, - aImageBitmap, - aBuffer, - aOffset, - aFormat) + : MapDataIntoBufferSource(aCx, aPromise, aImageBitmap, aBuffer, aOffset, aFormat) { } diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index cf1a8ff558166..d8f998f7ebf45 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -1737,10 +1737,9 @@ class UpdateContextLossStatusTask : public CancelableRunnable RefPtr mWebGL; public: - explicit UpdateContextLossStatusTask(WebGLContext* webgl) - : CancelableRunnable("UpdateContextLossStatusTask") - , mWebGL(webgl) - { + explicit UpdateContextLossStatusTask(WebGLContext* webgl) + : mWebGL(webgl) + { } NS_IMETHOD Run() override { diff --git a/dom/canvas/WebGLQuery.cpp b/dom/canvas/WebGLQuery.cpp index f6cc7d54aac25..c7cdaddfe2fe6 100644 --- a/dom/canvas/WebGLQuery.cpp +++ b/dom/canvas/WebGLQuery.cpp @@ -18,16 +18,13 @@ class AvailableRunnable final : public Runnable const RefPtr mQuery; public: - explicit AvailableRunnable(WebGLQuery* query) - : Runnable("AvailableRunnable") - , mQuery(query) - { - } - - NS_IMETHOD Run() override - { - mQuery->mCanBeAvailable = true; - return NS_OK; + explicit AvailableRunnable(WebGLQuery* query) + : mQuery(query) + { } + + NS_IMETHOD Run() override { + mQuery->mCanBeAvailable = true; + return NS_OK; } }; diff --git a/dom/events/AsyncEventDispatcher.cpp b/dom/events/AsyncEventDispatcher.cpp index e8f702f9ac8ae..3dda3d6b0a7d7 100644 --- a/dom/events/AsyncEventDispatcher.cpp +++ b/dom/events/AsyncEventDispatcher.cpp @@ -22,9 +22,8 @@ using namespace dom; AsyncEventDispatcher::AsyncEventDispatcher(EventTarget* aTarget, WidgetEvent& aEvent) - : CancelableRunnable("AsyncEventDispatcher") - , mTarget(aTarget) - , mEventMessage(eUnidentifiedEvent) + : mTarget(aTarget), + mEventMessage(eUnidentifiedEvent) { MOZ_ASSERT(mTarget); RefPtr event = diff --git a/dom/events/AsyncEventDispatcher.h b/dom/events/AsyncEventDispatcher.h index 70a623ef27537..3387eb6224c09 100644 --- a/dom/events/AsyncEventDispatcher.h +++ b/dom/events/AsyncEventDispatcher.h @@ -34,12 +34,9 @@ class AsyncEventDispatcher : public CancelableRunnable * the event is dispatched to it, otherwise the dispatch path starts * at the first chrome ancestor of that target. */ - AsyncEventDispatcher(nsINode* aTarget, - const nsAString& aEventType, - bool aBubbles, - bool aOnlyChromeDispatch) - : CancelableRunnable("AsyncEventDispatcher") - , mTarget(aTarget) + AsyncEventDispatcher(nsINode* aTarget, const nsAString& aEventType, + bool aBubbles, bool aOnlyChromeDispatch) + : mTarget(aTarget) , mEventType(aEventType) , mEventMessage(eUnidentifiedEvent) , mBubbles(aBubbles) @@ -56,8 +53,7 @@ class AsyncEventDispatcher : public CancelableRunnable AsyncEventDispatcher(nsINode* aTarget, mozilla::EventMessage aEventMessage, bool aBubbles, bool aOnlyChromeDispatch) - : CancelableRunnable("AsyncEventDispatcher") - , mTarget(aTarget) + : mTarget(aTarget) , mEventMessage(aEventMessage) , mBubbles(aBubbles) , mOnlyChromeDispatch(aOnlyChromeDispatch) @@ -68,8 +64,7 @@ class AsyncEventDispatcher : public CancelableRunnable AsyncEventDispatcher(dom::EventTarget* aTarget, const nsAString& aEventType, bool aBubbles) - : CancelableRunnable("AsyncEventDispatcher") - , mTarget(aTarget) + : mTarget(aTarget) , mEventType(aEventType) , mEventMessage(eUnidentifiedEvent) , mBubbles(aBubbles) @@ -79,8 +74,7 @@ class AsyncEventDispatcher : public CancelableRunnable AsyncEventDispatcher(dom::EventTarget* aTarget, mozilla::EventMessage aEventMessage, bool aBubbles) - : CancelableRunnable("AsyncEventDispatcher") - , mTarget(aTarget) + : mTarget(aTarget) , mEventMessage(aEventMessage) , mBubbles(aBubbles) { @@ -89,8 +83,7 @@ class AsyncEventDispatcher : public CancelableRunnable } AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent) - : CancelableRunnable("AsyncEventDispatcher") - , mTarget(aTarget) + : mTarget(aTarget) , mEvent(aEvent) , mEventMessage(eUnidentifiedEvent) { diff --git a/dom/events/DataTransferItem.cpp b/dom/events/DataTransferItem.cpp index 36addf0d02fde..2bb8ed8ae150c 100644 --- a/dom/events/DataTransferItem.cpp +++ b/dom/events/DataTransferItem.cpp @@ -446,10 +446,9 @@ DataTransferItem::GetAsString(FunctionStringCallback* aCallback, class GASRunnable final : public Runnable { public: - GASRunnable(FunctionStringCallback* aCallback, const nsAString& aStringData) - : mozilla::Runnable("GASRunnable") - , mCallback(aCallback) - , mStringData(aStringData) + GASRunnable(FunctionStringCallback* aCallback, + const nsAString& aStringData) + : mCallback(aCallback), mStringData(aStringData) {} NS_IMETHOD Run() override diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index c3add0a51c4e4..9cddab0776633 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -1412,12 +1412,9 @@ EventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext, int32_t clickHoldDelay = Preferences::GetInt("ui.click_hold_context_menus.delay", 500); mClickHoldTimer->SetTarget(SystemGroup::EventTargetFor(TaskCategory::Other)); - mClickHoldTimer->InitWithNamedFuncCallback( - sClickHoldCallback, - this, - clickHoldDelay, - nsITimer::TYPE_ONE_SHOT, - "EventStateManager::CreateClickHoldTimer"); + mClickHoldTimer->InitWithFuncCallback(sClickHoldCallback, this, + clickHoldDelay, + nsITimer::TYPE_ONE_SHOT); } } // CreateClickHoldTimer diff --git a/dom/events/TextComposition.cpp b/dom/events/TextComposition.cpp index f17f2dc27a010..425737606ff9e 100644 --- a/dom/events/TextComposition.cpp +++ b/dom/events/TextComposition.cpp @@ -712,13 +712,12 @@ TextComposition::HasEditor() const ******************************************************************************/ TextComposition::CompositionEventDispatcher::CompositionEventDispatcher( - TextComposition* aComposition, - nsINode* aEventTarget, - EventMessage aEventMessage, - const nsAString& aData, - bool aIsSynthesizedEvent) - : Runnable("TextComposition::CompositionEventDispatcher") - , mTextComposition(aComposition) + TextComposition* aComposition, + nsINode* aEventTarget, + EventMessage aEventMessage, + const nsAString& aData, + bool aIsSynthesizedEvent) + : mTextComposition(aComposition) , mEventTarget(aEventTarget) , mData(aData) , mEventMessage(aEventMessage) diff --git a/dom/events/TextComposition.h b/dom/events/TextComposition.h index 4ca3fd0b35bdd..1925a1c47d3d8 100644 --- a/dom/events/TextComposition.h +++ b/dom/events/TextComposition.h @@ -433,9 +433,7 @@ class TextComposition final EventMessage mEventMessage; bool mIsSynthesizedEvent; - CompositionEventDispatcher() - : Runnable("TextComposition::CompositionEventDispatcher") - , mIsSynthesizedEvent(false){}; + CompositionEventDispatcher() : mIsSynthesizedEvent(false) {}; }; /** diff --git a/dom/events/WheelHandlingHelper.cpp b/dom/events/WheelHandlingHelper.cpp index 4f773009295dd..301c1803f4c22 100644 --- a/dom/events/WheelHandlingHelper.cpp +++ b/dom/events/WheelHandlingHelper.cpp @@ -332,11 +332,8 @@ WheelTransaction::SetTimeout() } sTimer->Cancel(); DebugOnly rv = - sTimer->InitWithNamedFuncCallback(OnTimeout, - nullptr, - GetTimeoutTime(), - nsITimer::TYPE_ONE_SHOT, - "WheelTransaction::SetTimeout"); + sTimer->InitWithFuncCallback(OnTimeout, nullptr, GetTimeoutTime(), + nsITimer::TYPE_ONE_SHOT); NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "nsITimer::InitWithFuncCallback failed"); } diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 6c7a556a3483c..24fd3f92247a2 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -75,8 +75,7 @@ class FetchSignalProxy final : public FetchSignal::Follower public: explicit FetchSignalProxyRunnable(FetchSignalProxy* aProxy) - : Runnable("dom::FetchSignalProxy::FetchSignalProxyRunnable") - , mProxy(aProxy) + : mProxy(aProxy) {} NS_IMETHOD @@ -265,8 +264,7 @@ class MainThreadFetchRunnable : public Runnable public: MainThreadFetchRunnable(WorkerFetchResolver* aResolver, InternalRequest* aRequest) - : Runnable("dom::MainThreadFetchRunnable") - , mResolver(aResolver) + : mResolver(aResolver) , mRequest(aRequest) { MOZ_ASSERT(mResolver); diff --git a/dom/fetch/FetchConsumer.cpp b/dom/fetch/FetchConsumer.cpp index 06f46070df140..cd80c1f0c4a82 100644 --- a/dom/fetch/FetchConsumer.cpp +++ b/dom/fetch/FetchConsumer.cpp @@ -58,8 +58,7 @@ class BeginConsumeBodyRunnable final : public Runnable public: explicit BeginConsumeBodyRunnable(FetchBodyConsumer* aConsumer) - : Runnable("BeginConsumeBodyRunnable") - , mFetchBodyConsumer(aConsumer) + : mFetchBodyConsumer(aConsumer) { } NS_IMETHOD diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index 8963f76ddc219..4fccb249d0934 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -643,8 +643,7 @@ class DataAvailableRunnable final : public Runnable public: explicit DataAvailableRunnable(FetchDriverObserver* aObserver) - : Runnable("dom::DataAvailableRunnable") - , mObserver(aObserver) + : mObserver(aObserver) { MOZ_ASSERT(aObserver); } diff --git a/dom/file/MutableBlobStorage.cpp b/dom/file/MutableBlobStorage.cpp index 3823b9204b6af..66dbfb51a47b7 100644 --- a/dom/file/MutableBlobStorage.cpp +++ b/dom/file/MutableBlobStorage.cpp @@ -31,8 +31,7 @@ class BlobCreationDoneRunnable final : public Runnable MutableBlobStorageCallback* aCallback, Blob* aBlob, nsresult aRv) - : Runnable("dom::BlobCreationDoneRunnable") - , mBlobStorage(aBlobStorage) + : mBlobStorage(aBlobStorage) , mCallback(aCallback) , mBlob(aBlob) , mRv(aRv) @@ -80,8 +79,7 @@ class FileCreatedRunnable final : public Runnable { public: FileCreatedRunnable(MutableBlobStorage* aBlobStorage, PRFileDesc* aFD) - : Runnable("dom::FileCreatedRunnable") - , mBlobStorage(aBlobStorage) + : mBlobStorage(aBlobStorage) , mFD(aFD) { MOZ_ASSERT(aBlobStorage); @@ -116,8 +114,7 @@ class CreateTemporaryFileRunnable final : public Runnable { public: explicit CreateTemporaryFileRunnable(MutableBlobStorage* aBlobStorage) - : Runnable("dom::CreateTemporaryFileRunnable") - , mBlobStorage(aBlobStorage) + : mBlobStorage(aBlobStorage) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(XRE_IsParentProcess()); @@ -151,8 +148,7 @@ class ErrorPropagationRunnable final : public Runnable { public: ErrorPropagationRunnable(MutableBlobStorage* aBlobStorage, nsresult aRv) - : Runnable("dom::ErrorPropagationRunnable") - , mBlobStorage(aBlobStorage) + : mBlobStorage(aBlobStorage) , mRv(aRv) {} @@ -221,12 +217,9 @@ class WriteRunnable final : public Runnable } private: - WriteRunnable(MutableBlobStorage* aBlobStorage, - PRFileDesc* aFD, - void* aData, - uint32_t aLength) - : Runnable("dom::WriteRunnable") - , mBlobStorage(aBlobStorage) + WriteRunnable(MutableBlobStorage* aBlobStorage, PRFileDesc* aFD, + void* aData, uint32_t aLength) + : mBlobStorage(aBlobStorage) , mFD(aFD) , mData(aData) , mLength(aLength) @@ -254,8 +247,7 @@ class CloseFileRunnable final : public Runnable { public: explicit CloseFileRunnable(PRFileDesc* aFD) - : Runnable("dom::CloseFileRunnable") - , mFD(aFD) + : mFD(aFD) {} NS_IMETHOD @@ -287,8 +279,7 @@ class CreateBlobRunnable final : public Runnable already_AddRefed aParent, const nsACString& aContentType, already_AddRefed aCallback) - : Runnable("dom::CreateBlobRunnable") - , mBlobStorage(aBlobStorage) + : mBlobStorage(aBlobStorage) , mParent(aParent) , mContentType(aContentType) , mCallback(aCallback) @@ -336,8 +327,7 @@ class LastRunnable final : public Runnable nsISupports* aParent, const nsACString& aContentType, MutableBlobStorageCallback* aCallback) - : Runnable("dom::LastRunnable") - , mBlobStorage(aBlobStorage) + : mBlobStorage(aBlobStorage) , mParent(aParent) , mContentType(aContentType) , mCallback(aCallback) diff --git a/dom/file/ipc/IPCBlobInputStream.cpp b/dom/file/ipc/IPCBlobInputStream.cpp index b0afe07bfb611..2bd24d1c53f58 100644 --- a/dom/file/ipc/IPCBlobInputStream.cpp +++ b/dom/file/ipc/IPCBlobInputStream.cpp @@ -46,8 +46,7 @@ class CallbackRunnable final : public CancelableRunnable private: CallbackRunnable(nsIInputStreamCallback* aCallback, IPCBlobInputStream* aStream) - : CancelableRunnable("dom::CallbackRunnable") - , mCallback(aCallback) + : mCallback(aCallback) , mStream(aStream) { MOZ_ASSERT(mCallback); diff --git a/dom/file/ipc/IPCBlobInputStreamChild.cpp b/dom/file/ipc/IPCBlobInputStreamChild.cpp index 06098a0b37ce7..4d107d2f0e587 100644 --- a/dom/file/ipc/IPCBlobInputStreamChild.cpp +++ b/dom/file/ipc/IPCBlobInputStreamChild.cpp @@ -25,8 +25,7 @@ class ShutdownRunnable final : public CancelableRunnable { public: explicit ShutdownRunnable(IPCBlobInputStreamChild* aActor) - : CancelableRunnable("dom::ShutdownRunnable") - , mActor(aActor) + : mActor(aActor) {} NS_IMETHOD @@ -46,8 +45,7 @@ class StreamNeededRunnable final : public CancelableRunnable { public: explicit StreamNeededRunnable(IPCBlobInputStreamChild* aActor) - : CancelableRunnable("dom::StreamNeededRunnable") - , mActor(aActor) + : mActor(aActor) {} NS_IMETHOD @@ -72,8 +70,7 @@ class StreamReadyRunnable final : public CancelableRunnable public: StreamReadyRunnable(IPCBlobInputStream* aDestinationStream, nsIInputStream* aCreatedStream) - : CancelableRunnable("dom::StreamReadyRunnable") - , mDestinationStream(aDestinationStream) + : mDestinationStream(aDestinationStream) , mCreatedStream(aCreatedStream) { MOZ_ASSERT(mDestinationStream); @@ -105,10 +102,8 @@ class IPCBlobInputStreamWorkerHolder final : public WorkerHolder class ReleaseWorkerHolderRunnable final : public CancelableRunnable { public: - explicit ReleaseWorkerHolderRunnable( - UniquePtr&& aWorkerHolder) - : CancelableRunnable("dom::ReleaseWorkerHolderRunnable") - , mWorkerHolder(Move(aWorkerHolder)) + explicit ReleaseWorkerHolderRunnable(UniquePtr&& aWorkerHolder) + : mWorkerHolder(Move(aWorkerHolder)) {} NS_IMETHOD diff --git a/dom/file/ipc/IPCBlobInputStreamThread.cpp b/dom/file/ipc/IPCBlobInputStreamThread.cpp index 6c40453a6f615..29090da92ef1d 100644 --- a/dom/file/ipc/IPCBlobInputStreamThread.cpp +++ b/dom/file/ipc/IPCBlobInputStreamThread.cpp @@ -27,8 +27,6 @@ bool gShutdownHasStarted = false; class ThreadInitializeRunnable final : public Runnable { public: - ThreadInitializeRunnable() : Runnable("dom::ThreadInitializeRunnable") {} - NS_IMETHOD Run() override { @@ -46,8 +44,7 @@ class MigrateActorRunnable final : public Runnable NS_DECL_ISUPPORTS_INHERITED explicit MigrateActorRunnable(IPCBlobInputStreamChild* aActor) - : Runnable("dom::MigrateActorRunnable") - , mActor(aActor) + : mActor(aActor) { MOZ_ASSERT(mActor); } diff --git a/dom/filehandle/ActorsParent.cpp b/dom/filehandle/ActorsParent.cpp index 3fbff0611c0fe..9895aeef38f90 100644 --- a/dom/filehandle/ActorsParent.cpp +++ b/dom/filehandle/ActorsParent.cpp @@ -588,8 +588,7 @@ class CopyFileHandleOp::ProgressRunnable final ProgressRunnable(CopyFileHandleOp* aCopyFileHandleOp, uint64_t aProgress, uint64_t aProgressMax) - : Runnable("dom::CopyFileHandleOp::ProgressRunnable") - , mCopyFileHandleOp(aCopyFileHandleOp) + : mCopyFileHandleOp(aCopyFileHandleOp) , mProgress(aProgress) , mProgressMax(aProgressMax) { } @@ -1082,11 +1081,10 @@ FileHandleThreadPool::MaybeFireCallback(StoragesCompleteCallback* aCallback) return true; } -FileHandleThreadPool::FileHandleQueue::FileHandleQueue( - FileHandleThreadPool* aFileHandleThreadPool, - FileHandle* aFileHandle) - : Runnable("dom::FileHandleThreadPool::FileHandleQueue") - , mOwningFileHandleThreadPool(aFileHandleThreadPool) +FileHandleThreadPool:: +FileHandleQueue::FileHandleQueue(FileHandleThreadPool* aFileHandleThreadPool, + FileHandle* aFileHandle) + : mOwningFileHandleThreadPool(aFileHandleThreadPool) , mFileHandle(aFileHandle) , mShouldFinish(false) { diff --git a/dom/filesystem/FileSystemRequestParent.cpp b/dom/filesystem/FileSystemRequestParent.cpp index 4f234a03fd9f6..a7ff9ba39baf2 100644 --- a/dom/filesystem/FileSystemRequestParent.cpp +++ b/dom/filesystem/FileSystemRequestParent.cpp @@ -82,8 +82,7 @@ class CheckPermissionRunnable final : public Runnable FileSystemRequestParent* aActor, FileSystemTaskParentBase* aTask, const nsAString& aPath) - : Runnable("dom::CheckPermissionRunnable") - , mContentParent(aParent) + : mContentParent(aParent) , mActor(aActor) , mTask(aTask) , mPath(aPath) diff --git a/dom/filesystem/FileSystemTaskBase.cpp b/dom/filesystem/FileSystemTaskBase.cpp index 307e8648993c9..4b28529d75183 100644 --- a/dom/filesystem/FileSystemTaskBase.cpp +++ b/dom/filesystem/FileSystemTaskBase.cpp @@ -231,12 +231,10 @@ FileSystemTaskChildBase::SetError(const nsresult& aErrorValue) * FileSystemTaskParentBase class */ -FileSystemTaskParentBase::FileSystemTaskParentBase( - FileSystemBase* aFileSystem, - const FileSystemParams& aParam, - FileSystemRequestParent* aParent) - : Runnable("dom::FileSystemTaskParentBase") - , mErrorValue(NS_OK) +FileSystemTaskParentBase::FileSystemTaskParentBase(FileSystemBase* aFileSystem, + const FileSystemParams& aParam, + FileSystemRequestParent* aParent) + : mErrorValue(NS_OK) , mFileSystem(aFileSystem) , mRequestParent(aParent) , mBackgroundEventTarget(GetCurrentThreadEventTarget()) diff --git a/dom/filesystem/GetFilesHelper.cpp b/dom/filesystem/GetFilesHelper.cpp index 7d77e241d2b69..f2e0d5333c9b6 100644 --- a/dom/filesystem/GetFilesHelper.cpp +++ b/dom/filesystem/GetFilesHelper.cpp @@ -61,7 +61,6 @@ class ReleaseRunnable final : public Runnable nsTArray>& aCallbacks, Sequence>& aFiles, already_AddRefed aGlobal) - : Runnable("dom::ReleaseRunnable") { mPromises.SwapElements(aPromises); mCallbacks.SwapElements(aCallbacks); diff --git a/dom/flyweb/HttpServer.cpp b/dom/flyweb/HttpServer.cpp index 776d5b0ca43ea..83ad916294ea1 100644 --- a/dom/flyweb/HttpServer.cpp +++ b/dom/flyweb/HttpServer.cpp @@ -89,9 +89,10 @@ void HttpServer::NotifyStarted(nsresult aStatus) { RefPtr listener = mListener; - nsCOMPtr event = NS_NewRunnableFunction( - "dom::HttpServer::NotifyStarted", - [listener, aStatus]() { listener->OnServerStarted(aStatus); }); + nsCOMPtr event = NS_NewRunnableFunction([listener, aStatus] () + { + listener->OnServerStarted(aStatus); + }); NS_DispatchToCurrentThread(event); } @@ -287,12 +288,12 @@ HttpServer::TransportProvider::MaybeNotify() { if (mTransport && mListener) { RefPtr self = this; - nsCOMPtr event = NS_NewRunnableFunction( - "dom::HttpServer::TransportProvider::MaybeNotify", [self, this]() { - DebugOnly rv = - mListener->OnTransportAvailable(mTransport, mInput, mOutput); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - }); + nsCOMPtr event = NS_NewRunnableFunction([self, this] () + { + DebugOnly rv = mListener->OnTransportAvailable(mTransport, + mInput, mOutput); + MOZ_ASSERT(NS_SUCCEEDED(rv)); + }); NS_DispatchToCurrentThread(event); } } @@ -632,9 +633,11 @@ HttpServer::Connection::ConsumeLine(const char* aBuffer, RefPtr listener = mServer->mListener; RefPtr request = mPendingWebSocketRequest; - nsCOMPtr event = NS_NewRunnableFunction( - "dom::HttpServer::Connection::ConsumeLine", - [listener, request]() { listener->OnWebSocket(request); }); + nsCOMPtr event = + NS_NewRunnableFunction([listener, request] () + { + listener->OnWebSocket(request); + }); NS_DispatchToCurrentThread(event); return NS_OK; @@ -699,9 +702,11 @@ HttpServer::Connection::ConsumeLine(const char* aBuffer, RefPtr listener = mServer->mListener; RefPtr request = mPendingReq.forget(); - nsCOMPtr event = NS_NewRunnableFunction( - "dom::HttpServer::Connection::ConsumeLine", - [listener, request]() { listener->OnRequest(request); }); + nsCOMPtr event = + NS_NewRunnableFunction([listener, request] () + { + listener->OnRequest(request); + }); NS_DispatchToCurrentThread(event); mPendingReqVersion = 0; diff --git a/dom/gamepad/cocoa/CocoaGamepad.cpp b/dom/gamepad/cocoa/CocoaGamepad.cpp index 76208303f8114..9520ef454e846 100644 --- a/dom/gamepad/cocoa/CocoaGamepad.cpp +++ b/dom/gamepad/cocoa/CocoaGamepad.cpp @@ -235,7 +235,7 @@ class DarwinGamepadServiceStartupRunnable final : public Runnable DarwinGamepadService MOZ_NON_OWNING_REF *mService; public: explicit DarwinGamepadServiceStartupRunnable(DarwinGamepadService *service) - : Runnable("DarwinGamepadServiceStartupRunnable"), mService(service) {} + : mService(service) {} NS_IMETHOD Run() override { MOZ_ASSERT(mService); diff --git a/dom/gamepad/ipc/GamepadEventChannelChild.cpp b/dom/gamepad/ipc/GamepadEventChannelChild.cpp index efeb115057944..a7e4e4ddc87c3 100644 --- a/dom/gamepad/ipc/GamepadEventChannelChild.cpp +++ b/dom/gamepad/ipc/GamepadEventChannelChild.cpp @@ -12,18 +12,15 @@ namespace { class GamepadUpdateRunnable final : public Runnable { public: - explicit GamepadUpdateRunnable(const GamepadChangeEvent& aGamepadEvent) - : Runnable("dom::GamepadUpdateRunnable") - , mEvent(aGamepadEvent) - { - } - NS_IMETHOD Run() override - { - RefPtr svc(GamepadManager::GetService()); - if (svc) { - svc->Update(mEvent); - } - return NS_OK; + explicit GamepadUpdateRunnable(const GamepadChangeEvent& aGamepadEvent) + : mEvent(aGamepadEvent) {} + NS_IMETHOD Run() override + { + RefPtr svc(GamepadManager::GetService()); + if (svc) { + svc->Update(mEvent); + } + return NS_OK; } protected: GamepadChangeEvent mEvent; diff --git a/dom/gamepad/ipc/GamepadEventChannelParent.cpp b/dom/gamepad/ipc/GamepadEventChannelParent.cpp index c50ed7e684373..9af3b8a3707be 100644 --- a/dom/gamepad/ipc/GamepadEventChannelParent.cpp +++ b/dom/gamepad/ipc/GamepadEventChannelParent.cpp @@ -20,13 +20,12 @@ class SendGamepadUpdateRunnable final : public Runnable RefPtr mParent; GamepadChangeEvent mEvent; public: - SendGamepadUpdateRunnable(GamepadEventChannelParent* aParent, - GamepadChangeEvent aEvent) - : Runnable("dom::SendGamepadUpdateRunnable") - , mEvent(aEvent) - { - MOZ_ASSERT(aParent); - mParent = aParent; + SendGamepadUpdateRunnable(GamepadEventChannelParent* aParent, + GamepadChangeEvent aEvent) + : mEvent(aEvent) + { + MOZ_ASSERT(aParent); + mParent = aParent; } NS_IMETHOD Run() override { diff --git a/dom/gamepad/windows/WindowsGamepad.cpp b/dom/gamepad/windows/WindowsGamepad.cpp index bfe712b962c8f..6a8b595e248b9 100644 --- a/dom/gamepad/windows/WindowsGamepad.cpp +++ b/dom/gamepad/windows/WindowsGamepad.cpp @@ -1002,9 +1002,7 @@ GamepadWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) class StartWindowsGamepadServiceRunnable final : public Runnable { public: - StartWindowsGamepadServiceRunnable() - : Runnable("StartWindowsGamepadServiceRunnable") - {} + StartWindowsGamepadServiceRunnable() {} NS_IMETHOD Run() override { @@ -1042,9 +1040,7 @@ class StartWindowsGamepadServiceRunnable final : public Runnable class StopWindowsGamepadServiceRunnable final : public Runnable { public: - StopWindowsGamepadServiceRunnable() - : Runnable("StopWindowsGamepadServiceRunnable") - {} + StopWindowsGamepadServiceRunnable() {} NS_IMETHOD Run() override { diff --git a/dom/geolocation/nsGeolocation.cpp b/dom/geolocation/nsGeolocation.cpp index 50b3dd9620ffe..2440015b51bdc 100644 --- a/dom/geolocation/nsGeolocation.cpp +++ b/dom/geolocation/nsGeolocation.cpp @@ -147,8 +147,7 @@ class RequestPromptEvent : public Runnable { public: RequestPromptEvent(nsGeolocationRequest* aRequest, nsWeakPtr aWindow) - : mozilla::Runnable("RequestPromptEvent") - , mRequest(aRequest) + : mRequest(aRequest) , mWindow(aWindow) { } @@ -169,9 +168,8 @@ class RequestAllowEvent : public Runnable { public: RequestAllowEvent(int allow, nsGeolocationRequest* request) - : mozilla::Runnable("RequestAllowEvent") - , mAllow(allow) - , mRequest(request) + : mAllow(allow), + mRequest(request) { } @@ -194,9 +192,8 @@ class RequestSendLocationEvent : public Runnable public: RequestSendLocationEvent(nsIDOMGeoPosition* aPosition, nsGeolocationRequest* aRequest) - : mozilla::Runnable("RequestSendLocationEvent") - , mPosition(aPosition) - , mRequest(aRequest) + : mPosition(aPosition), + mRequest(aRequest) { } diff --git a/dom/html/HTMLCanvasElement.cpp b/dom/html/HTMLCanvasElement.cpp index d1f6f491ff65c..5daf4b67935e1 100644 --- a/dom/html/HTMLCanvasElement.cpp +++ b/dom/html/HTMLCanvasElement.cpp @@ -241,10 +241,8 @@ HTMLCanvasPrintState::Done() if (mCanvas) { mCanvas->InvalidateCanvas(); } - RefPtr> doneEvent = - NewRunnableMethod("dom::HTMLCanvasPrintState::NotifyDone", - this, - &HTMLCanvasPrintState::NotifyDone); + RefPtr > doneEvent = + NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone); if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) { mPendingNotify = true; } @@ -523,10 +521,8 @@ HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback) } mPrintState = new HTMLCanvasPrintState(this, mCurrentContext, aCallback); - RefPtr> renderEvent = - NewRunnableMethod("dom::HTMLCanvasElement::CallPrintCallback", - this, - &HTMLCanvasElement::CallPrintCallback); + RefPtr > renderEvent = + NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback); return OwnerDoc()->Dispatch("HTMLCanvasElement::CallPrintCallback", TaskCategory::Other, renderEvent.forget()); @@ -848,16 +844,13 @@ HTMLCanvasElement::ToBlob(JSContext* aCx, // According to spec, blob should return null if either its horizontal // dimension or its vertical dimension is zero. See link below. // https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-toblob - OwnerDoc()->Dispatch( - "FireNullBlobEvent", - TaskCategory::Other, - NewRunnableMethod( - "dom::HTMLCanvasElement::ToBlob", - &aCallback, - static_cast( - &BlobCallback::Call), - nullptr, - nullptr)); + OwnerDoc()->Dispatch("FireNullBlobEvent", + TaskCategory::Other, + NewRunnableMethod( + &aCallback, + static_cast(&BlobCallback::Call), + nullptr, nullptr)); return; } @@ -1360,8 +1353,7 @@ HTMLCanvasElement::OnVisibilityChange() { public: explicit Runnable(AsyncCanvasRenderer* aRenderer) - : mozilla::CancelableRunnable("Runnable") - , mRenderer(aRenderer) + : mRenderer(aRenderer) {} NS_IMETHOD Run() override @@ -1403,8 +1395,7 @@ HTMLCanvasElement::OnMemoryPressure() { public: explicit Runnable(AsyncCanvasRenderer* aRenderer) - : mozilla::CancelableRunnable("Runnable") - , mRenderer(aRenderer) + : mRenderer(aRenderer) {} NS_IMETHOD Run() override diff --git a/dom/html/HTMLFormElement.h b/dom/html/HTMLFormElement.h index 74a993be7c19d..284d3a6925b78 100644 --- a/dom/html/HTMLFormElement.h +++ b/dom/html/HTMLFormElement.h @@ -426,8 +426,7 @@ class HTMLFormElement final : public nsGenericHTMLElement, class RemoveElementRunnable : public Runnable { public: explicit RemoveElementRunnable(HTMLFormElement* aForm) - : Runnable("dom::HTMLFormElement::RemoveElementRunnable") - , mForm(aForm) + : mForm(aForm) {} NS_IMETHOD Run() override { diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index 13151bdc303c4..de50d22500084 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -79,11 +79,9 @@ namespace dom { class ImageLoadTask : public Runnable { public: - ImageLoadTask(HTMLImageElement* aElement, - bool aAlwaysLoad, + ImageLoadTask(HTMLImageElement *aElement, bool aAlwaysLoad, bool aUseUrgentStartForChannel) - : Runnable("dom::ImageLoadTask") - , mElement(aElement) + : mElement(aElement) , mAlwaysLoad(aAlwaysLoad) , mUseUrgentStartForChannel(aUseUrgentStartForChannel) { @@ -678,10 +676,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, if (LoadingEnabled() && OwnerDoc()->IsCurrentActiveDocument()) { nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::HTMLImageElement::MaybeLoadImage", - this, - &HTMLImageElement::MaybeLoadImage, - false)); + NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage, false)); } } @@ -774,14 +769,9 @@ HTMLImageElement::NodeInfoChanged(nsIDocument* aOldDoc) // Bug 1076583 - We still behave synchronously in the non-responsive case nsContentUtils::AddScriptRunner( (InResponsiveMode()) - ? NewRunnableMethod("dom::HTMLImageElement::QueueImageLoadTask", - this, - &HTMLImageElement::QueueImageLoadTask, - true) - : NewRunnableMethod("dom::HTMLImageElement::MaybeLoadImage", - this, - &HTMLImageElement::MaybeLoadImage, - true)); + ? NewRunnableMethod(this, &HTMLImageElement::QueueImageLoadTask, true) + : NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage, true) + ); } } @@ -904,10 +894,7 @@ HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren) mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::HTMLImageElement::MaybeLoadImage", - dest, - &HTMLImageElement::MaybeLoadImage, - false)); + NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage, false)); } } diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index e9c3cf6f7dd34..0f890531ca93c 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -4870,9 +4870,7 @@ HTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, ClearBrokenState(); RemoveStatesSilently(NS_EVENT_STATE_BROKEN); nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::HTMLInputElement::MaybeLoadImage", - this, - &HTMLInputElement::MaybeLoadImage)); + NewRunnableMethod(this, &HTMLInputElement::MaybeLoadImage)); } } diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index feba468c9196d..a28d5f57c1725 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -171,8 +171,7 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, } void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal; - nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::HTMLLinkElement::BindToTree", this, update)); + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update)); CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded")); diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 16da96903ddeb..3544bc57a8daf 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -232,12 +232,10 @@ RejectPromises(const nsTArray>& aPromises, nsresult aError) class nsMediaEvent : public Runnable { public: - explicit nsMediaEvent(HTMLMediaElement* aElement) - : Runnable("dom::nsMediaEvent") - , mElement(aElement) - , mLoadID(mElement->GetCurrentLoadID()) - { - } + + explicit nsMediaEvent(HTMLMediaElement* aElement) : + mElement(aElement), + mLoadID(mElement->GetCurrentLoadID()) {} ~nsMediaEvent() {} NS_IMETHOD Run() = 0; @@ -407,11 +405,9 @@ class HTMLMediaElement::StreamSizeListener : public DirectMediaStreamTrackListen for (VideoSegment::ConstChunkIterator c(video); !c.IsEnded(); c.Next()) { if (c->mFrame.GetIntrinsicSize() != gfx::IntSize(0,0)) { mInitialSizeFound = true; - nsCOMPtr event = NewRunnableMethod( - "dom::HTMLMediaElement::StreamSizeListener::ReceivedSize", - this, - &StreamSizeListener::ReceivedSize, - c->mFrame.GetIntrinsicSize()); + nsCOMPtr event = + NewRunnableMethod(this, &StreamSizeListener::ReceivedSize, + c->mFrame.GetIntrinsicSize()); // This is fine to dispatch straight to main thread (instead of via // ...AfterStreamUpdate()) since it reflects state of the element, // not the stream. Events reflecting stream or track state should be @@ -974,26 +970,24 @@ class HTMLMediaElement::AudioChannelAgentCallback final : } uint64_t windowID = mAudioChannelAgent->WindowID(); - NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::HTMLMediaElement::AudioChannelAgentCallback::" - "MaybeNotifyMediaResumed", - [windowID]() -> void { - nsCOMPtr observerService = - services::GetObserverService(); - if (NS_WARN_IF(!observerService)) { - return; - } + NS_DispatchToMainThread(NS_NewRunnableFunction([windowID]() -> void { + nsCOMPtr observerService = + services::GetObserverService(); + if (NS_WARN_IF(!observerService)) { + return; + } - nsCOMPtr wrapper = - do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID); - if (NS_WARN_IF(!wrapper)) { - return; - } + nsCOMPtr wrapper = + do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID); + if (NS_WARN_IF(!wrapper)) { + return; + } - wrapper->SetData(windowID); - observerService->NotifyObservers( - wrapper, "media-playback-resumed", u"active"); - })); + wrapper->SetData(windowID); + observerService->NotifyObservers(wrapper, + "media-playback-resumed", + u"active"); + })); } bool @@ -4096,12 +4090,8 @@ HTMLMediaElement::WakeLockBoolWrapper::UpdateWakeLock() int timeout = Preferences::GetInt("media.wakelock_timeout", 2000); mTimer = do_CreateInstance("@mozilla.org/timer;1"); if (mTimer) { - mTimer->InitWithNamedFuncCallback( - TimerCallback, - this, - timeout, - nsITimer::TYPE_ONE_SHOT, - "dom::HTMLMediaElement::WakeLockBoolWrapper::UpdateWakeLock"); + mTimer->InitWithFuncCallback(TimerCallback, this, timeout, + nsITimer::TYPE_ONE_SHOT); } } } @@ -4541,12 +4531,11 @@ void HTMLMediaElement::UnbindFromTree(bool aDeep, NotifyDecoderActivityChanges(); RefPtr self(this); - nsCOMPtr task = - NS_NewRunnableFunction("dom::HTMLMediaElement::UnbindFromTree", [self]() { - if (self->mUnboundFromTree) { - self->Pause(); - } - }); + nsCOMPtr task = NS_NewRunnableFunction([self] () { + if (self->mUnboundFromTree) { + self->Pause(); + } + }); RunInStableState(task); } @@ -4855,15 +4844,9 @@ class HTMLMediaElement::StreamListener : public MediaStreamListener, { nsCOMPtr event; if (aBlocked == BLOCKED) { - event = NewRunnableMethod( - "dom::HTMLMediaElement::StreamListener::DoNotifyBlocked", - this, - &StreamListener::DoNotifyBlocked); + event = NewRunnableMethod(this, &StreamListener::DoNotifyBlocked); } else { - event = NewRunnableMethod( - "dom::HTMLMediaElement::StreamListener::DoNotifyUnblocked", - this, - &StreamListener::DoNotifyUnblocked); + event = NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked); } aGraph->DispatchToMainThreadAfterStreamStateUpdate(mAbstractMainThread, event.forget()); @@ -4873,10 +4856,7 @@ class HTMLMediaElement::StreamListener : public MediaStreamListener, MutexAutoLock lock(mMutex); aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod( - "dom::HTMLMediaElement::StreamListener::DoNotifyHaveCurrentData", - this, - &StreamListener::DoNotifyHaveCurrentData)); + NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData)); } virtual void NotifyOutput(MediaStreamGraph* aGraph, GraphTime aCurrentTime) override @@ -4887,9 +4867,7 @@ class HTMLMediaElement::StreamListener : public MediaStreamListener, mPendingNotifyOutput = true; aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod("dom::HTMLMediaElement::StreamListener::DoNotifyOutput", - this, - &StreamListener::DoNotifyOutput)); + NewRunnableMethod(this, &StreamListener::DoNotifyOutput)); } private: @@ -6318,9 +6296,7 @@ void HTMLMediaElement::AddRemoveSelfReference() // Dispatch Release asynchronously so that we don't destroy this object // inside a call stack of method calls on this object nsCOMPtr event = - NewRunnableMethod("dom::HTMLMediaElement::DoRemoveSelfReference", - this, - &HTMLMediaElement::DoRemoveSelfReference); + NewRunnableMethod(this, &HTMLMediaElement::DoRemoveSelfReference); NS_DispatchToMainThread(event); } } @@ -7517,9 +7493,9 @@ HTMLMediaElement::AsyncResolveSeekDOMPromiseIfExists() MOZ_ASSERT(NS_IsMainThread()); if (mSeekDOMPromise) { RefPtr promise = mSeekDOMPromise.forget(); - nsCOMPtr r = NS_NewRunnableFunction( - "dom::HTMLMediaElement::AsyncResolveSeekDOMPromiseIfExists", - [=]() { promise->MaybeResolveWithUndefined(); }); + nsCOMPtr r = NS_NewRunnableFunction([=] () { + promise->MaybeResolveWithUndefined(); + }); mAbstractMainThread->Dispatch(r.forget()); mSeekDOMPromise = nullptr; } @@ -7531,9 +7507,9 @@ HTMLMediaElement::AsyncRejectSeekDOMPromiseIfExists() MOZ_ASSERT(NS_IsMainThread()); if (mSeekDOMPromise) { RefPtr promise = mSeekDOMPromise.forget(); - nsCOMPtr r = NS_NewRunnableFunction( - "dom::HTMLMediaElement::AsyncRejectSeekDOMPromiseIfExists", - [=]() { promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR); }); + nsCOMPtr r = NS_NewRunnableFunction([=] () { + promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR); + }); mAbstractMainThread->Dispatch(r.forget()); mSeekDOMPromise = nullptr; } @@ -7551,32 +7527,29 @@ HTMLMediaElement::ReportCanPlayTelemetry() } thread->Dispatch( - NS_NewRunnableFunction( - "dom::HTMLMediaElement::ReportCanPlayTelemetry", - [thread]() { + NS_NewRunnableFunction([thread]() { #if XP_WIN - // Windows Media Foundation requires MSCOM to be inited. - HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); - MOZ_ASSERT(hr == S_OK); + // Windows Media Foundation requires MSCOM to be inited. + HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); + MOZ_ASSERT(hr == S_OK); #endif - bool aac = MP4Decoder::IsSupportedType( - MediaContainerType(MEDIAMIMETYPE("audio/mp4")), nullptr); - bool h264 = MP4Decoder::IsSupportedType( - MediaContainerType(MEDIAMIMETYPE("video/mp4")), nullptr); + bool aac = MP4Decoder::IsSupportedType( + MediaContainerType(MEDIAMIMETYPE("audio/mp4")), nullptr); + bool h264 = MP4Decoder::IsSupportedType( + MediaContainerType(MEDIAMIMETYPE("video/mp4")), nullptr); #if XP_WIN - CoUninitialize(); + CoUninitialize(); #endif - AbstractThread::MainThread()->Dispatch(NS_NewRunnableFunction( - "dom::HTMLMediaElement::ReportCanPlayTelemetry", - [thread, aac, h264]() { - LOG(LogLevel::Debug, ("MediaTelemetry aac=%d h264=%d", aac, h264)); - Telemetry::Accumulate( - Telemetry::HistogramID::VIDEO_CAN_CREATE_AAC_DECODER, aac); - Telemetry::Accumulate( - Telemetry::HistogramID::VIDEO_CAN_CREATE_H264_DECODER, h264); - thread->AsyncShutdown(); - })); - }), + AbstractThread::MainThread()->Dispatch( + NS_NewRunnableFunction([thread, aac, h264]() { + LOG(LogLevel::Debug, ("MediaTelemetry aac=%d h264=%d", aac, h264)); + Telemetry::Accumulate( + Telemetry::HistogramID::VIDEO_CAN_CREATE_AAC_DECODER, aac); + Telemetry::Accumulate( + Telemetry::HistogramID::VIDEO_CAN_CREATE_H264_DECODER, h264); + thread->AsyncShutdown(); + })); + }), NS_DISPATCH_NORMAL); } diff --git a/dom/html/HTMLObjectElement.cpp b/dom/html/HTMLObjectElement.cpp index 100f022ce9cea..b06133d9b5b4e 100644 --- a/dom/html/HTMLObjectElement.cpp +++ b/dom/html/HTMLObjectElement.cpp @@ -131,9 +131,7 @@ class PluginFocusSetter : public Runnable { public: PluginFocusSetter(nsIWidget* aWidget, Element* aElement) - : Runnable("PluginFocusSetter") - , mWidget(aWidget) - , mElement(aElement) + : mWidget(aWidget), mElement(aElement) { } @@ -271,8 +269,7 @@ HTMLObjectElement::BindToTree(nsIDocument *aDocument, // If we already have all the children, start the load. if (mIsDoneAddingChildren && !pluginDoc) { void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad; - nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::HTMLObjectElement::BindToTree", this, start)); + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, start)); } return NS_OK; diff --git a/dom/html/HTMLSharedObjectElement.cpp b/dom/html/HTMLSharedObjectElement.cpp index 1f02624f1679f..4897ee516393e 100644 --- a/dom/html/HTMLSharedObjectElement.cpp +++ b/dom/html/HTMLSharedObjectElement.cpp @@ -139,8 +139,7 @@ HTMLSharedObjectElement::BindToTree(nsIDocument *aDocument, if (mIsDoneAddingChildren && !pluginDoc) { void (HTMLSharedObjectElement::*start)() = &HTMLSharedObjectElement::StartObjectLoad; - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "dom::HTMLSharedObjectElement::BindToTree", this, start)); + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, start)); } return NS_OK; diff --git a/dom/html/HTMLStyleElement.cpp b/dom/html/HTMLStyleElement.cpp index 908bf95895ff9..743f4addb96e0 100644 --- a/dom/html/HTMLStyleElement.cpp +++ b/dom/html/HTMLStyleElement.cpp @@ -146,8 +146,7 @@ HTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, NS_ENSURE_SUCCESS(rv, rv); void (HTMLStyleElement::*update)() = &HTMLStyleElement::UpdateStyleSheetInternal; - nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::HTMLStyleElement::BindToTree", this, update)); + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update)); return rv; } diff --git a/dom/html/HTMLTrackElement.cpp b/dom/html/HTMLTrackElement.cpp index 30fb5038fe30d..09b86398fef17 100644 --- a/dom/html/HTMLTrackElement.cpp +++ b/dom/html/HTMLTrackElement.cpp @@ -265,10 +265,7 @@ void HTMLTrackElement::DispatchLoadResource() { if (!mLoadResourceDispatched) { - RefPtr r = - NewRunnableMethod("dom::HTMLTrackElement::LoadResource", - this, - &HTMLTrackElement::LoadResource); + RefPtr r = NewRunnableMethod(this, &HTMLTrackElement::LoadResource); nsContentUtils::RunInStableState(r.forget()); mLoadResourceDispatched = true; } @@ -440,11 +437,11 @@ HTMLTrackElement::DispatchTrackRunnable(const nsString& aEventName) if (!doc) { return; } - nsCOMPtr runnable = NewRunnableMethod( - "dom::HTMLTrackElement::DispatchTrustedEvent", - this, - &HTMLTrackElement::DispatchTrustedEvent, - aEventName); + nsCOMPtr runnable = + NewRunnableMethod + (this, + &HTMLTrackElement::DispatchTrustedEvent, + aEventName); doc->Dispatch("HTMLTrackElement::DispatchTrackRunnable", TaskCategory::Other, runnable.forget()); } diff --git a/dom/html/ImageDocument.cpp b/dom/html/ImageDocument.cpp index 4d3d3b841f822..4b7008e57583c 100644 --- a/dom/html/ImageDocument.cpp +++ b/dom/html/ImageDocument.cpp @@ -493,9 +493,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa // come during painting and this will trigger invalidation. if (aType == imgINotificationObserver::HAS_TRANSPARENCY) { nsCOMPtr runnable = - NewRunnableMethod("dom::ImageDocument::OnHasTransparency", - this, - &ImageDocument::OnHasTransparency); + NewRunnableMethod(this, &ImageDocument::OnHasTransparency); nsContentUtils::AddScriptRunner(runnable); } @@ -568,9 +566,7 @@ ImageDocument::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage) } nsCOMPtr runnable = - NewRunnableMethod("dom::ImageDocument::DefaultCheckOverflowing", - this, - &ImageDocument::DefaultCheckOverflowing); + NewRunnableMethod(this, &ImageDocument::DefaultCheckOverflowing); nsContentUtils::AddScriptRunner(runnable); UpdateTitleAndCharset(); diff --git a/dom/html/TextTrackManager.cpp b/dom/html/TextTrackManager.cpp index 37009773e0da1..4d3ccf3652171 100644 --- a/dom/html/TextTrackManager.cpp +++ b/dom/html/TextTrackManager.cpp @@ -170,10 +170,8 @@ TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel, ReportTelemetryForTrack(track); if (aTextTrackSource == TextTrackSource::Track) { - RefPtr task = NewRunnableMethod( - "dom::TextTrackManager::HonorUserPreferencesForTrackSelection", - this, - &TextTrackManager::HonorUserPreferencesForTrackSelection); + RefPtr task = + NewRunnableMethod(this, &TextTrackManager::HonorUserPreferencesForTrackSelection); nsContentUtils::RunInStableState(task.forget()); } @@ -192,10 +190,8 @@ TextTrackManager::AddTextTrack(TextTrack* aTextTrack) ReportTelemetryForTrack(aTextTrack); if (aTextTrack->GetTextTrackSource() == TextTrackSource::Track) { - RefPtr task = NewRunnableMethod( - "dom::TextTrackManager::HonorUserPreferencesForTrackSelection", - this, - &TextTrackManager::HonorUserPreferencesForTrackSelection); + RefPtr task = + NewRunnableMethod(this, &TextTrackManager::HonorUserPreferencesForTrackSelection); nsContentUtils::RunInStableState(task.forget()); } } @@ -487,15 +483,12 @@ class SimpleTextTrackEvent : public Runnable { public: friend class CompareSimpleTextTrackEvents; - SimpleTextTrackEvent(const nsAString& aEventName, - double aTime, - TextTrack* aTrack, - TextTrackCue* aCue) - : Runnable("dom::SimpleTextTrackEvent") - , mName(aEventName) - , mTime(aTime) - , mTrack(aTrack) - , mCue(aCue) + SimpleTextTrackEvent(const nsAString& aEventName, double aTime, + TextTrack* aTrack, TextTrackCue* aCue) + : mName(aEventName), + mTime(aTime), + mTrack(aTrack), + mCue(aCue) {} NS_IMETHOD Run() { @@ -631,11 +624,8 @@ TextTrackManager::DispatchUpdateCueDisplay() nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow(); if (win) { nsGlobalWindow::Cast(win)->Dispatch( - "TextTrackManager::UpdateCueDisplay", - TaskCategory::Other, - NewRunnableMethod("dom::TextTrackManager::UpdateCueDisplay", - this, - &TextTrackManager::UpdateCueDisplay)); + "TextTrackManager::UpdateCueDisplay", TaskCategory::Other, + NewRunnableMethod(this, &TextTrackManager::UpdateCueDisplay)); mUpdateCueDisplayDispatched = true; } } @@ -654,11 +644,8 @@ TextTrackManager::DispatchTimeMarchesOn() nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow(); if (win) { nsGlobalWindow::Cast(win)->Dispatch( - "TextTrackManager::TimeMarchesOn", - TaskCategory::Other, - NewRunnableMethod("dom::TextTrackManager::TimeMarchesOn", - this, - &TextTrackManager::TimeMarchesOn)); + "TextTrackManager::TimeMarchesOn", TaskCategory::Other, + NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn)); mTimeMarchesOnDispatched = true; } } diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 3f7bf997f54c7..4767e162860cd 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -120,11 +120,7 @@ using namespace mozilla::dom; class nsAutoFocusEvent : public Runnable { public: - explicit nsAutoFocusEvent(nsGenericHTMLFormElement* aElement) - : mozilla::Runnable("nsAutoFocusEvent") - , mElement(aElement) - { - } + explicit nsAutoFocusEvent(nsGenericHTMLFormElement* aElement) : mElement(aElement) {} NS_IMETHOD Run() override { nsFocusManager* fm = nsFocusManager::GetFocusManager(); diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index ac69848f9d124..66e8eb6cc9b49 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -2505,9 +2505,7 @@ nsHTMLDocument::MaybeEditingStateChanged() EditingStateChanged(); } else if (!mInDestructor) { nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsHTMLDocument::MaybeEditingStateChanged", - this, - &nsHTMLDocument::MaybeEditingStateChanged)); + NewRunnableMethod(this, &nsHTMLDocument::MaybeEditingStateChanged)); } } } @@ -2538,10 +2536,9 @@ nsHTMLDocument::SetMayStartLayout(bool aMayStartLayout) class DeferredContentEditableCountChangeEvent : public Runnable { public: - DeferredContentEditableCountChangeEvent(nsHTMLDocument* aDoc, - nsIContent* aElement) - : mozilla::Runnable("DeferredContentEditableCountChangeEvent") - , mDoc(aDoc) + DeferredContentEditableCountChangeEvent(nsHTMLDocument *aDoc, + nsIContent *aElement) + : mDoc(aDoc) , mElement(aElement) { } diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp index 58a7fcbd98947..bdf7c560b7520 100644 --- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -86,10 +86,9 @@ class MOZ_STACK_CLASS ValueSetter class RestoreSelectionState : public Runnable { public: - RestoreSelectionState(nsTextEditorState* aState, nsTextControlFrame* aFrame) - : mozilla::Runnable("RestoreSelectionState") - , mFrame(aFrame) - , mTextEditorState(aState) + RestoreSelectionState(nsTextEditorState *aState, nsTextControlFrame *aFrame) + : mFrame(aFrame), + mTextEditorState(aState) { } @@ -1250,11 +1249,10 @@ nsTextEditorState::GetSelectionController() const // Helper class, used below in BindToFrame(). class PrepareEditorEvent : public Runnable { public: - PrepareEditorEvent(nsTextEditorState& aState, - nsIContent* aOwnerContent, - const nsAString& aCurrentValue) - : mozilla::Runnable("PrepareEditorEvent") - , mState(&aState) + PrepareEditorEvent(nsTextEditorState &aState, + nsIContent *aOwnerContent, + const nsAString &aCurrentValue) + : mState(&aState) , mOwnerContent(aOwnerContent) , mCurrentValue(aCurrentValue) { diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 1c34898beceec..8e9522e92b103 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -5994,8 +5994,7 @@ class DatabaseOperationBase protected: DatabaseOperationBase(const nsID& aBackgroundChildLoggingId, uint64_t aLoggingSerialNumber) - : Runnable("dom::indexedDB::DatabaseOperationBase") - , mOwningEventTarget(GetCurrentThreadEventTarget()) + : mOwningEventTarget(GetCurrentThreadEventTarget()) , mBackgroundChildLoggingId(aBackgroundChildLoggingId) , mLoggingSerialNumber(aLoggingSerialNumber) , mResultCode(NS_OK) @@ -6351,8 +6350,7 @@ class WaitForTransactionsHelper final public: WaitForTransactionsHelper(const nsCString& aDatabaseId, nsIRunnable* aCallback) - : Runnable("dom::indexedDB::WaitForTransactionsHelper") - , mDatabaseId(aDatabaseId) + : mDatabaseId(aDatabaseId) , mCallback(aCallback) , mState(State::Initial) { @@ -9001,8 +8999,7 @@ class GetFileReferencesHelper final const nsACString& aOrigin, const nsAString& aDatabaseName, int64_t aFileId) - : Runnable("dom::indexedDB::GetFileReferencesHelper") - , mPersistenceType(aPersistenceType) + : mPersistenceType(aPersistenceType) , mOrigin(aOrigin) , mDatabaseName(aDatabaseName) , mFileId(aFileId) @@ -9030,9 +9027,6 @@ class GetFileReferencesHelper final class FlushPendingFileDeletionsRunnable final : public Runnable { -public: - FlushPendingFileDeletionsRunnable() : Runnable("FlushPendingFileDeletionsRunnable") {} - private: ~FlushPendingFileDeletionsRunnable() override = default; @@ -9371,8 +9365,7 @@ class Maintenance final public: explicit Maintenance(QuotaClient* aQuotaClient) - : Runnable("dom::indexedDB::Maintenance") - , mQuotaClient(aQuotaClient) + : mQuotaClient(aQuotaClient) , mStartTime(PR_Now()) , mResultCode(NS_OK) , mAborted(false) @@ -9588,8 +9581,7 @@ class DatabaseMaintenance final const nsCString& aGroup, const nsCString& aOrigin, const nsString& aDatabasePath) - : Runnable("dom::indexedDB::DatabaseMaintenance") - , mMaintenance(aMaintenance) + : mMaintenance(aMaintenance) , mGroup(aGroup) , mOrigin(aOrigin) , mDatabasePath(aDatabasePath) @@ -12639,7 +12631,7 @@ ConnectionPool::ShutdownThread(ThreadInfo& aThreadInfo) NS_DISPATCH_NORMAL)); MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread( - NewRunnableMethod("nsIThread::Shutdown", thread, &nsIThread::Shutdown))); + NewRunnableMethod(thread, &nsIThread::Shutdown))); mTotalThreadCount--; } @@ -12747,7 +12739,7 @@ ConnectionPool::ScheduleTransaction(TransactionInfo* aTransactionInfo, // We need a thread right now so force all idle processing to stop by // posting a dummy runnable to each thread that might be doing idle // maintenance. - nsCOMPtr runnable = new Runnable("IndexedDBDummyRunnable"); + nsCOMPtr runnable = new Runnable(); for (uint32_t index = mDatabasesPerformingIdleMaintenance.Length(); index > 0; @@ -13191,8 +13183,7 @@ ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId) ConnectionPool:: ConnectionRunnable::ConnectionRunnable(DatabaseInfo* aDatabaseInfo) - : Runnable("dom::indexedDB::ConnectionPool::ConnectionRunnable") - , mDatabaseInfo(aDatabaseInfo) + : mDatabaseInfo(aDatabaseInfo) , mOwningEventTarget(GetCurrentThreadEventTarget()) { AssertIsOnBackgroundThread(); @@ -13354,12 +13345,11 @@ DatabasesCompleteCallback::~DatabasesCompleteCallback() MOZ_COUNT_DTOR(ConnectionPool::DatabasesCompleteCallback); } -ConnectionPool::FinishCallbackWrapper::FinishCallbackWrapper( - ConnectionPool* aConnectionPool, - uint64_t aTransactionId, - FinishCallback* aCallback) - : Runnable("dom::indexedDB::ConnectionPool::FinishCallbackWrapper") - , mConnectionPool(aConnectionPool) +ConnectionPool:: +FinishCallbackWrapper::FinishCallbackWrapper(ConnectionPool* aConnectionPool, + uint64_t aTransactionId, + FinishCallback* aCallback) + : mConnectionPool(aConnectionPool) , mCallback(aCallback) , mOwningEventTarget(GetCurrentThreadEventTarget()) , mTransactionId(aTransactionId) @@ -13422,9 +13412,9 @@ FinishCallbackWrapper::Run() uint32_t ConnectionPool::ThreadRunnable::sNextSerialNumber = 0; -ConnectionPool::ThreadRunnable::ThreadRunnable() - : Runnable("dom::indexedDB::ConnectionPool::ThreadRunnable") - , mSerialNumber(++sNextSerialNumber) +ConnectionPool:: +ThreadRunnable::ThreadRunnable() + : mSerialNumber(++sNextSerialNumber) , mFirstRun(true) , mContinueRunning(true) { @@ -14487,9 +14477,7 @@ Database::MaybeCloseConnection() IsClosed() && mDirectoryLock) { nsCOMPtr callback = - NewRunnableMethod("dom::indexedDB::Database::ConnectionClosedCallback", - this, - &Database::ConnectionClosedCallback); + NewRunnableMethod(this, &Database::ConnectionClosedCallback); RefPtr helper = new WaitForTransactionsHelper(Id(), callback); @@ -22691,10 +22679,8 @@ OpenDatabaseOp::SendResults() // Make sure to release the database on this thread. mDatabase = nullptr; } else if (mDirectoryLock) { - nsCOMPtr callback = NewRunnableMethod( - "dom::indexedDB::OpenDatabaseOp::ConnectionClosedCallback", - this, - &OpenDatabaseOp::ConnectionClosedCallback); + nsCOMPtr callback = + NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback); RefPtr helper = new WaitForTransactionsHelper(mDatabaseId, callback); diff --git a/dom/indexedDB/FileInfo.cpp b/dom/indexedDB/FileInfo.cpp index f4f515c20ae6d..471007273a1e6 100644 --- a/dom/indexedDB/FileInfo.cpp +++ b/dom/indexedDB/FileInfo.cpp @@ -60,8 +60,7 @@ class CleanupFileRunnable final DoCleanup(FileManager* aFileManager, int64_t aFileId); CleanupFileRunnable(FileManager* aFileManager, int64_t aFileId) - : Runnable("dom::indexedDB::CleanupFileRunnable") - , mFileManager(aFileManager) + : mFileManager(aFileManager) , mFileId(aFileId) { MOZ_ASSERT(aFileManager); diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index 5abbb1a874c86..2813c29c41424 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -73,9 +73,9 @@ class CancelableRunnableWrapper final nsCOMPtr mRunnable; public: - explicit CancelableRunnableWrapper(nsIRunnable* aRunnable) - : CancelableRunnable("dom::CancelableRunnableWrapper") - , mRunnable(aRunnable) + explicit + CancelableRunnableWrapper(nsIRunnable* aRunnable) + : mRunnable(aRunnable) { MOZ_ASSERT(aRunnable); } diff --git a/dom/indexedDB/ScriptErrorHelper.cpp b/dom/indexedDB/ScriptErrorHelper.cpp index b643154e95913..7a47406417539 100644 --- a/dom/indexedDB/ScriptErrorHelper.cpp +++ b/dom/indexedDB/ScriptErrorHelper.cpp @@ -36,8 +36,7 @@ class ScriptErrorRunnable final : public mozilla::Runnable uint32_t aSeverityFlag, bool aIsChrome, uint64_t aInnerWindowID) - : mozilla::Runnable("ScriptErrorRunnable") - , mMessage(aMessage) + : mMessage(aMessage) , mFilename(aFilename) , mLineNumber(aLineNumber) , mColumnNumber(aColumnNumber) @@ -56,8 +55,7 @@ class ScriptErrorRunnable final : public mozilla::Runnable uint32_t aSeverityFlag, bool aIsChrome, uint64_t aInnerWindowID) - : mozilla::Runnable("ScriptErrorRunnable") - , mMessageName(aMessageName) + : mMessageName(aMessageName) , mFilename(aFilename) , mLineNumber(aLineNumber) , mColumnNumber(aColumnNumber) diff --git a/dom/ipc/ContentBridgeChild.cpp b/dom/ipc/ContentBridgeChild.cpp index 740f8f04e881f..4f875a2deed92 100644 --- a/dom/ipc/ContentBridgeChild.cpp +++ b/dom/ipc/ContentBridgeChild.cpp @@ -32,10 +32,7 @@ ContentBridgeChild::~ContentBridgeChild() void ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy) { - MessageLoop::current()->PostTask( - NewRunnableMethod("dom::ContentBridgeChild::DeferredDestroy", - this, - &ContentBridgeChild::DeferredDestroy)); + MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy)); } /*static*/ void diff --git a/dom/ipc/ContentBridgeParent.cpp b/dom/ipc/ContentBridgeParent.cpp index 4cbc78f51545d..3f8ee5ca82163 100644 --- a/dom/ipc/ContentBridgeParent.cpp +++ b/dom/ipc/ContentBridgeParent.cpp @@ -36,10 +36,7 @@ ContentBridgeParent::ActorDestroy(ActorDestroyReason aWhy) if (os) { os->RemoveObserver(this, "content-child-shutdown"); } - MessageLoop::current()->PostTask( - NewRunnableMethod("dom::ContentBridgeParent::DeferredDestroy", - this, - &ContentBridgeParent::DeferredDestroy)); + MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy)); } /*static*/ ContentBridgeParent* @@ -176,8 +173,7 @@ ContentBridgeParent::NotifyTabDestroyed() { int32_t numLiveTabs = ManagedPBrowserParent().Count(); if (numLiveTabs == 1) { - MessageLoop::current()->PostTask(NewRunnableMethod( - "dom::ContentBridgeParent::Close", this, &ContentBridgeParent::Close)); + MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::Close)); } } diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 16fed34a73aa7..247b3c21960ba 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -2776,12 +2776,10 @@ ContentChild::StartForceKillTimer() if (timeoutSecs > 0) { mForceKillTimer = do_CreateInstance("@mozilla.org/timer;1"); MOZ_ASSERT(mForceKillTimer); - mForceKillTimer->InitWithNamedFuncCallback( - ContentChild::ForceKillTimerCallback, + mForceKillTimer->InitWithFuncCallback(ContentChild::ForceKillTimerCallback, this, timeoutSecs * 1000, - nsITimer::TYPE_ONE_SHOT, - "dom::ContentChild::StartForceKillTimer"); + nsITimer::TYPE_ONE_SHOT); } } @@ -2811,9 +2809,7 @@ ContentChild::RecvShutdown() // time (100ms) in the hopes that the event loop will have finished by // then. MessageLoop::current()->PostDelayedTask( - NewRunnableMethod( - "dom::ContentChild::RecvShutdown", this, &ContentChild::RecvShutdown), - 100); + NewRunnableMethod(this, &ContentChild::RecvShutdown), 100); return IPC_OK(); } } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index c4bd1548f6c52..35d37b608d10e 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1711,11 +1711,7 @@ DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess) // system. struct DelayedDeleteContentParentTask : public Runnable { - explicit DelayedDeleteContentParentTask(ContentParent* aObj) - : Runnable("dom::DelayedDeleteContentParentTask") - , mObj(aObj) - { - } + explicit DelayedDeleteContentParentTask(ContentParent* aObj) : mObj(aObj) { } // No-op NS_IMETHOD Run() override { return NS_OK; } @@ -1847,11 +1843,10 @@ ContentParent::ActorDestroy(ActorDestroyReason why) // Destroy any processes created by this ContentParent for(uint32_t i = 0; i < childIDArray.Length(); i++) { ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]); - MessageLoop::current()->PostTask( - NewRunnableMethod("dom::ContentParent::ShutDownProcess", - cp, - &ContentParent::ShutDownProcess, - SEND_SHUTDOWN_MESSAGE)); + MessageLoop::current()->PostTask(NewRunnableMethod + (cp, + &ContentParent::ShutDownProcess, + SEND_SHUTDOWN_MESSAGE)); } cpm->RemoveContentProcess(this->ChildID()); @@ -1977,12 +1972,10 @@ ContentParent::StartForceKillTimer() if (timeoutSecs > 0) { mForceKillTimer = do_CreateInstance("@mozilla.org/timer;1"); MOZ_ASSERT(mForceKillTimer); - mForceKillTimer->InitWithNamedFuncCallback( - ContentParent::ForceKillTimerCallback, - this, - timeoutSecs * 1000, - nsITimer::TYPE_ONE_SHOT, - "dom::ContentParent::StartForceKillTimer"); + mForceKillTimer->InitWithFuncCallback(ContentParent::ForceKillTimerCallback, + this, + timeoutSecs * 1000, + nsITimer::TYPE_ONE_SHOT); } } @@ -2011,11 +2004,10 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId, if (tabIds.Length() == 1 && !ShouldKeepProcessAlive() && !TryToRecycle()) { // In the case of normal shutdown, send a shutdown message to child to // allow it to perform shutdown tasks. - MessageLoop::current()->PostTask( - NewRunnableMethod("dom::ContentParent::ShutDownProcess", - this, - &ContentParent::ShutDownProcess, - SEND_SHUTDOWN_MESSAGE)); + MessageLoop::current()->PostTask(NewRunnableMethod + (this, + &ContentParent::ShutDownProcess, + SEND_SHUTDOWN_MESSAGE)); } } @@ -4102,8 +4094,7 @@ class AnonymousTemporaryFileRequestor final : public Runnable { public: AnonymousTemporaryFileRequestor(ContentParent* aCP, const uint64_t& aID) - : Runnable("dom::AnonymousTemporaryFileRequestor") - , mCP(aCP) + : mCP(aCP) , mID(aID) , mRv(NS_OK) , mPRFD(nullptr) diff --git a/dom/ipc/FilePickerParent.cpp b/dom/ipc/FilePickerParent.cpp index 9448a1afd2dd6..ad1ff208be08d 100644 --- a/dom/ipc/FilePickerParent.cpp +++ b/dom/ipc/FilePickerParent.cpp @@ -49,12 +49,11 @@ FilePickerParent::~FilePickerParent() // 2. The stream transport thread stat()s the file in Run() and then dispatches // the same runnable on the main thread. // 3. The main thread sends the results over IPC. -FilePickerParent::IORunnable::IORunnable(FilePickerParent* aFPParent, +FilePickerParent::IORunnable::IORunnable(FilePickerParent *aFPParent, nsTArray>& aFiles, bool aIsDirectory) - : mozilla::Runnable("dom::FilePickerParent::IORunnable") - , mFilePickerParent(aFPParent) - , mIsDirectory(aIsDirectory) + : mFilePickerParent(aFPParent) + , mIsDirectory(aIsDirectory) { mFiles.SwapElements(aFiles); MOZ_ASSERT_IF(aIsDirectory, mFiles.Length() == 1); diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp index 77fc8beb82697..39ba78d0b9829 100644 --- a/dom/ipc/PreallocatedProcessManager.cpp +++ b/dom/ipc/PreallocatedProcessManager.cpp @@ -206,9 +206,7 @@ PreallocatedProcessManagerImpl::AllocateAfterDelay() // message loop in practice never goes idle, that didn't work out well. // Let's just launch the process after the delay. NS_DelayedDispatchToCurrentThread( - NewRunnableMethod("PreallocatedProcessManagerImpl::AllocateNow", - this, - &PreallocatedProcessManagerImpl::AllocateNow), + NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow), Preferences::GetUint("dom.ipc.processPrelaunch.delayMs", DEFAULT_ALLOCATE_DELAY)); } @@ -220,10 +218,7 @@ PreallocatedProcessManagerImpl::AllocateOnIdle() return; } - NS_IdleDispatchToCurrentThread( - NewRunnableMethod("PreallocatedProcessManagerImpl::AllocateNow", - this, - &PreallocatedProcessManagerImpl::AllocateNow)); + NS_IdleDispatchToCurrentThread(NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow)); } void diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp index 2f8fcfe2d256e..91f605cb8b0e7 100644 --- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -369,9 +369,7 @@ HangMonitorChild::ActorDestroy(ActorDestroyReason aWhy) // We use a task here to ensure that IPDL is finished with this // HangMonitorChild before it gets deleted on the main thread. - Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ShutdownOnThread", - this, - &HangMonitorChild::ShutdownOnThread)); + Dispatch(NewNonOwningRunnableMethod(this, &HangMonitorChild::ShutdownOnThread)); } mozilla::ipc::IPCResult @@ -482,12 +480,10 @@ HangMonitorChild::NotifySlowScript(nsITabChild* aTabChild, } nsAutoCString filename(aFileName); - Dispatch(NewNonOwningRunnableMethod( - "HangMonitorChild::NotifySlowScriptAsync", - this, - &HangMonitorChild::NotifySlowScriptAsync, - id, - filename)); + Dispatch(NewNonOwningRunnableMethod + (this, + &HangMonitorChild::NotifySlowScriptAsync, + id, filename)); return SlowScriptAction::Continue; } @@ -515,11 +511,9 @@ HangMonitorChild::NotifyPluginHang(uint32_t aPluginId) mSentReport = true; // bounce to background thread - Dispatch(NewNonOwningRunnableMethod( - "HangMonitorChild::NotifyPluginHangAsync", - this, - &HangMonitorChild::NotifyPluginHangAsync, - aPluginId)); + Dispatch(NewNonOwningRunnableMethod(this, + &HangMonitorChild::NotifyPluginHangAsync, + aPluginId)); } void @@ -541,9 +535,7 @@ HangMonitorChild::ClearHang() if (mSentReport) { // bounce to background thread - Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ClearHangAsync", - this, - &HangMonitorChild::ClearHangAsync)); + Dispatch(NewNonOwningRunnableMethod(this, &HangMonitorChild::ClearHangAsync)); MonitorAutoLock lock(mMonitor); mSentReport = false; @@ -611,8 +603,7 @@ HangMonitorParent::Shutdown() mProcess = nullptr; } - Dispatch(NewNonOwningRunnableMethod("HangMonitorParent::ShutdownOnThread", - this, + Dispatch(NewNonOwningRunnableMethod(this, &HangMonitorParent::ShutdownOnThread)); while (!mShutdownDone) { @@ -643,12 +634,8 @@ HangMonitorParent::ForcePaint(dom::TabParent* aTab, uint64_t aLayerObserverEpoch MOZ_RELEASE_ASSERT(NS_IsMainThread()); if (sShouldForcePaint) { TabId id = aTab->GetTabId(); - Dispatch(NewNonOwningRunnableMethod( - "HangMonitorParent::ForcePaintOnThread", - this, - &HangMonitorParent::ForcePaintOnThread, - id, - aLayerObserverEpoch)); + Dispatch(NewNonOwningRunnableMethod + (this, &HangMonitorParent::ForcePaintOnThread, id, aLayerObserverEpoch)); } } @@ -957,10 +944,8 @@ HangMonitoredProcess::TerminateScript() return NS_ERROR_UNEXPECTED; } - ProcessHangMonitor::Get()->Dispatch( - NewNonOwningRunnableMethod("HangMonitorParent::TerminateScript", - mActor, - &HangMonitorParent::TerminateScript)); + ProcessHangMonitor::Get()->Dispatch(NewNonOwningRunnableMethod(mActor, + &HangMonitorParent::TerminateScript)); return NS_OK; } @@ -976,10 +961,8 @@ HangMonitoredProcess::BeginStartingDebugger() return NS_ERROR_UNEXPECTED; } - ProcessHangMonitor::Get()->Dispatch( - NewNonOwningRunnableMethod("HangMonitorParent::BeginStartingDebugger", - mActor, - &HangMonitorParent::BeginStartingDebugger)); + ProcessHangMonitor::Get()->Dispatch(NewNonOwningRunnableMethod(mActor, + &HangMonitorParent::BeginStartingDebugger)); return NS_OK; } @@ -995,10 +978,8 @@ HangMonitoredProcess::EndStartingDebugger() return NS_ERROR_UNEXPECTED; } - ProcessHangMonitor::Get()->Dispatch( - NewNonOwningRunnableMethod("HangMonitorParent::EndStartingDebugger", - mActor, - &HangMonitorParent::EndStartingDebugger)); + ProcessHangMonitor::Get()->Dispatch(NewNonOwningRunnableMethod(mActor, + &HangMonitorParent::EndStartingDebugger)); return NS_OK; } @@ -1178,12 +1159,10 @@ CreateHangMonitorParent(ContentParent* aContentParent, auto* process = new HangMonitoredProcess(parent, aContentParent); parent->SetProcess(process); - monitor->Dispatch( - NewNonOwningRunnableMethod&&>( - "HangMonitorParent::Bind", - parent, - &HangMonitorParent::Bind, - Move(aEndpoint))); + monitor->Dispatch(NewNonOwningRunnableMethod + &&>(parent, + &HangMonitorParent::Bind, + Move(aEndpoint))); return parent; } @@ -1199,12 +1178,10 @@ mozilla::CreateHangMonitorChild(Endpoint&& aEndpoint) ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate(); auto* child = new HangMonitorChild(monitor); - monitor->Dispatch( - NewNonOwningRunnableMethod&&>( - "HangMonitorChild::Bind", - child, - &HangMonitorChild::Bind, - Move(aEndpoint))); + monitor->Dispatch(NewNonOwningRunnableMethod + &&>(child, + &HangMonitorChild::Bind, + Move(aEndpoint))); } void diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 8870ef7f46cce..093075f06f906 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2781,13 +2781,8 @@ class LayerTreeUpdateRunnable final bool mActive; public: - explicit LayerTreeUpdateRunnable(uint64_t aLayersId, - uint64_t aEpoch, - bool aActive) - : Runnable("dom::LayerTreeUpdateRunnable") - , mLayersId(aLayersId) - , mEpoch(aEpoch) - , mActive(aActive) + explicit LayerTreeUpdateRunnable(uint64_t aLayersId, uint64_t aEpoch, bool aActive) + : mLayersId(aLayersId), mEpoch(aEpoch), mActive(aActive) { MOZ_ASSERT(!NS_IsMainThread()); } diff --git a/dom/jsurl/nsJSProtocolHandler.cpp b/dom/jsurl/nsJSProtocolHandler.cpp index 845fc2b8a158a..beb8f30e6a1cd 100644 --- a/dom/jsurl/nsJSProtocolHandler.cpp +++ b/dom/jsurl/nsJSProtocolHandler.cpp @@ -663,8 +663,7 @@ nsJSChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) name = "nsJSChannel::NotifyListener"; } - nsresult rv = NS_DispatchToCurrentThread( - mozilla::NewRunnableMethod(name, this, method)); + nsresult rv = NS_DispatchToCurrentThread(mozilla::NewRunnableMethod(name, this, method)); if (NS_FAILED(rv)) { loadGroup->RemoveRequest(this, nullptr, rv); diff --git a/dom/media/Benchmark.cpp b/dom/media/Benchmark.cpp index 2846a74470bb8..7a1782766584e 100644 --- a/dom/media/Benchmark.cpp +++ b/dom/media/Benchmark.cpp @@ -111,8 +111,8 @@ Benchmark::Run() RefPtr p = mPromise.Ensure(__func__); RefPtr self = this; - mPlaybackState.Dispatch(NS_NewRunnableFunction( - "Benchmark::Run", [self]() { self->mPlaybackState.DemuxSamples(); })); + mPlaybackState.Dispatch( + NS_NewRunnableFunction([self]() { self->mPlaybackState.DemuxSamples(); })); return p; } @@ -196,8 +196,7 @@ BenchmarkPlayback::DemuxNextSample() && mSamples.Length() == (size_t)ref->mParameters.mStopAtFrame.ref()) { InitDecoder(Move(*mTrackDemuxer->GetInfo())); } else { - Dispatch(NS_NewRunnableFunction("BenchmarkPlayback::DemuxNextSample", - [this, ref]() { DemuxNextSample(); })); + Dispatch(NS_NewRunnableFunction([this, ref]() { DemuxNextSample(); })); } }, [this, ref](const MediaResult& aError) { @@ -292,10 +291,9 @@ BenchmarkPlayback::Output(const MediaDataDecoder::DecodedData& aResults) || mDrained)) { uint32_t decodeFps = frames / elapsedTime.ToSeconds(); MainThreadShutdown(); - ref->Dispatch( - NS_NewRunnableFunction("BenchmarkPlayback::Output", [ref, decodeFps]() { - ref->ReturnResult(decodeFps); - })); + ref->Dispatch(NS_NewRunnableFunction([ref, decodeFps]() { + ref->ReturnResult(decodeFps); + })); } } diff --git a/dom/media/CanvasCaptureMediaStream.cpp b/dom/media/CanvasCaptureMediaStream.cpp index 2f24540d0a46b..c30f2f3f43511 100644 --- a/dom/media/CanvasCaptureMediaStream.cpp +++ b/dom/media/CanvasCaptureMediaStream.cpp @@ -142,11 +142,7 @@ class TimerDriver : public OutputStreamDriver if (!mTimer) { return; } - mTimer->InitWithNamedFuncCallback(&TimerTick, - this, - int(1000 / mFPS), - nsITimer::TYPE_REPEATING_SLACK, - "dom::TimerDriver::TimerDriver"); + mTimer->InitWithFuncCallback(&TimerTick, this, int(1000 / mFPS), nsITimer::TYPE_REPEATING_SLACK); } static void TimerTick(nsITimer* aTimer, void* aClosure) diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index a885274cd3258..29f8a870dad32 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -421,8 +421,7 @@ void InitLibrary() Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_BACKEND); Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_LOG_LEVEL); #ifndef MOZ_WIDGET_ANDROID - NS_DispatchToMainThread( - NS_NewRunnableFunction("CubebUtils::InitLibrary", &InitBrandName)); + NS_DispatchToMainThread(NS_NewRunnableFunction(&InitBrandName)); #endif } diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 9afd2ec409ac0..0ad0e9aa4d6a3 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -185,10 +185,7 @@ class DOMMediaStream::OwnedStreamListener : public MediaStreamListener { RefPtr newTrack = mStream->CreateDOMTrack(aTrackID, aType, source); NS_DispatchToMainThread(NewRunnableMethod>( - "DOMMediaStream::AddTrackInternal", - mStream, - &DOMMediaStream::AddTrackInternal, - newTrack)); + mStream, &DOMMediaStream::AddTrackInternal, newTrack)); } void DoNotifyTrackEnded(MediaStream* aInputStream, TrackID aInputTrackID, @@ -206,10 +203,8 @@ class DOMMediaStream::OwnedStreamListener : public MediaStreamListener { if (track) { LOG(LogLevel::Debug, ("DOMMediaStream %p MediaStreamTrack %p ended at the source. Marking it ended.", mStream, track.get())); - NS_DispatchToMainThread( - NewRunnableMethod("dom::MediaStreamTrack::OverrideEnded", - track, - &MediaStreamTrack::OverrideEnded)); + NS_DispatchToMainThread(NewRunnableMethod( + track, &MediaStreamTrack::OverrideEnded)); } } @@ -222,27 +217,15 @@ class DOMMediaStream::OwnedStreamListener : public MediaStreamListener { if (aTrackEvents & TrackEventCommand::TRACK_EVENT_CREATED) { aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod, - TrackID>( - "DOMMediaStream::OwnedStreamListener::DoNotifyTrackCreated", - this, - &OwnedStreamListener::DoNotifyTrackCreated, - aID, - aQueuedMedia.GetType(), - aInputStream, - aInputTrackID)); + NewRunnableMethod, TrackID>( + this, &OwnedStreamListener::DoNotifyTrackCreated, + aID, aQueuedMedia.GetType(), aInputStream, aInputTrackID)); } else if (aTrackEvents & TrackEventCommand::TRACK_EVENT_ENDED) { aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, NewRunnableMethod, TrackID, TrackID>( - "DOMMediaStream::OwnedStreamListener::DoNotifyTrackEnded", - this, - &OwnedStreamListener::DoNotifyTrackEnded, - aInputStream, - aInputTrackID, - aID)); + this, &OwnedStreamListener::DoNotifyTrackEnded, + aInputStream, aInputTrackID, aID)); } } @@ -283,9 +266,7 @@ class DOMMediaStream::PlaybackStreamListener : public MediaStreamListener { // dispatch. We have to do the same to notify of created tracks to stay // in sync. (Or NotifyTracksCreated is called before tracks are added). NS_DispatchToMainThread( - NewRunnableMethod("DOMMediaStream::NotifyTracksCreated", - mStream, - &DOMMediaStream::NotifyTracksCreated)); + NewRunnableMethod(mStream, &DOMMediaStream::NotifyTracksCreated)); } void DoNotifyFinished() @@ -296,9 +277,8 @@ class DOMMediaStream::PlaybackStreamListener : public MediaStreamListener { return; } - NS_DispatchToMainThread(NewRunnableMethod("DOMMediaStream::NotifyFinished", - mStream, - &DOMMediaStream::NotifyFinished)); + NS_DispatchToMainThread(NewRunnableMethod( + mStream, &DOMMediaStream::NotifyFinished)); } // The methods below are called on the MediaStreamGraph thread. @@ -307,10 +287,7 @@ class DOMMediaStream::PlaybackStreamListener : public MediaStreamListener { { aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod( - "DOMMediaStream::PlaybackStreamListener::DoNotifyFinishedTrackCreation", - this, - &PlaybackStreamListener::DoNotifyFinishedTrackCreation)); + NewRunnableMethod(this, &PlaybackStreamListener::DoNotifyFinishedTrackCreation)); } @@ -320,10 +297,7 @@ class DOMMediaStream::PlaybackStreamListener : public MediaStreamListener { if (event == MediaStreamGraphEvent::EVENT_FINISHED) { aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod( - "DOMMediaStream::PlaybackStreamListener::DoNotifyFinished", - this, - &PlaybackStreamListener::DoNotifyFinished)); + NewRunnableMethod(this, &PlaybackStreamListener::DoNotifyFinished)); } } diff --git a/dom/media/EncodedBufferCache.cpp b/dom/media/EncodedBufferCache.cpp index 0e3c3ed46f00e..31fb99dd82838 100644 --- a/dom/media/EncodedBufferCache.cpp +++ b/dom/media/EncodedBufferCache.cpp @@ -50,9 +50,7 @@ EncodedBufferCache::AppendBuffer(nsTArray & aBuf) Monitor monitor("EncodeBufferCache::AppendBuffer"); RefPtr cc = dom::ContentChild::GetSingleton(); nsCOMPtr runnable = - NewRunnableMethod( - "dom::ContentChild::AsyncOpenAnonymousTemporaryFile", - cc, + NewRunnableMethod(cc, &dom::ContentChild::AsyncOpenAnonymousTemporaryFile, [&](PRFileDesc* aFile) { rv = aFile ? NS_OK : NS_ERROR_FAILURE; diff --git a/dom/media/FileBlockCache.cpp b/dom/media/FileBlockCache.cpp index cfeedefb73199..a0d044703c085 100644 --- a/dom/media/FileBlockCache.cpp +++ b/dom/media/FileBlockCache.cpp @@ -95,18 +95,15 @@ FileBlockCache::Init() if (XRE_IsParentProcess()) { RefPtr self = this; - rv = mThread->Dispatch( - NS_NewRunnableFunction("FileBlockCache::Init", - [self] { - PRFileDesc* fd = nullptr; - nsresult rv = NS_OpenAnonymousTemporaryFile(&fd); - if (NS_SUCCEEDED(rv)) { - self->SetCacheFile(fd); - } else { - self->Close(); - } - }), - NS_DISPATCH_NORMAL); + rv = mThread->Dispatch(NS_NewRunnableFunction([self] { + PRFileDesc* fd = nullptr; + nsresult rv = NS_OpenAnonymousTemporaryFile(&fd); + if (NS_SUCCEEDED(rv)) { + self->SetCacheFile(fd); + } else { + self->Close(); + } + }), NS_DISPATCH_NORMAL); } else { // We must request a temporary file descriptor from the parent process. RefPtr self = this; @@ -160,28 +157,19 @@ FileBlockCache::Close() // Let the thread close the FD, and then trigger its own shutdown. // Note that mThread is now empty, so no other task will be posted there. // Also mThread and mFD are empty and therefore can be reused immediately. - nsresult rv = thread->Dispatch( - NS_NewRunnableFunction("FileBlockCache::Close", - [thread, fd] { - if (fd) { - CloseFD(fd); - } - // We must shut down the thread in another - // runnable. This is called - // while we're shutting down the media cache, and - // nsIThread::Shutdown() - // can cause events to run before it completes, - // which could end up - // opening more streams, while the media cache is - // shutting down and - // releasing memory etc! - nsCOMPtr event = - new ShutdownThreadEvent(thread); - SystemGroup::Dispatch("ShutdownThreadEvent", - TaskCategory::Other, - event.forget()); - }), - NS_DISPATCH_NORMAL); + nsresult rv = thread->Dispatch(NS_NewRunnableFunction([thread, fd] { + if (fd) { + CloseFD(fd); + } + // We must shut down the thread in another runnable. This is called + // while we're shutting down the media cache, and nsIThread::Shutdown() + // can cause events to run before it completes, which could end up + // opening more streams, while the media cache is shutting down and + // releasing memory etc! + nsCOMPtr event = new ShutdownThreadEvent(thread); + SystemGroup::Dispatch( + "ShutdownThreadEvent", TaskCategory::Other, event.forget()); + }), NS_DISPATCH_NORMAL); NS_ENSURE_SUCCESS_VOID(rv); } diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index a19bc1fbec2c5..ee39c442fa56d 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -141,10 +141,8 @@ ThreadedDriver::ThreadedDriver(MediaStreamGraphImpl* aGraphImpl) class MediaStreamGraphShutdownThreadRunnable : public Runnable { public: - explicit MediaStreamGraphShutdownThreadRunnable( - already_AddRefed aThread) - : Runnable("MediaStreamGraphShutdownThreadRunnable") - , mThread(aThread) + explicit MediaStreamGraphShutdownThreadRunnable(already_AddRefed aThread) + : mThread(aThread) { } NS_IMETHOD Run() override @@ -175,8 +173,7 @@ ThreadedDriver::~ThreadedDriver() class MediaStreamGraphInitThreadRunnable : public Runnable { public: explicit MediaStreamGraphInitThreadRunnable(ThreadedDriver* aDriver) - : Runnable("MediaStreamGraphInitThreadRunnable") - , mDriver(aDriver) + : mDriver(aDriver) { } NS_IMETHOD Run() override @@ -470,12 +467,10 @@ OfflineClockDriver::WakeUp() MOZ_ASSERT(false, "An offline graph should not have to wake up."); } -AsyncCubebTask::AsyncCubebTask(AudioCallbackDriver* aDriver, - AsyncCubebOperation aOperation) - : Runnable("AsyncCubebTask") - , mDriver(aDriver) - , mOperation(aOperation) - , mShutdownGrip(aDriver->GraphImpl()) +AsyncCubebTask::AsyncCubebTask(AudioCallbackDriver* aDriver, AsyncCubebOperation aOperation) + : mDriver(aDriver), + mOperation(aOperation), + mShutdownGrip(aDriver->GraphImpl()) { NS_WARNING_ASSERTION(mDriver->mAudioStream || aOperation == INIT, "No audio stream!"); @@ -497,10 +492,9 @@ AsyncCubebTask::EnsureThread() // since we don't know the order that the shutdown-threads observers // will run. ClearOnShutdown guarantees it runs first. if (!NS_IsMainThread()) { - NS_DispatchToMainThread( - NS_NewRunnableFunction("AsyncCubebTask::EnsureThread", []() -> void { - ClearOnShutdown(&sThreadPool, ShutdownPhase::ShutdownThreads); - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([]() -> void { + ClearOnShutdown(&sThreadPool, ShutdownPhase::ShutdownThreads); + })); } else { ClearOnShutdown(&sThreadPool, ShutdownPhase::ShutdownThreads); } diff --git a/dom/media/Latency.cpp b/dom/media/Latency.cpp index cdc3af87c47ed..c42c3178aac08 100644 --- a/dom/media/Latency.cpp +++ b/dom/media/Latency.cpp @@ -47,24 +47,18 @@ GetLatencyLog() class LogEvent : public Runnable { public: - LogEvent(AsyncLatencyLogger::LatencyLogIndex aIndex, - uint64_t aID, - int64_t aValue, - TimeStamp aTimeStamp) - : mozilla::Runnable("LogEvent") - , mIndex(aIndex) - , mID(aID) - , mValue(aValue) - , mTimeStamp(aTimeStamp) + LogEvent(AsyncLatencyLogger::LatencyLogIndex aIndex, uint64_t aID, int64_t aValue, + TimeStamp aTimeStamp) : + mIndex(aIndex), + mID(aID), + mValue(aValue), + mTimeStamp(aTimeStamp) {} - LogEvent(AsyncLatencyLogger::LatencyLogIndex aIndex, - uint64_t aID, - int64_t aValue) - : mozilla::Runnable("LogEvent") - , mIndex(aIndex) - , mID(aID) - , mValue(aValue) - , mTimeStamp(TimeStamp()) + LogEvent(AsyncLatencyLogger::LatencyLogIndex aIndex, uint64_t aID, int64_t aValue) : + mIndex(aIndex), + mID(aID), + mValue(aValue), + mTimeStamp(TimeStamp()) {} ~LogEvent() {} diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 69ee072162073..9d13360d9e9e4 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -214,36 +214,30 @@ MediaDecoder::ResourceCallback::NotifyDataArrived() // calls to MediaDecoder::NotifyDataArrived() which will update the buffer // ranges of the reader. mTimerArmed = true; - mTimer->InitWithNamedFuncCallback( - TimerCallback, - this, - sDelay, - nsITimer::TYPE_ONE_SHOT, - "MediaDecoder::ResourceCallback::NotifyDataArrived"); + mTimer->InitWithFuncCallback( + TimerCallback, this, sDelay, nsITimer::TYPE_ONE_SHOT); } void MediaDecoder::ResourceCallback::NotifyDataEnded(nsresult aStatus) { RefPtr self = this; - nsCOMPtr r = NS_NewRunnableFunction( - "MediaDecoder::ResourceCallback::NotifyDataEnded", [=]() { - if (!self->mDecoder) { - return; - } - self->mDecoder->NotifyDownloadEnded(aStatus); - if (NS_SUCCEEDED(aStatus)) { - MediaDecoderOwner* owner = self->GetMediaOwner(); - MOZ_ASSERT(owner); - owner->DownloadSuspended(); - - // NotifySuspendedStatusChanged will tell the element that download - // has been suspended "by the cache", which is true since we never - // download anything. The element can then transition to - // HAVE_ENOUGH_DATA. - self->mDecoder->NotifySuspendedStatusChanged(); - } - }); + nsCOMPtr r = NS_NewRunnableFunction([=] () { + if (!self->mDecoder) { + return; + } + self->mDecoder->NotifyDownloadEnded(aStatus); + if (NS_SUCCEEDED(aStatus)) { + MediaDecoderOwner* owner = self->GetMediaOwner(); + MOZ_ASSERT(owner); + owner->DownloadSuspended(); + + // NotifySuspendedStatusChanged will tell the element that download + // has been suspended "by the cache", which is true since we never + // download anything. The element can then transition to HAVE_ENOUGH_DATA. + self->mDecoder->NotifySuspendedStatusChanged(); + } + }); mAbstractMainThread->Dispatch(r.forget()); } @@ -270,12 +264,11 @@ MediaDecoder::ResourceCallback::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) { RefPtr self = this; - nsCOMPtr r = NS_NewRunnableFunction( - "MediaDecoder::ResourceCallback::NotifyBytesConsumed", [=]() { - if (self->mDecoder) { - self->mDecoder->NotifyBytesConsumed(aBytes, aOffset); - } - }); + nsCOMPtr r = NS_NewRunnableFunction([=] () { + if (self->mDecoder) { + self->mDecoder->NotifyBytesConsumed(aBytes, aOffset); + } + }); mAbstractMainThread->Dispatch(r.forget()); } @@ -478,11 +471,10 @@ MediaDecoder::Shutdown() // Ensure we always unregister asynchronously in order not to disrupt // the hashtable iterating in MediaShutdownManager::Shutdown(). RefPtr self = this; - nsCOMPtr r = - NS_NewRunnableFunction("MediaDecoder::Shutdown", [self]() { - self->mVideoFrameContainer = nullptr; - MediaShutdownManager::Instance().Unregister(self); - }); + nsCOMPtr r = NS_NewRunnableFunction([self] () { + self->mVideoFrameContainer = nullptr; + MediaShutdownManager::Instance().Unregister(self); + }); mAbstractMainThread->Dispatch(r.forget()); } diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp index b9133f8d367fd..d192ab5df2f3e 100644 --- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -92,10 +92,7 @@ MediaDecoderReader::Init() mTaskQueue, this, &MediaDecoderReader::NotifyDataArrived); } // Dispatch initialization that needs to happen on that task queue. - mTaskQueue->Dispatch( - NewRunnableMethod("MediaDecoderReader::InitializationTask", - this, - &MediaDecoderReader::InitializationTask)); + mTaskQueue->Dispatch(NewRunnableMethod(this, &MediaDecoderReader::InitializationTask)); return InitInternal(); } @@ -247,8 +244,7 @@ class ReRequestVideoWithSkipTask : public Runnable public: ReRequestVideoWithSkipTask(MediaDecoderReader* aReader, const media::TimeUnit& aTimeThreshold) - : Runnable("ReRequestVideoWithSkipTask") - , mReader(aReader) + : mReader(aReader) , mTimeThreshold(aTimeThreshold) { } @@ -274,8 +270,7 @@ class ReRequestAudioTask : public Runnable { public: explicit ReRequestAudioTask(MediaDecoderReader* aReader) - : Runnable("ReRequestAudioTask") - , mReader(aReader) + : mReader(aReader) { } diff --git a/dom/media/MediaDecoderReaderWrapper.cpp b/dom/media/MediaDecoderReaderWrapper.cpp index 7e4b776dfa64b..48a1367078078 100644 --- a/dom/media/MediaDecoderReaderWrapper.cpp +++ b/dom/media/MediaDecoderReaderWrapper.cpp @@ -111,9 +111,7 @@ MediaDecoderReaderWrapper::ReleaseResources() { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); nsCOMPtr r = - NewRunnableMethod("MediaDecoderReader::ReleaseResources", - mReader, - &MediaDecoderReader::ReleaseResources); + NewRunnableMethod(mReader, &MediaDecoderReader::ReleaseResources); mReader->OwnerThread()->Dispatch(r.forget()); } @@ -122,8 +120,7 @@ MediaDecoderReaderWrapper::ResetDecode(TrackSet aTracks) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); nsCOMPtr r = - NewRunnableMethod("MediaDecoderReader::ResetDecode", - mReader, + NewRunnableMethod(mReader, &MediaDecoderReader::ResetDecode, aTracks); mReader->OwnerThread()->Dispatch(r.forget()); @@ -164,9 +161,7 @@ MediaDecoderReaderWrapper::SetVideoBlankDecode(bool aIsBlankDecode) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); nsCOMPtr r = - NewRunnableMethod("MediaDecoderReader::SetVideoNullDecode", - mReader, - &MediaDecoderReader::SetVideoNullDecode, + NewRunnableMethod(mReader, &MediaDecoderReader::SetVideoNullDecode, aIsBlankDecode); mReader->OwnerThread()->Dispatch(r.forget()); } diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 0185f3a9d4b74..9292301a96926 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1663,9 +1663,7 @@ class MediaDecoderStateMachine::NextFrameSeekingState { public: explicit AysncNextFrameSeekTask(NextFrameSeekingState* aStateObject) - : Runnable("MediaDecoderStateMachine::NextFrameSeekingState::" - "AysncNextFrameSeekTask") - , mStateObj(aStateObject) + : mStateObj(aStateObject) { } @@ -2895,10 +2893,7 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder) // Dispatch initialization that needs to happen on that task queue. nsCOMPtr r = NewRunnableMethod>( - "MediaDecoderStateMachine::InitializationTask", - this, - &MediaDecoderStateMachine::InitializationTask, - aDecoder); + this, &MediaDecoderStateMachine::InitializationTask, aDecoder); mTaskQueue->DispatchStateChange(r.forget()); mAudioQueueListener = AudioQueue().PopEvent().Connect( @@ -3105,11 +3100,10 @@ void MediaDecoderStateMachine::PlayStateChanged() void MediaDecoderStateMachine::SetVideoDecodeMode(VideoDecodeMode aMode) { - nsCOMPtr r = NewRunnableMethod( - "MediaDecoderStateMachine::SetVideoDecodeModeInternal", - this, - &MediaDecoderStateMachine::SetVideoDecodeModeInternal, - aMode); + nsCOMPtr r = + NewRunnableMethod(this, + &MediaDecoderStateMachine::SetVideoDecodeModeInternal, + aMode); OwnerThread()->DispatchStateChange(r.forget()); } @@ -3658,9 +3652,7 @@ MediaDecoderStateMachine::ScheduleStateMachine() mDispatchedStateMachine = true; OwnerThread()->Dispatch( - NewRunnableMethod("MediaDecoderStateMachine::RunStateMachine", - this, - &MediaDecoderStateMachine::RunStateMachine)); + NewRunnableMethod(this, &MediaDecoderStateMachine::RunStateMachine)); } void @@ -3895,12 +3887,9 @@ MediaDecoderStateMachine::RequestDebugInfo() using PromiseType = MediaDecoder::DebugInfoPromise; RefPtr p = new PromiseType::Private(__func__); RefPtr self = this; - OwnerThread()->Dispatch( - NS_NewRunnableFunction( - "MediaDecoderStateMachine::RequestDebugInfo", - [self, p]() { p->Resolve(self->GetDebugInfo(), __func__); }), - AbstractThread::AssertDispatchSuccess, - AbstractThread::TailDispatch); + OwnerThread()->Dispatch(NS_NewRunnableFunction([self, p] () { + p->Resolve(self->GetDebugInfo(), __func__); + }), AbstractThread::AssertDispatchSuccess, AbstractThread::TailDispatch); return p.forget(); } @@ -3910,11 +3899,8 @@ void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream, MOZ_ASSERT(NS_IsMainThread()); LOG("AddOutputStream aStream=%p!", aStream); mOutputStreamManager->Add(aStream, aFinishWhenEnded); - nsCOMPtr r = - NewRunnableMethod("MediaDecoderStateMachine::SetAudioCaptured", - this, - &MediaDecoderStateMachine::SetAudioCaptured, - true); + nsCOMPtr r = NewRunnableMethod( + this, &MediaDecoderStateMachine::SetAudioCaptured, true); OwnerThread()->Dispatch(r.forget()); } @@ -3924,11 +3910,8 @@ void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream) LOG("RemoveOutputStream=%p!", aStream); mOutputStreamManager->Remove(aStream); if (mOutputStreamManager->IsEmpty()) { - nsCOMPtr r = - NewRunnableMethod("MediaDecoderStateMachine::SetAudioCaptured", - this, - &MediaDecoderStateMachine::SetAudioCaptured, - false); + nsCOMPtr r = NewRunnableMethod( + this, &MediaDecoderStateMachine::SetAudioCaptured, false); OwnerThread()->Dispatch(r.forget()); } } diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index d911f57f16dbc..17fdc126ba967 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -184,11 +184,8 @@ class MediaDecoderStateMachine void DispatchSetPlaybackRate(double aPlaybackRate) { - OwnerThread()->DispatchStateChange( - NewRunnableMethod("MediaDecoderStateMachine::SetPlaybackRate", - this, - &MediaDecoderStateMachine::SetPlaybackRate, - aPlaybackRate)); + OwnerThread()->DispatchStateChange(NewRunnableMethod( + this, &MediaDecoderStateMachine::SetPlaybackRate, aPlaybackRate)); } RefPtr BeginShutdown(); @@ -197,14 +194,11 @@ class MediaDecoderStateMachine void DispatchSetFragmentEndTime(const media::TimeUnit& aEndTime) { RefPtr self = this; - nsCOMPtr r = NS_NewRunnableFunction( - "MediaDecoderStateMachine::DispatchSetFragmentEndTime", - [self, aEndTime]() { - // A negative number means we don't have a fragment end time at all. - self->mFragmentEndTime = aEndTime >= media::TimeUnit::Zero() - ? aEndTime - : media::TimeUnit::Invalid(); - }); + nsCOMPtr r = NS_NewRunnableFunction([self, aEndTime] () { + // A negative number means we don't have a fragment end time at all. + self->mFragmentEndTime = aEndTime >= media::TimeUnit::Zero() + ? aEndTime : media::TimeUnit::Invalid(); + }); OwnerThread()->Dispatch(r.forget()); } diff --git a/dom/media/MediaEventSource.h b/dom/media/MediaEventSource.h index 1c34a415597c6..ee59ed689cc8d 100644 --- a/dom/media/MediaEventSource.h +++ b/dom/media/MediaEventSource.h @@ -135,13 +135,9 @@ class Listener : public RevocableToken { if (CanTakeArgs()) { DispatchTask(NewRunnableMethod::Type&&...>( - "detail::Listener::ApplyWithArgs", - this, - &Listener::ApplyWithArgs, - Forward(aEvents)...)); + this, &Listener::ApplyWithArgs, Forward(aEvents)...)); } else { - DispatchTask(NewRunnableMethod( - "detail::Listener::ApplyWithNoArgs", this, &Listener::ApplyWithNoArgs)); + DispatchTask(NewRunnableMethod(this, &Listener::ApplyWithNoArgs)); } } diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 00dc94f0400e9..4d2d81bcc8ed7 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -120,9 +120,10 @@ GlobalAllocPolicy::GlobalAllocPolicy() SystemGroup::Dispatch( "GlobalAllocPolicy::ClearOnShutdown", TaskCategory::Other, - NS_NewRunnableFunction("GlobalAllocPolicy::GlobalAllocPolicy", [this]() { + NS_NewRunnableFunction([this] () { ClearOnShutdown(this, ShutdownPhase::ShutdownThreads); - })); + }) + ); } GlobalAllocPolicy::~GlobalAllocPolicy() @@ -925,9 +926,9 @@ class MediaFormatReader::DemuxerProxy::Wrapper : public MediaTrackDemuxer void Reset() override { RefPtr self = this; - mTaskQueue->Dispatch( - NS_NewRunnableFunction("MediaFormatReader::DemuxerProxy::Wrapper::Reset", - [self]() { self->mTrackDemuxer->Reset(); })); + mTaskQueue->Dispatch(NS_NewRunnableFunction([self]() { + self->mTrackDemuxer->Reset(); + })); } nsresult GetNextRandomAccessPoint(TimeUnit* aTime) override @@ -985,7 +986,6 @@ class MediaFormatReader::DemuxerProxy::Wrapper : public MediaTrackDemuxer { RefPtr trackDemuxer = mTrackDemuxer.forget(); mTaskQueue->Dispatch(NS_NewRunnableFunction( - "MediaFormatReader::DemuxerProxy::Wrapper::~Wrapper", [trackDemuxer]() { trackDemuxer->BreakCycles(); })); } @@ -1268,8 +1268,7 @@ class DispatchKeyNeededEvent : public Runnable DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, nsTArray& aInitData, const nsString& aInitDataType) - : Runnable("DispatchKeyNeededEvent") - , mDecoder(aDecoder) + : mDecoder(aDecoder) , mInitData(aInitData) , mInitDataType(aInitDataType) { @@ -1296,11 +1295,10 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) { RefPtr proxy = aProxy; RefPtr self = this; - nsCOMPtr r = - NS_NewRunnableFunction("MediaFormatReader::SetCDMProxy", [=]() { - MOZ_ASSERT(self->OnTaskQueue()); - self->mCDMProxy = proxy; - }); + nsCOMPtr r = NS_NewRunnableFunction([=] () { + MOZ_ASSERT(self->OnTaskQueue()); + self->mCDMProxy = proxy; + }); OwnerThread()->Dispatch(r.forget()); } @@ -1469,7 +1467,7 @@ MediaFormatReader::OnDemuxerInitDone(const MediaResult& aResult) if (aResult != NS_OK && mDecoder) { RefPtr decoder = mDecoder; mDecoder->AbstractMainThread()->Dispatch(NS_NewRunnableFunction( - "MediaFormatReader::OnDemuxerInitDone", [decoder, aResult]() { + [decoder, aResult] () { if (decoder->GetOwner()) { decoder->GetOwner()->DecodeWarning(aResult); } @@ -1856,8 +1854,8 @@ MediaFormatReader::ScheduleUpdate(TrackType aTrack) } LOGV("SchedulingUpdate(%s)", TrackTypeToStr(aTrack)); decoder.mUpdateScheduled = true; - RefPtr task(NewRunnableMethod( - "MediaFormatReader::Update", this, &MediaFormatReader::Update, aTrack)); + RefPtr task( + NewRunnableMethod(this, &MediaFormatReader::Update, aTrack)); OwnerThread()->Dispatch(task.forget()); } @@ -2711,8 +2709,8 @@ MediaFormatReader::ScheduleSeek() return; } mSeekScheduled = true; - OwnerThread()->Dispatch(NewRunnableMethod( - "MediaFormatReader::AttemptSeek", this, &MediaFormatReader::AttemptSeek)); + OwnerThread()->Dispatch( + NewRunnableMethod(this, &MediaFormatReader::AttemptSeek)); } void diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 45362ace508d3..697f44e4765de 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -651,12 +651,12 @@ template class ErrorCallbackRunnable : public Runnable { public: - ErrorCallbackRunnable(nsCOMPtr&& aOnSuccess, - nsCOMPtr&& aOnFailure, - MediaMgrError& aError, - uint64_t aWindowID) - : Runnable("ErrorCallbackRunnable") - , mError(&aError) + ErrorCallbackRunnable( + nsCOMPtr&& aOnSuccess, + nsCOMPtr&& aOnFailure, + MediaMgrError& aError, + uint64_t aWindowID) + : mError(&aError) , mWindowID(aWindowID) , mManager(MediaManager::GetInstance()) { @@ -991,8 +991,7 @@ class GetUserMediaStreamRunnable : public Runnable AudioDevice* aAudioDevice, VideoDevice* aVideoDevice, PeerIdentity* aPeerIdentity) - : Runnable("GetUserMediaStreamRunnable") - , mConstraints(aConstraints) + : mConstraints(aConstraints) , mAudioDevice(aAudioDevice) , mVideoDevice(aVideoDevice) , mWindowID(aWindowID) @@ -1291,8 +1290,7 @@ class GetUserMediaStreamRunnable : public Runnable callback.forget(), self->mWindowID, self->mOnFailure.forget()))); - NS_DispatchToMainThread(NS_NewRunnableFunction("MediaManager::SendPendingGUMRequest", - []() -> void { + NS_DispatchToMainThread(NS_NewRunnableFunction([]() -> void { RefPtr manager = MediaManager::GetInstance(); manager->SendPendingGUMRequest(); })); @@ -1449,15 +1447,12 @@ class GetUserMediaTask : public Runnable const MediaStreamConstraints& aConstraints, already_AddRefed aOnSuccess, already_AddRefed aOnFailure, - uint64_t aWindowID, - GetUserMediaWindowListener* aWindowListener, - SourceListener* aSourceListener, - MediaEnginePrefs& aPrefs, + uint64_t aWindowID, GetUserMediaWindowListener *aWindowListener, + SourceListener *aSourceListener, MediaEnginePrefs &aPrefs, const ipc::PrincipalInfo& aPrincipalInfo, bool aIsChrome, MediaManager::SourceSet* aSourceSet) - : Runnable("GetUserMediaTask") - , mConstraints(aConstraints) + : mConstraints(aConstraints) , mOnSuccess(aOnSuccess) , mOnFailure(aOnFailure) , mWindowID(aWindowID) @@ -1488,10 +1483,7 @@ class GetUserMediaTask : public Runnable NS_DispatchToMainThread(errorRunnable.forget()); // Do after ErrorCallbackRunnable Run()s, as it checks active window list NS_DispatchToMainThread(NewRunnableMethod>( - "GetUserMediaWindowListener::Remove", - mWindowListener, - &GetUserMediaWindowListener::Remove, - mSourceListener)); + mWindowListener, &GetUserMediaWindowListener::Remove, mSourceListener)); } NS_IMETHOD @@ -1550,8 +1542,7 @@ class GetUserMediaTask : public Runnable Fail(NS_LITERAL_STRING("NotReadableError"), NS_ConvertUTF8toUTF16(errorMsg)); } - NS_DispatchToMainThread(NS_NewRunnableFunction("MediaManager::SendPendingGUMRequest", - []() -> void { + NS_DispatchToMainThread(NS_NewRunnableFunction([]() -> void { RefPtr manager = MediaManager::GetInstance(); manager->SendPendingGUMRequest(); })); @@ -1668,9 +1659,8 @@ class GetUserMediaRunnableWrapper : public Runnable { public: // This object must take ownership of task - GetUserMediaRunnableWrapper(GetUserMediaTask* task) - : Runnable("GetUserMediaRunnableWrapper") - , mTask(task) { + GetUserMediaRunnableWrapper(GetUserMediaTask* task) : + mTask(task) { } ~GetUserMediaRunnableWrapper() { @@ -2984,13 +2974,10 @@ MediaManager::Shutdown() class ShutdownTask : public Runnable { public: - ShutdownTask(MediaManager* aManager, already_AddRefed aReply) - : mozilla::Runnable("ShutdownTask") - , mManager(aManager) - , mReply(aReply) - { - } - + ShutdownTask(MediaManager* aManager, + already_AddRefed aReply) + : mManager(aManager) + , mReply(aReply) {} private: NS_IMETHOD Run() override @@ -3724,9 +3711,7 @@ SourceListener::NotifyEvent(MediaStreamGraph* aGraph, NotifyFinished(); return; } - target->Dispatch(NewRunnableMethod("SourceListener::NotifyFinished", - this, - &SourceListener::NotifyFinished), + target->Dispatch(NewRunnableMethod(this, &SourceListener::NotifyFinished), NS_DISPATCH_NORMAL); break; case MediaStreamGraphEvent::EVENT_REMOVED: @@ -3738,9 +3723,7 @@ SourceListener::NotifyEvent(MediaStreamGraph* aGraph, NotifyRemoved(); return; } - target->Dispatch(NewRunnableMethod("SourceListener::NotifyRemoved", - this, - &SourceListener::NotifyRemoved), + target->Dispatch(NewRunnableMethod(this, &SourceListener::NotifyRemoved), NS_DISPATCH_NORMAL); break; case MediaStreamGraphEvent::EVENT_HAS_DIRECT_LISTENERS: @@ -3989,9 +3972,7 @@ GetUserMediaWindowListener::NotifySourceTrackStopped() } nsCOMPtr runnable = - NewRunnableMethod("GetUserMediaWindowListener::NotifyChromeOfTrackStops", - this, - &GetUserMediaWindowListener::NotifyChromeOfTrackStops); + NewRunnableMethod(this, &GetUserMediaWindowListener::NotifyChromeOfTrackStops); nsContentUtils::RunInStableState(runnable.forget()); mChromeNotificationTaskPosted = true; } @@ -4007,29 +3988,21 @@ GetUserMediaWindowListener::NotifyChromeOfTrackStops() } GetUserMediaNotificationEvent::GetUserMediaNotificationEvent( - GetUserMediaStatus aStatus, - uint64_t aWindowID) - : Runnable("GetUserMediaNotificationEvent") - , mStatus(aStatus) - , mWindowID(aWindowID) -{ -} + GetUserMediaStatus aStatus, + uint64_t aWindowID) +: mStatus(aStatus), mWindowID(aWindowID) {} GetUserMediaNotificationEvent::GetUserMediaNotificationEvent( - GetUserMediaStatus aStatus, - already_AddRefed aStream, - already_AddRefed>> - aOnTracksAvailableCallback, - uint64_t aWindowID, - already_AddRefed aError) - : Runnable("GetUserMediaNotificationEvent") - , mStream(aStream) - , mOnTracksAvailableCallback(aOnTracksAvailableCallback) - , mStatus(aStatus) - , mWindowID(aWindowID) - , mOnFailure(aError) -{ -} + GetUserMediaStatus aStatus, + already_AddRefed aStream, + already_AddRefed>> aOnTracksAvailableCallback, + uint64_t aWindowID, + already_AddRefed aError) +: mStream(aStream), + mOnTracksAvailableCallback(aOnTracksAvailableCallback), + mStatus(aStatus), + mWindowID(aWindowID), + mOnFailure(aError) {} GetUserMediaNotificationEvent::~GetUserMediaNotificationEvent() { } diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 4136130c05c0f..d02490830ba32 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -168,13 +168,9 @@ class ReleaseMediaOperationResource : public Runnable public: ReleaseMediaOperationResource( already_AddRefed aStream, - already_AddRefed>> - aOnTracksAvailableCallback) - : Runnable("ReleaseMediaOperationResource") - , mStream(aStream) - , mOnTracksAvailableCallback(aOnTracksAvailableCallback) - { - } + already_AddRefed>> aOnTracksAvailableCallback): + mStream(aStream), + mOnTracksAvailableCallback(aOnTracksAvailableCallback) {} NS_IMETHOD Run() override {return NS_OK;} private: RefPtr mStream; diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index 06e3191962b15..ea8c93309b19f 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -177,8 +177,7 @@ class MediaRecorder::Session: public nsIObserver, { public: explicit PushBlobRunnable(Session* aSession) - : Runnable("dom::MediaRecorder::Session::PushBlobRunnable") - , mSession(aSession) + : mSession(aSession) { } NS_IMETHOD Run() override @@ -208,8 +207,7 @@ class MediaRecorder::Session: public nsIObserver, { public: explicit EncoderErrorNotifierRunnable(Session* aSession) - : Runnable("dom::MediaRecorder::Session::EncoderErrorNotifierRunnable") - , mSession(aSession) + : mSession(aSession) { } NS_IMETHOD Run() override @@ -236,9 +234,8 @@ class MediaRecorder::Session: public nsIObserver, class DispatchStartEventRunnable : public Runnable { public: - DispatchStartEventRunnable(Session* aSession, const nsAString& aEventName) - : Runnable("dom::MediaRecorder::Session::DispatchStartEventRunnable") - , mSession(aSession) + DispatchStartEventRunnable(Session* aSession, const nsAString & aEventName) + : mSession(aSession) , mEventName(aEventName) { } @@ -267,10 +264,7 @@ class MediaRecorder::Session: public nsIObserver, { public: explicit ExtractRunnable(Session* aSession) - : Runnable("dom::MediaRecorder::Session::ExtractRunnable") - , mSession(aSession) - { - } + : mSession(aSession) {} ~ExtractRunnable() {} @@ -370,16 +364,10 @@ class MediaRecorder::Session: public nsIObserver, { public: explicit DestroyRunnable(Session* aSession) - : Runnable("dom::MediaRecorder::Session::DestroyRunnable") - , mSession(aSession) - { - } + : mSession(aSession) {} explicit DestroyRunnable(already_AddRefed aSession) - : Runnable("dom::MediaRecorder::Session::DestroyRunnable") - , mSession(aSession) - { - } + : mSession(aSession) {} NS_IMETHOD Run() override { @@ -812,11 +800,8 @@ class MediaRecorder::Session: public nsIObserver, new DispatchStartEventRunnable(this, NS_LITERAL_STRING("start"))); if (NS_FAILED(rv)) { - NS_DispatchToMainThread( - NewRunnableMethod("dom::MediaRecorder::NotifyError", - mRecorder, - &MediaRecorder::NotifyError, - rv)); + NS_DispatchToMainThread(NewRunnableMethod(mRecorder, + &MediaRecorder::NotifyError, rv)); } if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this)))) { MOZ_ASSERT(false, "NS_DispatchToMainThread EncoderErrorNotifierRunnable failed"); diff --git a/dom/media/MediaResource.cpp b/dom/media/MediaResource.cpp index 316b850dfca66..045c43bba86ad 100644 --- a/dom/media/MediaResource.cpp +++ b/dom/media/MediaResource.cpp @@ -67,11 +67,10 @@ MediaResource::Destroy() delete this; return; } - nsresult rv = SystemGroup::Dispatch( - "MediaResource::Destroy", - TaskCategory::Other, - NewNonOwningRunnableMethod( - "MediaResource::Destroy", this, &MediaResource::Destroy)); + nsresult rv = + SystemGroup::Dispatch("MediaResource::Destroy", + TaskCategory::Other, + NewNonOwningRunnableMethod(this, &MediaResource::Destroy)); MOZ_ALWAYS_SUCCEEDS(rv); } diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index ba4719b58cb6f..93939231628ec 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -3638,10 +3638,9 @@ MediaStreamGraphImpl::CollectSizesForMemoryReport( { public: explicit FinishCollectRunnable( - already_AddRefed aHandleReport, - already_AddRefed aHandlerData) - : mozilla::Runnable("FinishCollectRunnable") - , mHandleReport(aHandleReport) + already_AddRefed aHandleReport, + already_AddRefed aHandlerData) + : mHandleReport(aHandleReport) , mHandlerData(aHandlerData) {} diff --git a/dom/media/MediaStreamTrack.cpp b/dom/media/MediaStreamTrack.cpp index 1ec6df7a4ba5d..853f9159adce7 100644 --- a/dom/media/MediaStreamTrack.cpp +++ b/dom/media/MediaStreamTrack.cpp @@ -111,11 +111,7 @@ class MediaStreamTrack::PrincipalHandleListener : public MediaStreamTrackListene aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, NewRunnableMethod>( - "dom::MediaStreamTrack::PrincipalHandleListener::" - "DoNotifyPrincipalHandleChanged", - this, - &PrincipalHandleListener::DoNotifyPrincipalHandleChanged, - aNewPrincipalHandle)); + this, &PrincipalHandleListener::DoNotifyPrincipalHandleChanged, aNewPrincipalHandle)); } protected: diff --git a/dom/media/MediaTimer.cpp b/dom/media/MediaTimer.cpp index 61b37c28eaaad..4baab31143287 100644 --- a/dom/media/MediaTimer.cpp +++ b/dom/media/MediaTimer.cpp @@ -42,10 +42,8 @@ MediaTimer::DispatchDestroy() // Destroy(), which may run completely before the stack if Dispatch() begins // to unwind. nsCOMPtr thread = mThread; - nsresult rv = - thread->Dispatch(NewNonOwningRunnableMethod( - "MediaTimer::Destroy", this, &MediaTimer::Destroy), - NS_DISPATCH_NORMAL); + nsresult rv = thread->Dispatch(NewNonOwningRunnableMethod(this, &MediaTimer::Destroy), + NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); (void) rv; } @@ -99,9 +97,8 @@ MediaTimer::ScheduleUpdate() } mUpdateScheduled = true; - nsresult rv = mThread->Dispatch( - NewRunnableMethod("MediaTimer::Update", this, &MediaTimer::Update), - NS_DISPATCH_NORMAL); + nsresult rv = mThread->Dispatch(NewRunnableMethod(this, &MediaTimer::Update), + NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); (void) rv; } diff --git a/dom/media/TextTrack.cpp b/dom/media/TextTrack.cpp index 7d0951eac4631..19c38a2597d99 100644 --- a/dom/media/TextTrack.cpp +++ b/dom/media/TextTrack.cpp @@ -337,11 +337,11 @@ TextTrack::DispatchAsyncTrustedEvent(const nsString& aEventName) } RefPtr self = this; nsGlobalWindow::Cast(win)->Dispatch( - "TextTrack::DispatchAsyncTrustedEvent", - TaskCategory::Other, - NS_NewRunnableFunction( - "dom::TextTrack::DispatchAsyncTrustedEvent", - [self, aEventName]() { self->DispatchTrustedEvent(aEventName); })); + "TextTrack::DispatchAsyncTrustedEvent", TaskCategory::Other, + NS_NewRunnableFunction([self, aEventName]() { + self->DispatchTrustedEvent(aEventName); + }) + ); } bool diff --git a/dom/media/TextTrackList.cpp b/dom/media/TextTrackList.cpp index abe6e5599d91a..47daa6ca77dea 100644 --- a/dom/media/TextTrackList.cpp +++ b/dom/media/TextTrackList.cpp @@ -141,8 +141,7 @@ class TrackEventRunner : public Runnable { public: TrackEventRunner(TextTrackList* aList, nsIDOMEvent* aEvent) - : Runnable("dom::TrackEventRunner") - , mList(aList) + : mList(aList) , mEvent(aEvent) {} diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index 73eb65d3d04d5..9b9e6f8b39fec 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -396,8 +396,8 @@ LogToBrowserConsole(const nsAString& aMsg) { if (!NS_IsMainThread()) { nsString msg(aMsg); - nsCOMPtr task = NS_NewRunnableFunction( - "LogToBrowserConsole", [msg]() { LogToBrowserConsole(msg); }); + nsCOMPtr task = + NS_NewRunnableFunction([msg]() { LogToBrowserConsole(msg); }); SystemGroup::Dispatch("LogToBrowserConsole", TaskCategory::Other, task.forget()); return; } diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index 4f7b88b93122e..2aeba950aaaf7 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -92,11 +92,7 @@ class MOZ_STACK_CLASS ReentrantMonitorConditionallyEnter class ShutdownThreadEvent : public Runnable { public: - explicit ShutdownThreadEvent(nsIThread* aThread) - : Runnable("ShutdownThreadEvent") - , mThread(aThread) - { - } + explicit ShutdownThreadEvent(nsIThread* aThread) : mThread(aThread) {} ~ShutdownThreadEvent() {} NS_IMETHOD Run() override { mThread->Shutdown(); @@ -271,11 +267,8 @@ RefPtr InvokeUntil(Work aWork, Condition aCondition) { } else if (aLocalCondition()) { aPromise->Resolve(true, __func__); } else { - nsCOMPtr r = NS_NewRunnableFunction( - "InvokeUntil::Helper::Iteration", - [aPromise, aLocalWork, aLocalCondition]() { - Iteration(aPromise, aLocalWork, aLocalCondition); - }); + nsCOMPtr r = + NS_NewRunnableFunction([aPromise, aLocalWork, aLocalCondition] () { Iteration(aPromise, aLocalWork, aLocalCondition); }); AbstractThread::GetCurrent()->Dispatch(r.forget()); } } diff --git a/dom/media/android/AndroidMediaPluginHost.cpp b/dom/media/android/AndroidMediaPluginHost.cpp index 9d8842daba545..c7088ce326619 100644 --- a/dom/media/android/AndroidMediaPluginHost.cpp +++ b/dom/media/android/AndroidMediaPluginHost.cpp @@ -46,7 +46,7 @@ static char* GetResource(Decoder *aDecoder) class GetIntPrefEvent : public Runnable { public: GetIntPrefEvent(const char* aPref, int32_t* aResult) - : Runnable("GetIntPrefEvent"), mPref(aPref), mResult(aResult) {} + : mPref(aPref), mResult(aResult) {} NS_IMETHOD Run() override { return Preferences::GetInt(mPref, mResult); } diff --git a/dom/media/android/AndroidMediaResourceServer.cpp b/dom/media/android/AndroidMediaResourceServer.cpp index 8fe7ba5e36e6e..37681b26cc703 100644 --- a/dom/media/android/AndroidMediaResourceServer.cpp +++ b/dom/media/android/AndroidMediaResourceServer.cpp @@ -124,11 +124,7 @@ class ServeResourceEvent : public Runnable { public: ServeResourceEvent(nsIInputStream* aInput, nsIOutputStream* aOutput, AndroidMediaResourceServer* aServer) - : Runnable("ServeResourceEvent") - , mInput(aInput) - , mOutput(aOutput) - , mServer(aServer) - {} + : mInput(aInput), mOutput(aOutput), mServer(aServer) {} // This method runs on the thread and exits when it has completed the // HTTP request. @@ -392,9 +388,8 @@ ResourceSocketListener::OnStopListening(nsIServerSocket* aServ, nsresult aStatus return NS_OK; } -AndroidMediaResourceServer::AndroidMediaResourceServer() - : Runnable("AndroidMediaResourceServer") - , mMutex("AndroidMediaResourceServer") +AndroidMediaResourceServer::AndroidMediaResourceServer() : + mMutex("AndroidMediaResourceServer") { } diff --git a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp index c9b73809d65cb..c042219d5c085 100644 --- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp +++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp @@ -69,8 +69,7 @@ MediaDrmCDMProxy::Init(PromiseId aPromiseId, } mCDM = mozilla::MakeUnique(mKeySystem); - nsCOMPtr task(NewRunnableMethod("MediaDrmCDMProxy::md_Init", - this, + nsCOMPtr task(NewRunnableMethod(this, &MediaDrmCDMProxy::md_Init, aPromiseId)); mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); @@ -94,8 +93,7 @@ MediaDrmCDMProxy::CreateSession(uint32_t aCreateSessionToken, data->mInitData = Move(aInitData); nsCOMPtr task( - NewRunnableMethod&&>("MediaDrmCDMProxy::md_CreateSession", - this, + NewRunnableMethod&&>(this, &MediaDrmCDMProxy::md_CreateSession, Move(data))); mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); @@ -135,8 +133,7 @@ MediaDrmCDMProxy::UpdateSession(const nsAString& aSessionId, data->mResponse = Move(aResponse); nsCOMPtr task( - NewRunnableMethod&&>("MediaDrmCDMProxy::md_UpdateSession", - this, + NewRunnableMethod&&>(this, &MediaDrmCDMProxy::md_UpdateSession, Move(data))); mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); @@ -155,8 +152,7 @@ MediaDrmCDMProxy::CloseSession(const nsAString& aSessionId, data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId); nsCOMPtr task( - NewRunnableMethod&&>("MediaDrmCDMProxy::md_CloseSession", - this, + NewRunnableMethod&&>(this, &MediaDrmCDMProxy::md_CloseSession, Move(data))); mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); @@ -177,8 +173,7 @@ MediaDrmCDMProxy::Shutdown() MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mOwnerThread); nsCOMPtr task( - NewRunnableMethod("MediaDrmCDMProxy::md_Shutdown", - this, &MediaDrmCDMProxy::md_Shutdown)); + NewRunnableMethod(this, &MediaDrmCDMProxy::md_Shutdown)); mOwnerThread->Dispatch(task, NS_DISPATCH_NORMAL); mOwnerThread->Shutdown(); @@ -331,8 +326,7 @@ MediaDrmCDMProxy::ResolvePromise(PromiseId aId) } } else { nsCOMPtr task; - task = NewRunnableMethod("MediaDrmCDMProxy::ResolvePromise", - this, + task = NewRunnableMethod(this, &MediaDrmCDMProxy::ResolvePromise, aId); mMainThread->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -414,8 +408,7 @@ MediaDrmCDMProxy::md_Init(uint32_t aPromiseId) mCallback.reset(new MediaDrmCDMCallbackProxy(this)); mCDM->Init(mCallback.get()); nsCOMPtr task( - NewRunnableMethod("MediaDrmCDMProxy::OnCDMCreated", - this, + NewRunnableMethod(this, &MediaDrmCDMProxy::OnCDMCreated, aPromiseId)); mMainThread->Dispatch(task.forget(), NS_DISPATCH_NORMAL); diff --git a/dom/media/eme/mediadrm/MediaDrmCDMProxy.h b/dom/media/eme/mediadrm/MediaDrmCDMProxy.h index 23be97cc396f2..2989f63165bcb 100644 --- a/dom/media/eme/mediadrm/MediaDrmCDMProxy.h +++ b/dom/media/eme/mediadrm/MediaDrmCDMProxy.h @@ -151,8 +151,7 @@ class MediaDrmCDMProxy : public CDMProxy { PromiseId aId, nsresult aCode, const nsCString& aReason) - : Runnable("RejectPromiseTask") - , mProxy(aProxy) + : mProxy(aProxy) , mId(aId) , mCode(aCode) , mReason(aReason) diff --git a/dom/media/gmp/ChromiumCDMParent.cpp b/dom/media/gmp/ChromiumCDMParent.cpp index 92ccdf5278fe9..57cbc9c80e442 100644 --- a/dom/media/gmp/ChromiumCDMParent.cpp +++ b/dom/media/gmp/ChromiumCDMParent.cpp @@ -287,8 +287,7 @@ ChromiumCDMParent::RecvOnResolveNewSessionPromise(const uint32_t& aPromiseId, } RefPtr task = - NewRunnableMethod("ChromiumCDMProxy::OnSetSessionId", - mProxy, + NewRunnableMethod(mProxy, &ChromiumCDMProxy::OnSetSessionId, token.value(), NS_ConvertUTF8toUTF16(aSessionId)); @@ -313,7 +312,6 @@ ChromiumCDMParent::RecvResolveLoadSessionPromise(const uint32_t& aPromiseId, } NS_DispatchToMainThread(NewRunnableMethod( - "ChromiumCDMProxy::OnResolveLoadSessionPromise", mProxy, &ChromiumCDMProxy::OnResolveLoadSessionPromise, aPromiseId, @@ -331,11 +329,8 @@ ChromiumCDMParent::ResolvePromise(uint32_t aPromiseId) if (!mProxy || mIsShutdown) { return; } - NS_DispatchToMainThread( - NewRunnableMethod("ChromiumCDMProxy::ResolvePromise", - mProxy, - &ChromiumCDMProxy::ResolvePromise, - aPromiseId)); + NS_DispatchToMainThread(NewRunnableMethod( + mProxy, &ChromiumCDMProxy::ResolvePromise, aPromiseId)); } ipc::IPCResult @@ -385,7 +380,6 @@ ChromiumCDMParent::RejectPromise(uint32_t aPromiseId, return; } NS_DispatchToMainThread(NewRunnableMethod( - "ChromiumCDMProxy::RejectPromise", mProxy, &ChromiumCDMProxy::RejectPromise, aPromiseId, @@ -434,10 +428,9 @@ ChromiumCDMParent::RecvOnSessionMessage(const nsCString& aSessionId, dom::MediaKeyMessageType messageType = ToDOMMessageType(aMessageType); nsTArray msg(Move(aMessage)); NS_DispatchToMainThread( - NS_NewRunnableFunction("gmp::ChromiumCDMParent::RecvOnSessionMessage", - [proxy, sid, messageType, msg]() mutable { - proxy->OnSessionMessage(sid, messageType, msg); - })); + NS_NewRunnableFunction([proxy, sid, messageType, msg]() mutable { + proxy->OnSessionMessage(sid, messageType, msg); + })); return IPC_OK(); } @@ -486,8 +479,7 @@ ChromiumCDMParent::RecvOnSessionKeysChange( } if (keyStatusesChange) { NS_DispatchToMainThread( - NewRunnableMethod("ChromiumCDMProxy::OnKeyStatusesChange", - mProxy, + NewRunnableMethod(mProxy, &ChromiumCDMProxy::OnKeyStatusesChange, NS_ConvertUTF8toUTF16(aSessionId))); } @@ -505,7 +497,6 @@ ChromiumCDMParent::RecvOnExpirationChange(const nsCString& aSessionId, return IPC_OK(); } NS_DispatchToMainThread(NewRunnableMethod( - "ChromiumCDMProxy::OnExpirationChange", mProxy, &ChromiumCDMProxy::OnExpirationChange, NS_ConvertUTF8toUTF16(aSessionId), @@ -521,8 +512,7 @@ ChromiumCDMParent::RecvOnSessionClosed(const nsCString& aSessionId) return IPC_OK(); } NS_DispatchToMainThread( - NewRunnableMethod("ChromiumCDMProxy::OnSessionClosed", - mProxy, + NewRunnableMethod(mProxy, &ChromiumCDMProxy::OnSessionClosed, NS_ConvertUTF8toUTF16(aSessionId))); return IPC_OK(); @@ -540,7 +530,6 @@ ChromiumCDMParent::RecvOnLegacySessionError(const nsCString& aSessionId, } NS_DispatchToMainThread( NewRunnableMethod( - "ChromiumCDMProxy::OnSessionError", mProxy, &ChromiumCDMProxy::OnSessionError, NS_ConvertUTF8toUTF16(aSessionId), @@ -905,8 +894,8 @@ ChromiumCDMParent::ActorDestroy(ActorDestroyReason aWhy) } bool abnormalShutdown = (aWhy == AbnormalShutdown); if (abnormalShutdown && proxy) { - RefPtr task = NewRunnableMethod( - "ChromiumCDMProxy::Terminated", proxy, &ChromiumCDMProxy::Terminated); + RefPtr task = + NewRunnableMethod(proxy, &ChromiumCDMProxy::Terminated); NS_DispatchToMainThread(task); } MaybeDisconnect(abnormalShutdown); @@ -1137,8 +1126,8 @@ ChromiumCDMParent::Shutdown() // collection, and that will not shut down cleanly as the GMP thread will be // shutdown by then. if (mProxy) { - RefPtr task = NewRunnableMethod( - "ChromiumCDMProxy::Shutdown", mProxy, &ChromiumCDMProxy::Shutdown); + RefPtr task = + NewRunnableMethod(mProxy, &ChromiumCDMProxy::Shutdown); NS_DispatchToMainThread(task.forget()); } diff --git a/dom/media/gmp/ChromiumCDMProxy.cpp b/dom/media/gmp/ChromiumCDMProxy.cpp index 7fa79a5120d8c..8b78e82b5b6c2 100644 --- a/dom/media/gmp/ChromiumCDMProxy.cpp +++ b/dom/media/gmp/ChromiumCDMProxy.cpp @@ -74,7 +74,6 @@ ChromiumCDMProxy::Init(PromiseId aPromiseId, RefPtr self(this); nsCString keySystem = NS_ConvertUTF16toUTF8(mKeySystem); RefPtr task(NS_NewRunnableFunction( - "ChromiumCDMProxy::Init", [self, nodeId, helper, aPromiseId, thread, keySystem]() -> void { MOZ_ASSERT(self->IsOnOwnerThread()); @@ -126,12 +125,9 @@ ChromiumCDMProxy::OnCDMCreated(uint32_t aPromiseId) this); if (!NS_IsMainThread()) { - mMainThread->Dispatch( - NewRunnableMethod("ChromiumCDMProxy::OnCDMCreated", - this, - &ChromiumCDMProxy::OnCDMCreated, - aPromiseId), - NS_DISPATCH_NORMAL); + mMainThread->Dispatch(NewRunnableMethod( + this, &ChromiumCDMProxy::OnCDMCreated, aPromiseId), + NS_DISPATCH_NORMAL); return; } MOZ_ASSERT(NS_IsMainThread()); @@ -213,19 +209,18 @@ ChromiumCDMProxy::CreateSession(uint32_t aCreateSessionToken, return; } - mGMPThread->Dispatch(NewRunnableMethod>( - "gmp::ChromiumCDMParent::CreateSession", - cdm, - &gmp::ChromiumCDMParent::CreateSession, - aCreateSessionToken, - sessionType, - initDataType, - aPromiseId, - Move(aInitData))); + mGMPThread->Dispatch( + NewRunnableMethod>(cdm, + &gmp::ChromiumCDMParent::CreateSession, + aCreateSessionToken, + sessionType, + initDataType, + aPromiseId, + Move(aInitData))); } void @@ -244,7 +239,6 @@ ChromiumCDMProxy::LoadSession(PromiseId aPromiseId, } mGMPThread->Dispatch(NewRunnableMethod( - "gmp::ChromiumCDMParent::LoadSession", cdm, &gmp::ChromiumCDMParent::LoadSession, aPromiseId, @@ -270,7 +264,6 @@ ChromiumCDMProxy::SetServerCertificate(PromiseId aPromiseId, } mGMPThread->Dispatch(NewRunnableMethod>( - "gmp::ChromiumCDMParent::SetServerCertificate", cdm, &gmp::ChromiumCDMParent::SetServerCertificate, aPromiseId, @@ -297,7 +290,6 @@ ChromiumCDMProxy::UpdateSession(const nsAString& aSessionId, } mGMPThread->Dispatch( NewRunnableMethod>( - "gmp::ChromiumCDMParent::UpdateSession", cdm, &gmp::ChromiumCDMParent::UpdateSession, NS_ConvertUTF16toUTF8(aSessionId), @@ -322,7 +314,6 @@ ChromiumCDMProxy::CloseSession(const nsAString& aSessionId, return; } mGMPThread->Dispatch(NewRunnableMethod( - "gmp::ChromiumCDMParent::CloseSession", cdm, &gmp::ChromiumCDMParent::CloseSession, NS_ConvertUTF16toUTF8(aSessionId), @@ -346,7 +337,6 @@ ChromiumCDMProxy::RemoveSession(const nsAString& aSessionId, return; } mGMPThread->Dispatch(NewRunnableMethod( - "gmp::ChromiumCDMParent::RemoveSession", cdm, &gmp::ChromiumCDMParent::RemoveSession, NS_ConvertUTF16toUTF8(aSessionId), @@ -368,8 +358,8 @@ ChromiumCDMProxy::Shutdown() // We need to keep this proxy alive until the parent has finished its // Shutdown (as it may still try to use the proxy until then). RefPtr self(this); - nsCOMPtr task = NS_NewRunnableFunction( - "ChromiumCDMProxy::Shutdown", [self, cdm]() { cdm->Shutdown(); }); + nsCOMPtr task = + NS_NewRunnableFunction([self, cdm]() { cdm->Shutdown(); }); mGMPThread->Dispatch(task.forget()); } } @@ -382,12 +372,7 @@ ChromiumCDMProxy::RejectPromise(PromiseId aId, if (!NS_IsMainThread()) { nsCOMPtr task; task = NewRunnableMethod( - "ChromiumCDMProxy::RejectPromise", - this, - &ChromiumCDMProxy::RejectPromise, - aId, - aCode, - aReason); + this, &ChromiumCDMProxy::RejectPromise, aId, aCode, aReason); NS_DispatchToMainThread(task); return; } @@ -405,10 +390,8 @@ ChromiumCDMProxy::ResolvePromise(PromiseId aId) { if (!NS_IsMainThread()) { nsCOMPtr task; - task = NewRunnableMethod("ChromiumCDMProxy::ResolvePromise", - this, - &ChromiumCDMProxy::ResolvePromise, - aId); + task = NewRunnableMethod( + this, &ChromiumCDMProxy::ResolvePromise, aId); NS_DispatchToMainThread(task); return; } diff --git a/dom/media/gmp/GMPCDMCallbackProxy.cpp b/dom/media/gmp/GMPCDMCallbackProxy.cpp index 12d27e6a65db6..10f4770d60664 100644 --- a/dom/media/gmp/GMPCDMCallbackProxy.cpp +++ b/dom/media/gmp/GMPCDMCallbackProxy.cpp @@ -30,9 +30,12 @@ GMPCDMCallbackProxy::SetDecryptorId(uint32_t aId) RefPtr proxy = mProxy; mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::SetDecryptorId", - [proxy, aId]() { proxy->OnSetDecryptorId(aId); }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, aId] () + { + proxy->OnSetDecryptorId(aId); + }), + NS_DISPATCH_NORMAL + ); } void @@ -44,10 +47,14 @@ GMPCDMCallbackProxy::SetSessionId(uint32_t aToken, RefPtr proxy = mProxy; auto sid = NS_ConvertUTF8toUTF16(aSessionId); mMainThread->Dispatch( - NS_NewRunnableFunction( - "GMPCDMCallbackProxy::SetSessionId", - [proxy, aToken, sid]() { proxy->OnSetSessionId(aToken, sid); }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, + aToken, + sid] () + { + proxy->OnSetSessionId(aToken, sid); + }), + NS_DISPATCH_NORMAL + ); } void @@ -58,12 +65,12 @@ GMPCDMCallbackProxy::ResolveLoadSessionPromise(uint32_t aPromiseId, RefPtr proxy = mProxy; mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::ResolveLoadSessionPromise", - [proxy, aPromiseId, aSuccess]() { - proxy->OnResolveLoadSessionPromise(aPromiseId, - aSuccess); - }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, aPromiseId, aSuccess] () + { + proxy->OnResolveLoadSessionPromise(aPromiseId, aSuccess); + }), + NS_DISPATCH_NORMAL + ); } void @@ -84,12 +91,15 @@ GMPCDMCallbackProxy::RejectPromise(uint32_t aPromiseId, RefPtr proxy = mProxy; mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::RejectPromise", - [proxy, aPromiseId, aException, aMessage]() { - proxy->OnRejectPromise( - aPromiseId, aException, aMessage); - }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, + aPromiseId, + aException, + aMessage] () + { + proxy->OnRejectPromise(aPromiseId, aException, aMessage); + }), + NS_DISPATCH_NORMAL + ); } void @@ -103,11 +113,15 @@ GMPCDMCallbackProxy::SessionMessage(const nsCString& aSessionId, auto sid = NS_ConvertUTF8toUTF16(aSessionId); nsTArray msg(aMessage); mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::SessionMessage", - [proxy, sid, aMessageType, msg]() mutable { - proxy->OnSessionMessage(sid, aMessageType, msg); - }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, + sid, + aMessageType, + msg] () mutable + { + proxy->OnSessionMessage(sid, aMessageType, msg); + }), + NS_DISPATCH_NORMAL + ); } void @@ -119,11 +133,14 @@ GMPCDMCallbackProxy::ExpirationChange(const nsCString& aSessionId, RefPtr proxy = mProxy; auto sid = NS_ConvertUTF8toUTF16(aSessionId); mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::ExpirationChange", - [proxy, sid, aExpiryTime]() { - proxy->OnExpirationChange(sid, aExpiryTime); - }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, + sid, + aExpiryTime] () + { + proxy->OnExpirationChange(sid, aExpiryTime); + }), + NS_DISPATCH_NORMAL + ); } void @@ -140,17 +157,22 @@ GMPCDMCallbackProxy::SessionClosed(const nsCString& aSessionId) if (keyStatusesChange) { RefPtr proxy = mProxy; mMainThread->Dispatch( - NS_NewRunnableFunction( - "GMPCDMCallbackProxy::SessionClosed", - [proxy, sid]() { proxy->OnKeyStatusesChange(sid); }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, sid] () + { + proxy->OnKeyStatusesChange(sid); + }), + NS_DISPATCH_NORMAL + ); } RefPtr proxy = mProxy; mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::SessionClosed", - [proxy, sid]() { proxy->OnSessionClosed(sid); }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, sid] () + { + proxy->OnSessionClosed(sid); + }), + NS_DISPATCH_NORMAL + ); } void @@ -165,12 +187,19 @@ GMPCDMCallbackProxy::SessionError(const nsCString& aSessionId, auto sid = NS_ConvertUTF8toUTF16(aSessionId); auto msg = NS_ConvertUTF8toUTF16(aMessage); mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::SessionError", - [proxy, sid, aException, aSystemCode, msg]() { - proxy->OnSessionError( - sid, aException, aSystemCode, msg); - }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, + sid, + aException, + aSystemCode, + msg] () + { + proxy->OnSessionError(sid, + aException, + aSystemCode, + msg); + }), + NS_DISPATCH_NORMAL + ); } void @@ -199,10 +228,12 @@ GMPCDMCallbackProxy::BatchedKeyStatusChangedInternal(const nsCString& aSessionId RefPtr proxy = mProxy; auto sid = NS_ConvertUTF8toUTF16(aSessionId); mMainThread->Dispatch( - NS_NewRunnableFunction( - "GMPCDMCallbackProxy::BatchedKeyStatusChangedInternal", - [proxy, sid]() { proxy->OnKeyStatusesChange(sid); }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy, sid] () + { + proxy->OnKeyStatusesChange(sid); + }), + NS_DISPATCH_NORMAL + ); } } @@ -223,9 +254,12 @@ GMPCDMCallbackProxy::Terminated() RefPtr proxy = mProxy; mMainThread->Dispatch( - NS_NewRunnableFunction("GMPCDMCallbackProxy::Terminated", - [proxy]() { proxy->Terminated(); }), - NS_DISPATCH_NORMAL); + NS_NewRunnableFunction([proxy] () + { + proxy->Terminated(); + }), + NS_DISPATCH_NORMAL + ); } } // namespace mozilla diff --git a/dom/media/gmp/GMPCDMProxy.cpp b/dom/media/gmp/GMPCDMProxy.cpp index 78074ddb95bd2..63ca56b302b40 100644 --- a/dom/media/gmp/GMPCDMProxy.cpp +++ b/dom/media/gmp/GMPCDMProxy.cpp @@ -92,8 +92,7 @@ GMPCDMProxy::Init(PromiseId aPromiseId, data->mGMPName = aGMPName; data->mCrashHelper = mCrashHelper; nsCOMPtr task( - NewRunnableMethod&&>("GMPCDMProxy::gmp_Init", - this, + NewRunnableMethod&&>(this, &GMPCDMProxy::gmp_Init, Move(data))); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -140,8 +139,7 @@ void GMPCDMProxy::OnSetDecryptorId(uint32_t aId) MOZ_ASSERT(mCreatePromiseId); mDecryptorId = aId; nsCOMPtr task( - NewRunnableMethod("GMPCDMProxy::OnCDMCreated", - this, + NewRunnableMethod(this, &GMPCDMProxy::OnCDMCreated, mCreatePromiseId)); mMainThread->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -296,8 +294,7 @@ GMPCDMProxy::CreateSession(uint32_t aCreateSessionToken, data->mInitData = Move(aInitData); nsCOMPtr task( - NewRunnableMethod&&>("GMPCDMProxy::gmp_CreateSession", - this, + NewRunnableMethod&&>(this, &GMPCDMProxy::gmp_CreateSession, Move(data))); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -340,8 +337,7 @@ GMPCDMProxy::LoadSession(PromiseId aPromiseId, data->mPromiseId = aPromiseId; data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId); nsCOMPtr task( - NewRunnableMethod&&>("GMPCDMProxy::gmp_LoadSession", - this, + NewRunnableMethod&&>(this, &GMPCDMProxy::gmp_LoadSession, Move(data))); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -371,8 +367,7 @@ GMPCDMProxy::SetServerCertificate(PromiseId aPromiseId, data->mPromiseId = aPromiseId; data->mCert = Move(aCert); nsCOMPtr task( - NewRunnableMethod&&>("GMPCDMProxy::gmp_SetServerCertificate", - this, + NewRunnableMethod&&>(this, &GMPCDMProxy::gmp_SetServerCertificate, Move(data))); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -404,8 +399,7 @@ GMPCDMProxy::UpdateSession(const nsAString& aSessionId, data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId); data->mResponse = Move(aResponse); nsCOMPtr task( - NewRunnableMethod&&>("GMPCDMProxy::gmp_UpdateSession", - this, + NewRunnableMethod&&>(this, &GMPCDMProxy::gmp_UpdateSession, Move(data))); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -436,8 +430,7 @@ GMPCDMProxy::CloseSession(const nsAString& aSessionId, data->mPromiseId = aPromiseId; data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId); nsCOMPtr task( - NewRunnableMethod&&>("GMPCDMProxy::gmp_CloseSession", - this, + NewRunnableMethod&&>(this, &GMPCDMProxy::gmp_CloseSession, Move(data))); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -466,8 +459,7 @@ GMPCDMProxy::RemoveSession(const nsAString& aSessionId, data->mPromiseId = aPromiseId; data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId); nsCOMPtr task( - NewRunnableMethod&&>("GMPCDMProxy::gmp_RemoveSession", - this, + NewRunnableMethod&&>(this, &GMPCDMProxy::gmp_RemoveSession, Move(data))); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); @@ -491,8 +483,7 @@ GMPCDMProxy::Shutdown() MOZ_ASSERT(NS_IsMainThread()); mKeys.Clear(); // Note: This may end up being the last owning reference to the GMPCDMProxy. - nsCOMPtr task(NewRunnableMethod( - "GMPCDMProxy::gmp_Shutdown", this, &GMPCDMProxy::gmp_Shutdown)); + nsCOMPtr task(NewRunnableMethod(this, &GMPCDMProxy::gmp_Shutdown)); if (mOwnerThread) { mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); } @@ -544,8 +535,9 @@ GMPCDMProxy::ResolvePromise(PromiseId aId) } } else { nsCOMPtr task; - task = NewRunnableMethod( - "GMPCDMProxy::ResolvePromise", this, &GMPCDMProxy::ResolvePromise, aId); + task = NewRunnableMethod(this, + &GMPCDMProxy::ResolvePromise, + aId); mMainThread->Dispatch(task.forget(), NS_DISPATCH_NORMAL); } } @@ -692,8 +684,7 @@ GMPCDMProxy::Decrypt(MediaRawData* aSample) RefPtr promise(job->Ensure()); nsCOMPtr task( - NewRunnableMethod>("GMPCDMProxy::gmp_Decrypt", - this, &GMPCDMProxy::gmp_Decrypt, job)); + NewRunnableMethod>(this, &GMPCDMProxy::gmp_Decrypt, job)); mOwnerThread->EventTarget()->Dispatch(task.forget(), NS_DISPATCH_NORMAL); return promise; } diff --git a/dom/media/gmp/GMPCDMProxy.h b/dom/media/gmp/GMPCDMProxy.h index 3a5a2e559739a..a1ec059603959 100644 --- a/dom/media/gmp/GMPCDMProxy.h +++ b/dom/media/gmp/GMPCDMProxy.h @@ -191,8 +191,7 @@ class GMPCDMProxy : public CDMProxy { PromiseId aId, nsresult aCode, const nsCString& aReason) - : Runnable("GMPCDMProxy::RejectPromiseTask") - , mProxy(aProxy) + : mProxy(aProxy) , mId(aId) , mCode(aCode) , mReason(aReason) diff --git a/dom/media/gmp/GMPContentParent.cpp b/dom/media/gmp/GMPContentParent.cpp index 2c5da871714ba..8ae313eb9956e 100644 --- a/dom/media/gmp/GMPContentParent.cpp +++ b/dom/media/gmp/GMPContentParent.cpp @@ -50,8 +50,7 @@ class ReleaseGMPContentParent : public Runnable { public: explicit ReleaseGMPContentParent(GMPContentParent* aToRelease) - : Runnable("gmp::ReleaseGMPContentParent") - , mToRelease(aToRelease) + : mToRelease(aToRelease) { } @@ -146,8 +145,8 @@ GMPContentParent::CloseIfUnused() GeckoMediaPluginServiceChild::GetSingleton()); gmp->RemoveGMPContentParent(toClose); } - NS_DispatchToCurrentThread(NewRunnableMethod( - "gmp::GMPContentParent::Close", toClose, &GMPContentParent::Close)); + NS_DispatchToCurrentThread(NewRunnableMethod(toClose, + &GMPContentParent::Close)); } } diff --git a/dom/media/gmp/GMPCrashHelper.cpp b/dom/media/gmp/GMPCrashHelper.cpp index 74fa5bfde3243..f46c4e833719f 100644 --- a/dom/media/gmp/GMPCrashHelper.cpp +++ b/dom/media/gmp/GMPCrashHelper.cpp @@ -19,11 +19,9 @@ GMPCrashHelper::Destroy() delete this; } else { // Don't addref, as then we'd end up releasing after the detele runs! - SystemGroup::Dispatch("GMPCrashHelper::Destroy", - TaskCategory::Other, - NewNonOwningRunnableMethod("GMPCrashHelper::Destroy", - this, - &GMPCrashHelper::Destroy)); + SystemGroup::Dispatch( + "GMPCrashHelper::Destroy", TaskCategory::Other, + NewNonOwningRunnableMethod(this, &GMPCrashHelper::Destroy)); } } diff --git a/dom/media/gmp/GMPDecryptorChild.cpp b/dom/media/gmp/GMPDecryptorChild.cpp index 532457694b6bd..2cc46de05b48e 100644 --- a/dom/media/gmp/GMPDecryptorChild.cpp +++ b/dom/media/gmp/GMPDecryptorChild.cpp @@ -196,12 +196,10 @@ GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult) if (!ON_GMP_THREAD()) { // We should run this whole method on the GMP thread since the buffer needs // to be deleted after the SendDecrypted call. - mPlugin->GMPMessageLoop()->PostTask( - NewRunnableMethod("gmp::GMPDecryptorChild::Decrypted", - this, - &GMPDecryptorChild::Decrypted, - aBuffer, - aResult)); + mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod + (this, + &GMPDecryptorChild::Decrypted, + aBuffer, aResult)); return; } diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index fdd070ce46ca8..1d7fe33676f95 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -334,7 +334,6 @@ GMPParent::ChildTerminated() LOGD("%s::%s: GMPEventTarget() returned nullptr.", __CLASS__, __FUNCTION__); } else { gmpEventTarget->Dispatch(NewRunnableMethod>( - "gmp::GeckoMediaPluginServiceParent::PluginTerminated", mService, &GeckoMediaPluginServiceParent::PluginTerminated, self), @@ -353,8 +352,7 @@ GMPParent::DeleteProcess() mState = GMPStateClosing; Close(); } - mProcess->Delete(NewRunnableMethod( - "gmp::GMPParent::ChildTerminated", this, &GMPParent::ChildTerminated)); + mProcess->Delete(NewRunnableMethod(this, &GMPParent::ChildTerminated)); LOGD("%s: Shut down process", __FUNCTION__); mProcess = nullptr; mState = GMPStateNotLoaded; diff --git a/dom/media/gmp/GMPPlatform.cpp b/dom/media/gmp/GMPPlatform.cpp index 269f16c68e7a2..9e8b02cb7cec3 100644 --- a/dom/media/gmp/GMPPlatform.cpp +++ b/dom/media/gmp/GMPPlatform.cpp @@ -77,8 +77,7 @@ class GMPSyncRunnable final // main thread tries to do a sync call back to the calling thread. MOZ_ASSERT(!IsOnChildMainThread()); - mMessageLoop->PostTask(NewRunnableMethod( - "gmp::GMPSyncRunnable::Run", this, &GMPSyncRunnable::Run)); + mMessageLoop->PostTask(NewRunnableMethod(this, &GMPSyncRunnable::Run)); MonitorAutoLock lock(mMonitor); while (!mDone) { lock.Wait(); @@ -141,8 +140,7 @@ RunOnMainThread(GMPTask* aTask) } RefPtr r = new GMPRunnable(aTask); - sMainLoop->PostTask( - NewRunnableMethod("gmp::GMPRunnable::Run", r, &GMPRunnable::Run)); + sMainLoop->PostTask(NewRunnableMethod(r, &GMPRunnable::Run)); return GMPNoErr; } @@ -276,8 +274,7 @@ GMPThreadImpl::Post(GMPTask* aTask) } RefPtr r = new GMPRunnable(aTask); - mThread.message_loop()->PostTask( - NewRunnableMethod("gmp::GMPRunnable::Run", r.get(), &GMPRunnable::Run)); + mThread.message_loop()->PostTask(NewRunnableMethod(r.get(), &GMPRunnable::Run)); } void diff --git a/dom/media/gmp/GMPProcessParent.cpp b/dom/media/gmp/GMPProcessParent.cpp index aad88b3ab1454..8c6cd7a0d3232 100644 --- a/dom/media/gmp/GMPProcessParent.cpp +++ b/dom/media/gmp/GMPProcessParent.cpp @@ -85,8 +85,7 @@ void GMPProcessParent::Delete(nsCOMPtr aCallback) { mDeletedCallback = aCallback; - XRE_GetIOMessageLoop()->PostTask(NewNonOwningRunnableMethod( - "gmp::GMPProcessParent::DoDelete", this, &GMPProcessParent::DoDelete)); + XRE_GetIOMessageLoop()->PostTask(NewNonOwningRunnableMethod(this, &GMPProcessParent::DoDelete)); } void diff --git a/dom/media/gmp/GMPServiceChild.cpp b/dom/media/gmp/GMPServiceChild.cpp index 02f0c097f06dd..8fec2d90c3a51 100644 --- a/dom/media/gmp/GMPServiceChild.cpp +++ b/dom/media/gmp/GMPServiceChild.cpp @@ -490,9 +490,8 @@ class OpenPGMPServiceChild : public mozilla::Runnable public: OpenPGMPServiceChild(UniquePtr&& aGMPServiceChild, ipc::Endpoint&& aEndpoint) - : Runnable("gmp::OpenPGMPServiceChild") - , mGMPServiceChild(Move(aGMPServiceChild)) - , mEndpoint(Move(aEndpoint)) + : mGMPServiceChild(Move(aGMPServiceChild)), + mEndpoint(Move(aEndpoint)) { } diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 2b66e2622eb10..31fcb158070c8 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -141,10 +141,8 @@ GeckoMediaPluginServiceParent::Init() int32_t expected = Preferences::GetInt("media.gmp.storage.version.expected", 0); if (version != expected) { Preferences::SetInt("media.gmp.storage.version.observed", expected); - return GMPDispatch( - NewRunnableMethod("gmp::GeckoMediaPluginServiceParent::ClearStorage", - this, - &GeckoMediaPluginServiceParent::ClearStorage)); + return GMPDispatch(NewRunnableMethod( + this, &GeckoMediaPluginServiceParent::ClearStorage)); } return NS_OK; } @@ -300,8 +298,7 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, LOGD(("%s::%s Starting to unload plugins, waiting for sync shutdown..." , __CLASS__, __FUNCTION__)); gmpThread->Dispatch( - NewRunnableMethod("gmp::GeckoMediaPluginServiceParent::UnloadPlugins", - this, + NewRunnableMethod(this, &GeckoMediaPluginServiceParent::UnloadPlugins), NS_DISPATCH_NORMAL); @@ -326,10 +323,8 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, } else if (!strcmp("browser:purge-session-history", aTopic)) { // Clear everything! if (!aSomeData || nsDependentString(aSomeData).IsEmpty()) { - return GMPDispatch( - NewRunnableMethod("gmp::GeckoMediaPluginServiceParent::ClearStorage", - this, - &GeckoMediaPluginServiceParent::ClearStorage)); + return GMPDispatch(NewRunnableMethod( + this, &GeckoMediaPluginServiceParent::ClearStorage)); } // Clear nodeIds/records modified after |t|. @@ -339,10 +334,8 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, return rv; } return GMPDispatch(NewRunnableMethod( - "gmp::GeckoMediaPluginServiceParent::ClearRecentHistoryOnGMPThread", - this, - &GeckoMediaPluginServiceParent::ClearRecentHistoryOnGMPThread, - t)); + this, &GeckoMediaPluginServiceParent::ClearRecentHistoryOnGMPThread, + t)); } return NS_OK; @@ -734,7 +727,7 @@ GeckoMediaPluginServiceParent::EnsurePluginsOnDiskScanned() // cause an event to be dispatched to which scans for plugins. We // dispatch a sync event to the GMP thread here in order to wait until // after the GMP thread has scanned any paths in MOZ_GMP_PATH. - nsresult rv = GMPDispatch(new mozilla::Runnable("GMPDummyRunnable"), NS_DISPATCH_SYNC); + nsresult rv = GMPDispatch(new mozilla::Runnable(), NS_DISPATCH_SYNC); NS_ENSURE_SUCCESS(rv, rv); MOZ_ASSERT(mScannedPluginOnDisk, "Should have scanned MOZ_GMP_PATH by now"); } @@ -1604,13 +1597,9 @@ GeckoMediaPluginServiceParent::ForgetThisSiteNative(const nsAString& aSite, { MOZ_ASSERT(NS_IsMainThread()); - return GMPDispatch( - NewRunnableMethod( - "gmp::GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread", - this, - &GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread, - NS_ConvertUTF16toUTF8(aSite), - aPattern)); + return GMPDispatch(NewRunnableMethod( + this, &GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread, + NS_ConvertUTF16toUTF8(aSite), aPattern)); } static bool IsNodeIdValid(GMPParent* aParent) { @@ -1838,8 +1827,7 @@ class DeleteGMPServiceParent : public mozilla::Runnable { public: explicit DeleteGMPServiceParent(GMPServiceParent* aToDelete) - : Runnable("gmp::DeleteGMPServiceParent") - , mToDelete(aToDelete) + : mToDelete(aToDelete) { } @@ -1873,12 +1861,11 @@ GMPServiceParent::ActorDestroy(ActorDestroyReason aWhy) // Make sure the IPC channel is closed before destroying mToDelete. MonitorAutoLock lock(monitor); - RefPtr task = NewNonOwningRunnableMethod( - "gmp::GMPServiceParent::CloseTransport", - this, - &GMPServiceParent::CloseTransport, - &monitor, - &completed); + RefPtr task = + NewNonOwningRunnableMethod(this, + &GMPServiceParent::CloseTransport, + &monitor, + &completed); XRE_GetIOMessageLoop()->PostTask(Move(task.forget())); while (!completed) { @@ -1889,12 +1876,12 @@ GMPServiceParent::ActorDestroy(ActorDestroyReason aWhy) // GMPServiceParent until the current calling context is finished with // the object. GMPServiceParent* self = this; - NS_DispatchToCurrentThread( - NS_NewRunnableFunction("gmp::GMPServiceParent::ActorDestroy", [self]() { - // The GMPServiceParent must be destroyed on the main thread. - NS_DispatchToMainThread(NS_NewRunnableFunction( - "gmp::GMPServiceParent::ActorDestroy", [self]() { delete self; })); + NS_DispatchToCurrentThread(NS_NewRunnableFunction([self]() { + // The GMPServiceParent must be destroyed on the main thread. + NS_DispatchToMainThread(NS_NewRunnableFunction([self]() { + delete self; })); + })); } class OpenPGMPServiceParent : public mozilla::Runnable @@ -1903,10 +1890,9 @@ class OpenPGMPServiceParent : public mozilla::Runnable OpenPGMPServiceParent(GMPServiceParent* aGMPServiceParent, ipc::Endpoint&& aEndpoint, bool* aResult) - : Runnable("gmp::OpenPGMPServiceParent") - , mGMPServiceParent(aGMPServiceParent) - , mEndpoint(Move(aEndpoint)) - , mResult(aResult) + : mGMPServiceParent(aGMPServiceParent), + mEndpoint(Move(aEndpoint)), + mResult(aResult) { } diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h index 846683cf65e60..86a0a8d5cf166 100644 --- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -145,12 +145,9 @@ class GeckoMediaPluginServiceParent final : public GeckoMediaPluginService REMOVE_AND_DELETE_FROM_DISK, }; - PathRunnable(GeckoMediaPluginServiceParent* aService, - const nsAString& aPath, - EOperation aOperation, - bool aDefer = false) - : Runnable("gmp::GeckoMediaPluginServiceParent::PathRunnable") - , mService(aService) + PathRunnable(GeckoMediaPluginServiceParent* aService, const nsAString& aPath, + EOperation aOperation, bool aDefer = false) + : mService(aService) , mPath(aPath) , mOperation(aOperation) , mDefer(aDefer) diff --git a/dom/media/gmp/GMPTimerParent.cpp b/dom/media/gmp/GMPTimerParent.cpp index f8cc29315ce14..3a0c9c52a8168 100644 --- a/dom/media/gmp/GMPTimerParent.cpp +++ b/dom/media/gmp/GMPTimerParent.cpp @@ -54,12 +54,10 @@ GMPTimerParent::RecvSetTimer(const uint32_t& aTimerId, NS_ENSURE_SUCCESS(rv, IPC_OK()); ctx->mParent = this; - rv = - ctx->mTimer->InitWithNamedFuncCallback(&GMPTimerParent::GMPTimerExpired, - ctx, - aTimeoutMs, - nsITimer::TYPE_ONE_SHOT, - "gmp::GMPTimerParent::RecvSetTimer"); + rv = ctx->mTimer->InitWithFuncCallback(&GMPTimerParent::GMPTimerExpired, + ctx, + aTimeoutMs, + nsITimer::TYPE_ONE_SHOT); NS_ENSURE_SUCCESS(rv, IPC_OK()); mTimers.PutEntry(ctx.forget()); diff --git a/dom/media/gmp/GMPVideoDecoderChild.cpp b/dom/media/gmp/GMPVideoDecoderChild.cpp index 001aa3091e541..6c6cd9dc08f0e 100644 --- a/dom/media/gmp/GMPVideoDecoderChild.cpp +++ b/dom/media/gmp/GMPVideoDecoderChild.cpp @@ -228,9 +228,7 @@ GMPVideoDecoderChild::Alloc(size_t aSize, if (mPendingDecodeComplete && mNeedShmemIntrCount == 0) { mPendingDecodeComplete = false; mPlugin->GMPMessageLoop()->PostTask( - NewRunnableMethod("gmp::GMPVideoDecoderChild::RecvDecodingComplete", - this, - &GMPVideoDecoderChild::RecvDecodingComplete)); + NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete)); } #else #ifdef GMP_SAFE_SHMEM diff --git a/dom/media/gmp/GMPVideoDecoderParent.cpp b/dom/media/gmp/GMPVideoDecoderParent.cpp index 27c565bfa406c..872c4a8975c67 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.cpp +++ b/dom/media/gmp/GMPVideoDecoderParent.cpp @@ -202,15 +202,12 @@ GMPVideoDecoderParent::Reset() mIsAwaitingResetComplete = true; RefPtr self(this); - nsCOMPtr task = NS_NewRunnableFunction( - "gmp::GMPVideoDecoderParent::Reset", [self]() -> void { - LOGD(("GMPVideoDecoderParent[%p]::ResetCompleteTimeout() timed out " - "waiting for ResetComplete", - self.get())); - self->mResetCompleteTimeout = nullptr; - LogToBrowserConsole(NS_LITERAL_STRING( - "GMPVideoDecoderParent timed out waiting for ResetComplete()")); - }); + nsCOMPtr task = NS_NewRunnableFunction([self]() -> void + { + LOGD(("GMPVideoDecoderParent[%p]::ResetCompleteTimeout() timed out waiting for ResetComplete", self.get())); + self->mResetCompleteTimeout = nullptr; + LogToBrowserConsole(NS_LITERAL_STRING("GMPVideoDecoderParent timed out waiting for ResetComplete()")); + }); CancelResetCompleteTimeout(); nsCOMPtr target = mPlugin->GMPEventTarget(); mResetCompleteTimeout = SimpleTimer::Create(task, 5000, target); diff --git a/dom/media/gmp/GMPVideoEncoderChild.cpp b/dom/media/gmp/GMPVideoEncoderChild.cpp index 2ad82a6d9ef35..e46769e7f32fb 100644 --- a/dom/media/gmp/GMPVideoEncoderChild.cpp +++ b/dom/media/gmp/GMPVideoEncoderChild.cpp @@ -209,9 +209,7 @@ GMPVideoEncoderChild::Alloc(size_t aSize, if (mPendingEncodeComplete && mNeedShmemIntrCount == 0) { mPendingEncodeComplete = false; mPlugin->GMPMessageLoop()->PostTask( - NewRunnableMethod("gmp::GMPVideoEncoderChild::RecvEncodingComplete", - this, - &GMPVideoEncoderChild::RecvEncodingComplete)); + NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete)); } #else #ifdef GMP_SAFE_SHMEM diff --git a/dom/media/gtest/GMPTestMonitor.h b/dom/media/gtest/GMPTestMonitor.h index 2c5f89e6784e7..6b736e06a5e35 100644 --- a/dom/media/gtest/GMPTestMonitor.h +++ b/dom/media/gtest/GMPTestMonitor.h @@ -37,8 +37,7 @@ class GMPTestMonitor mozilla::SystemGroup::Dispatch( "GMPTestMonitor::SetFinished", mozilla::TaskCategory::Other, - mozilla::NewNonOwningRunnableMethod( - "GMPTestMonitor::MarkFinished", this, &GMPTestMonitor::MarkFinished)); + mozilla::NewNonOwningRunnableMethod(this, &GMPTestMonitor::MarkFinished)); } private: diff --git a/dom/media/gtest/TestGMPCrossOrigin.cpp b/dom/media/gtest/TestGMPCrossOrigin.cpp index 87517531b29e5..ca8be79241554 100644 --- a/dom/media/gtest/TestGMPCrossOrigin.cpp +++ b/dom/media/gtest/TestGMPCrossOrigin.cpp @@ -355,8 +355,7 @@ NS_IMPL_ISUPPORTS(GMPShutdownObserver, nsIRunnable, nsIObserver) class NotifyObserversTask : public Runnable { public: explicit NotifyObserversTask(const char* aTopic) - : mozilla::Runnable("NotifyObserversTask") - , mTopic(aTopic) + : mTopic(aTopic) {} NS_IMETHOD Run() override { MOZ_ASSERT(NS_IsMainThread()); @@ -533,8 +532,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback void DoTest(void (GMPStorageTest::*aTestMethod)()) { EnsureNSSInitializedChromeOrContent(); nsCOMPtr thread(GetGMPThread()); - ClearGMPStorage( - NewRunnableMethod("GMPStorageTest::DoTest", this, aTestMethod), thread); + ClearGMPStorage(NewRunnableMethod(this, aTestMethod), thread); AwaitFinished(); } @@ -587,12 +585,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback EXPECT_TRUE(!PBnodeId2.Equals(nodeId2)); nsCOMPtr thread(GetGMPThread()); - ClearGMPStorage( - NewRunnableMethod("GMPStorageTest::TestGetNodeId_Continuation", - this, - &GMPStorageTest::TestGetNodeId_Continuation, - nodeId1), - thread); + ClearGMPStorage(NewRunnableMethod( + this, &GMPStorageTest::TestGetNodeId_Continuation, nodeId1), thread); } void TestGetNodeId_Continuation(nsCString aNodeId1) { @@ -652,9 +646,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback { public: Updates(GMPStorageTest* aRunner, nsTArray&& aUpdates) - : mozilla::Runnable("GMPStorageTest::Updates") - , mRunner(aRunner) - , mUpdates(Move(aUpdates)) + : mRunner(aRunner), + mUpdates(Move(aUpdates)) { } @@ -714,9 +707,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback // It sends us a "test-storage complete" message when its passed, or // some other message if its tests fail. Expect(NS_LITERAL_CSTRING("test-storage complete"), - NewRunnableMethod("GMPStorageTest::SetFinished", - this, - &GMPStorageTest::SetFinished)); + NewRunnableMethod(this, &GMPStorageTest::SetFinished)); CreateDecryptor(NS_LITERAL_STRING("http://example1.com"), NS_LITERAL_STRING("http://example2.com"), @@ -735,10 +726,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback EXPECT_TRUE(IsGMPStorageIsEmpty()); // Generate storage data for some site. - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestForgetThisSite_AnotherSite", - this, - &GMPStorageTest::TestForgetThisSite_AnotherSite); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestForgetThisSite_AnotherSite); Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget()); CreateDecryptor(NS_LITERAL_STRING("http://example1.com"), @@ -751,10 +740,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback Shutdown(); // Generate storage data for another site. - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestForgetThisSite_CollectSiteInfo", - this, - &GMPStorageTest::TestForgetThisSite_CollectSiteInfo); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestForgetThisSite_CollectSiteInfo); Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget()); CreateDecryptor(NS_LITERAL_STRING("http://example3.com"), @@ -799,13 +786,11 @@ class GMPStorageTest : public GMPDecryptorProxyCallback EnumerateGMPStorageDir(NS_LITERAL_CSTRING("id"), NodeIdCollector(siteInfo.get())); // Invoke "Forget this site" on the main thread. - SystemGroup::Dispatch("TestForgetThisSite_Forget", - TaskCategory::Other, - NewRunnableMethod&&>( - "GMPStorageTest::TestForgetThisSite_Forget", - this, - &GMPStorageTest::TestForgetThisSite_Forget, - Move(siteInfo))); + SystemGroup::Dispatch( + "TestForgetThisSite_Forget", + TaskCategory::Other, + NewRunnableMethod&&>( + this, &GMPStorageTest::TestForgetThisSite_Forget, Move(siteInfo))); } void TestForgetThisSite_Forget(UniquePtr&& aSiteInfo) { @@ -818,14 +803,11 @@ class GMPStorageTest : public GMPDecryptorProxyCallback service->GetThread(getter_AddRefs(thread)); nsCOMPtr r = NewRunnableMethod&&>( - "GMPStorageTest::TestForgetThisSite_Verify", - this, - &GMPStorageTest::TestForgetThisSite_Verify, - Move(aSiteInfo)); + this, &GMPStorageTest::TestForgetThisSite_Verify, Move(aSiteInfo)); thread->Dispatch(r, NS_DISPATCH_NORMAL); nsCOMPtr f = NewRunnableMethod( - "GMPStorageTest::SetFinished", this, &GMPStorageTest::SetFinished); + this, &GMPStorageTest::SetFinished); thread->Dispatch(f, NS_DISPATCH_NORMAL); } @@ -890,10 +872,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback EXPECT_TRUE(IsGMPStorageIsEmpty()); // Generate storage data for some site. - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestClearRecentHistory1_Clear", - this, - &GMPStorageTest::TestClearRecentHistory1_Clear); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestClearRecentHistory1_Clear); Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget()); CreateDecryptor(NS_LITERAL_STRING("http://example1.com"), @@ -914,10 +894,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback EXPECT_TRUE(IsGMPStorageIsEmpty()); // Generate storage data for some site. - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestClearRecentHistory2_Clear", - this, - &GMPStorageTest::TestClearRecentHistory2_Clear); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestClearRecentHistory2_Clear); Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget()); CreateDecryptor(NS_LITERAL_STRING("http://example1.com"), @@ -938,10 +916,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback EXPECT_TRUE(IsGMPStorageIsEmpty()); // Generate storage data for some site. - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestClearRecentHistory3_Clear", - this, - &GMPStorageTest::TestClearRecentHistory3_Clear); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestClearRecentHistory3_Clear); Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget()); CreateDecryptor(NS_LITERAL_STRING("http://example1.com"), @@ -971,10 +947,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback nsresult rv = EnumerateGMPStorageDir(NS_LITERAL_CSTRING("id"), f); EXPECT_TRUE(NS_SUCCEEDED(rv)); - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestClearRecentHistory_CheckEmpty", - this, - &GMPStorageTest::TestClearRecentHistory_CheckEmpty); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestClearRecentHistory_CheckEmpty); nsCOMPtr t(GetGMPThread()); ClearGMPStorage(r.forget(), t, f.GetResult()); } @@ -984,10 +958,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback nsresult rv = EnumerateGMPStorageDir(NS_LITERAL_CSTRING("storage"), f); EXPECT_TRUE(NS_SUCCEEDED(rv)); - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestClearRecentHistory_CheckEmpty", - this, - &GMPStorageTest::TestClearRecentHistory_CheckEmpty); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestClearRecentHistory_CheckEmpty); nsCOMPtr t(GetGMPThread()); ClearGMPStorage(r.forget(), t, f.GetResult()); } @@ -997,10 +969,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback nsresult rv = EnumerateGMPStorageDir(NS_LITERAL_CSTRING("storage"), f); EXPECT_TRUE(NS_SUCCEEDED(rv)); - nsCOMPtr r = - NewRunnableMethod("GMPStorageTest::TestClearRecentHistory_CheckNonEmpty", - this, - &GMPStorageTest::TestClearRecentHistory_CheckNonEmpty); + nsCOMPtr r = NewRunnableMethod( + this, &GMPStorageTest::TestClearRecentHistory_CheckNonEmpty); nsCOMPtr t(GetGMPThread()); ClearGMPStorage(r.forget(), t, f.GetResult() + 1); } @@ -1056,11 +1026,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback auto t = time(0); nsCString response("stored crossOriginTestRecordId "); response.AppendInt((int64_t)t); - Expect(response, - NewRunnableMethod( - "GMPStorageTest::TestCrossOriginStorage_RecordStoredContinuation", - this, - &GMPStorageTest::TestCrossOriginStorage_RecordStoredContinuation)); + Expect(response, NewRunnableMethod(this, + &GMPStorageTest::TestCrossOriginStorage_RecordStoredContinuation)); nsCString update("store crossOriginTestRecordId "); update.AppendInt((int64_t)t); @@ -1078,11 +1045,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback // and try to read the record. Shutdown(); - Expect(NS_LITERAL_CSTRING( - "retrieve crossOriginTestRecordId succeeded (length 0 bytes)"), - NewRunnableMethod("GMPStorageTest::SetFinished", - this, - &GMPStorageTest::SetFinished)); + Expect(NS_LITERAL_CSTRING("retrieve crossOriginTestRecordId succeeded (length 0 bytes)"), + NewRunnableMethod(this, &GMPStorageTest::SetFinished)); CreateDecryptor(NS_LITERAL_STRING("http://example5.com"), NS_LITERAL_STRING("http://example6.com"), @@ -1094,11 +1058,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback // Send the decryptor the message "store recordid $time" // Wait for the decrytor to send us "stored recordid $time" nsCString response("stored pbdata test-pb-data"); - Expect(response, - NewRunnableMethod( - "GMPStorageTest::TestPBStorage_RecordStoredContinuation", - this, - &GMPStorageTest::TestPBStorage_RecordStoredContinuation)); + Expect(response, NewRunnableMethod(this, + &GMPStorageTest::TestPBStorage_RecordStoredContinuation)); // Open decryptor on one, origin, write a record, close decryptor, // open another, and test that record can be read, close decryptor, @@ -1114,10 +1075,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback Shutdown(); Expect(NS_LITERAL_CSTRING("retrieve pbdata succeeded (length 12 bytes)"), - NewRunnableMethod( - "GMPStorageTest::TestPBStorage_RecordRetrievedContinuation", - this, - &GMPStorageTest::TestPBStorage_RecordRetrievedContinuation)); + NewRunnableMethod(this, + &GMPStorageTest::TestPBStorage_RecordRetrievedContinuation)); CreateDecryptor(NS_LITERAL_STRING("http://pb1.com"), NS_LITERAL_STRING("http://pb2.com"), @@ -1130,9 +1089,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback SimulatePBModeExit(); Expect(NS_LITERAL_CSTRING("retrieve pbdata succeeded (length 0 bytes)"), - NewRunnableMethod("GMPStorageTest::SetFinished", - this, - &GMPStorageTest::SetFinished)); + NewRunnableMethod(this, + &GMPStorageTest::SetFinished)); CreateDecryptor(NS_LITERAL_STRING("http://pb1.com"), NS_LITERAL_STRING("http://pb2.com"), @@ -1145,8 +1103,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback Shutdown(); Expect(NS_LITERAL_CSTRING("OP tests completed"), - NewRunnableMethod("GMPStorageTest::SetFinished", - this, &GMPStorageTest::SetFinished)); + NewRunnableMethod(this, &GMPStorageTest::SetFinished)); CreateDecryptor(NS_LITERAL_STRING("http://example15.com"), NS_LITERAL_STRING("http://example16.com"), @@ -1184,10 +1141,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback response.Append(longRecordName); response.AppendLiteral(" "); response.Append(data); - Expect(response, - NewRunnableMethod("GMPStorageTest::SetFinished", - this, - &GMPStorageTest::SetFinished)); + Expect(response, NewRunnableMethod(this, &GMPStorageTest::SetFinished)); nsCString update("store "); update.Append(longRecordName); @@ -1214,11 +1168,9 @@ class GMPStorageTest : public GMPDecryptorProxyCallback return; } EXPECT_FALSE(mNodeId.IsEmpty()); - RefPtr task(new GMPShutdownObserver( - NewRunnableMethod( - "GMPStorageTest::Shutdown", this, &GMPStorageTest::Shutdown), - Move(aContinuation), - mNodeId)); + RefPtr task( + new GMPShutdownObserver(NewRunnableMethod(this, &GMPStorageTest::Shutdown), + Move(aContinuation), mNodeId)); SystemGroup::Dispatch("GMPShutdownObserver", TaskCategory::Other, task.forget()); } @@ -1236,8 +1188,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback void SetFinished() { mFinished = true; Shutdown(); - nsCOMPtr task = - NewRunnableMethod("GMPStorageTest::Dummy", this, &GMPStorageTest::Dummy); + nsCOMPtr task = NewRunnableMethod(this, &GMPStorageTest::Dummy); SystemGroup::Dispatch("GMPStorageTest::Dummy", TaskCategory::Other, task.forget()); } @@ -1327,8 +1278,9 @@ GMPTestRunner::DoTest(void (GMPTestRunner::*aTestMethod)(GMPTestMonitor&)) nsCOMPtr thread(GetGMPThread()); GMPTestMonitor monitor; - thread->Dispatch(NewRunnableMethod( - "GMPTestRunner::DoTest", this, aTestMethod, monitor), + thread->Dispatch(NewRunnableMethod(this, + aTestMethod, + monitor), NS_DISPATCH_NORMAL); monitor.AwaitFinished(); } diff --git a/dom/media/gtest/TestGMPRemoveAndDelete.cpp b/dom/media/gtest/TestGMPRemoveAndDelete.cpp index 20d715c7eb996..4ac92e34e5662 100644 --- a/dom/media/gtest/TestGMPRemoveAndDelete.cpp +++ b/dom/media/gtest/TestGMPRemoveAndDelete.cpp @@ -263,16 +263,10 @@ GMPRemoveTest::CreateVideoDecoder(nsCString aNodeId) GMPVideoHost* host; GMPVideoDecoderProxy* decoder = nullptr; - mGMPThread->Dispatch(NewNonOwningRunnableMethod( - "GMPRemoveTest::gmp_GetVideoDecoder", - this, - &GMPRemoveTest::gmp_GetVideoDecoder, - aNodeId, - &decoder, - &host), - NS_DISPATCH_NORMAL); + mGMPThread->Dispatch( + NewNonOwningRunnableMethod( + this, &GMPRemoveTest::gmp_GetVideoDecoder, aNodeId, &decoder, &host), + NS_DISPATCH_NORMAL); mTestMonitor.AwaitFinished(); @@ -286,16 +280,9 @@ GMPRemoveTest::CreateVideoDecoder(nsCString aNodeId) nsTArray empty; mGMPThread->Dispatch( - NewNonOwningRunnableMethod&, - GMPVideoDecoderCallbackProxy*, - int32_t>("GMPVideoDecoderProxy::InitDecode", - decoder, - &GMPVideoDecoderProxy::InitDecode, - codec, - empty, - this, - 1 /* core count */), + NewNonOwningRunnableMethod&, GMPVideoDecoderCallbackProxy*, int32_t>( + decoder, &GMPVideoDecoderProxy::InitDecode, + codec, empty, this, 1 /* core count */), NS_DISPATCH_SYNC); if (mDecoder) { @@ -344,10 +331,9 @@ GMPRemoveTest::gmp_GetVideoDecoder(nsCString aNodeId, void GMPRemoveTest::CloseVideoDecoder() { - mGMPThread->Dispatch(NewNonOwningRunnableMethod("GMPVideoDecoderProxy::Close", - mDecoder, - &GMPVideoDecoderProxy::Close), - NS_DISPATCH_SYNC); + mGMPThread->Dispatch( + NewNonOwningRunnableMethod(mDecoder, &GMPVideoDecoderProxy::Close), + NS_DISPATCH_SYNC); mDecoder = nullptr; mHost = nullptr; @@ -362,10 +348,9 @@ GMPRemoveTest::DeletePluginDirectory(bool aCanDefer) GMPErr GMPRemoveTest::Decode() { - mGMPThread->Dispatch(NewNonOwningRunnableMethod("GMPRemoveTest::gmp_Decode", - this, - &GMPRemoveTest::gmp_Decode), - NS_DISPATCH_NORMAL); + mGMPThread->Dispatch( + NewNonOwningRunnableMethod(this, &GMPRemoveTest::gmp_Decode), + NS_DISPATCH_NORMAL); mTestMonitor.AwaitFinished(); return mDecodeResult; diff --git a/dom/media/gtest/TestMP4Demuxer.cpp b/dom/media/gtest/TestMP4Demuxer.cpp index 0a213f62269c0..231dba0386cfb 100644 --- a/dom/media/gtest/TestMP4Demuxer.cpp +++ b/dom/media/gtest/TestMP4Demuxer.cpp @@ -148,8 +148,7 @@ class MP4DemuxerBinding void DispatchTask(FunctionType aFun) { - RefPtr r = - NS_NewRunnableFunction("MP4DemuxerBinding::DispatchTask", aFun); + RefPtr r = NS_NewRunnableFunction(aFun); mTaskQueue->Dispatch(r.forget()); } diff --git a/dom/media/hls/HLSDemuxer.cpp b/dom/media/hls/HLSDemuxer.cpp index f13a3f6f1cb66..cfcbf6a225a91 100644 --- a/dom/media/hls/HLSDemuxer.cpp +++ b/dom/media/hls/HLSDemuxer.cpp @@ -88,7 +88,6 @@ class HLSDemuxer::HLSDemuxerCallbacksSupport if (!mDemuxer) { return; } RefPtr self = this; mDemuxer->GetTaskQueue()->Dispatch(NS_NewRunnableFunction( - "HLSDemuxer::HLSDemuxerCallbacksSupport::OnInitialized", [=] () { MutexAutoLock lock(self->mMutex); if (self->mDemuxer) { @@ -639,8 +638,7 @@ HLSTrackDemuxer::BreakCycles() { RefPtr self = this; nsCOMPtr task = - NS_NewRunnableFunction("HLSTrackDemuxer::BreakCycles", - [self]() { + NS_NewRunnableFunction([self]() { self->mParent = nullptr; } ); mParent->GetTaskQueue()->Dispatch(task.forget()); diff --git a/dom/media/imagecapture/CaptureTask.cpp b/dom/media/imagecapture/CaptureTask.cpp index 29832429d7922..95aeb8478f24e 100644 --- a/dom/media/imagecapture/CaptureTask.cpp +++ b/dom/media/imagecapture/CaptureTask.cpp @@ -176,10 +176,7 @@ CaptureTask::PostTrackEndEvent() { public: explicit TrackEndRunnable(CaptureTask* aTask) - : mozilla::Runnable("TrackEndRunnable") - , mTask(aTask) - { - } + : mTask(aTask) {} NS_IMETHOD Run() override { diff --git a/dom/media/ipc/RemoteVideoDecoder.cpp b/dom/media/ipc/RemoteVideoDecoder.cpp index d4e1df1588826..28953829bf973 100644 --- a/dom/media/ipc/RemoteVideoDecoder.cpp +++ b/dom/media/ipc/RemoteVideoDecoder.cpp @@ -34,11 +34,10 @@ RemoteVideoDecoder::~RemoteVideoDecoder() // it alive until we send the delete message. RefPtr actor = mActor; - RefPtr task = NS_NewRunnableFunction( - "dom::RemoteVideoDecoder::~RemoteVideoDecoder", [actor]() { - MOZ_ASSERT(actor); - actor->DestroyIPDL(); - }); + RefPtr task = NS_NewRunnableFunction([actor]() { + MOZ_ASSERT(actor); + actor->DestroyIPDL(); + }); // Drop out references to the actor so that the last ref // always gets released on the manager thread. @@ -104,13 +103,10 @@ RemoteVideoDecoder::SetSeekThreshold(const media::TimeUnit& aTime) { RefPtr self = this; media::TimeUnit time = aTime; - VideoDecoderManagerChild::GetManagerThread()->Dispatch( - NS_NewRunnableFunction("dom::RemoteVideoDecoder::SetSeekThreshold", - [=]() { - MOZ_ASSERT(self->mActor); - self->mActor->SetSeekThreshold(time); - }), - NS_DISPATCH_NORMAL); + VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([=]() { + MOZ_ASSERT(self->mActor); + self->mActor->SetSeekThreshold(time); + }), NS_DISPATCH_NORMAL); } MediaDataDecoder::ConversionRequired @@ -164,16 +160,11 @@ RemoteDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams) SynchronousTask task("InitIPDL"); bool success; - VideoDecoderManagerChild::GetManagerThread()->Dispatch( - NS_NewRunnableFunction( - "dom::RemoteDecoderModule::CreateVideoDecoder", - [&]() { - AutoCompleteTask complete(&task); - success = object->mActor->InitIPDL( - aParams.VideoConfig(), - aParams.mKnowsCompositor->GetTextureFactoryIdentifier()); - }), - NS_DISPATCH_NORMAL); + VideoDecoderManagerChild::GetManagerThread()->Dispatch(NS_NewRunnableFunction([&]() { + AutoCompleteTask complete(&task); + success = object->mActor->InitIPDL(aParams.VideoConfig(), + aParams.mKnowsCompositor->GetTextureFactoryIdentifier()); + }), NS_DISPATCH_NORMAL); task.Wait(); if (!success) { diff --git a/dom/media/ipc/VideoDecoderChild.cpp b/dom/media/ipc/VideoDecoderChild.cpp index 46392b343f3ab..600272aa88303 100644 --- a/dom/media/ipc/VideoDecoderChild.cpp +++ b/dom/media/ipc/VideoDecoderChild.cpp @@ -124,24 +124,23 @@ VideoDecoderChild::ActorDestroy(ActorDestroyReason aWhy) // Defer reporting an error until we've recreated the manager so that // it'll be safe for MediaFormatReader to recreate decoders RefPtr ref = this; - GetManager()->RunWhenRecreated( - NS_NewRunnableFunction("dom::VideoDecoderChild::ActorDestroy", [=]() { - if (ref->mInitialized) { - mDecodedData.Clear(); - mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, - __func__); - mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, - __func__); - mFlushPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, - __func__); - // Make sure the next request will be rejected accordingly if ever - // called. - mNeedNewDecoder = true; - } else { - ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, - __func__); - } - })); + GetManager()->RunWhenRecreated(NS_NewRunnableFunction([=]() { + if (ref->mInitialized) { + mDecodedData.Clear(); + mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); + mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); + mFlushPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); + // Make sure the next request will be rejected accordingly if ever + // called. + mNeedNewDecoder = true; + } else { + ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, + __func__); + } + })); } mCanSend = false; } diff --git a/dom/media/ipc/VideoDecoderManagerChild.cpp b/dom/media/ipc/VideoDecoderManagerChild.cpp index 3dab09c91a280..7749f56aaa925 100644 --- a/dom/media/ipc/VideoDecoderManagerChild.cpp +++ b/dom/media/ipc/VideoDecoderManagerChild.cpp @@ -61,16 +61,12 @@ VideoDecoderManagerChild::Shutdown() MOZ_ASSERT(NS_IsMainThread()); if (sVideoDecoderChildThread) { - sVideoDecoderChildThread->Dispatch( - NS_NewRunnableFunction("dom::VideoDecoderManagerChild::Shutdown", - []() { - if (sDecoderManager && - sDecoderManager->CanSend()) { - sDecoderManager->Close(); - sDecoderManager = nullptr; - } - }), - NS_DISPATCH_NORMAL); + sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction([]() { + if (sDecoderManager && sDecoderManager->CanSend()) { + sDecoderManager->Close(); + sDecoderManager = nullptr; + } + }), NS_DISPATCH_NORMAL); sVideoDecoderChildAbstractThread = nullptr; sVideoDecoderChildThread->Shutdown(); @@ -181,15 +177,12 @@ VideoDecoderManagerChild::DeallocShmem(mozilla::ipc::Shmem& aShmem) if (NS_GetCurrentThread() != sVideoDecoderChildThread) { RefPtr self = this; mozilla::ipc::Shmem shmem = aShmem; - sVideoDecoderChildThread->Dispatch( - NS_NewRunnableFunction("dom::VideoDecoderManagerChild::DeallocShmem", - [self, shmem]() { - if (self->CanSend()) { - mozilla::ipc::Shmem shmemCopy = shmem; - self->DeallocShmem(shmemCopy); - } - }), - NS_DISPATCH_NORMAL); + sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction([self, shmem]() { + if (self->CanSend()) { + mozilla::ipc::Shmem shmemCopy = shmem; + self->DeallocShmem(shmemCopy); + } + }), NS_DISPATCH_NORMAL); return true; } return PVideoDecoderManagerChild::DeallocShmem(aShmem); @@ -226,8 +219,7 @@ VideoDecoderManagerChild::Readback(const SurfaceDescriptorGPUVideo& aSD) RefPtr ref = this; SurfaceDescriptor sd; - if (NS_FAILED(sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction("VideoDecoderManagerChild::Readback", - [&]() { + if (NS_FAILED(sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction([&]() { AutoCompleteTask complete(&task); if (ref->CanSend()) { ref->SendReadback(aSD, &sd); @@ -262,15 +254,11 @@ VideoDecoderManagerChild::DeallocateSurfaceDescriptorGPUVideo(const SurfaceDescr { RefPtr ref = this; SurfaceDescriptorGPUVideo sd = Move(aSD); - sVideoDecoderChildThread->Dispatch( - NS_NewRunnableFunction( - "dom::VideoDecoderManagerChild::DeallocateSurfaceDescriptorGPUVideo", - [ref, sd]() { - if (ref->CanSend()) { - ref->SendDeallocateSurfaceDescriptorGPUVideo(sd); - } - }), - NS_DISPATCH_NORMAL); + sVideoDecoderChildThread->Dispatch(NS_NewRunnableFunction([ref, sd]() { + if (ref->CanSend()) { + ref->SendDeallocateSurfaceDescriptorGPUVideo(sd); + } + }), NS_DISPATCH_NORMAL); } void diff --git a/dom/media/ipc/VideoDecoderManagerParent.cpp b/dom/media/ipc/VideoDecoderManagerParent.cpp index d80899aa04b09..f914f8bf87136 100644 --- a/dom/media/ipc/VideoDecoderManagerParent.cpp +++ b/dom/media/ipc/VideoDecoderManagerParent.cpp @@ -50,12 +50,10 @@ class VideoDecoderManagerThreadHolder private: ~VideoDecoderManagerThreadHolder() { - NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::VideoDecoderManagerThreadHolder::~VideoDecoderManagerThreadHolder", - []() -> void { - sVideoDecoderManagerThread->Shutdown(); - sVideoDecoderManagerThread = nullptr; - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([]() -> void { + sVideoDecoderManagerThread->Shutdown(); + sVideoDecoderManagerThread = nullptr; + })); } }; StaticRefPtr sVideoDecoderManagerThreadHolder; @@ -101,16 +99,14 @@ VideoDecoderManagerParent::StartupThreads() sVideoDecoderManagerThread = managerThread; sVideoDecoderManagerThreadHolder = new VideoDecoderManagerThreadHolder(); #if XP_WIN - sVideoDecoderManagerThread->Dispatch(NS_NewRunnableFunction("VideoDecoderManagerParent::StartupThreads", - []() { + sVideoDecoderManagerThread->Dispatch(NS_NewRunnableFunction([]() { HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); MOZ_ASSERT(hr == S_OK); }), NS_DISPATCH_NORMAL); #endif - sVideoDecoderManagerThread->Dispatch( - NS_NewRunnableFunction("dom::VideoDecoderManagerParent::StartupThreads", - []() { layers::VideoBridgeChild::Startup(); }), - NS_DISPATCH_NORMAL); + sVideoDecoderManagerThread->Dispatch(NS_NewRunnableFunction([]() { + layers::VideoBridgeChild::Startup(); + }), NS_DISPATCH_NORMAL); sManagerTaskQueue = new TaskQueue( managerThread.forget(), "VideoDecoderManagerParent::sManagerTaskQueue"); @@ -136,9 +132,9 @@ void VideoDecoderManagerParent::ShutdownVideoBridge() { if (sVideoDecoderManagerThread) { - RefPtr task = NS_NewRunnableFunction( - "dom::VideoDecoderManagerParent::ShutdownVideoBridge", - []() { VideoBridgeChild::Shutdown(); }); + RefPtr task = NS_NewRunnableFunction([]() { + VideoBridgeChild::Shutdown(); + }); SyncRunnable::DispatchToThread(sVideoDecoderManagerThread, task); } } @@ -163,12 +159,8 @@ VideoDecoderManagerParent::CreateForContent(Endpoint RefPtr parent = new VideoDecoderManagerParent(sVideoDecoderManagerThreadHolder); - RefPtr task = - NewRunnableMethod&&>( - "dom::VideoDecoderManagerParent::Open", - parent, - &VideoDecoderManagerParent::Open, - Move(aEndpoint)); + RefPtr task = NewRunnableMethod&&>( + parent, &VideoDecoderManagerParent::Open, Move(aEndpoint)); sVideoDecoderManagerThread->Dispatch(task.forget(), NS_DISPATCH_NORMAL); return true; } diff --git a/dom/media/mediasink/DecodedStream.cpp b/dom/media/mediasink/DecodedStream.cpp index 39e7bf08e0339..3ae885dc14154 100644 --- a/dom/media/mediasink/DecodedStream.cpp +++ b/dom/media/mediasink/DecodedStream.cpp @@ -60,9 +60,7 @@ class DecodedStreamGraphListener : public MediaStreamListener { if (event == MediaStreamGraphEvent::EVENT_FINISHED) { aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod("DecodedStreamGraphListener::DoNotifyFinished", - this, - &DecodedStreamGraphListener::DoNotifyFinished)); + NewRunnableMethod(this, &DecodedStreamGraphListener::DoNotifyFinished)); } } @@ -75,11 +73,10 @@ class DecodedStreamGraphListener : public MediaStreamListener { void Forget() { RefPtr self = this; - mAbstractMainThread->Dispatch( - NS_NewRunnableFunction("DecodedStreamGraphListener::Forget", [self]() { - MOZ_ASSERT(NS_IsMainThread()); - self->mFinishPromise.ResolveIfExists(true, __func__); - })); + mAbstractMainThread->Dispatch(NS_NewRunnableFunction([self] () { + MOZ_ASSERT(NS_IsMainThread()); + self->mFinishPromise.ResolveIfExists(true, __func__); + })); MutexAutoLock lock(mMutex); mStream = nullptr; } @@ -113,11 +110,9 @@ UpdateStreamSuspended(AbstractThread* aMainThread, MediaStream* aStream, bool aB } else { nsCOMPtr r; if (aBlocking) { - r = NewRunnableMethod( - "MediaStream::Suspend", aStream, &MediaStream::Suspend); + r = NewRunnableMethod(aStream, &MediaStream::Suspend); } else { - r = - NewRunnableMethod("MediaStream::Resume", aStream, &MediaStream::Resume); + r = NewRunnableMethod(aStream, &MediaStream::Resume); } aMainThread->Dispatch(r.forget()); } @@ -411,8 +406,9 @@ DecodedStream::DestroyData(UniquePtr aData) DecodedStreamData* data = aData.release(); data->Forget(); - nsCOMPtr r = NS_NewRunnableFunction("DecodedStream::DestroyData", - [=]() { delete data; }); + nsCOMPtr r = NS_NewRunnableFunction([=] () { + delete data; + }); mAbstractMainThread->Dispatch(r.forget()); } diff --git a/dom/media/mediasource/AsyncEventRunner.h b/dom/media/mediasource/AsyncEventRunner.h index 5b506523b998f..a1b6265f71114 100644 --- a/dom/media/mediasource/AsyncEventRunner.h +++ b/dom/media/mediasource/AsyncEventRunner.h @@ -16,8 +16,7 @@ class AsyncEventRunner : public Runnable { public: AsyncEventRunner(T* aTarget, const char* aName) - : Runnable("AsyncEventRunner") - , mTarget(aTarget) + : mTarget(aTarget) , mName(aName) {} diff --git a/dom/media/mediasource/AutoTaskQueue.h b/dom/media/mediasource/AutoTaskQueue.h index 5f0a62c2d8724..225bd6102c3a9 100644 --- a/dom/media/mediasource/AutoTaskQueue.h +++ b/dom/media/mediasource/AutoTaskQueue.h @@ -60,8 +60,7 @@ class AutoTaskQueue : public AbstractThread { RefPtr taskqueue = mTaskQueue; nsCOMPtr task = - NS_NewRunnableFunction("AutoTaskQueue::~AutoTaskQueue", - [taskqueue]() { taskqueue->BeginShutdown(); }); + NS_NewRunnableFunction([taskqueue]() { taskqueue->BeginShutdown(); }); SystemGroup::Dispatch("~AutoTaskQueue", TaskCategory::Other, task.forget()); } RefPtr mTaskQueue; diff --git a/dom/media/mediasource/MediaSourceDemuxer.cpp b/dom/media/mediasource/MediaSourceDemuxer.cpp index e1cdbecc521fc..7a48c82c765f7 100644 --- a/dom/media/mediasource/MediaSourceDemuxer.cpp +++ b/dom/media/mediasource/MediaSourceDemuxer.cpp @@ -56,8 +56,8 @@ MediaSourceDemuxer::AddSizeOfResources( // NB: The track buffers must only be accessed on the TaskQueue. RefPtr self = this; RefPtr sizes = aSizes; - nsCOMPtr task = NS_NewRunnableFunction( - "MediaSourceDemuxer::AddSizeOfResources", [self, sizes]() { + nsCOMPtr task = + NS_NewRunnableFunction([self, sizes] () { for (TrackBuffersManager* manager : self->mSourceBuffers) { manager->AddSizeOfResources(sizes); } @@ -69,15 +69,14 @@ MediaSourceDemuxer::AddSizeOfResources( void MediaSourceDemuxer::NotifyInitDataArrived() { RefPtr self = this; - nsCOMPtr task = NS_NewRunnableFunction( - "MediaSourceDemuxer::NotifyInitDataArrived", [self]() { - if (self->mInitPromise.IsEmpty()) { - return; - } - if (self->ScanSourceBuffersForContent()) { - self->mInitPromise.ResolveIfExists(NS_OK, __func__); - } - }); + nsCOMPtr task = NS_NewRunnableFunction([self]() { + if (self->mInitPromise.IsEmpty()) { + return; + } + if (self->ScanSourceBuffersForContent()) { + self->mInitPromise.ResolveIfExists(NS_OK, __func__); + } + }); GetTaskQueue()->Dispatch(task.forget()); } @@ -169,11 +168,10 @@ MediaSourceDemuxer::GetCrypto() void MediaSourceDemuxer::AttachSourceBuffer(TrackBuffersManager* aSourceBuffer) { - nsCOMPtr task = NewRunnableMethod( - "MediaSourceDemuxer::DoAttachSourceBuffer", - this, - &MediaSourceDemuxer::DoAttachSourceBuffer, - aSourceBuffer); + nsCOMPtr task = + NewRunnableMethod( + this, &MediaSourceDemuxer::DoAttachSourceBuffer, + aSourceBuffer); GetTaskQueue()->Dispatch(task.forget()); } @@ -188,11 +186,10 @@ MediaSourceDemuxer::DoAttachSourceBuffer(mozilla::TrackBuffersManager* aSourceBu void MediaSourceDemuxer::DetachSourceBuffer(TrackBuffersManager* aSourceBuffer) { - nsCOMPtr task = NewRunnableMethod( - "MediaSourceDemuxer::DoDetachSourceBuffer", - this, - &MediaSourceDemuxer::DoDetachSourceBuffer, - aSourceBuffer); + nsCOMPtr task = + NewRunnableMethod( + this, &MediaSourceDemuxer::DoDetachSourceBuffer, + aSourceBuffer); GetTaskQueue()->Dispatch(task.forget()); } @@ -345,7 +342,7 @@ MediaSourceTrackDemuxer::Reset() MOZ_ASSERT(mParent, "Called after BreackCycle()"); RefPtr self = this; nsCOMPtr task = - NS_NewRunnableFunction("MediaSourceTrackDemuxer::Reset", [self]() { + NS_NewRunnableFunction([self] () { self->mNextSample.reset(); self->mReset = true; self->mManager->Seek(self->mType, TimeUnit::Zero(), TimeUnit::Zero()); @@ -387,10 +384,10 @@ MediaSourceTrackDemuxer::BreakCycles() { RefPtr self = this; nsCOMPtr task = - NS_NewRunnableFunction("MediaSourceTrackDemuxer::BreakCycles", [self]() { + NS_NewRunnableFunction([self]() { self->mParent = nullptr; self->mManager = nullptr; - }); + } ); mParent->GetTaskQueue()->Dispatch(task.forget()); } diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index b9abcfb1d5467..ee258a37aab3c 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -65,8 +65,7 @@ class DispatchKeyNeededEvent : public Runnable { DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, nsTArray& aInitData, const nsString& aInitDataType) - : Runnable("DispatchKeyNeededEvent") - , mDecoder(aDecoder) + : mDecoder(aDecoder) , mInitData(aInitData) , mInitDataType(aInitDataType) { @@ -148,10 +147,7 @@ TrackBuffersManager::QueueTask(SourceBufferTask* aTask) { if (!OnTaskQueue()) { GetTaskQueue()->Dispatch(NewRunnableMethod>( - "TrackBuffersManager::QueueTask", - this, - &TrackBuffersManager::QueueTask, - aTask)); + this, &TrackBuffersManager::QueueTask, aTask)); return; } MOZ_ASSERT(OnTaskQueue()); @@ -216,10 +212,7 @@ TrackBuffersManager::ProcessTasks() default: NS_WARNING("Invalid Task"); } - GetTaskQueue()->Dispatch( - NewRunnableMethod("TrackBuffersManager::ProcessTasks", - this, - &TrackBuffersManager::ProcessTasks)); + GetTaskQueue()->Dispatch(NewRunnableMethod(this, &TrackBuffersManager::ProcessTasks)); } // The MSE spec requires that we abort the current SegmentParserLoop @@ -797,10 +790,7 @@ TrackBuffersManager::RejectAppend(const MediaResult& aRejectValue, const char* a void TrackBuffersManager::ScheduleSegmentParserLoop() { - GetTaskQueue()->Dispatch( - NewRunnableMethod("TrackBuffersManager::SegmentParserLoop", - this, - &TrackBuffersManager::SegmentParserLoop)); + GetTaskQueue()->Dispatch(NewRunnableMethod(this, &TrackBuffersManager::SegmentParserLoop)); } void @@ -884,12 +874,11 @@ TrackBuffersManager::OnDemuxerResetDone(const MediaResult& aResult) if (aResult != NS_OK && mParentDecoder) { RefPtr self = this; - mAbstractMainThread->Dispatch(NS_NewRunnableFunction( - "TrackBuffersManager::OnDemuxerResetDone", [self, aResult]() { - if (self->mParentDecoder && self->mParentDecoder->GetOwner()) { - self->mParentDecoder->GetOwner()->DecodeWarning(aResult); - } - })); + mAbstractMainThread->Dispatch(NS_NewRunnableFunction([self, aResult] () { + if (self->mParentDecoder && self->mParentDecoder->GetOwner()) { + self->mParentDecoder->GetOwner()->DecodeWarning(aResult); + } + })); } // Recreate track demuxers. @@ -1010,11 +999,10 @@ TrackBuffersManager::OnDemuxerInitDone(const MediaResult& aResult) int64_t duration = std::max(videoDuration, audioDuration); // 1. Update the duration attribute if it currently equals NaN. // Those steps are performed by the MediaSourceDecoder::SetInitialDuration - mAbstractMainThread->Dispatch( - NewRunnableMethod("MediaSourceDecoder::SetInitialDuration", - mParentDecoder.get(), - &MediaSourceDecoder::SetInitialDuration, - duration ? duration : -1)); + mAbstractMainThread->Dispatch(NewRunnableMethod + (mParentDecoder.get(), + &MediaSourceDecoder::SetInitialDuration, + duration ? duration : -1)); // 2. If the initialization segment has no audio, video, or text tracks, then // run the append error algorithm with the decode error parameter set to true @@ -1171,12 +1159,11 @@ TrackBuffersManager::OnDemuxerInitDone(const MediaResult& aResult) if (aResult != NS_OK && mParentDecoder) { RefPtr self = this; - mAbstractMainThread->Dispatch(NS_NewRunnableFunction( - "TrackBuffersManager::OnDemuxerInitDone", [self, aResult]() { - if (self->mParentDecoder && self->mParentDecoder->GetOwner()) { - self->mParentDecoder->GetOwner()->DecodeWarning(aResult); - } - })); + mAbstractMainThread->Dispatch(NS_NewRunnableFunction([self, aResult] () { + if (self->mParentDecoder && self->mParentDecoder->GetOwner()) { + self->mParentDecoder->GetOwner()->DecodeWarning(aResult); + } + })); } } diff --git a/dom/media/ogg/OggDemuxer.cpp b/dom/media/ogg/OggDemuxer.cpp index 26cc97fda18dd..cc0017d53fa8c 100644 --- a/dom/media/ogg/OggDemuxer.cpp +++ b/dom/media/ogg/OggDemuxer.cpp @@ -129,20 +129,14 @@ OggDemuxer::~OggDemuxer() // a chained stream or not. bool isChained = mIsChained; void* ptr = this; - nsCOMPtr task = NS_NewRunnableFunction( - "OggDemuxer::~OggDemuxer", [ptr, isChained]() -> void { - // We can't use OGG_DEBUG here because it implicitly refers to `this`, - // which we can't capture in this runnable. - MOZ_LOG(gMediaDemuxerLog, - mozilla::LogLevel::Debug, - ("OggDemuxer(%p)::%s: Reporting telemetry " - "MEDIA_OGG_LOADED_IS_CHAINED=%d", - ptr, - __func__, - isChained)); - Telemetry::Accumulate( - Telemetry::HistogramID::MEDIA_OGG_LOADED_IS_CHAINED, isChained); - }); + nsCOMPtr task = NS_NewRunnableFunction([ptr, isChained]() -> void { + // We can't use OGG_DEBUG here because it implicitly refers to `this`, + // which we can't capture in this runnable. + MOZ_LOG(gMediaDemuxerLog, mozilla::LogLevel::Debug, + ("OggDemuxer(%p)::%s: Reporting telemetry MEDIA_OGG_LOADED_IS_CHAINED=%d", + ptr, __func__, isChained)); + Telemetry::Accumulate(Telemetry::HistogramID::MEDIA_OGG_LOADED_IS_CHAINED, isChained); + }); SystemGroup::Dispatch("~OggDemuxer::report_telemetry", TaskCategory::Other, task.forget()); diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp index 5105957d33c95..afc040eabc530 100644 --- a/dom/media/platforms/PDMFactory.cpp +++ b/dom/media/platforms/PDMFactory.cpp @@ -191,7 +191,7 @@ PDMFactory::EnsureInit() const // Not on the main thread -> Sync-dispatch creation to main thread. nsCOMPtr mainTarget = GetMainThreadEventTarget(); nsCOMPtr runnable = - NS_NewRunnableFunction("PDMFactory::EnsureInit", []() { + NS_NewRunnableFunction([]() { StaticMutexAutoLock mon(sMonitor); if (!sInstance) { sInstance = new PDMFactoryImpl(); diff --git a/dom/media/platforms/android/RemoteDataDecoder.cpp b/dom/media/platforms/android/RemoteDataDecoder.cpp index ed57b99a82262..20dac82cfbc50 100644 --- a/dom/media/platforms/android/RemoteDataDecoder.cpp +++ b/dom/media/platforms/android/RemoteDataDecoder.cpp @@ -555,8 +555,7 @@ RemoteDataDecoder::UpdateInputStatus(int64_t aTimestamp, bool aProcessed) { if (!mTaskQueue->IsCurrentThreadIn()) { mTaskQueue->Dispatch( - NewRunnableMethod("RemoteDataDecoder::UpdateInputStatus", - this, + NewRunnableMethod(this, &RemoteDataDecoder::UpdateInputStatus, aTimestamp, aProcessed)); @@ -584,8 +583,7 @@ RemoteDataDecoder::UpdateOutputStatus(MediaData* aSample) { if (!mTaskQueue->IsCurrentThreadIn()) { mTaskQueue->Dispatch( - NewRunnableMethod("RemoteDataDecoder::UpdateOutputStatus", - this, + NewRunnableMethod(this, &RemoteDataDecoder::UpdateOutputStatus, aSample)); return; @@ -619,8 +617,7 @@ RemoteDataDecoder::DrainComplete() { if (!mTaskQueue->IsCurrentThreadIn()) { mTaskQueue->Dispatch( - NewRunnableMethod("RemoteDataDecoder::DrainComplete", - this, &RemoteDataDecoder::DrainComplete)); + NewRunnableMethod(this, &RemoteDataDecoder::DrainComplete)); return; } AssertOnTaskQueue(); @@ -638,8 +635,7 @@ RemoteDataDecoder::Error(const MediaResult& aError) { if (!mTaskQueue->IsCurrentThreadIn()) { mTaskQueue->Dispatch( - NewRunnableMethod("RemoteDataDecoder::Error", - this, &RemoteDataDecoder::Error, aError)); + NewRunnableMethod(this, &RemoteDataDecoder::Error, aError)); return; } AssertOnTaskQueue(); diff --git a/dom/media/platforms/omx/OmxDataDecoder.cpp b/dom/media/platforms/omx/OmxDataDecoder.cpp index 885366f99aa58..011e23cc861e1 100644 --- a/dom/media/platforms/omx/OmxDataDecoder.cpp +++ b/dom/media/platforms/omx/OmxDataDecoder.cpp @@ -386,17 +386,16 @@ OmxDataDecoder::EmptyBufferDone(BufferData* aData) mCheckingInputExhausted = true; RefPtr self = this; - nsCOMPtr r = - NS_NewRunnableFunction("OmxDataDecoder::EmptyBufferDone", [self, this]() { - mCheckingInputExhausted = false; + nsCOMPtr r = NS_NewRunnableFunction([self, this]() { + mCheckingInputExhausted = false; - if (mMediaRawDatas.Length()) { - return; - } + if (mMediaRawDatas.Length()) { + return; + } - mDecodePromise.ResolveIfExists(mDecodedData, __func__); - mDecodedData.Clear(); - }); + mDecodePromise.ResolveIfExists(mDecodedData, __func__); + mDecodedData.Clear(); + }); mOmxTaskQueue->Dispatch(r.forget()); } diff --git a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp index 46aa556b7cbfb..e0cad38baa5c5 100644 --- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp @@ -252,8 +252,7 @@ WMFAudioMFTManager::Output(int64_t aStreamOffset, if (!sample) { LOG("Audio MFTDecoder returned success but null output."); - nsCOMPtr task = NS_NewRunnableFunction("WMFAudioMFTManager::Output", - []() -> void { + nsCOMPtr task = NS_NewRunnableFunction([]() -> void { LOG("Reporting telemetry AUDIO_MFT_OUTPUT_NULL_SAMPLES"); Telemetry::Accumulate(Telemetry::HistogramID::AUDIO_MFT_OUTPUT_NULL_SAMPLES, 1); }); diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp index 79a6dbf4bfa5b..e06ecee2f0c2b 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp @@ -62,7 +62,6 @@ SendTelemetry(unsigned long hr) } nsCOMPtr runnable = NS_NewRunnableFunction( - "SendTelemetry", [sample] { Telemetry::Accumulate(Telemetry::MEDIA_WMF_DECODE_ERROR, sample); }); @@ -231,8 +230,7 @@ WMFMediaDataDecoder::SetSeekThreshold(const media::TimeUnit& aTime) RefPtr self = this; nsCOMPtr runnable = - NS_NewRunnableFunction("WMFMediaDataDecoder::SetSeekThreshold", - [self, aTime]() { + NS_NewRunnableFunction([self, aTime]() { media::TimeUnit threshold = aTime; self->mMFTManager->SetSeekThreshold(threshold); }); diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index 9de254f16c426..04b3f11d90145 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -151,8 +151,7 @@ WMFVideoMFTManager::~WMFVideoMFTManager() ? 2 : mGotValidOutputAfterNullOutput ? 3 : 4; - nsCOMPtr task = NS_NewRunnableFunction("WMFVideoMFTManager::~WMFVideoMFTManager", - [=]() -> void { + nsCOMPtr task = NS_NewRunnableFunction([=]() -> void { LOG(nsPrintfCString("Reporting telemetry VIDEO_MFT_OUTPUT_NULL_SAMPLES=%d", telemetry) .get()); @@ -389,8 +388,7 @@ class CreateDXVAManagerEvent : public Runnable public: CreateDXVAManagerEvent(layers::KnowsCompositor* aKnowsCompositor, nsCString& aFailureReason) - : Runnable("CreateDXVAManagerEvent") - , mBackend(LayersBackend::LAYERS_D3D11) + : mBackend(LayersBackend::LAYERS_D3D11) , mKnowsCompositor(aKnowsCompositor) , mFailureReason(aFailureReason) { @@ -693,8 +691,7 @@ class SupportsConfigEvent : public Runnable { SupportsConfigEvent(DXVA2Manager* aDXVA2Manager, IMFMediaType* aMediaType, float aFramerate) - : Runnable("SupportsConfigEvent") - , mDXVA2Manager(aDXVA2Manager) + : mDXVA2Manager(aDXVA2Manager) , mMediaType(aMediaType) , mFramerate(aFramerate) , mSupportsConfig(false) diff --git a/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp b/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp index 374cacfa2b70c..099b7957ca7e7 100644 --- a/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp +++ b/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp @@ -107,7 +107,6 @@ MediaDataDecoderProxy::SetSeekThreshold(const media::TimeUnit& aTime) RefPtr self = this; media::TimeUnit time = aTime; mProxyThread->Dispatch(NS_NewRunnableFunction( - "MediaDataDecoderProxy::SetSeekThreshold", [self, time] { self->mProxyDecoder->SetSeekThreshold(time); })); } diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index f932d87df09cf..b955881291ff1 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -46,10 +46,7 @@ class FakeOnDeviceChangeEventRunnable : public Runnable { public: explicit FakeOnDeviceChangeEventRunnable(uint8_t counter) - : Runnable("camera::FakeOnDeviceChangeEventRunnable") - , mCounter(counter) - { - } + : mCounter(counter) {} NS_IMETHOD Run() override { @@ -77,10 +74,7 @@ class InitializeIPCThread : public Runnable { public: InitializeIPCThread() - : Runnable("camera::InitializeIPCThread") - , mCamerasChild(nullptr) - { - } + : mCamerasChild(nullptr) {} NS_IMETHOD Run() override { // Try to get the PBackground handle @@ -291,12 +285,8 @@ CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine, LOG(("NumberOfCapabilities for %s", deviceUniqueIdUTF8)); nsCString unique_id(deviceUniqueIdUTF8); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendNumberOfCapabilities", - this, - &CamerasChild::SendNumberOfCapabilities, - aCapEngine, - unique_id); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendNumberOfCapabilities, aCapEngine, unique_id); LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger); LOG(("Capture capability count: %d", dispatcher.ReturnValue())); return dispatcher.ReturnValue(); @@ -307,11 +297,8 @@ CamerasChild::NumberOfCaptureDevices(CaptureEngine aCapEngine) { LOG((__PRETTY_FUNCTION__)); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendNumberOfCaptureDevices", - this, - &CamerasChild::SendNumberOfCaptureDevices, - aCapEngine); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendNumberOfCaptureDevices, aCapEngine); LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger); LOG(("Capture Devices: %d", dispatcher.ReturnValue())); return dispatcher.ReturnValue(); @@ -334,11 +321,8 @@ CamerasChild::EnsureInitialized(CaptureEngine aCapEngine) { LOG((__PRETTY_FUNCTION__)); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendEnsureInitialized", - this, - &CamerasChild::SendEnsureInitialized, - aCapEngine); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendEnsureInitialized, aCapEngine); LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger); LOG(("Capture Devices: %d", dispatcher.ReturnValue())); return dispatcher.ReturnValue(); @@ -353,13 +337,8 @@ CamerasChild::GetCaptureCapability(CaptureEngine aCapEngine, LOG(("GetCaptureCapability: %s %d", unique_idUTF8, capability_number)); nsCString unique_id(unique_idUTF8); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendGetCaptureCapability", - this, - &CamerasChild::SendGetCaptureCapability, - aCapEngine, - unique_id, - capability_number); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendGetCaptureCapability, aCapEngine, unique_id, capability_number); LockAndDispatch<> dispatcher(this, __func__, runnable); if (dispatcher.Success()) { capability = mReplyCapability; @@ -395,12 +374,8 @@ CamerasChild::GetCaptureDevice(CaptureEngine aCapEngine, { LOG((__PRETTY_FUNCTION__)); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendGetCaptureDevice", - this, - &CamerasChild::SendGetCaptureDevice, - aCapEngine, - list_number); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendGetCaptureDevice, aCapEngine, list_number); LockAndDispatch<> dispatcher(this, __func__, runnable); if (dispatcher.Success()) { base::strlcpy(device_nameUTF8, mReplyDeviceName.get(), device_nameUTF8Length); @@ -439,15 +414,8 @@ CamerasChild::AllocateCaptureDevice(CaptureEngine aCapEngine, LOG((__PRETTY_FUNCTION__)); nsCString unique_id(unique_idUTF8); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendAllocateCaptureDevice", - this, - &CamerasChild::SendAllocateCaptureDevice, - aCapEngine, - unique_id, - aPrincipalInfo); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendAllocateCaptureDevice, aCapEngine, unique_id, aPrincipalInfo); LockAndDispatch<> dispatcher(this, __func__, runnable); if (dispatcher.Success()) { LOG(("Capture Device allocated: %d", mReplyInteger)); @@ -475,12 +443,8 @@ CamerasChild::ReleaseCaptureDevice(CaptureEngine aCapEngine, { LOG((__PRETTY_FUNCTION__)); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendReleaseCaptureDevice", - this, - &CamerasChild::SendReleaseCaptureDevice, - aCapEngine, - capture_id); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendReleaseCaptureDevice, aCapEngine, capture_id); LockAndDispatch<> dispatcher(this, __func__, runnable); return dispatcher.ReturnValue(); } @@ -525,14 +489,9 @@ CamerasChild::StartCapture(CaptureEngine aCapEngine, webrtcCaps.rawType, webrtcCaps.codecType, webrtcCaps.interlaced); - nsCOMPtr runnable = mozilla:: - NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendStartCapture", - this, - &CamerasChild::SendStartCapture, - aCapEngine, - capture_id, - capCap); + nsCOMPtr runnable = + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendStartCapture, aCapEngine, capture_id, capCap); LockAndDispatch<> dispatcher(this, __func__, runnable); return dispatcher.ReturnValue(); } @@ -542,12 +501,8 @@ CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id) { LOG((__PRETTY_FUNCTION__)); nsCOMPtr runnable = - mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendStopCapture", - this, - &CamerasChild::SendStopCapture, - aCapEngine, - capture_id); + mozilla::NewNonOwningRunnableMethod + (this, &CamerasChild::SendStopCapture, aCapEngine, capture_id); LockAndDispatch<> dispatcher(this, __func__, runnable); if (dispatcher.Success()) { RemoveCallback(aCapEngine, capture_id); @@ -571,9 +526,9 @@ Shutdown(void) class ShutdownRunnable : public Runnable { public: - explicit ShutdownRunnable(already_AddRefed&& aReplyEvent) - : Runnable("camera::ShutdownRunnable") - , mReplyEvent(aReplyEvent){}; + explicit + ShutdownRunnable(already_AddRefed&& aReplyEvent) + : mReplyEvent(aReplyEvent) {}; NS_IMETHOD Run() override { LOG(("Closing BackgroundChild")); @@ -610,8 +565,8 @@ CamerasChild::ShutdownParent() // Delete the parent actor. // CamerasChild (this) will remain alive and is only deleted by the // IPC layer when SendAllDone returns. - nsCOMPtr deleteRunnable = mozilla::NewNonOwningRunnableMethod( - "camera::PCamerasChild::SendAllDone", this, &CamerasChild::SendAllDone); + nsCOMPtr deleteRunnable = + mozilla::NewNonOwningRunnableMethod(this, &CamerasChild::SendAllDone); CamerasSingleton::Thread()->Dispatch(deleteRunnable, NS_DISPATCH_NORMAL); } else { LOG(("ShutdownParent called without PBackground thread")); @@ -626,8 +581,9 @@ CamerasChild::ShutdownChild() LOG(("PBackground thread exists, dispatching close")); // Dispatch closing the IPC thread back to us when the // BackgroundChild is closed. - RefPtr runnable = new ShutdownRunnable(NewRunnableMethod( - "nsIThread::Shutdown", CamerasSingleton::Thread(), &nsIThread::Shutdown)); + RefPtr runnable = + new ShutdownRunnable(NewRunnableMethod(CamerasSingleton::Thread(), + &nsIThread::Shutdown)); CamerasSingleton::Thread()->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL); } else { LOG(("Shutdown called without PBackground thread")); @@ -637,10 +593,9 @@ CamerasChild::ShutdownChild() CamerasSingleton::Thread() = nullptr; if (CamerasSingleton::FakeDeviceChangeEventThread()) { - RefPtr runnable = new ShutdownRunnable( - NewRunnableMethod("nsIThread::Shutdown", - CamerasSingleton::FakeDeviceChangeEventThread(), - &nsIThread::Shutdown)); + RefPtr runnable = + new ShutdownRunnable(NewRunnableMethod(CamerasSingleton::FakeDeviceChangeEventThread(), + &nsIThread::Shutdown)); CamerasSingleton::FakeDeviceChangeEventThread()->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL); } CamerasSingleton::FakeDeviceChangeEventThread() = nullptr; diff --git a/dom/media/systemservices/CamerasParent.cpp b/dom/media/systemservices/CamerasParent.cpp index 54f45e931c33d..5be8ff3386695 100644 --- a/dom/media/systemservices/CamerasParent.cpp +++ b/dom/media/systemservices/CamerasParent.cpp @@ -70,16 +70,11 @@ void InputObserver::OnDeviceChange() { class DeliverFrameRunnable : public ::mozilla::Runnable { public: - DeliverFrameRunnable(CamerasParent* aParent, - CaptureEngine aEngine, - uint32_t aStreamId, - const webrtc::VideoFrame& aFrame, - const VideoFrameProperties& aProperties) - : Runnable("camera::DeliverFrameRunnable") - , mParent(aParent) - , mCapEngine(aEngine) - , mStreamId(aStreamId) - , mProperties(aProperties) + DeliverFrameRunnable(CamerasParent *aParent, CaptureEngine aEngine, + uint32_t aStreamId, const webrtc::VideoFrame& aFrame, + const VideoFrameProperties& aProperties) + : mParent(aParent), mCapEngine(aEngine), mStreamId(aStreamId), + mProperties(aProperties) { // No ShmemBuffer (of the right size) was available, so make an // extra buffer here. We have no idea when we are going to run and @@ -92,17 +87,11 @@ class DeliverFrameRunnable : public ::mozilla::Runnable { aProperties.bufferSize(), aFrame); } - DeliverFrameRunnable(CamerasParent* aParent, - CaptureEngine aEngine, - uint32_t aStreamId, - ShmemBuffer aBuffer, - VideoFrameProperties& aProperties) - : Runnable("camera::DeliverFrameRunnable") - , mParent(aParent) - , mCapEngine(aEngine) - , mStreamId(aStreamId) - , mBuffer(Move(aBuffer)) - , mProperties(aProperties){}; + DeliverFrameRunnable(CamerasParent* aParent, CaptureEngine aEngine, + uint32_t aStreamId, ShmemBuffer aBuffer, VideoFrameProperties& aProperties) + : mParent(aParent), mCapEngine(aEngine), mStreamId(aStreamId), + mBuffer(Move(aBuffer)), mProperties(aProperties) + {}; NS_IMETHOD Run() override { if (mParent->IsShuttingDown()) { diff --git a/dom/media/systemservices/MediaSystemResourceManager.cpp b/dom/media/systemservices/MediaSystemResourceManager.cpp index e4e2ca2cb95d3..29db0ef3eaed5 100644 --- a/dom/media/systemservices/MediaSystemResourceManager.cpp +++ b/dom/media/systemservices/MediaSystemResourceManager.cpp @@ -65,7 +65,7 @@ MediaSystemResourceManager::Init() bool done = false; RefPtr runnable = - NS_NewRunnableFunction("MediaSystemResourceManager::Init", [&]() { + NS_NewRunnableFunction([&]() { if (!sSingleton) { sSingleton = new MediaSystemResourceManager(); } @@ -199,10 +199,10 @@ MediaSystemResourceManager::Acquire(MediaSystemResourceClient* aClient) } aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_WAITING; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask( - NewRunnableMethod("MediaSystemResourceManager::DoAcquire", - this, - &MediaSystemResourceManager::DoAcquire, - aClient->mId)); + NewRunnableMethod( + this, + &MediaSystemResourceManager::DoAcquire, + aClient->mId)); } bool @@ -242,10 +242,10 @@ MediaSystemResourceManager::AcquireSyncNoWait(MediaSystemResourceClient* aClient } ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask( - NewRunnableMethod("MediaSystemResourceManager::DoAcquire", - this, - &MediaSystemResourceManager::DoAcquire, - aClient->mId)); + NewRunnableMethod( + this, + &MediaSystemResourceManager::DoAcquire, + aClient->mId)); // should stop the thread until done. while (!done) { @@ -309,10 +309,10 @@ MediaSystemResourceManager::ReleaseResource(MediaSystemResourceClient* aClient) aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_END; ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask( - NewRunnableMethod("MediaSystemResourceManager::DoRelease", - this, - &MediaSystemResourceManager::DoRelease, - aClient->mId)); + NewRunnableMethod( + this, + &MediaSystemResourceManager::DoRelease, + aClient->mId)); } } @@ -338,7 +338,6 @@ MediaSystemResourceManager::HandleAcquireResult(uint32_t aId, bool aSuccess) if (!InImageBridgeChildThread()) { ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask( NewRunnableMethod( - "MediaSystemResourceManager::HandleAcquireResult", this, &MediaSystemResourceManager::HandleAcquireResult, aId, diff --git a/dom/media/systemservices/MediaTaskUtils.h b/dom/media/systemservices/MediaTaskUtils.h index a6c43c57e007f..c9b64fd2a4d57 100644 --- a/dom/media/systemservices/MediaTaskUtils.h +++ b/dom/media/systemservices/MediaTaskUtils.h @@ -24,12 +24,7 @@ template class LambdaTask : public Runnable { public: - explicit LambdaTask(OnRunType&& aOnRun) - : Runnable("media::LambdaTask") - , mOnRun(Move(aOnRun)) - { - } - + explicit LambdaTask(OnRunType&& aOnRun) : mOnRun(Move(aOnRun)) {} private: NS_IMETHOD Run() override diff --git a/dom/media/systemservices/MediaUtils.h b/dom/media/systemservices/MediaUtils.h index 61cbbd7a50895..c208147aaafc1 100644 --- a/dom/media/systemservices/MediaUtils.h +++ b/dom/media/systemservices/MediaUtils.h @@ -186,12 +186,7 @@ template class LambdaRunnable : public Runnable { public: - explicit LambdaRunnable(OnRunType&& aOnRun) - : Runnable("media::LambdaRunnable") - , mOnRun(Move(aOnRun)) - { - } - + explicit LambdaRunnable(OnRunType&& aOnRun) : mOnRun(Move(aOnRun)) {} private: NS_IMETHODIMP Run() override diff --git a/dom/media/webaudio/AnalyserNode.cpp b/dom/media/webaudio/AnalyserNode.cpp index 0bfd4138198f7..ba9d10b4cc695 100644 --- a/dom/media/webaudio/AnalyserNode.cpp +++ b/dom/media/webaudio/AnalyserNode.cpp @@ -29,9 +29,9 @@ class AnalyserNodeEngine final : public AudioNodeEngine class TransferBuffer final : public Runnable { public: - TransferBuffer(AudioNodeStream* aStream, const AudioChunk& aChunk) - : Runnable("dom::AnalyserNodeEngine::TransferBuffer") - , mStream(aStream) + TransferBuffer(AudioNodeStream* aStream, + const AudioChunk& aChunk) + : mStream(aStream) , mChunk(aChunk) { } diff --git a/dom/media/webaudio/AudioBufferSourceNode.cpp b/dom/media/webaudio/AudioBufferSourceNode.cpp index 6c61af54ef2a3..5bde3cf099e3a 100644 --- a/dom/media/webaudio/AudioBufferSourceNode.cpp +++ b/dom/media/webaudio/AudioBufferSourceNode.cpp @@ -809,10 +809,7 @@ AudioBufferSourceNode::NotifyMainThreadStreamFinished() { public: explicit EndedEventDispatcher(AudioBufferSourceNode* aNode) - : mozilla::Runnable("EndedEventDispatcher") - , mNode(aNode) - { - } + : mNode(aNode) {} NS_IMETHOD Run() override { // If it's not safe to run scripts right now, schedule this to run later diff --git a/dom/media/webaudio/AudioDestinationNode.cpp b/dom/media/webaudio/AudioDestinationNode.cpp index ed55031b238a2..abe357e3264e3 100644 --- a/dom/media/webaudio/AudioDestinationNode.cpp +++ b/dom/media/webaudio/AudioDestinationNode.cpp @@ -125,8 +125,7 @@ class OfflineDestinationNodeEngine final : public AudioNodeEngine { public: OnCompleteTask(AudioContext* aAudioContext, AudioBuffer* aRenderedBuffer) - : Runnable("dom::OfflineDestinationNodeEngine::OnCompleteTask") - , mAudioContext(aAudioContext) + : mAudioContext(aAudioContext) , mRenderedBuffer(aRenderedBuffer) {} @@ -205,9 +204,9 @@ class OfflineDestinationNodeEngine final : public AudioNodeEngine class InputMutedRunnable final : public Runnable { public: - InputMutedRunnable(AudioNodeStream* aStream, bool aInputMuted) - : Runnable("dom::InputMutedRunnable") - , mStream(aStream) + InputMutedRunnable(AudioNodeStream* aStream, + bool aInputMuted) + : mStream(aStream) , mInputMuted(aInputMuted) { } @@ -413,10 +412,8 @@ AudioDestinationNode::NotifyMainThreadStreamFinished() MOZ_ASSERT(mStream->IsFinished()); if (mIsOffline) { - NS_DispatchToCurrentThread( - NewRunnableMethod("dom::AudioDestinationNode::FireOfflineCompletionEvent", - this, - &AudioDestinationNode::FireOfflineCompletionEvent)); + NS_DispatchToCurrentThread(NewRunnableMethod(this, + &AudioDestinationNode::FireOfflineCompletionEvent)); } } diff --git a/dom/media/webaudio/AudioNode.cpp b/dom/media/webaudio/AudioNode.cpp index 33ad902ee1a3d..068a447ae879c 100644 --- a/dom/media/webaudio/AudioNode.cpp +++ b/dom/media/webaudio/AudioNode.cpp @@ -340,10 +340,7 @@ AudioNode::DisconnectFromOutputIfConnected(uint32_t aOutputNodeIndex, { public: explicit RunnableRelease(already_AddRefed aNode) - : mozilla::Runnable("RunnableRelease") - , mNode(aNode) - { - } + : mNode(aNode) {} NS_IMETHOD Run() override { diff --git a/dom/media/webaudio/ConstantSourceNode.cpp b/dom/media/webaudio/ConstantSourceNode.cpp index 1615233510dc3..b3af764b4ab65 100644 --- a/dom/media/webaudio/ConstantSourceNode.cpp +++ b/dom/media/webaudio/ConstantSourceNode.cpp @@ -257,10 +257,7 @@ ConstantSourceNode::NotifyMainThreadStreamFinished() { public: explicit EndedEventDispatcher(ConstantSourceNode* aNode) - : mozilla::Runnable("EndedEventDispatcher") - , mNode(aNode) - { - } + : mNode(aNode) {} NS_IMETHOD Run() override { // If it's not safe to run scripts right now, schedule this to run later diff --git a/dom/media/webaudio/DynamicsCompressorNode.cpp b/dom/media/webaudio/DynamicsCompressorNode.cpp index 974405ec05f7c..46e14c79a3341 100644 --- a/dom/media/webaudio/DynamicsCompressorNode.cpp +++ b/dom/media/webaudio/DynamicsCompressorNode.cpp @@ -148,8 +148,7 @@ class DynamicsCompressorNodeEngine final : public AudioNodeEngine { public: Command(AudioNodeStream* aStream, float aReduction) - : mozilla::Runnable("Command") - , mStream(aStream) + : mStream(aStream) , mReduction(aReduction) { } diff --git a/dom/media/webaudio/MediaBufferDecoder.cpp b/dom/media/webaudio/MediaBufferDecoder.cpp index 4ef2f9328d936..c8791dfe470f4 100644 --- a/dom/media/webaudio/MediaBufferDecoder.cpp +++ b/dom/media/webaudio/MediaBufferDecoder.cpp @@ -42,8 +42,7 @@ class ReportResultTask final : public Runnable ReportResultTask(WebAudioDecodeJob& aDecodeJob, WebAudioDecodeJob::ResultFn aFunction, WebAudioDecodeJob::ErrorCode aErrorCode) - : Runnable("ReportResultTask") - , mDecodeJob(aDecodeJob) + : mDecodeJob(aDecodeJob) , mFunction(aFunction) , mErrorCode(aErrorCode) { @@ -79,12 +78,10 @@ enum class PhaseEnum : int class MediaDecodeTask final : public Runnable { public: - MediaDecodeTask(const MediaContainerType& aContainerType, - uint8_t* aBuffer, + MediaDecodeTask(const MediaContainerType& aContainerType, uint8_t* aBuffer, uint32_t aLength, WebAudioDecodeJob& aDecodeJob) - : Runnable("MediaDecodeTask") - , mContainerType(aContainerType) + : mContainerType(aContainerType) , mBuffer(aBuffer) , mLength(aLength) , mDecodeJob(aDecodeJob) @@ -106,8 +103,8 @@ class MediaDecodeTask final : public Runnable mDecodeJob.OnFailure(aErrorCode); } else { // Take extra care to cleanup on the main thread - mMainThread->Dispatch(NewRunnableMethod( - "MediaDecodeTask::Cleanup", this, &MediaDecodeTask::Cleanup)); + mMainThread->Dispatch(NewRunnableMethod(this, &MediaDecodeTask::Cleanup)); + nsCOMPtr event = new ReportResultTask(mDecodeJob, &WebAudioDecodeJob::OnFailure, aErrorCode); @@ -269,14 +266,13 @@ MediaDecodeTask::OnMetadataRead(MetadataHolder&& aMetadata) mContainerType.Type().AsString().Data()); } - nsCOMPtr task = NS_NewRunnableFunction( - "MediaDecodeTask::OnMetadataRead", [codec]() -> void { - MOZ_ASSERT(!codec.IsEmpty()); - MOZ_LOG(gMediaDecoderLog, - LogLevel::Debug, - ("Telemetry (WebAudio) MEDIA_CODEC_USED= '%s'", codec.get())); - Telemetry::Accumulate(Telemetry::HistogramID::MEDIA_CODEC_USED, codec); - }); + nsCOMPtr task = NS_NewRunnableFunction([codec]() -> void { + MOZ_ASSERT(!codec.IsEmpty()); + MOZ_LOG(gMediaDecoderLog, + LogLevel::Debug, + ("Telemetry (WebAudio) MEDIA_CODEC_USED= '%s'", codec.get())); + Telemetry::Accumulate(Telemetry::HistogramID::MEDIA_CODEC_USED, codec); + }); SystemGroup::Dispatch("MediaDecodeTask::OnMetadataRead()::report_telemetry", TaskCategory::Other, task.forget()); diff --git a/dom/media/webaudio/OscillatorNode.cpp b/dom/media/webaudio/OscillatorNode.cpp index 66485092d7560..7bc61fe62a2ed 100644 --- a/dom/media/webaudio/OscillatorNode.cpp +++ b/dom/media/webaudio/OscillatorNode.cpp @@ -580,10 +580,7 @@ OscillatorNode::NotifyMainThreadStreamFinished() { public: explicit EndedEventDispatcher(OscillatorNode* aNode) - : mozilla::Runnable("EndedEventDispatcher") - , mNode(aNode) - { - } + : mNode(aNode) {} NS_IMETHOD Run() override { // If it's not safe to run scripts right now, schedule this to run later diff --git a/dom/media/webaudio/PlayingRefChangeHandler.h b/dom/media/webaudio/PlayingRefChangeHandler.h index 6a832c243a81a..6436d1dbc304d 100644 --- a/dom/media/webaudio/PlayingRefChangeHandler.h +++ b/dom/media/webaudio/PlayingRefChangeHandler.h @@ -18,8 +18,7 @@ class PlayingRefChangeHandler final : public Runnable public: enum ChangeType { ADDREF, RELEASE }; PlayingRefChangeHandler(AudioNodeStream* aStream, ChangeType aChange) - : Runnable("dom::PlayingRefChangeHandler") - , mStream(aStream) + : mStream(aStream) , mChange(aChange) { } diff --git a/dom/media/webaudio/ScriptProcessorNode.cpp b/dom/media/webaudio/ScriptProcessorNode.cpp index a3a8370d5e423..41a3c99930aec 100644 --- a/dom/media/webaudio/ScriptProcessorNode.cpp +++ b/dom/media/webaudio/ScriptProcessorNode.cpp @@ -375,8 +375,7 @@ class ScriptProcessorNodeEngine final : public AudioNodeEngine Command(AudioNodeStream* aStream, already_AddRefed aInputBuffer, double aPlaybackTime) - : mozilla::Runnable("Command") - , mStream(aStream) + : mStream(aStream) , mInputBuffer(aInputBuffer) , mPlaybackTime(aPlaybackTime) { diff --git a/dom/media/webaudio/WebAudioUtils.cpp b/dom/media/webaudio/WebAudioUtils.cpp index 9bf3465b642be..6289f803b3c29 100644 --- a/dom/media/webaudio/WebAudioUtils.cpp +++ b/dom/media/webaudio/WebAudioUtils.cpp @@ -101,9 +101,8 @@ WebAudioUtils::LogToDeveloperConsole(uint64_t aWindowID, const char* aKey) // It is similar to ContentUtils::ReportToConsole, but also works off main // thread. if (!NS_IsMainThread()) { - nsCOMPtr task = NS_NewRunnableFunction( - "dom::WebAudioUtils::LogToDeveloperConsole", - [aWindowID, aKey]() { LogToDeveloperConsole(aWindowID, aKey); }); + nsCOMPtr task = + NS_NewRunnableFunction([aWindowID, aKey]() { LogToDeveloperConsole(aWindowID, aKey); }); NS_DispatchToMainThread(task.forget(), NS_DISPATCH_NORMAL); return; } diff --git a/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp b/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp index 9ad7e9b65e812..b4aee7b484b40 100644 --- a/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp +++ b/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp @@ -111,15 +111,11 @@ size_t HRTFDatabaseLoader::sizeOfIncludingThis(mozilla::MallocSizeOf aMallocSize class HRTFDatabaseLoader::ProxyReleaseEvent final : public Runnable { public: - explicit ProxyReleaseEvent(HRTFDatabaseLoader* loader) - : mozilla::Runnable("WebCore::HRTFDatabaseLoader::ProxyReleaseEvent") - , mLoader(loader) - { - } - NS_IMETHOD Run() override - { - mLoader->MainThreadRelease(); - return NS_OK; + explicit ProxyReleaseEvent(HRTFDatabaseLoader* loader) : mLoader(loader) {} + NS_IMETHOD Run() override + { + mLoader->MainThreadRelease(); + return NS_OK; } private: HRTFDatabaseLoader* mLoader; diff --git a/dom/media/webaudio/blink/ReverbConvolver.cpp b/dom/media/webaudio/blink/ReverbConvolver.cpp index 988209fa6c73a..e739400aee35e 100644 --- a/dom/media/webaudio/blink/ReverbConvolver.cpp +++ b/dom/media/webaudio/blink/ReverbConvolver.cpp @@ -151,10 +151,8 @@ ReverbConvolver::ReverbConvolver(const float* impulseResponseData, NS_WARNING("Cannot start convolver thread."); return; } - m_backgroundThread.message_loop()->PostTask(NewNonOwningRunnableMethod( - "WebCore::ReverbConvolver::backgroundThreadEntry", - this, - &ReverbConvolver::backgroundThreadEntry)); + m_backgroundThread.message_loop()->PostTask(NewNonOwningRunnableMethod(this, + &ReverbConvolver::backgroundThreadEntry)); } } diff --git a/dom/media/webrtc/MediaEngineTabVideoSource.h b/dom/media/webrtc/MediaEngineTabVideoSource.h index 16a4574259c05..afd65f48c825c 100644 --- a/dom/media/webrtc/MediaEngineTabVideoSource.h +++ b/dom/media/webrtc/MediaEngineTabVideoSource.h @@ -62,40 +62,28 @@ class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventList class StartRunnable : public Runnable { public: - explicit StartRunnable(MediaEngineTabVideoSource *videoSource) - : Runnable("MediaEngineTabVideoSource::StartRunnable") - , mVideoSource(videoSource) - {} + explicit StartRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {} NS_IMETHOD Run(); RefPtr mVideoSource; }; class StopRunnable : public Runnable { public: - explicit StopRunnable(MediaEngineTabVideoSource *videoSource) - : Runnable("MediaEngineTabVideoSource::StopRunnable") - , mVideoSource(videoSource) - {} + explicit StopRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {} NS_IMETHOD Run(); RefPtr mVideoSource; }; class InitRunnable : public Runnable { public: - explicit InitRunnable(MediaEngineTabVideoSource *videoSource) - : Runnable("MediaEngineTabVideoSource::InitRunnable") - , mVideoSource(videoSource) - {} + explicit InitRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {} NS_IMETHOD Run(); RefPtr mVideoSource; }; class DestroyRunnable : public Runnable { public: - explicit DestroyRunnable(MediaEngineTabVideoSource* videoSource) - : Runnable("MediaEngineTabVideoSource::DestroyRunnable") - , mVideoSource(videoSource) - {} + explicit DestroyRunnable(MediaEngineTabVideoSource* videoSource) : mVideoSource(videoSource) {} NS_IMETHOD Run(); RefPtr mVideoSource; }; diff --git a/dom/media/webspeech/recognition/SpeechRecognition.h b/dom/media/webspeech/recognition/SpeechRecognition.h index 806d4a8d6f7d9..08866041a8ac1 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.h +++ b/dom/media/webspeech/recognition/SpeechRecognition.h @@ -257,15 +257,13 @@ class SpeechRecognition final : public DOMEventTargetHelper, class SpeechEvent : public Runnable { public: - SpeechEvent(SpeechRecognition* aRecognition, - SpeechRecognition::EventType aType) - : Runnable("dom::SpeechEvent") - , mAudioSegment(0) - , mRecognitionResultList(nullptr) - , mError(nullptr) - , mRecognition(aRecognition) - , mType(aType) - , mTrackRate(0) + SpeechEvent(SpeechRecognition* aRecognition, SpeechRecognition::EventType aType) + : mAudioSegment(0) + , mRecognitionResultList(nullptr) + , mError(nullptr) + , mRecognition(aRecognition) + , mType(aType) + , mTrackRate(0) { } diff --git a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm index 78e16be1a2be0..557c1e9452115 100644 --- a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm +++ b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm @@ -224,8 +224,7 @@ - (void)speechSynthesizer:(NSSpeechSynthesizer*)aSender public: RegisterVoicesRunnable(OSXSpeechSynthesizerService* aSpeechService, nsTArray& aList) - : Runnable("RegisterVoicesRunnable") - , mSpeechService(aSpeechService) + : mSpeechService(aSpeechService) , mVoices(aList) { } @@ -270,8 +269,7 @@ - (void)speechSynthesizer:(NSSpeechSynthesizer*)aSender { public: explicit EnumVoicesRunnable(OSXSpeechSynthesizerService* aSpeechService) - : Runnable("EnumVoicesRunnable") - , mSpeechService(aSpeechService) + : mSpeechService(aSpeechService) { } diff --git a/dom/media/webspeech/synth/nsSpeechTask.cpp b/dom/media/webspeech/synth/nsSpeechTask.cpp index 4c6204edea499..8c02ff95192f0 100644 --- a/dom/media/webspeech/synth/nsSpeechTask.cpp +++ b/dom/media/webspeech/synth/nsSpeechTask.cpp @@ -66,16 +66,12 @@ class SynthStreamListener : public MediaStreamListener mStarted = true; aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod("dom::SynthStreamListener::DoNotifyStarted", - this, - &SynthStreamListener::DoNotifyStarted)); + NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted)); } aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod("dom::SynthStreamListener::DoNotifyFinished", - this, - &SynthStreamListener::DoNotifyFinished)); + NewRunnableMethod(this, &SynthStreamListener::DoNotifyFinished)); } break; case MediaStreamGraphEvent::EVENT_REMOVED: @@ -94,9 +90,7 @@ class SynthStreamListener : public MediaStreamListener mStarted = true; aGraph->DispatchToMainThreadAfterStreamStateUpdate( mAbstractMainThread, - NewRunnableMethod("dom::SynthStreamListener::DoNotifyStarted", - this, - &SynthStreamListener::DoNotifyStarted)); + NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted)); } } diff --git a/dom/media/webspeech/synth/pico/nsPicoService.cpp b/dom/media/webspeech/synth/pico/nsPicoService.cpp index 559a0232d7be2..c3cf812fcc45c 100644 --- a/dom/media/webspeech/synth/pico/nsPicoService.cpp +++ b/dom/media/webspeech/synth/pico/nsPicoService.cpp @@ -469,7 +469,7 @@ nsPicoService::Observe(nsISupports* aSubject, const char* aTopic, DebugOnly rv = NS_NewNamedThread("Pico Worker", getter_AddRefs(mThread)); MOZ_ASSERT(NS_SUCCEEDED(rv)); return mThread->Dispatch( - NewRunnableMethod("nsPicoService::Init", this, &nsPicoService::Init), NS_DISPATCH_NORMAL); + NewRunnableMethod(this, &nsPicoService::Init), NS_DISPATCH_NORMAL); } // nsISpeechService @@ -579,8 +579,7 @@ nsPicoService::Init() rv = dirIterator->HasMoreElements(&hasMoreElements); } - NS_DispatchToMainThread(NewRunnableMethod("nsPicoService::RegisterVoices", - this, &nsPicoService::RegisterVoices)); + NS_DispatchToMainThread(NewRunnableMethod(this, &nsPicoService::RegisterVoices)); } void diff --git a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp index ecfbd25c9caa2..77a8f7cd9394e 100644 --- a/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp +++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp @@ -273,12 +273,10 @@ speechd_cb(size_t msg_id, size_t client_id, SPDNotificationType state) SpeechDispatcherService* service = SpeechDispatcherService::GetInstance(false); if (service) { - NS_DispatchToMainThread(NewRunnableMethod( - "dom::SpeechDispatcherService::EventNotify", - service, - &SpeechDispatcherService::EventNotify, - static_cast(msg_id), - state)); + NS_DispatchToMainThread( + NewRunnableMethod( + service, &SpeechDispatcherService::EventNotify, + static_cast(msg_id), state)); } } @@ -313,10 +311,7 @@ SpeechDispatcherService::Init() getter_AddRefs(mInitThread)); MOZ_ASSERT(NS_SUCCEEDED(rv)); rv = mInitThread->Dispatch( - NewRunnableMethod("dom::SpeechDispatcherService::Setup", - this, - &SpeechDispatcherService::Setup), - NS_DISPATCH_NORMAL); + NewRunnableMethod(this, &SpeechDispatcherService::Setup), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); } @@ -424,10 +419,7 @@ SpeechDispatcherService::Setup() } } - NS_DispatchToMainThread( - NewRunnableMethod("dom::SpeechDispatcherService::RegisterVoices", - this, - &SpeechDispatcherService::RegisterVoices)); + NS_DispatchToMainThread(NewRunnableMethod(this, &SpeechDispatcherService::RegisterVoices)); //mInitialized = true; } @@ -534,16 +526,10 @@ SpeechDispatcherService::Speak(const nsAString& aText, const nsAString& aUri, // In that case, don't send empty string to speechd, // and just emulate a speechd start and end event. NS_DispatchToMainThread(NewRunnableMethod( - "dom::SpeechDispatcherCallback::OnSpeechEvent", - callback, - &SpeechDispatcherCallback::OnSpeechEvent, - SPD_EVENT_BEGIN)); + callback, &SpeechDispatcherCallback::OnSpeechEvent, SPD_EVENT_BEGIN)); NS_DispatchToMainThread(NewRunnableMethod( - "dom::SpeechDispatcherCallback::OnSpeechEvent", - callback, - &SpeechDispatcherCallback::OnSpeechEvent, - SPD_EVENT_END)); + callback, &SpeechDispatcherCallback::OnSpeechEvent, SPD_EVENT_END)); } return NS_OK; diff --git a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp index ed3e1402e5f49..582ff35510af5 100644 --- a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp +++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp @@ -141,10 +141,8 @@ FakeDirectAudioSynth::Speak(const nsAString& aText, const nsAString& aUri, class Runnable final : public mozilla::Runnable { public: - Runnable(nsISpeechTask* aTask, const nsAString& aText) - : mozilla::Runnable("Runnable") - , mTask(aTask) - , mText(aText) + Runnable(nsISpeechTask* aTask, const nsAString& aText) : + mTask(aTask), mText(aText) { } @@ -206,9 +204,8 @@ FakeIndirectAudioSynth::Speak(const nsAString& aText, const nsAString& aUri, class DispatchStart final : public Runnable { public: - explicit DispatchStart(nsISpeechTask* aTask) - : mozilla::Runnable("DispatchStart") - , mTask(aTask) + explicit DispatchStart(nsISpeechTask* aTask) : + mTask(aTask) { } @@ -226,10 +223,8 @@ FakeIndirectAudioSynth::Speak(const nsAString& aText, const nsAString& aUri, class DispatchEnd final : public Runnable { public: - DispatchEnd(nsISpeechTask* aTask, const nsAString& aText) - : mozilla::Runnable("DispatchEnd") - , mTask(aTask) - , mText(aText) + DispatchEnd(nsISpeechTask* aTask, const nsAString& aText) : + mTask(aTask), mText(aText) { } @@ -248,10 +243,8 @@ FakeIndirectAudioSynth::Speak(const nsAString& aText, const nsAString& aUri, class DispatchError final : public Runnable { public: - DispatchError(nsISpeechTask* aTask, const nsAString& aText) - : mozilla::Runnable("DispatchError") - , mTask(aTask) - , mText(aText) + DispatchError(nsISpeechTask* aTask, const nsAString& aText) : + mTask(aTask), mText(aText) { } @@ -363,8 +356,7 @@ nsFakeSynthServices::Observe(nsISupports* aSubject, const char* aTopic, } if (Preferences::GetBool("media.webspeech.synth.test")) { - NS_DispatchToMainThread(NewRunnableMethod( - "dom::nsFakeSynthServices::Init", this, &nsFakeSynthServices::Init)); + NS_DispatchToMainThread(NewRunnableMethod(this, &nsFakeSynthServices::Init)); } return NS_OK; diff --git a/dom/messagechannel/MessagePort.cpp b/dom/messagechannel/MessagePort.cpp index 0aa457883437e..37d77b5f1b830 100644 --- a/dom/messagechannel/MessagePort.cpp +++ b/dom/messagechannel/MessagePort.cpp @@ -53,8 +53,7 @@ class PostMessageRunnable final : public CancelableRunnable public: PostMessageRunnable(MessagePort* aPort, SharedMessagePortMessage* aData) - : CancelableRunnable("dom::PostMessageRunnable") - , mPort(aPort) + : mPort(aPort) , mData(aData) { MOZ_ASSERT(aPort); diff --git a/dom/network/UDPSocket.cpp b/dom/network/UDPSocket.cpp index dbb8f25fe5e94..e460428c71208 100644 --- a/dom/network/UDPSocket.cpp +++ b/dom/network/UDPSocket.cpp @@ -551,9 +551,7 @@ UDPSocket::Init(const nsString& aLocalAddress, class OpenSocketRunnable final : public Runnable { public: - explicit OpenSocketRunnable(UDPSocket* aSocket) - : mozilla::Runnable("OpenSocketRunnable") - , mSocket(aSocket) + explicit OpenSocketRunnable(UDPSocket* aSocket) : mSocket(aSocket) { } NS_IMETHOD Run() override diff --git a/dom/notification/DesktopNotification.cpp b/dom/notification/DesktopNotification.cpp index f3a59e36feb40..76f1c5afb0308 100644 --- a/dom/notification/DesktopNotification.cpp +++ b/dom/notification/DesktopNotification.cpp @@ -37,8 +37,7 @@ class DesktopNotificationRequest : public nsIContentPermissionRequest NS_DECL_NSICONTENTPERMISSIONREQUEST explicit DesktopNotificationRequest(DesktopNotification* aNotification) - : Runnable("dom::DesktopNotificationRequest") - , mDesktopNotification(aNotification) + : mDesktopNotification(aNotification) { mRequester = new nsContentPermissionRequester(mDesktopNotification->GetOwner()); } diff --git a/dom/payments/ipc/PaymentRequestParent.cpp b/dom/payments/ipc/PaymentRequestParent.cpp index 3bf215a284a2d..b2fb89d2b33cd 100644 --- a/dom/payments/ipc/PaymentRequestParent.cpp +++ b/dom/payments/ipc/PaymentRequestParent.cpp @@ -149,8 +149,7 @@ PaymentRequestParent::RespondPayment(nsIPaymentActionResponse* aResponse) nsCOMPtr self = do_QueryInterface(this); MOZ_ASSERT(self); nsCOMPtr response = aResponse; - nsCOMPtr r = NS_NewRunnableFunction("PaymentRequestParent::RespondPayment", - [self, response] () + nsCOMPtr r = NS_NewRunnableFunction([self, response] () { self->RespondPayment(response); }); diff --git a/dom/performance/Performance.cpp b/dom/performance/Performance.cpp index a835b92b8e9d4..95bfe933af9a6 100644 --- a/dom/performance/Performance.cpp +++ b/dom/performance/Performance.cpp @@ -516,8 +516,7 @@ class NotifyObserversTask final : public CancelableRunnable { public: explicit NotifyObserversTask(Performance* aPerformance) - : CancelableRunnable("dom::NotifyObserversTask") - , mPerformance(aPerformance) + : mPerformance(aPerformance) { MOZ_ASSERT(mPerformance); } diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index 1dc92619b9262..00223651cb9d6 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -887,8 +887,7 @@ java::GeckoSurface::LocalRef nsNPAPIPluginInstance::CreateSurface() return nullptr; } - nsCOMPtr frameCallback = NewRunnableMethod("nsNPAPIPluginInstance::OnSurfaceTextureFrameAvailable", - this, &nsNPAPIPluginInstance::OnSurfaceTextureFrameAvailable); + nsCOMPtr frameCallback = NewRunnableMethod(this, &nsNPAPIPluginInstance::OnSurfaceTextureFrameAvailable); java::SurfaceTextureListener::LocalRef listener = java::SurfaceTextureListener::New(); @@ -1448,11 +1447,7 @@ nsNPAPIPluginInstance::ScheduleTimer(uint32_t interval, NPBool repeat, void (*ti return 0; } const short timerType = (repeat ? (short)nsITimer::TYPE_REPEATING_SLACK : (short)nsITimer::TYPE_ONE_SHOT); - xpcomTimer->InitWithNamedFuncCallback(PluginTimerCallback, - newTimer, - interval, - timerType, - "nsNPAPIPluginInstance::ScheduleTimer"); + xpcomTimer->InitWithFuncCallback(PluginTimerCallback, newTimer, interval, timerType); newTimer->timer = xpcomTimer; // save callback function diff --git a/dom/plugins/ipc/ChildAsyncCall.cpp b/dom/plugins/ipc/ChildAsyncCall.cpp index ded84607df715..6adc05d559984 100644 --- a/dom/plugins/ipc/ChildAsyncCall.cpp +++ b/dom/plugins/ipc/ChildAsyncCall.cpp @@ -12,10 +12,8 @@ namespace mozilla { namespace plugins { ChildAsyncCall::ChildAsyncCall(PluginInstanceChild* instance, - PluginThreadCallback aFunc, - void* aUserData) - : CancelableRunnable("plugins::ChildAsyncCall") - , mInstance(instance) + PluginThreadCallback aFunc, void* aUserData) + : mInstance(instance) , mFunc(aFunc) , mData(aUserData) { diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 770fdd2f3e5c7..21b2c1dbf8dcc 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -3020,15 +3020,8 @@ PluginInstanceChild::RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType, // RPC call, and both Flash and Java don't expect to receive setwindow calls // at arbitrary times. mCurrentAsyncSetWindowTask = - NewNonOwningCancelableRunnableMethod( - "plugins::PluginInstanceChild::DoAsyncSetWindow", - this, - &PluginInstanceChild::DoAsyncSetWindow, - aSurfaceType, - aWindow, - true); + NewNonOwningCancelableRunnableMethod + (this, &PluginInstanceChild::DoAsyncSetWindow, aSurfaceType, aWindow, true); RefPtr addrefedTask = mCurrentAsyncSetWindowTask; MessageLoop::current()->PostTask(addrefedTask.forget()); @@ -3954,10 +3947,8 @@ PluginInstanceChild::AsyncShowPluginFrame(void) return; } - mCurrentInvalidateTask = NewNonOwningCancelableRunnableMethod( - "plugins::PluginInstanceChild::InvalidateRectDelayed", - this, - &PluginInstanceChild::InvalidateRectDelayed); + mCurrentInvalidateTask = + NewNonOwningCancelableRunnableMethod(this, &PluginInstanceChild::InvalidateRectDelayed); RefPtr addrefedTask = mCurrentInvalidateTask; MessageLoop::current()->PostTask(addrefedTask.forget()); } diff --git a/dom/plugins/ipc/PluginProcessParent.cpp b/dom/plugins/ipc/PluginProcessParent.cpp index 4a24abc802f5c..14d1f50b9dc15 100644 --- a/dom/plugins/ipc/PluginProcessParent.cpp +++ b/dom/plugins/ipc/PluginProcessParent.cpp @@ -124,10 +124,7 @@ PluginProcessParent::Delete() return; } - ioLoop->PostTask( - NewNonOwningRunnableMethod("plugins::PluginProcessParent::Delete", - this, - &PluginProcessParent::Delete)); + ioLoop->PostTask(NewNonOwningRunnableMethod(this, &PluginProcessParent::Delete)); } void diff --git a/dom/plugins/ipc/PluginProcessParent.h b/dom/plugins/ipc/PluginProcessParent.h index 89f1675627b48..2644c60a32b76 100644 --- a/dom/plugins/ipc/PluginProcessParent.h +++ b/dom/plugins/ipc/PluginProcessParent.h @@ -27,10 +27,9 @@ namespace plugins { class LaunchCompleteTask : public Runnable { public: - LaunchCompleteTask() - : Runnable("plugins::LaunchCompleteTask") - , mLaunchSucceeded(false) - { + LaunchCompleteTask() + : mLaunchSucceeded(false) + { } void SetLaunchSucceeded() { mLaunchSucceeded = true; } diff --git a/dom/presentation/PresentationAvailability.cpp b/dom/presentation/PresentationAvailability.cpp index e6c1e094433c5..93f27dfbfc5c8 100644 --- a/dom/presentation/PresentationAvailability.cpp +++ b/dom/presentation/PresentationAvailability.cpp @@ -172,11 +172,10 @@ PresentationAvailability::NotifyAvailableChange(const nsTArray& aAvail available |= mAvailabilityOfUrl[i]; } - return NS_DispatchToCurrentThread(NewRunnableMethod( - "dom::PresentationAvailability::UpdateAvailabilityAndDispatchEvent", - this, - &PresentationAvailability::UpdateAvailabilityAndDispatchEvent, - available)); + return NS_DispatchToCurrentThread(NewRunnableMethod + (this, + &PresentationAvailability::UpdateAvailabilityAndDispatchEvent, + available)); } void diff --git a/dom/presentation/PresentationCallbacks.cpp b/dom/presentation/PresentationCallbacks.cpp index 16813f757614f..fd0ffee31cae0 100644 --- a/dom/presentation/PresentationCallbacks.cpp +++ b/dom/presentation/PresentationCallbacks.cpp @@ -137,12 +137,11 @@ PresentationReconnectCallback::NotifySuccess(const nsAString& aUrl) } nsString sessionId = nsString(mSessionId); - return NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::PresentationReconnectCallback::NotifySuccess", - [sessionId, service]() -> void { - service->BuildTransport(sessionId, - nsIPresentationService::ROLE_CONTROLLER); - })); + return NS_DispatchToMainThread( + NS_NewRunnableFunction([sessionId, service]() -> void { + service->BuildTransport(sessionId, + nsIPresentationService::ROLE_CONTROLLER); + })); } NS_IMETHODIMP diff --git a/dom/presentation/PresentationConnection.cpp b/dom/presentation/PresentationConnection.cpp index b7b6504bffb2b..f36b506d1e97e 100644 --- a/dom/presentation/PresentationConnection.cpp +++ b/dom/presentation/PresentationConnection.cpp @@ -641,9 +641,7 @@ NS_IMETHODIMP PresentationConnection::Cancel(nsresult aStatus) { nsCOMPtr event = - NewRunnableMethod("dom::PresentationConnection::ProcessConnectionWentAway", - this, - &PresentationConnection::ProcessConnectionWentAway); + NewRunnableMethod(this, &PresentationConnection::ProcessConnectionWentAway); return NS_DispatchToCurrentThread(event); } NS_IMETHODIMP @@ -738,9 +736,8 @@ PresentationConnection::AsyncCloseConnectionWithErrorMsg(const nsAString& aMessa nsString message = nsString(aMessage); RefPtr self = this; - nsCOMPtr r = NS_NewRunnableFunction( - "dom::PresentationConnection::AsyncCloseConnectionWithErrorMsg", - [self, message]() -> void { + nsCOMPtr r = + NS_NewRunnableFunction([self, message]() -> void { // Set |mState| to |PresentationConnectionState::Closed| here to avoid // calling |ProcessStateChanged|. self->mState = PresentationConnectionState::Closed; diff --git a/dom/presentation/PresentationDeviceManager.cpp b/dom/presentation/PresentationDeviceManager.cpp index a1a76276c7c85..7e5a4700c898f 100644 --- a/dom/presentation/PresentationDeviceManager.cpp +++ b/dom/presentation/PresentationDeviceManager.cpp @@ -157,9 +157,7 @@ PresentationDeviceManager::GetAvailableDevices(nsIArray* aPresentationUrls, nsIA // Bug 1194049: some providers may discontinue discovery after timeout. // Call |ForceDiscovery()| here to make sure device lists are updated. NS_DispatchToMainThread( - NewRunnableMethod("dom::PresentationDeviceManager::ForceDiscovery", - this, - &PresentationDeviceManager::ForceDiscovery)); + NewRunnableMethod(this, &PresentationDeviceManager::ForceDiscovery)); nsTArray presentationUrls; if (aPresentationUrls) { diff --git a/dom/presentation/PresentationReceiver.cpp b/dom/presentation/PresentationReceiver.cpp index 0b9aaa40cc823..738b3758b801f 100644 --- a/dom/presentation/PresentationReceiver.cpp +++ b/dom/presentation/PresentationReceiver.cpp @@ -135,9 +135,10 @@ PresentationReceiver::GetConnectionList(ErrorResult& aRv) } RefPtr self = this; - nsresult rv = NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::PresentationReceiver::GetConnectionList", - [self]() -> void { self->CreateConnectionList(); })); + nsresult rv = + NS_DispatchToMainThread(NS_NewRunnableFunction([self] () -> void { + self->CreateConnectionList(); + })); if (NS_FAILED(rv)) { aRv.Throw(rv); return nullptr; diff --git a/dom/presentation/PresentationRequest.cpp b/dom/presentation/PresentationRequest.cpp index 2a7d7705b19aa..b5820221c0f9f 100644 --- a/dom/presentation/PresentationRequest.cpp +++ b/dom/presentation/PresentationRequest.cpp @@ -281,12 +281,12 @@ PresentationRequest::Reconnect(const nsAString& aPresentationId, } nsString presentationId = nsString(aPresentationId); - nsCOMPtr r = NewRunnableMethod>( - "dom::PresentationRequest::FindOrCreatePresentationConnection", - this, - &PresentationRequest::FindOrCreatePresentationConnection, - presentationId, - promise); + nsCOMPtr r = + NewRunnableMethod>( + this, + &PresentationRequest::FindOrCreatePresentationConnection, + presentationId, + promise); if (NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(r)))) { promise->MaybeReject(NS_ERROR_DOM_OPERATION_ERR); diff --git a/dom/presentation/PresentationService.cpp b/dom/presentation/PresentationService.cpp index 6a3751ab768a5..34030cfdb8139 100644 --- a/dom/presentation/PresentationService.cpp +++ b/dom/presentation/PresentationService.cpp @@ -1119,14 +1119,13 @@ PresentationService::UntrackSessionInfo(const nsAString& aSessionId, uint64_t windowId; nsresult rv = GetWindowIdBySessionIdInternal(aSessionId, aRole, &windowId); if (NS_SUCCEEDED(rv)) { - NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::PresentationService::UntrackSessionInfo", [windowId]() -> void { - PRES_DEBUG("Attempt to close window[%" PRIu64 "]\n", windowId); - - if (auto* window = nsGlobalWindow::GetInnerWindowWithId(windowId)) { - window->Close(); - } - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([windowId]() -> void { + PRES_DEBUG("Attempt to close window[%" PRIu64 "]\n", windowId); + + if (auto* window = nsGlobalWindow::GetInnerWindowWithId(windowId)) { + window->Close(); + } + })); } mSessionInfoAtReceiver.Remove(aSessionId); diff --git a/dom/presentation/PresentationSessionInfo.cpp b/dom/presentation/PresentationSessionInfo.cpp index 88dac827ac144..8208d073ce09d 100644 --- a/dom/presentation/PresentationSessionInfo.cpp +++ b/dom/presentation/PresentationSessionInfo.cpp @@ -111,8 +111,7 @@ PresentationNetworkHelper::OnGetWifiIPAddress(const nsACString& aIPAddress) MOZ_ASSERT(mFunc); NS_DispatchToMainThread( - NewRunnableMethod("dom::PresentationNetworkHelper::OnGetWifiIPAddress", - mInfo, + NewRunnableMethod(mInfo, mFunc, aIPAddress)); return NS_OK; @@ -685,7 +684,6 @@ PresentationControllingInfo::GetAddress() // into main thread instead of calling it directly. NS_DispatchToMainThread( NewRunnableMethod( - "dom::PresentationControllingInfo::OnGetAddress", this, &PresentationControllingInfo::OnGetAddress, NS_ConvertUTF16toUTF8(ip))); @@ -1111,11 +1109,11 @@ PresentationControllingInfo::OnListedNetworkAddresses(const char** aAddressArray // On Firefox desktop, the IP address is retrieved from a callback function. // To make consistent code sequence, following function call is dispatched // into main thread instead of calling it directly. - NS_DispatchToMainThread(NewRunnableMethod( - "dom::PresentationControllingInfo::OnGetAddress", - this, - &PresentationControllingInfo::OnGetAddress, - ip)); + NS_DispatchToMainThread( + NewRunnableMethod( + this, + &PresentationControllingInfo::OnGetAddress, + ip)); return NS_OK; } @@ -1127,11 +1125,11 @@ PresentationControllingInfo::OnListNetworkAddressesFailed() // In 1-UA case, transport channel can still be established // on loopback interface even if no network address available. - NS_DispatchToMainThread(NewRunnableMethod( - "dom::PresentationControllingInfo::OnGetAddress", - this, - &PresentationControllingInfo::OnGetAddress, - "127.0.0.1")); + NS_DispatchToMainThread( + NewRunnableMethod( + this, + &PresentationControllingInfo::OnGetAddress, + "127.0.0.1")); return NS_OK; } diff --git a/dom/presentation/PresentationTCPSessionTransport.cpp b/dom/presentation/PresentationTCPSessionTransport.cpp index 103d388cddebd..3af39e6e4232d 100644 --- a/dom/presentation/PresentationTCPSessionTransport.cpp +++ b/dom/presentation/PresentationTCPSessionTransport.cpp @@ -112,19 +112,17 @@ PresentationTCPSessionTransport::BuildTCPSenderTransport(nsISocketTransport* aTr nsCOMPtr sessionTransport = do_QueryObject(this); nsCOMPtr onSessionTransportRunnable = - NewRunnableMethod( - "nsIPresentationSessionTransportBuilderListener::OnSessionTransport", - mListener, - &nsIPresentationSessionTransportBuilderListener::OnSessionTransport, - sessionTransport); + NewRunnableMethod + (mListener, + &nsIPresentationSessionTransportBuilderListener::OnSessionTransport, + sessionTransport); NS_DispatchToCurrentThread(onSessionTransportRunnable.forget()); - nsCOMPtr setReadyStateRunnable = NewRunnableMethod( - "dom::PresentationTCPSessionTransport::SetReadyState", - this, - &PresentationTCPSessionTransport::SetReadyState, - ReadyState::OPEN); + nsCOMPtr setReadyStateRunnable = + NewRunnableMethod(this, + &PresentationTCPSessionTransport::SetReadyState, + ReadyState::OPEN); return NS_DispatchToCurrentThread(setReadyStateRunnable.forget()); } @@ -194,11 +192,10 @@ PresentationTCPSessionTransport::BuildTCPReceiverTransport(nsIPresentationChanne nsCOMPtr sessionTransport = do_QueryObject(this); nsCOMPtr runnable = - NewRunnableMethod( - "nsIPresentationSessionTransportBuilderListener::OnSessionTransport", - mListener, - &nsIPresentationSessionTransportBuilderListener::OnSessionTransport, - sessionTransport); + NewRunnableMethod + (mListener, + &nsIPresentationSessionTransportBuilderListener::OnSessionTransport, + sessionTransport); return NS_DispatchToCurrentThread(runnable.forget()); } diff --git a/dom/presentation/ipc/PresentationIPCService.cpp b/dom/presentation/ipc/PresentationIPCService.cpp index 8f0460fe27803..5e2273c3c8719 100644 --- a/dom/presentation/ipc/PresentationIPCService.cpp +++ b/dom/presentation/ipc/PresentationIPCService.cpp @@ -485,15 +485,13 @@ PresentationIPCService::UntrackSessionInfo(const nsAString& aSessionId, if (NS_SUCCEEDED(GetWindowIdBySessionIdInternal(aSessionId, aRole, &windowId))) { - NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::PresentationIPCService::UntrackSessionInfo", - [windowId]() -> void { - PRES_DEBUG("Attempt to close window[%" PRIu64 "]\n", windowId); - - if (auto* window = nsGlobalWindow::GetInnerWindowWithId(windowId)) { - window->Close(); - } - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([windowId]() -> void { + PRES_DEBUG("Attempt to close window[%" PRIu64 "]\n", windowId); + + if (auto* window = nsGlobalWindow::GetInnerWindowWithId(windowId)) { + window->Close(); + } + })); } } diff --git a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp index 701599a980eb2..ddd5939bb4dd4 100644 --- a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp +++ b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp @@ -834,10 +834,8 @@ MulticastDNSDeviceProvider::OnRegistrationFailed(nsIDNSServiceInfo* aServiceInfo mRegisterRequest = nullptr; if (aErrorCode == nsIDNSRegistrationListener::ERROR_SERVICE_NOT_RUNNING) { - return NS_DispatchToMainThread(NewRunnableMethod( - "dom::presentation::MulticastDNSDeviceProvider::RegisterMDNSService", - this, - &MulticastDNSDeviceProvider::RegisterMDNSService)); + return NS_DispatchToMainThread( + NewRunnableMethod(this, &MulticastDNSDeviceProvider::RegisterMDNSService)); } return NS_OK; diff --git a/dom/promise/PromiseDebugging.cpp b/dom/promise/PromiseDebugging.cpp index 6ed9012562807..f3ec33e8bfe89 100644 --- a/dom/promise/PromiseDebugging.cpp +++ b/dom/promise/PromiseDebugging.cpp @@ -24,8 +24,6 @@ namespace dom { class FlushRejections: public CancelableRunnable { public: - FlushRejections() : CancelableRunnable("dom::FlushRejections") {} - static void Init() { if (!sDispatched.init()) { MOZ_CRASH("Could not initialize FlushRejections::sDispatched"); diff --git a/dom/push/PushManager.cpp b/dom/push/PushManager.cpp index d150a8daff505..ef7823c0515c4 100644 --- a/dom/push/PushManager.cpp +++ b/dom/push/PushManager.cpp @@ -272,8 +272,7 @@ class GetSubscriptionRunnable final : public Runnable const nsAString& aScope, PushManager::SubscriptionAction aAction, nsTArray&& aAppServerKey) - : Runnable("dom::GetSubscriptionRunnable") - , mProxy(aProxy) + : mProxy(aProxy) , mScope(aScope) , mAction(aAction) , mAppServerKey(Move(aAppServerKey)) @@ -401,8 +400,7 @@ class PermissionStateRunnable final : public Runnable { public: explicit PermissionStateRunnable(PromiseWorkerProxy* aProxy) - : Runnable("dom::PermissionStateRunnable") - , mProxy(aProxy) + : mProxy(aProxy) {} NS_IMETHOD diff --git a/dom/push/PushSubscription.cpp b/dom/push/PushSubscription.cpp index 660d1c580cf1b..bfe8b5dd97302 100644 --- a/dom/push/PushSubscription.cpp +++ b/dom/push/PushSubscription.cpp @@ -141,9 +141,9 @@ NS_IMPL_ISUPPORTS(WorkerUnsubscribeResultCallback, nsIUnsubscribeResultCallback) class UnsubscribeRunnable final : public Runnable { public: - UnsubscribeRunnable(PromiseWorkerProxy* aProxy, const nsAString& aScope) - : Runnable("dom::UnsubscribeRunnable") - , mProxy(aProxy) + UnsubscribeRunnable(PromiseWorkerProxy* aProxy, + const nsAString& aScope) + : mProxy(aProxy) , mScope(aScope) { MOZ_ASSERT(aProxy); diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index 0beef549ca936..32acf1f131d72 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -378,8 +378,7 @@ class QuotaObject::StoragePressureRunnable final public: explicit StoragePressureRunnable(uint64_t aUsage) - : Runnable("dom::quota::QuotaObject::StoragePressureRunnable") - , mUsage(aUsage) + : mUsage(aUsage) { } private: @@ -411,8 +410,7 @@ class QuotaManager::CreateRunnable final public: CreateRunnable() - : Runnable("dom::quota::QuotaManager::CreateRunnable") - , mResultCode(NS_OK) + : mResultCode(NS_OK) , mState(State::Initial) { AssertIsOnBackgroundThread(); @@ -457,8 +455,7 @@ class QuotaManager::ShutdownRunnable final public: explicit ShutdownRunnable(bool& aDone) - : Runnable("dom::quota::QuotaManager::ShutdownRunnable") - , mDone(aDone) + : mDone(aDone) { MOZ_ASSERT(NS_IsMainThread()); } @@ -792,9 +789,8 @@ class OriginOperationBase protected: explicit OriginOperationBase( - nsIEventTarget* aOwningThread = GetCurrentThreadEventTarget()) + nsIEventTarget* aOwningThread = GetCurrentThreadEventTarget()) : BackgroundThreadObject(aOwningThread) - , Runnable("dom::quota::OriginOperationBase") , mResultCode(NS_OK) , mState(State_Initial) , mActorDestroyed(false) @@ -1564,9 +1560,9 @@ class StorageDirectoryHelper const bool mPersistent; public: - StorageDirectoryHelper(nsIFile* aDirectory, bool aPersistent) - : Runnable("dom::quota::StorageDirectoryHelper") - , mMutex("StorageDirectoryHelper::mMutex") + StorageDirectoryHelper(nsIFile* aDirectory, + bool aPersistent) + : mMutex("StorageDirectoryHelper::mMutex") , mCondVar(mMutex, "StorageDirectoryHelper::mCondVar") , mMainThreadResultCode(NS_OK) , mWaiting(true) @@ -3653,9 +3649,7 @@ QuotaManager::Shutdown() // QuotaManager on the IO thread. This should probably use // NewNonOwningRunnableMethod ... RefPtr runnable = - NewRunnableMethod("dom::quota::QuotaManager::ReleaseIOThreadObjects", - this, - &QuotaManager::ReleaseIOThreadObjects); + NewRunnableMethod(this, &QuotaManager::ReleaseIOThreadObjects); MOZ_ASSERT(runnable); // Give clients a chance to cleanup IO thread only objects. @@ -5891,12 +5885,11 @@ GroupInfoPair::GetGroupInfoForPersistenceType(PersistenceType aPersistenceType) CollectOriginsHelper::CollectOriginsHelper(mozilla::Mutex& aMutex, uint64_t aMinSizeToBeFreed) - : Runnable("dom::quota::CollectOriginsHelper") - , mMinSizeToBeFreed(aMinSizeToBeFreed) - , mMutex(aMutex) - , mCondVar(aMutex, "CollectOriginsHelper::mCondVar") - , mSizeToBeFreed(0) - , mWaiting(true) +: mMinSizeToBeFreed(aMinSizeToBeFreed), + mMutex(aMutex), + mCondVar(aMutex, "CollectOriginsHelper::mCondVar"), + mSizeToBeFreed(0), + mWaiting(true) { MOZ_ASSERT(!NS_IsMainThread(), "Wrong thread!"); mMutex.AssertCurrentThreadOwns(); @@ -6515,9 +6508,7 @@ Quota::RecvStartIdleMaintenance() QuotaManager* quotaManager = QuotaManager::Get(); if (!quotaManager) { nsCOMPtr callback = - NewRunnableMethod("dom::quota::Quota::StartIdleMaintenance", - this, - &Quota::StartIdleMaintenance); + NewRunnableMethod(this, &Quota::StartIdleMaintenance); QuotaManager::GetOrCreate(callback); return IPC_OK(); diff --git a/dom/quota/QuotaManagerService.cpp b/dom/quota/QuotaManagerService.cpp index eb2dbf8c21bdd..01be3f87e203b 100644 --- a/dom/quota/QuotaManagerService.cpp +++ b/dom/quota/QuotaManagerService.cpp @@ -86,8 +86,7 @@ class AbortOperationsRunnable final public: explicit AbortOperationsRunnable(ContentParentId aContentParentId) - : Runnable("dom::quota::AbortOperationsRunnable") - , mContentParentId(aContentParentId) + : mContentParentId(aContentParentId) { } private: diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp index f00c46bbd0f1a..075be452117e2 100644 --- a/dom/script/ScriptLoader.cpp +++ b/dom/script/ScriptLoader.cpp @@ -1050,9 +1050,9 @@ class ScriptRequestProcessor : public Runnable RefPtr mLoader; RefPtr mRequest; public: - ScriptRequestProcessor(ScriptLoader* aLoader, ScriptLoadRequest* aRequest) - : Runnable("dom::ScriptRequestProcessor") - , mLoader(aLoader) + ScriptRequestProcessor(ScriptLoader* aLoader, + ScriptLoadRequest* aRequest) + : mLoader(aLoader) , mRequest(aRequest) {} NS_IMETHOD Run() override @@ -1207,8 +1207,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement) if (!scriptURI) { // Asynchronously report the failure to create a URI object NS_DispatchToCurrentThread( - NewRunnableMethod("nsIScriptElement::FireErrorEvent", - aElement, + NewRunnableMethod(aElement, &nsIScriptElement::FireErrorEvent)); return false; } @@ -1298,8 +1297,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement) // Asynchronously report the load failure NS_DispatchToCurrentThread( - NewRunnableMethod("nsIScriptElement::FireErrorEvent", - aElement, + NewRunnableMethod(aElement, &nsIScriptElement::FireErrorEvent)); return false; } @@ -1484,8 +1482,7 @@ class NotifyOffThreadScriptLoadCompletedRunnable : public Runnable public: NotifyOffThreadScriptLoadCompletedRunnable(ScriptLoadRequest* aRequest, ScriptLoader* aLoader) - : Runnable("dom::NotifyOffThreadScriptLoadCompletedRunnable") - , mRequest(aRequest) + : mRequest(aRequest) , mLoader(aLoader) , mDocGroup(aLoader->GetDocGroup()) , mToken(nullptr) @@ -2414,10 +2411,8 @@ void ScriptLoader::ProcessPendingRequestsAsync() { if (HasPendingRequests()) { - nsCOMPtr task = - NewRunnableMethod("dom::ScriptLoader::ProcessPendingRequests", - this, - &ScriptLoader::ProcessPendingRequests); + nsCOMPtr task = NewRunnableMethod(this, + &ScriptLoader::ProcessPendingRequests); if (mDocument) { mDocument->Dispatch("ScriptLoader", TaskCategory::Other, task.forget()); } else { diff --git a/dom/security/nsCSPContext.cpp b/dom/security/nsCSPContext.cpp index c1f00a6bfbfac..e844ab9cd3955 100644 --- a/dom/security/nsCSPContext.cpp +++ b/dom/security/nsCSPContext.cpp @@ -1075,8 +1075,7 @@ class CSPReportSenderRunnable final : public Runnable const nsAString& aScriptSample, uint32_t aLineNum, nsCSPContext* aCSPContext) - : mozilla::Runnable("CSPReportSenderRunnable") - , mBlockedContentSource(aBlockedContentSource) + : mBlockedContentSource(aBlockedContentSource) , mOriginalURI(aOriginalURI) , mViolatedPolicyIndex(aViolatedPolicyIndex) , mReportOnlyFlag(aReportOnlyFlag) diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index ea8327b3a474d..92f6edf40bc0f 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -119,13 +119,8 @@ enum MixedContentHSTSPrimingState { class nsMixedContentEvent : public Runnable { public: - nsMixedContentEvent(nsISupports* aContext, - MixedContentTypes aType, - bool aRootHasSecureConnection) - : mozilla::Runnable("nsMixedContentEvent") - , mContext(aContext) - , mType(aType) - , mRootHasSecureConnection(aRootHasSecureConnection) + nsMixedContentEvent(nsISupports *aContext, MixedContentTypes aType, bool aRootHasSecureConnection) + : mContext(aContext), mType(aType), mRootHasSecureConnection(aRootHasSecureConnection) {} NS_IMETHOD Run() override diff --git a/dom/smil/nsSMILTimedElement.cpp b/dom/smil/nsSMILTimedElement.cpp index bfa5d0eb74a58..120536be07475 100644 --- a/dom/smil/nsSMILTimedElement.cpp +++ b/dom/smil/nsSMILTimedElement.cpp @@ -87,11 +87,9 @@ namespace int32_t mDetail; public: - AsyncTimeEventRunner(nsIContent* aTarget, - EventMessage aMsg, + AsyncTimeEventRunner(nsIContent* aTarget, EventMessage aMsg, int32_t aDetail) - : mozilla::Runnable("AsyncTimeEventRunner") - , mTarget(aTarget) + : mTarget(aTarget) , mMsg(aMsg) , mDetail(aDetail) { diff --git a/dom/storage/LocalStorageCache.cpp b/dom/storage/LocalStorageCache.cpp index 8f785266ccd03..2a4a34b79a452 100644 --- a/dom/storage/LocalStorageCache.cpp +++ b/dom/storage/LocalStorageCache.cpp @@ -111,9 +111,8 @@ LocalStorageCache::Release(void) return; } - RefPtr> event = - NewNonOwningRunnableMethod("dom::LocalStorageCacheBridge::Release", - static_cast(this), + RefPtr > event = + NewNonOwningRunnableMethod(static_cast(this), &LocalStorageCacheBridge::Release); nsresult rv = NS_DispatchToMainThread(event); @@ -626,8 +625,7 @@ class LoadUsageRunnable : public Runnable { public: LoadUsageRunnable(int64_t* aUsage, const int64_t aDelta) - : Runnable("dom::LoadUsageRunnable") - , mTarget(aUsage) + : mTarget(aUsage) , mDelta(aDelta) {} diff --git a/dom/storage/StorageDBThread.cpp b/dom/storage/StorageDBThread.cpp index 5de22c50b96fe..a85ee56a3e75e 100644 --- a/dom/storage/StorageDBThread.cpp +++ b/dom/storage/StorageDBThread.cpp @@ -723,10 +723,8 @@ StorageDBThread::NotifyFlushCompletion() { #ifdef DOM_STORAGE_TESTS if (!NS_IsMainThread()) { - RefPtr> event = - NewNonOwningRunnableMethod("dom::StorageDBThread::NotifyFlushCompletion", - this, - &StorageDBThread::NotifyFlushCompletion); + RefPtr > event = + NewNonOwningRunnableMethod(this, &StorageDBThread::NotifyFlushCompletion); NS_DispatchToMainThread(event); return; } diff --git a/dom/storage/StorageIPC.cpp b/dom/storage/StorageIPC.cpp index 928354114d860..603d578918bd8 100644 --- a/dom/storage/StorageIPC.cpp +++ b/dom/storage/StorageIPC.cpp @@ -315,8 +315,7 @@ class SendInitialChildDataRunnable : public Runnable { public: explicit SendInitialChildDataRunnable(StorageDBParent* aParent) - : Runnable("dom::SendInitialChildDataRunnable") - , mParent(aParent) + : mParent(aParent) {} private: @@ -646,13 +645,12 @@ class LoadRunnable : public Runnable const nsACString& aOriginNoSuffix, const nsAString& aKey = EmptyString(), const nsAString& aValue = EmptyString()) - : Runnable("dom::LoadRunnable") - , mParent(aParent) - , mType(aType) - , mSuffix(aOriginSuffix) - , mOrigin(aOriginNoSuffix) - , mKey(aKey) - , mValue(aValue) + : mParent(aParent) + , mType(aType) + , mSuffix(aOriginSuffix) + , mOrigin(aOriginNoSuffix) + , mKey(aKey) + , mValue(aValue) { } LoadRunnable(StorageDBParent* aParent, @@ -660,12 +658,11 @@ class LoadRunnable : public Runnable const nsACString& aOriginSuffix, const nsACString& aOriginNoSuffix, nsresult aRv) - : Runnable("dom::LoadRunnable") - , mParent(aParent) - , mType(aType) - , mSuffix(aOriginSuffix) - , mOrigin(aOriginNoSuffix) - , mRv(aRv) + : mParent(aParent) + , mType(aType) + , mSuffix(aOriginSuffix) + , mOrigin(aOriginNoSuffix) + , mRv(aRv) { } private: @@ -753,11 +750,9 @@ namespace { class UsageRunnable : public Runnable { public: - UsageRunnable(StorageDBParent* aParent, - const nsACString& aOriginScope, + UsageRunnable(StorageDBParent* aParent, const nsACString& aOriginScope, const int64_t& aUsage) - : Runnable("dom::UsageRunnable") - , mParent(aParent) + : mParent(aParent) , mOriginScope(aOriginScope) , mUsage(aUsage) {} diff --git a/dom/svg/SVGFEImageElement.cpp b/dom/svg/SVGFEImageElement.cpp index 75854739e41bb..ed6d2cca1539b 100644 --- a/dom/svg/SVGFEImageElement.cpp +++ b/dom/svg/SVGFEImageElement.cpp @@ -172,9 +172,7 @@ SVGFEImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, ClearBrokenState(); RemoveStatesSilently(NS_EVENT_STATE_BROKEN); nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::SVGFEImageElement::MaybeLoadSVGImage", - this, - &SVGFEImageElement::MaybeLoadSVGImage)); + NewRunnableMethod(this, &SVGFEImageElement::MaybeLoadSVGImage)); } return rv; diff --git a/dom/svg/SVGImageElement.cpp b/dom/svg/SVGImageElement.cpp index 8dea0ca89a670..6f3ffd7847c83 100644 --- a/dom/svg/SVGImageElement.cpp +++ b/dom/svg/SVGImageElement.cpp @@ -203,9 +203,7 @@ SVGImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, ClearBrokenState(); RemoveStatesSilently(NS_EVENT_STATE_BROKEN); nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::SVGImageElement::MaybeLoadSVGImage", - this, - &SVGImageElement::MaybeLoadSVGImage)); + NewRunnableMethod(this, &SVGImageElement::MaybeLoadSVGImage)); } return rv; diff --git a/dom/svg/SVGStyleElement.cpp b/dom/svg/SVGStyleElement.cpp index f0332a8923186..22fb204dff951 100644 --- a/dom/svg/SVGStyleElement.cpp +++ b/dom/svg/SVGStyleElement.cpp @@ -78,8 +78,7 @@ SVGStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, NS_ENSURE_SUCCESS(rv, rv); void (SVGStyleElement::*update)() = &SVGStyleElement::UpdateStyleSheetInternal; - nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::SVGStyleElement::BindToTree", this, update)); + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update)); return rv; } diff --git a/dom/system/nsDeviceSensors.cpp b/dom/system/nsDeviceSensors.cpp index bb8b28068f043..739f67a07aa7f 100644 --- a/dom/system/nsDeviceSensors.cpp +++ b/dom/system/nsDeviceSensors.cpp @@ -139,10 +139,10 @@ NS_IMETHODIMP nsDeviceSensors::HasWindowListener(uint32_t aType, nsIDOMWindow *a class DeviceSensorTestEvent : public Runnable { public: - DeviceSensorTestEvent(nsDeviceSensors* aTarget, uint32_t aType) - : mozilla::Runnable("DeviceSensorTestEvent") - , mTarget(aTarget) - , mType(aType) + DeviceSensorTestEvent(nsDeviceSensors* aTarget, + uint32_t aType) + : mTarget(aTarget) + , mType(aType) { } diff --git a/dom/u2f/U2F.cpp b/dom/u2f/U2F.cpp index f0a216a69a949..0d1aaaaba88f0 100644 --- a/dom/u2f/U2F.cpp +++ b/dom/u2f/U2F.cpp @@ -163,12 +163,10 @@ U2FStatus::GetResponse() return mResponse; } -U2FTask::U2FTask(const nsAString& aOrigin, - const nsAString& aAppId, +U2FTask::U2FTask(const nsAString& aOrigin, const nsAString& aAppId, const Authenticator& aAuthenticator, nsISerialEventTarget* aEventTarget) - : Runnable("dom::U2FTask") - , mOrigin(aOrigin) + : mOrigin(aOrigin) , mAppId(aAppId) , mAuthenticator(aAuthenticator) , mEventTarget(aEventTarget) @@ -192,8 +190,7 @@ U2FTask::Execute() U2FPrepTask::U2FPrepTask(const Authenticator& aAuthenticator, nsISerialEventTarget* aEventTarget) - : Runnable("dom::U2FPrepTask") - , mAuthenticator(aAuthenticator) + : mAuthenticator(aAuthenticator) , mEventTarget(aEventTarget) {} @@ -447,8 +444,7 @@ U2FSignTask::Run() U2FRunnable::U2FRunnable(const nsAString& aOrigin, const nsAString& aAppId, nsISerialEventTarget* aEventTarget) - : Runnable("dom::U2FRunnable") - , mOrigin(aOrigin) + : mOrigin(aOrigin) , mAppId(aAppId) , mEventTarget(aEventTarget) {} @@ -681,14 +677,14 @@ U2FRegisterRunnable::Run() if (status->IsStopped()) { status->WaitGroupAdd(); mEventTarget->Dispatch(NS_NewRunnableFunction( - "dom::U2FRegisterRunnable::Run", [&status, this] () { RegisterResponse response; response.mErrorCode.Construct( static_cast(status->GetErrorCode())); SendResponse(response); status->WaitGroupDone(); - })); + } + )); // Don't exit until the main thread runnable completes status->WaitGroupWait(); @@ -744,7 +740,6 @@ U2FRegisterRunnable::Run() // Transmit back to the JS engine from the Main Thread status->WaitGroupAdd(); mEventTarget->Dispatch(NS_NewRunnableFunction( - "dom::U2FRegisterRunnable::Run", [&status, this] () { RegisterResponse response; if (status->GetErrorCode() == ErrorCode::OK) { @@ -755,7 +750,8 @@ U2FRegisterRunnable::Run() } SendResponse(response); status->WaitGroupDone(); - })); + } + )); // TODO: Add timeouts, Bug 1301793 status->WaitGroupWait(); @@ -927,7 +923,6 @@ U2FSignRunnable::Run() // Transmit back to the JS engine from the Main Thread status->WaitGroupAdd(); mEventTarget->Dispatch(NS_NewRunnableFunction( - "dom::U2FSignRunnable::Run", [&status, this] () { SignResponse response; if (status->GetErrorCode() == ErrorCode::OK) { @@ -938,7 +933,8 @@ U2FSignRunnable::Run() } SendResponse(response); status->WaitGroupDone(); - })); + } + )); // TODO: Add timeouts, Bug 1301793 status->WaitGroupWait(); diff --git a/dom/url/URLMainThread.cpp b/dom/url/URLMainThread.cpp index 7d33c2bb30c99..39f5bd3a69635 100644 --- a/dom/url/URLMainThread.cpp +++ b/dom/url/URLMainThread.cpp @@ -125,8 +125,8 @@ URLMainThread::CreateObjectURL(const GlobalObject& aGlobal, return; } - nsCOMPtr revocation = - NS_NewRunnableFunction("dom::URLMainThread::CreateObjectURL", [url] { + nsCOMPtr revocation = NS_NewRunnableFunction( + [url] { nsHostObjectProtocolHandler::RemoveDataEntry(url); }); diff --git a/dom/url/URLWorker.cpp b/dom/url/URLWorker.cpp index 0e66489033e1e..0fc8f86d609b9 100644 --- a/dom/url/URLWorker.cpp +++ b/dom/url/URLWorker.cpp @@ -279,8 +279,7 @@ class TeardownURLRunnable : public Runnable { public: explicit TeardownURLRunnable(URLWorker::URLProxy* aURLProxy) - : Runnable("dom::TeardownURLRunnable") - , mURLProxy(aURLProxy) + : mURLProxy(aURLProxy) { } diff --git a/dom/webauthn/U2FSoftTokenManager.cpp b/dom/webauthn/U2FSoftTokenManager.cpp index a92c642853fec..0de3b2fac9720 100644 --- a/dom/webauthn/U2FSoftTokenManager.cpp +++ b/dom/webauthn/U2FSoftTokenManager.cpp @@ -234,7 +234,6 @@ U2FSoftTokenManager::GetOrCreateWrappingKey(const UniquePK11SlotInfo& aSlot, ("Key stored, nickname set to %s.", mSecretNickname.get())); GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction( - "dom::U2FSoftTokenManager::GetOrCreateWrappingKey", [] () { MOZ_ASSERT(NS_IsMainThread()); Preferences::SetUint(PREF_U2F_NSSTOKEN_COUNTER, 0); @@ -798,7 +797,6 @@ U2FSoftTokenManager::Sign(const nsTArray& aApplication, counterItem.data[3] = (mCounter >> 0) & 0xFF; uint32_t counter = mCounter; GetMainThreadEventTarget()->Dispatch(NS_NewRunnableFunction( - "dom::U2FSoftTokenManager::Sign", [counter] () { MOZ_ASSERT(NS_IsMainThread()); Preferences::SetUint(PREF_U2F_NSSTOKEN_COUNTER, counter); diff --git a/dom/webbrowserpersist/WebBrowserPersistDocumentParent.cpp b/dom/webbrowserpersist/WebBrowserPersistDocumentParent.cpp index 66073c0aed3b8..a54b1f4f2d5fc 100644 --- a/dom/webbrowserpersist/WebBrowserPersistDocumentParent.cpp +++ b/dom/webbrowserpersist/WebBrowserPersistDocumentParent.cpp @@ -44,11 +44,9 @@ WebBrowserPersistDocumentParent::ActorDestroy(ActorDestroyReason aWhy) // dropping the last reference to another document's // WebBrowserPersistRemoteDocument. To avoid that, defer the // callback until after the entire subtree is destroyed. - nsCOMPtr errorLater = NewRunnableMethod( - "nsIWebBrowserPersistDocumentReceiver::OnError", - mOnReady, - &nsIWebBrowserPersistDocumentReceiver::OnError, - NS_ERROR_FAILURE); + nsCOMPtr errorLater = NewRunnableMethod + (mOnReady, &nsIWebBrowserPersistDocumentReceiver::OnError, + NS_ERROR_FAILURE); NS_DispatchToCurrentThread(errorLater); mOnReady = nullptr; } diff --git a/dom/webbrowserpersist/WebBrowserPersistResourcesParent.cpp b/dom/webbrowserpersist/WebBrowserPersistResourcesParent.cpp index 2c5194dce8884..94e0b2c919084 100644 --- a/dom/webbrowserpersist/WebBrowserPersistResourcesParent.cpp +++ b/dom/webbrowserpersist/WebBrowserPersistResourcesParent.cpp @@ -31,13 +31,10 @@ WebBrowserPersistResourcesParent::ActorDestroy(ActorDestroyReason aWhy) if (aWhy != Deletion && mVisitor) { // See comment in WebBrowserPersistDocumentParent::ActorDestroy // (or bug 1202887) for why this is deferred. - nsCOMPtr errorLater = - NewRunnableMethod, nsresult>( - "nsIWebBrowserPersistResourceVisitor::EndVisit", - mVisitor, - &nsIWebBrowserPersistResourceVisitor::EndVisit, - mDocument, - NS_ERROR_FAILURE); + nsCOMPtr errorLater = NewRunnableMethod + , nsresult> + (mVisitor, &nsIWebBrowserPersistResourceVisitor::EndVisit, + mDocument, NS_ERROR_FAILURE); NS_DispatchToCurrentThread(errorLater); } mVisitor = nullptr; diff --git a/dom/webbrowserpersist/WebBrowserPersistSerializeParent.cpp b/dom/webbrowserpersist/WebBrowserPersistSerializeParent.cpp index c4b179d292866..f723145e29e28 100644 --- a/dom/webbrowserpersist/WebBrowserPersistSerializeParent.cpp +++ b/dom/webbrowserpersist/WebBrowserPersistSerializeParent.cpp @@ -75,18 +75,11 @@ WebBrowserPersistSerializeParent::ActorDestroy(ActorDestroyReason aWhy) MOZ_ASSERT(aWhy != Deletion); // See comment in WebBrowserPersistDocumentParent::ActorDestroy // (or bug 1202887) for why this is deferred. - nsCOMPtr errorLater = - NewRunnableMethod, - nsCOMPtr, - nsCString, - nsresult>( - "nsIWebBrowserPersistWriteCompletion::OnFinish", - mFinish, - &nsIWebBrowserPersistWriteCompletion::OnFinish, - mDocument, - mStream, - EmptyCString(), - NS_ERROR_FAILURE); + nsCOMPtr errorLater = NewRunnableMethod + , nsCOMPtr, + nsCString, nsresult> + (mFinish, &nsIWebBrowserPersistWriteCompletion::OnFinish, + mDocument, mStream, EmptyCString(), NS_ERROR_FAILURE); NS_DispatchToCurrentThread(errorLater); mFinish = nullptr; } diff --git a/dom/webbrowserpersist/nsWebBrowserPersist.cpp b/dom/webbrowserpersist/nsWebBrowserPersist.cpp index fdde2e56e24bd..20d9a21ee4dbe 100644 --- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp +++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp @@ -675,10 +675,8 @@ nsWebBrowserPersist::SerializeNextFile() // Finish and clean things up. Defer this because the caller // may have been expecting to use the listeners that that // method will clear. - NS_DispatchToCurrentThread( - NewRunnableMethod("nsWebBrowserPersist::FinishDownload", - this, - &nsWebBrowserPersist::FinishDownload)); + NS_DispatchToCurrentThread(NewRunnableMethod(this, + &nsWebBrowserPersist::FinishDownload)); return; } @@ -789,10 +787,8 @@ nsWebBrowserPersist::OnWrite::OnFinish(nsIWebBrowserPersistDocument* aDoc, return NS_OK; } } - NS_DispatchToCurrentThread( - NewRunnableMethod("nsWebBrowserPersist::SerializeNextFile", - mParent, - &nsWebBrowserPersist::SerializeNextFile)); + NS_DispatchToCurrentThread(NewRunnableMethod(mParent, + &nsWebBrowserPersist::SerializeNextFile)); return NS_OK; } @@ -1794,11 +1790,9 @@ nsWebBrowserPersist::FinishSaveDocumentInternal(nsIURI* aFile, // Bounce this off the event loop to avoid stack overflow. typedef StoreCopyPassByRRef WalkStorage; auto saveMethod = &nsWebBrowserPersist::SaveDocumentDeferred; - nsCOMPtr saveLater = NewRunnableMethod( - "nsWebBrowserPersist::FinishSaveDocumentInternal", - this, - saveMethod, - mozilla::Move(toWalk)); + nsCOMPtr saveLater = + NewRunnableMethod(this, saveMethod, + mozilla::Move(toWalk)); NS_DispatchToCurrentThread(saveLater); } else { // Done walking DOMs; on to the serialization phase. diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index a52e83df1c696..2e2d4f3bf5a31 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -1254,10 +1254,7 @@ class WorkerThreadPrimaryRunnable final : public Runnable WorkerThreadPrimaryRunnable(WorkerPrivate* aWorkerPrivate, WorkerThread* aThread, JSRuntime* aParentRuntime) - : mozilla::Runnable("WorkerThreadPrimaryRunnable") - , mWorkerPrivate(aWorkerPrivate) - , mThread(aThread) - , mParentRuntime(aParentRuntime) + : mWorkerPrivate(aWorkerPrivate), mThread(aThread), mParentRuntime(aParentRuntime) { MOZ_ASSERT(aWorkerPrivate); MOZ_ASSERT(aThread); diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 8a612804ca6bf..5bbb428bbc5b0 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -762,8 +762,7 @@ class ScriptLoaderRunnable final : public nsIRunnable, mCanceled = true; MOZ_ALWAYS_SUCCEEDS( - NS_DispatchToMainThread(NewRunnableMethod("ScriptLoaderRunnable::CancelMainThreadWithBindingAborted", - this, + NS_DispatchToMainThread(NewRunnableMethod(this, &ScriptLoaderRunnable::CancelMainThreadWithBindingAborted))); } diff --git a/dom/workers/ServiceWorkerClient.cpp b/dom/workers/ServiceWorkerClient.cpp index 68d4a7ec56808..07ed5d07394ce 100644 --- a/dom/workers/ServiceWorkerClient.cpp +++ b/dom/workers/ServiceWorkerClient.cpp @@ -137,9 +137,7 @@ class ServiceWorkerClientPostMessageRunnable final ServiceWorkerClientPostMessageRunnable(uint64_t aSourceID, const nsACString& aSourceScope, uint64_t aWindowId) - : mozilla::Runnable("ServiceWorkerClientPostMessageRunnable") - , StructuredCloneHolder(CloningSupported, - TransferringSupported, + : StructuredCloneHolder(CloningSupported, TransferringSupported, StructuredCloneScope::SameProcessDifferentThread) , mSourceID(aSourceID) , mSourceScope(aSourceScope) diff --git a/dom/workers/ServiceWorkerClients.cpp b/dom/workers/ServiceWorkerClients.cpp index a9b8c6efe5e44..e32a6e98e7f39 100644 --- a/dom/workers/ServiceWorkerClients.cpp +++ b/dom/workers/ServiceWorkerClients.cpp @@ -111,10 +111,10 @@ class GetRunnable final : public Runnable RefPtr mPromiseProxy; nsString mClientId; public: - GetRunnable(PromiseWorkerProxy* aPromiseProxy, const nsAString& aClientId) - : mozilla::Runnable("GetRunnable") - , mPromiseProxy(aPromiseProxy) - , mClientId(aClientId) + GetRunnable(PromiseWorkerProxy* aPromiseProxy, + const nsAString& aClientId) + : mPromiseProxy(aPromiseProxy), + mClientId(aClientId) { } @@ -201,11 +201,10 @@ class MatchAllRunnable final : public Runnable const nsCString& aScope, uint64_t aServiceWorkerID, bool aIncludeUncontrolled) - : mozilla::Runnable("MatchAllRunnable") - , mPromiseProxy(aPromiseProxy) - , mScope(aScope) - , mServiceWorkerID(aServiceWorkerID) - , mIncludeUncontrolled(aIncludeUncontrolled) + : mPromiseProxy(aPromiseProxy), + mScope(aScope), + mServiceWorkerID(aServiceWorkerID), + mIncludeUncontrolled(aIncludeUncontrolled) { MOZ_ASSERT(mPromiseProxy); } @@ -280,8 +279,7 @@ class ClaimRunnable final : public Runnable public: ClaimRunnable(PromiseWorkerProxy* aPromiseProxy, const nsCString& aScope) - : mozilla::Runnable("ClaimRunnable") - , mPromiseProxy(aPromiseProxy) + : mPromiseProxy(aPromiseProxy) , mScope(aScope) // Safe to call GetWorkerPrivate() since we are being called on the worker // thread via script (so no clean up has occured yet). @@ -510,8 +508,7 @@ class OpenWindowRunnable final : public Runnable OpenWindowRunnable(PromiseWorkerProxy* aPromiseProxy, const nsAString& aUrl, const nsAString& aScope) - : mozilla::Runnable("OpenWindowRunnable") - , mPromiseProxy(aPromiseProxy) + : mPromiseProxy(aPromiseProxy) , mUrl(aUrl) , mScope(aScope) { diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp index 6d317a492b5ef..e0f25e6cfab0d 100644 --- a/dom/workers/ServiceWorkerEvents.cpp +++ b/dom/workers/ServiceWorkerEvents.cpp @@ -95,12 +95,10 @@ AsyncLog(nsIInterceptedChannel* aInterceptedChannel, BEGIN_WORKERS_NAMESPACE -CancelChannelRunnable::CancelChannelRunnable( - nsMainThreadPtrHandle& aChannel, - nsMainThreadPtrHandle& aRegistration, - nsresult aStatus) - : Runnable("dom::workers::CancelChannelRunnable") - , mChannel(aChannel) +CancelChannelRunnable::CancelChannelRunnable(nsMainThreadPtrHandle& aChannel, + nsMainThreadPtrHandle& aRegistration, + nsresult aStatus) + : mChannel(aChannel) , mRegistration(aRegistration) , mStatus(aStatus) { @@ -179,8 +177,7 @@ class FinishResponse final : public Runnable const ChannelInfo& aWorkerChannelInfo, const nsACString& aScriptSpec, const nsACString& aResponseURLSpec) - : Runnable("dom::workers::FinishResponse") - , mChannel(aChannel) + : mChannel(aChannel) , mInternalResponse(aInternalResponse) , mWorkerChannelInfo(aWorkerChannelInfo) , mScriptSpec(aScriptSpec) @@ -884,8 +881,7 @@ class WaitUntilHandler final : public PromiseNativeHandler } MOZ_ALWAYS_SUCCEEDS(mWorkerPrivate->DispatchToMainThread( - NewRunnableMethod("WaitUntilHandler::ReportOnMainThread", - this, &WaitUntilHandler::ReportOnMainThread))); + NewRunnableMethod(this, &WaitUntilHandler::ReportOnMainThread))); } void diff --git a/dom/workers/ServiceWorkerInfo.cpp b/dom/workers/ServiceWorkerInfo.cpp index f0e281e1673aa..6beba301b8111 100644 --- a/dom/workers/ServiceWorkerInfo.cpp +++ b/dom/workers/ServiceWorkerInfo.cpp @@ -144,8 +144,7 @@ class ChangeStateUpdater final : public Runnable public: ChangeStateUpdater(const nsTArray& aInstances, ServiceWorkerState aState) - : Runnable("dom::workers::ChangeStateUpdater") - , mState(aState) + : mState(aState) { for (size_t i = 0; i < aInstances.Length(); ++i) { mInstances.AppendElement(aInstances[i]); diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index c2c3069da5635..8c61727affe6d 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -206,8 +206,7 @@ class TeardownRunnable final : public Runnable { public: explicit TeardownRunnable(ServiceWorkerManagerChild* aActor) - : Runnable("dom::workers::TeardownRunnable") - , mActor(aActor) + : mActor(aActor) { MOZ_ASSERT(mActor); } @@ -387,8 +386,7 @@ class PropagateSoftUpdateRunnable final : public Runnable public: PropagateSoftUpdateRunnable(const OriginAttributes& aOriginAttributes, const nsAString& aScope) - : Runnable("dom::workers::PropagateSoftUpdateRunnable") - , mOriginAttributes(aOriginAttributes) + : mOriginAttributes(aOriginAttributes) , mScope(aScope) {} @@ -418,8 +416,7 @@ class PropagateUnregisterRunnable final : public Runnable PropagateUnregisterRunnable(nsIPrincipal* aPrincipal, nsIServiceWorkerUnregisterCallback* aCallback, const nsAString& aScope) - : Runnable("dom::workers::PropagateUnregisterRunnable") - , mPrincipal(aPrincipal) + : mPrincipal(aPrincipal) , mCallback(aCallback) , mScope(aScope) { @@ -451,9 +448,7 @@ class RemoveRunnable final : public Runnable { public: explicit RemoveRunnable(const nsACString& aHost) - : Runnable("dom::workers::RemoveRunnable") - { - } + {} NS_IMETHOD Run() override { @@ -478,9 +473,7 @@ class PropagateRemoveRunnable final : public Runnable { public: explicit PropagateRemoveRunnable(const nsACString& aHost) - : Runnable("dom::workers::PropagateRemoveRunnable") - { - } + {} NS_IMETHOD Run() override { @@ -505,9 +498,7 @@ class PropagateRemoveAllRunnable final : public Runnable { public: PropagateRemoveAllRunnable() - : Runnable("dom::workers::PropagateRemoveAllRunnable") - { - } + {} NS_IMETHOD Run() override { @@ -587,11 +578,9 @@ class SoftUpdateRunnable final : public CancelableRunnable { public: SoftUpdateRunnable(const OriginAttributes& aOriginAttributes, - const nsACString& aScope, - bool aInternalMethod, + const nsACString& aScope, bool aInternalMethod, GenericPromise::Private* aPromise) - : CancelableRunnable("dom::workers::SoftUpdateRunnable") - , mAttrs(aOriginAttributes) + : mAttrs(aOriginAttributes) , mScope(aScope) , mInternalMethod(aInternalMethod) , mPromise(aPromise) @@ -661,8 +650,7 @@ class UpdateRunnable final : public CancelableRunnable ServiceWorkerUpdateFinishCallback* aCallback, Type aType, GenericPromise::Private* aPromise) - : CancelableRunnable("dom::workers::UpdateRunnable") - , mPrincipal(aPrincipal) + : mPrincipal(aPrincipal) , mScope(aScope) , mCallback(aCallback) , mType(aType) @@ -726,8 +714,7 @@ class ResolvePromiseRunnable final : public CancelableRunnable { public: explicit ResolvePromiseRunnable(GenericPromise::Private* aPromise) - : CancelableRunnable("dom::workers::ResolvePromiseRunnable") - , mPromise(aPromise) + : mPromise(aPromise) {} NS_IMETHOD @@ -972,9 +959,7 @@ class GetRegistrationsRunnable final : public Runnable RefPtr mPromise; public: GetRegistrationsRunnable(nsPIDOMWindowInner* aWindow, Promise* aPromise) - : Runnable("dom::workers::GetRegistrationsRunnable") - , mWindow(aWindow) - , mPromise(aPromise) + : mWindow(aWindow), mPromise(aPromise) {} NS_IMETHOD @@ -1100,13 +1085,9 @@ class GetRegistrationRunnable final : public Runnable nsString mDocumentURL; public: - GetRegistrationRunnable(nsPIDOMWindowInner* aWindow, - Promise* aPromise, + GetRegistrationRunnable(nsPIDOMWindowInner* aWindow, Promise* aPromise, const nsAString& aDocumentURL) - : Runnable("dom::workers::GetRegistrationRunnable") - , mWindow(aWindow) - , mPromise(aPromise) - , mDocumentURL(aDocumentURL) + : mWindow(aWindow), mPromise(aPromise), mDocumentURL(aDocumentURL) {} NS_IMETHOD @@ -1210,9 +1191,7 @@ class GetReadyPromiseRunnable final : public Runnable public: GetReadyPromiseRunnable(nsPIDOMWindowInner* aWindow, Promise* aPromise) - : Runnable("dom::workers::GetReadyPromiseRunnable") - , mWindow(aWindow) - , mPromise(aPromise) + : mWindow(aWindow), mPromise(aPromise) {} NS_IMETHOD @@ -2640,14 +2619,12 @@ class ContinueDispatchFetchEventRunnable : public Runnable nsString mDocumentId; bool mIsReload; public: - ContinueDispatchFetchEventRunnable( - ServiceWorkerPrivate* aServiceWorkerPrivate, - nsIInterceptedChannel* aChannel, - nsILoadGroup* aLoadGroup, - const nsAString& aDocumentId, - bool aIsReload) - : Runnable("dom::workers::ContinueDispatchFetchEventRunnable") - , mServiceWorkerPrivate(aServiceWorkerPrivate) + ContinueDispatchFetchEventRunnable(ServiceWorkerPrivate* aServiceWorkerPrivate, + nsIInterceptedChannel* aChannel, + nsILoadGroup* aLoadGroup, + const nsAString& aDocumentId, + bool aIsReload) + : mServiceWorkerPrivate(aServiceWorkerPrivate) , mChannel(aChannel) , mLoadGroup(aLoadGroup) , mDocumentId(aDocumentId) @@ -2788,8 +2765,7 @@ ServiceWorkerManager::DispatchFetchEvent(const OriginAttributes& aOriginAttribut // When this service worker was registered, we also sent down the permissions // for the runnable. They should have arrived by now, but we still need to // wait for them if they have not. - nsCOMPtr permissionsRunnable = NS_NewRunnableFunction( - "dom::workers::ServiceWorkerManager::DispatchFetchEvent", [=]() { + nsCOMPtr permissionsRunnable = NS_NewRunnableFunction([=] () { nsCOMPtr permMgr = services::GetPermissionManager(); MOZ_ALWAYS_SUCCEEDS(permMgr->WhenPermissionsAvailable(serviceWorker->Principal(), continueRunnable)); diff --git a/dom/workers/ServiceWorkerManagerParent.cpp b/dom/workers/ServiceWorkerManagerParent.cpp index a4d21c10b0716..41f106b083d97 100644 --- a/dom/workers/ServiceWorkerManagerParent.cpp +++ b/dom/workers/ServiceWorkerManagerParent.cpp @@ -30,8 +30,7 @@ class RegisterServiceWorkerCallback final : public Runnable public: RegisterServiceWorkerCallback(const ServiceWorkerRegistrationData& aData, uint64_t aParentID) - : Runnable("dom::workers::RegisterServiceWorkerCallback") - , mData(aData) + : mData(aData) , mParentID(aParentID) { AssertIsInMainProcess(); @@ -75,8 +74,7 @@ class UnregisterServiceWorkerCallback final : public Runnable UnregisterServiceWorkerCallback(const PrincipalInfo& aPrincipalInfo, const nsString& aScope, uint64_t aParentID) - : Runnable("dom::workers::UnregisterServiceWorkerCallback") - , mPrincipalInfo(aPrincipalInfo) + : mPrincipalInfo(aPrincipalInfo) , mScope(aScope) , mParentID(aParentID) { @@ -124,8 +122,7 @@ class CheckPrincipalWithCallbackRunnable final : public Runnable CheckPrincipalWithCallbackRunnable(already_AddRefed aParent, const PrincipalInfo& aPrincipalInfo, Runnable* aCallback) - : Runnable("dom::workers::CheckPrincipalWithCallbackRunnable") - , mContentParent(aParent) + : mContentParent(aParent) , mPrincipalInfo(aPrincipalInfo) , mCallback(aCallback) , mBackgroundEventTarget(GetCurrentThreadEventTarget()) diff --git a/dom/workers/ServiceWorkerManagerService.cpp b/dom/workers/ServiceWorkerManagerService.cpp index b622b4f8901de..e3d474648f0fa 100644 --- a/dom/workers/ServiceWorkerManagerService.cpp +++ b/dom/workers/ServiceWorkerManagerService.cpp @@ -109,17 +109,16 @@ ServiceWorkerManagerService::PropagateRegistration( // Send permissions fot the newly registered service worker to all of the // content processes. PrincipalInfo pi = aData.principal(); - NS_DispatchToMainThread(NS_NewRunnableFunction( - "dom::workers::ServiceWorkerManagerService::PropagateRegistration", [pi]() { - nsTArray cps; - ContentParent::GetAll(cps); - for (auto* cp : cps) { - nsCOMPtr principal = PrincipalInfoToPrincipal(pi); - if (principal) { - cp->TransmitPermissionsForPrincipal(principal); + NS_DispatchToMainThread(NS_NewRunnableFunction([pi] () { + nsTArray cps; + ContentParent::GetAll(cps); + for (auto* cp : cps) { + nsCOMPtr principal = PrincipalInfoToPrincipal(pi); + if (principal) { + cp->TransmitPermissionsForPrincipal(principal); + } } - } - })); + })); #ifdef DEBUG MOZ_ASSERT(parentFound); diff --git a/dom/workers/ServiceWorkerPrivate.cpp b/dom/workers/ServiceWorkerPrivate.cpp index ca5af769dd395..d52f2a598e33f 100644 --- a/dom/workers/ServiceWorkerPrivate.cpp +++ b/dom/workers/ServiceWorkerPrivate.cpp @@ -146,11 +146,8 @@ class CheckScriptEvaluationWithCallback final : public WorkerRunnable aWorkerPrivate->AssertIsOnWorkerThread(); bool fetchHandlerWasAdded = aWorkerPrivate->FetchHandlerWasAdded(); - nsCOMPtr runnable = NewRunnableMethod( - "dom::workers::CheckScriptEvaluationWithCallback::ReportFetchFlag", - this, - &CheckScriptEvaluationWithCallback::ReportFetchFlag, - fetchHandlerWasAdded); + nsCOMPtr runnable = NewRunnableMethod(this, + &CheckScriptEvaluationWithCallback::ReportFetchFlag, fetchHandlerWasAdded); aWorkerPrivate->DispatchToMainThread(runnable.forget()); ReportScriptEvaluationResult(aWorkerPrivate->WorkerScriptExecutedSuccessfully()); @@ -379,10 +376,7 @@ class KeepAliveHandler final : public WorkerHolder CycleCollectedJSContext* cx = CycleCollectedJSContext::Get(); MOZ_ASSERT(cx); - RefPtr r = - NewRunnableMethod("dom::workers::KeepAliveHandler::MaybeDone", - this, - &KeepAliveHandler::MaybeDone); + RefPtr r = NewRunnableMethod(this, &KeepAliveHandler::MaybeDone); cx->DispatchToMicroTask(r.forget()); } }; @@ -395,11 +389,9 @@ class RegistrationUpdateRunnable : public Runnable const bool mNeedTimeCheck; public: - RegistrationUpdateRunnable( - nsMainThreadPtrHandle& aRegistration, - bool aNeedTimeCheck) - : Runnable("dom::workers::RegistrationUpdateRunnable") - , mRegistration(aRegistration) + RegistrationUpdateRunnable(nsMainThreadPtrHandle& aRegistration, + bool aNeedTimeCheck) + : mRegistration(aRegistration) , mNeedTimeCheck(aNeedTimeCheck) { MOZ_DIAGNOSTIC_ASSERT(mRegistration); @@ -872,11 +864,9 @@ class PushErrorReporter final : public ExtendableEventCallback mMessageId.IsEmpty()) { return; } - nsCOMPtr runnable = NewRunnableMethod( - "dom::workers::PushErrorReporter::ReportOnMainThread", - this, - &PushErrorReporter::ReportOnMainThread, - aReason); + nsCOMPtr runnable = + NewRunnableMethod(this, + &PushErrorReporter::ReportOnMainThread, aReason); MOZ_ALWAYS_TRUE(NS_SUCCEEDED( workerPrivate->DispatchToMainThread(runnable.forget()))); } @@ -1522,10 +1512,8 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable class ResumeRequest final : public Runnable { nsMainThreadPtrHandle mChannel; public: - explicit ResumeRequest( - nsMainThreadPtrHandle& aChannel) - : Runnable("dom::workers::FetchEventRunnable::ResumeRequest") - , mChannel(aChannel) + explicit ResumeRequest(nsMainThreadPtrHandle& aChannel) + : mChannel(aChannel) { mChannel->SetFinishResponseStart(TimeStamp::Now()); } @@ -1684,9 +1672,7 @@ ServiceWorkerPrivate::SendFetchEvent(nsIInterceptedChannel* aChannel, // if the ServiceWorker script fails to load for some reason, just resume // the original channel. nsCOMPtr failRunnable = - NewRunnableMethod("nsIInterceptedChannel::ResetInterception", - aChannel, - &nsIInterceptedChannel::ResetInterception); + NewRunnableMethod(aChannel, &nsIInterceptedChannel::ResetInterception); aChannel->SetLaunchServiceWorkerStart(TimeStamp::Now()); aChannel->SetDispatchFetchEventStart(TimeStamp::Now()); diff --git a/dom/workers/ServiceWorkerPrivate.h b/dom/workers/ServiceWorkerPrivate.h index 76ddb6e2ec87e..fcd32c6c83447 100644 --- a/dom/workers/ServiceWorkerPrivate.h +++ b/dom/workers/ServiceWorkerPrivate.h @@ -27,8 +27,6 @@ class KeepAliveToken; class LifeCycleEventCallback : public Runnable { public: - LifeCycleEventCallback() : Runnable("dom::workers::LifeCycleEventCallback") {} - // Called on the worker thread. virtual void SetResult(bool aResult) = 0; diff --git a/dom/workers/ServiceWorkerRegistrar.cpp b/dom/workers/ServiceWorkerRegistrar.cpp index 0006c3832c0af..264b0b3ce5839 100644 --- a/dom/workers/ServiceWorkerRegistrar.cpp +++ b/dom/workers/ServiceWorkerRegistrar.cpp @@ -707,8 +707,7 @@ class ServiceWorkerRegistrarSaveDataRunnable final : public Runnable { public: ServiceWorkerRegistrarSaveDataRunnable() - : Runnable("dom::ServiceWorkerRegistrarSaveDataRunnable") - , mEventTarget(GetCurrentThreadEventTarget()) + : mEventTarget(GetCurrentThreadEventTarget()) { AssertIsOnBackgroundThread(); } @@ -722,8 +721,7 @@ class ServiceWorkerRegistrarSaveDataRunnable final : public Runnable service->SaveData(); RefPtr runnable = - NewRunnableMethod("ServiceWorkerRegistrar::DataSaved", - service, &ServiceWorkerRegistrar::DataSaved); + NewRunnableMethod(service, &ServiceWorkerRegistrar::DataSaved); nsresult rv = mEventTarget->Dispatch(runnable, NS_DISPATCH_NORMAL); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -797,9 +795,7 @@ ServiceWorkerRegistrar::MaybeScheduleShutdownCompleted() } RefPtr runnable = - NewRunnableMethod("dom::ServiceWorkerRegistrar::ShutdownCompleted", - this, - &ServiceWorkerRegistrar::ShutdownCompleted); + NewRunnableMethod(this, &ServiceWorkerRegistrar::ShutdownCompleted); nsresult rv = NS_DispatchToMainThread(runnable); if (NS_WARN_IF(NS_FAILED(rv))) { return; @@ -961,9 +957,7 @@ ServiceWorkerRegistrar::ProfileStarted() MOZ_ASSERT(target, "Must have stream transport service"); nsCOMPtr runnable = - NewRunnableMethod("dom::ServiceWorkerRegistrar::LoadData", - this, - &ServiceWorkerRegistrar::LoadData); + NewRunnableMethod(this, &ServiceWorkerRegistrar::LoadData); rv = target->Dispatch(runnable, NS_DISPATCH_NORMAL); if (NS_FAILED(rv)) { NS_WARNING("Failed to dispatch the LoadDataRunnable."); diff --git a/dom/workers/ServiceWorkerRegistration.cpp b/dom/workers/ServiceWorkerRegistration.cpp index 30fdcf7303cfe..53b25ecbf2be8 100644 --- a/dom/workers/ServiceWorkerRegistration.cpp +++ b/dom/workers/ServiceWorkerRegistration.cpp @@ -492,9 +492,9 @@ class WorkerThreadUpdateCallback final : public ServiceWorkerUpdateFinishCallbac class UpdateRunnable final : public Runnable { public: - UpdateRunnable(PromiseWorkerProxy* aPromiseProxy, const nsAString& aScope) - : Runnable("dom::UpdateRunnable") - , mPromiseProxy(aPromiseProxy) + UpdateRunnable(PromiseWorkerProxy* aPromiseProxy, + const nsAString& aScope) + : mPromiseProxy(aPromiseProxy) , mScope(aScope) {} @@ -663,9 +663,9 @@ class StartUnregisterRunnable final : public Runnable const nsString mScope; public: - StartUnregisterRunnable(PromiseWorkerProxy* aProxy, const nsAString& aScope) - : Runnable("dom::StartUnregisterRunnable") - , mPromiseWorkerProxy(aProxy) + StartUnregisterRunnable(PromiseWorkerProxy* aProxy, + const nsAString& aScope) + : mPromiseWorkerProxy(aProxy) , mScope(aScope) { MOZ_ASSERT(aProxy); @@ -1188,9 +1188,7 @@ ServiceWorkerRegistrationWorkerThread::InitListener() } nsCOMPtr r = - NewRunnableMethod("dom::WorkerListener::StartListeningForEvents", - mListener, - &WorkerListener::StartListeningForEvents); + NewRunnableMethod(mListener, &WorkerListener::StartListeningForEvents); MOZ_ALWAYS_SUCCEEDS(worker->DispatchToMainThread(r.forget())); } @@ -1212,9 +1210,7 @@ ServiceWorkerRegistrationWorkerThread::ReleaseListener() mListener->ClearRegistration(); nsCOMPtr r = - NewRunnableMethod("dom::WorkerListener::StopListeningForEvents", - mListener, - &WorkerListener::StopListeningForEvents); + NewRunnableMethod(mListener, &WorkerListener::StopListeningForEvents); MOZ_ALWAYS_SUCCEEDS(mWorkerPrivate->DispatchToMainThread(r.forget())); mListener = nullptr; diff --git a/dom/workers/ServiceWorkerRegistrationInfo.cpp b/dom/workers/ServiceWorkerRegistrationInfo.cpp index 3a0f50d2ccad6..57a41c3f075b4 100644 --- a/dom/workers/ServiceWorkerRegistrationInfo.cpp +++ b/dom/workers/ServiceWorkerRegistrationInfo.cpp @@ -228,8 +228,7 @@ void ServiceWorkerRegistrationInfo::TryToActivateAsync() { MOZ_ALWAYS_SUCCEEDS( - NS_DispatchToMainThread(NewRunnableMethod("ServiceWorkerRegistrationInfo::TryToActivate", - this, + NS_DispatchToMainThread(NewRunnableMethod(this, &ServiceWorkerRegistrationInfo::TryToActivate))); } @@ -268,17 +267,13 @@ ServiceWorkerRegistrationInfo::Activate() // "Queue a task to fire a simple event named controllerchange..." nsCOMPtr controllerChangeRunnable = NewRunnableMethod>( - "dom::workers::ServiceWorkerManager::FireControllerChange", - swm, - &ServiceWorkerManager::FireControllerChange, - this); + swm, &ServiceWorkerManager::FireControllerChange, this); NS_DispatchToMainThread(controllerChangeRunnable); - nsCOMPtr failRunnable = NewRunnableMethod( - "dom::workers::ServiceWorkerRegistrationInfo::FinishActivate", - this, - &ServiceWorkerRegistrationInfo::FinishActivate, - false /* success */); + nsCOMPtr failRunnable = + NewRunnableMethod(this, + &ServiceWorkerRegistrationInfo::FinishActivate, + false /* success */); nsMainThreadPtrHandle handle( new nsMainThreadPtrHolder( @@ -380,14 +375,9 @@ ServiceWorkerRegistrationInfo::UpdateRegistrationStateProperties(WhichServiceWor { AssertIsOnMainThread(); - nsCOMPtr runnable = - NewRunnableMethod( - "dom::workers::ServiceWorkerRegistrationInfo::" - "AsyncUpdateRegistrationStateProperties", - this, - &ServiceWorkerRegistrationInfo::AsyncUpdateRegistrationStateProperties, - aWorker, - aTransition); + nsCOMPtr runnable = NewRunnableMethod( + this, + &ServiceWorkerRegistrationInfo::AsyncUpdateRegistrationStateProperties, aWorker, aTransition); MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable.forget())); } diff --git a/dom/workers/ServiceWorkerUpdateJob.cpp b/dom/workers/ServiceWorkerUpdateJob.cpp index 110cbc1d892a6..7f56d9d0518c4 100644 --- a/dom/workers/ServiceWorkerUpdateJob.cpp +++ b/dom/workers/ServiceWorkerUpdateJob.cpp @@ -509,8 +509,6 @@ ServiceWorkerUpdateJob::Install(ServiceWorkerManager* aSWM) // fire the updatefound event nsCOMPtr upr = NewRunnableMethod>( - "dom::workers::ServiceWorkerManager::" - "FireUpdateFoundOnServiceWorkerRegistrations", aSWM, &ServiceWorkerManager::FireUpdateFoundOnServiceWorkerRegistrations, mRegistration); @@ -518,11 +516,8 @@ ServiceWorkerUpdateJob::Install(ServiceWorkerManager* aSWM) // Call ContinueAfterInstallEvent(false) on main thread if the SW // script fails to load. - nsCOMPtr failRunnable = NewRunnableMethod( - "dom::workers::ServiceWorkerUpdateJob::ContinueAfterInstallEvent", - this, - &ServiceWorkerUpdateJob::ContinueAfterInstallEvent, - false); + nsCOMPtr failRunnable = NewRunnableMethod + (this, &ServiceWorkerUpdateJob::ContinueAfterInstallEvent, false); nsMainThreadPtrHandle handle( new nsMainThreadPtrHolder( diff --git a/dom/workers/ServiceWorkerWindowClient.cpp b/dom/workers/ServiceWorkerWindowClient.cpp index 5689ac727a180..530c51ca74484 100644 --- a/dom/workers/ServiceWorkerWindowClient.cpp +++ b/dom/workers/ServiceWorkerWindowClient.cpp @@ -111,8 +111,7 @@ class ClientFocusRunnable final : public Runnable public: ClientFocusRunnable(uint64_t aWindowId, PromiseWorkerProxy* aPromiseProxy) - : mozilla::Runnable("ClientFocusRunnable") - , mWindowId(aWindowId) + : mWindowId(aWindowId) , mPromiseProxy(aPromiseProxy) { MOZ_ASSERT(mPromiseProxy); @@ -339,12 +338,10 @@ class ClientNavigateRunnable final : public Runnable MOZ_INIT_OUTSIDE_CTOR WorkerPrivate* mWorkerPrivate; public: - ClientNavigateRunnable(uint64_t aWindowId, - const nsAString& aUrl, + ClientNavigateRunnable(uint64_t aWindowId, const nsAString& aUrl, const nsAString& aScope, PromiseWorkerProxy* aPromiseProxy) - : mozilla::Runnable("ClientNavigateRunnable") - , mWindowId(aWindowId) + : mWindowId(aWindowId) , mUrl(aUrl) , mScope(aScope) , mPromiseProxy(aPromiseProxy) diff --git a/dom/workers/WorkerDebuggerManager.cpp b/dom/workers/WorkerDebuggerManager.cpp index 210c3a0b1f3c7..dfd7e5acc3509 100644 --- a/dom/workers/WorkerDebuggerManager.cpp +++ b/dom/workers/WorkerDebuggerManager.cpp @@ -24,9 +24,8 @@ class RegisterDebuggerMainThreadRunnable final : public mozilla::Runnable public: RegisterDebuggerMainThreadRunnable(WorkerPrivate* aWorkerPrivate, bool aNotifyListeners) - : mozilla::Runnable("RegisterDebuggerMainThreadRunnable") - , mWorkerPrivate(aWorkerPrivate) - , mNotifyListeners(aNotifyListeners) + : mWorkerPrivate(aWorkerPrivate), + mNotifyListeners(aNotifyListeners) { } private: @@ -50,8 +49,7 @@ class UnregisterDebuggerMainThreadRunnable final : public mozilla::Runnable public: explicit UnregisterDebuggerMainThreadRunnable(WorkerPrivate* aWorkerPrivate) - : mozilla::Runnable("UnregisterDebuggerMainThreadRunnable") - , mWorkerPrivate(aWorkerPrivate) + : mWorkerPrivate(aWorkerPrivate) { } private: diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 711645a4abfd7..e50a456c9785f 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -353,7 +353,6 @@ class MainThreadReleaseRunnable final : public Runnable public: MainThreadReleaseRunnable(nsTArray>& aDoomed, nsCOMPtr& aLoadGroupToCancel) - : mozilla::Runnable("MainThreadReleaseRunnable") { mDoomed.SwapElements(aDoomed); mLoadGroupToCancel.swap(aLoadGroupToCancel); @@ -428,8 +427,7 @@ class TopLevelWorkerFinishedRunnable final : public Runnable public: explicit TopLevelWorkerFinishedRunnable(WorkerPrivate* aFinishedWorker) - : mozilla::Runnable("TopLevelWorkerFinishedRunnable") - , mFinishedWorker(aFinishedWorker) + : mFinishedWorker(aFinishedWorker) { aFinishedWorker->AssertIsOnWorkerThread(); } @@ -2580,13 +2578,11 @@ WorkerPrivate::MemoryReporter::FinishCollectRunnable::FinishCollectRunnable( nsISupports* aHandlerData, bool aAnonymize, const nsACString& aPath) - : mozilla::Runnable( - "dom::workers::WorkerPrivate::MemoryReporter::FinishCollectRunnable") - , mHandleReport(aHandleReport) - , mHandlerData(aHandlerData) - , mAnonymize(aAnonymize) - , mSuccess(false) - , mCxStats(aPath) + : mHandleReport(aHandleReport), + mHandlerData(aHandlerData), + mAnonymize(aAnonymize), + mSuccess(false), + mCxStats(aPath) { } NS_IMETHODIMP @@ -4096,9 +4092,8 @@ class PostDebuggerMessageRunnable final : public Runnable public: PostDebuggerMessageRunnable(WorkerDebugger* aDebugger, const nsAString& aMessage) - : mozilla::Runnable("PostDebuggerMessageRunnable") - , mDebugger(aDebugger) - , mMessage(aMessage) + : mDebugger(aDebugger), + mMessage(aMessage) { } @@ -4124,14 +4119,12 @@ class ReportDebuggerErrorRunnable final : public Runnable public: ReportDebuggerErrorRunnable(WorkerDebugger* aDebugger, - const nsAString& aFilename, - uint32_t aLineno, + const nsAString& aFilename, uint32_t aLineno, const nsAString& aMessage) - : mozilla::Runnable("ReportDebuggerErrorRunnable") - , mDebugger(aDebugger) - , mFilename(aFilename) - , mLineno(aLineno) - , mMessage(aMessage) + : mDebugger(aDebugger), + mFilename(aFilename), + mLineno(aLineno), + mMessage(aMessage) { } diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index e6b6ca775574f..fd998b24e7e19 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -559,12 +559,10 @@ WorkerControlRunnable::DispatchInternal() NS_IMPL_ISUPPORTS_INHERITED0(WorkerControlRunnable, WorkerRunnable) -WorkerMainThreadRunnable::WorkerMainThreadRunnable( - WorkerPrivate* aWorkerPrivate, - const nsACString& aTelemetryKey) - : mozilla::Runnable("dom::workers::WorkerMainThreadRunnable") - , mWorkerPrivate(aWorkerPrivate) - , mTelemetryKey(aTelemetryKey) +WorkerMainThreadRunnable::WorkerMainThreadRunnable(WorkerPrivate* aWorkerPrivate, + const nsACString& aTelemetryKey) +: mWorkerPrivate(aWorkerPrivate) +, mTelemetryKey(aTelemetryKey) { mWorkerPrivate->AssertIsOnWorkerThread(); } @@ -663,10 +661,8 @@ WorkerSameThreadRunnable::PostDispatch(WorkerPrivate* aWorkerPrivate, } } -WorkerProxyToMainThreadRunnable::WorkerProxyToMainThreadRunnable( - WorkerPrivate* aWorkerPrivate) - : mozilla::Runnable("dom::workers::WorkerProxyToMainThreadRunnable") - , mWorkerPrivate(aWorkerPrivate) +WorkerProxyToMainThreadRunnable::WorkerProxyToMainThreadRunnable(WorkerPrivate* aWorkerPrivate) + : mWorkerPrivate(aWorkerPrivate) { MOZ_ASSERT(mWorkerPrivate); mWorkerPrivate->AssertIsOnWorkerThread(); diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 5f978d4774d17..fd3e0ed7e1e10 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -651,8 +651,7 @@ class ReportFetchListenerWarningRunnable final : public Runnable public: explicit ReportFetchListenerWarningRunnable(const nsString& aScope) - : mozilla::Runnable("ReportFetchListenerWarningRunnable") - , mScope(NS_ConvertUTF16toUTF8(aScope)) + : mScope(NS_ConvertUTF16toUTF8(aScope)) { WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate(); MOZ_ASSERT(workerPrivate); @@ -760,8 +759,7 @@ class WorkerScopeSkipWaitingRunnable final : public Runnable public: WorkerScopeSkipWaitingRunnable(PromiseWorkerProxy* aPromiseProxy, const nsCString& aScope) - : mozilla::Runnable("WorkerScopeSkipWaitingRunnable") - , mPromiseProxy(aPromiseProxy) + : mPromiseProxy(aPromiseProxy) , mScope(aScope) { MOZ_ASSERT(aPromiseProxy); diff --git a/dom/xbl/nsBindingManager.cpp b/dom/xbl/nsBindingManager.cpp index 9102ebcfebee8..03b492cc4942c 100644 --- a/dom/xbl/nsBindingManager.cpp +++ b/dom/xbl/nsBindingManager.cpp @@ -390,12 +390,8 @@ nsBindingManager::DoProcessAttachedQueue() nsresult rv = NS_ERROR_FAILURE; nsCOMPtr timer = do_CreateInstance(NS_TIMER_CONTRACTID); if (timer) { - rv = timer->InitWithNamedFuncCallback( - PostPAQEventCallback, - this, - 100, - nsITimer::TYPE_ONE_SHOT, - "nsBindingManager::DoProcessAttachedQueue"); + rv = timer->InitWithFuncCallback(PostPAQEventCallback, this, + 100, nsITimer::TYPE_ONE_SHOT); } if (NS_SUCCEEDED(rv)) { NS_ADDREF_THIS(); diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp index e2741136098b1..79ebe8d8c9b02 100644 --- a/dom/xhr/XMLHttpRequestMainThread.cpp +++ b/dom/xhr/XMLHttpRequestMainThread.cpp @@ -145,11 +145,7 @@ NS_IMPL_ISUPPORTS(nsXHRParseEndListener, nsIDOMEventListener) class nsResumeTimeoutsEvent : public Runnable { public: - explicit nsResumeTimeoutsEvent(nsPIDOMWindowInner* aWindow) - : Runnable("dom::nsResumeTimeoutsEvent") - , mWindow(aWindow) - { - } + explicit nsResumeTimeoutsEvent(nsPIDOMWindowInner* aWindow) : mWindow(aWindow) {} NS_IMETHOD Run() override { @@ -3127,11 +3123,9 @@ XMLHttpRequestMainThread::SendInternal(const BodyExtractorBase* aBody) } else { // Defer the actual sending of async events just in case listeners // are attached after the send() method is called. - return DispatchToMainThread(NewRunnableMethod( - "dom::XMLHttpRequestMainThread::CloseRequestWithError", - this, - &XMLHttpRequestMainThread::CloseRequestWithError, - ProgressEventType::error)); + return DispatchToMainThread(NewRunnableMethod(this, + &XMLHttpRequestMainThread::CloseRequestWithError, + ProgressEventType::error)); } } diff --git a/dom/xhr/XMLHttpRequestWorker.cpp b/dom/xhr/XMLHttpRequestWorker.cpp index 722361a15583e..f9cd680fce3ee 100644 --- a/dom/xhr/XMLHttpRequestWorker.cpp +++ b/dom/xhr/XMLHttpRequestWorker.cpp @@ -357,8 +357,7 @@ class AsyncTeardownRunnable final : public Runnable public: explicit AsyncTeardownRunnable(Proxy* aProxy) - : Runnable("dom::AsyncTeardownRunnable") - , mProxy(aProxy) + : mProxy(aProxy) { MOZ_ASSERT(aProxy); } @@ -439,13 +438,9 @@ class LoadStartDetectionRunnable final : public Runnable, public: LoadStartDetectionRunnable(Proxy* aProxy, XMLHttpRequestWorker* aXHRPrivate) - : Runnable("dom::LoadStartDetectionRunnable") - , mWorkerPrivate(aProxy->mWorkerPrivate) - , mProxy(aProxy) - , mXHR(aProxy->mXHR) - , mXMLHttpRequestPrivate(aXHRPrivate) - , mChannelId(mProxy->mInnerChannelId) - , mReceivedLoadStart(false) + : mWorkerPrivate(aProxy->mWorkerPrivate), mProxy(aProxy), mXHR(aProxy->mXHR), + mXMLHttpRequestPrivate(aXHRPrivate), mChannelId(mProxy->mInnerChannelId), + mReceivedLoadStart(false) { AssertIsOnMainThread(); mEventType.AssignWithConversion(sEventStrings[STRING_loadstart]); diff --git a/dom/xml/XMLStylesheetProcessingInstruction.cpp b/dom/xml/XMLStylesheetProcessingInstruction.cpp index 7c407eb98da41..3d94e179b48a5 100644 --- a/dom/xml/XMLStylesheetProcessingInstruction.cpp +++ b/dom/xml/XMLStylesheetProcessingInstruction.cpp @@ -63,8 +63,7 @@ XMLStylesheetProcessingInstruction::BindToTree(nsIDocument* aDocument, void (XMLStylesheetProcessingInstruction::*update)() = &XMLStylesheetProcessingInstruction::UpdateStyleSheetInternal; - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "dom::XMLStylesheetProcessingInstruction::BindToTree", this, update)); + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update)); return rv; } diff --git a/dom/xml/nsXMLContentSink.cpp b/dom/xml/nsXMLContentSink.cpp index 3bd8a5dff95df..19b0cc8ee8ecc 100644 --- a/dom/xml/nsXMLContentSink.cpp +++ b/dom/xml/nsXMLContentSink.cpp @@ -1583,10 +1583,8 @@ nsXMLContentSink::ContinueInterruptedParsingIfEnabled() void nsXMLContentSink::ContinueInterruptedParsingAsync() { - nsCOMPtr ev = - NewRunnableMethod("nsXMLContentSink::ContinueInterruptedParsingIfEnabled", - this, - &nsXMLContentSink::ContinueInterruptedParsingIfEnabled); + nsCOMPtr ev = NewRunnableMethod(this, + &nsXMLContentSink::ContinueInterruptedParsingIfEnabled); NS_DispatchToCurrentThread(ev); } diff --git a/dom/xml/nsXMLPrettyPrinter.cpp b/dom/xml/nsXMLPrettyPrinter.cpp index 3393335de92dc..1582cd92a2a8c 100644 --- a/dom/xml/nsXMLPrettyPrinter.cpp +++ b/dom/xml/nsXMLPrettyPrinter.cpp @@ -193,8 +193,8 @@ nsXMLPrettyPrinter::MaybeUnhook(nsIContent* aContent) // since AddScriptRunner _could_ in theory run us // synchronously mUnhookPending = true; - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "nsXMLPrettyPrinter::Unhook", this, &nsXMLPrettyPrinter::Unhook)); + nsContentUtils::AddScriptRunner( + NewRunnableMethod(this, &nsXMLPrettyPrinter::Unhook)); } } diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index c3f4c289a717e..9424d1110593e 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -546,8 +546,7 @@ class nsTransformBlockerEvent : public mozilla::Runnable { RefPtr mProcessor; explicit nsTransformBlockerEvent(txMozillaXSLTProcessor* processor) - : mozilla::Runnable("nsTransformBlockerEvent") - , mProcessor(processor) + : mProcessor(processor) {} ~nsTransformBlockerEvent() diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index 5106b595c3624..1fdc38052edca 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -1039,14 +1039,10 @@ XULDocument::AttributeChanged(nsIDocument* aDocument, if (ShouldPersistAttribute(aElement, aAttribute) && !persist.IsEmpty() && // XXXldb This should check that it's a token, not just a substring. persist.Find(nsDependentAtomString(aAttribute)) >= 0) { - nsContentUtils::AddScriptRunner( - NewRunnableMethod( - "dom::XULDocument::DoPersist", - this, - &XULDocument::DoPersist, - aElement, - kNameSpaceID_None, - aAttribute)); + nsContentUtils::AddScriptRunner(NewRunnableMethod + + (this, &XULDocument::DoPersist, aElement, kNameSpaceID_None, + aAttribute)); } } @@ -3148,10 +3144,8 @@ XULDocument::MaybeBroadcast() mDelayedBroadcasters.Length())) { if (!nsContentUtils::IsSafeToRunScript()) { if (!mInDestructor) { - nsContentUtils::AddScriptRunner( - NewRunnableMethod("dom::XULDocument::MaybeBroadcast", - this, - &XULDocument::MaybeBroadcast)); + nsContentUtils::AddScriptRunner( + NewRunnableMethod(this, &XULDocument::MaybeBroadcast)); } return; } diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index ee57baf89f048..80b7a33b4f197 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -793,11 +793,7 @@ IsInFeedSubscribeLine(nsXULElement* aElement) class XULInContentErrorReporter : public Runnable { public: - explicit XULInContentErrorReporter(nsIDocument* aDocument) - : mozilla::Runnable("XULInContentErrorReporter") - , mDocument(aDocument) - { - } + explicit XULInContentErrorReporter(nsIDocument* aDocument) : mDocument(aDocument) {} NS_IMETHOD Run() override { @@ -1877,8 +1873,7 @@ class SetDrawInTitleBarEvent : public Runnable { public: SetDrawInTitleBarEvent(nsIWidget* aWidget, bool aState) - : mozilla::Runnable("SetDrawInTitleBarEvent") - , mWidget(aWidget) + : mWidget(aWidget) , mState(aState) {} @@ -1933,25 +1928,19 @@ nsXULElement::UpdateBrightTitlebarForeground(nsIDocument* aDoc) class MarginSetter : public Runnable { public: - explicit MarginSetter(nsIWidget* aWidget) - : mozilla::Runnable("MarginSetter") - , mWidget(aWidget) - , mMargin(-1, -1, -1, -1) - { - } - MarginSetter(nsIWidget* aWidget, const LayoutDeviceIntMargin& aMargin) - : mozilla::Runnable("MarginSetter") - , mWidget(aWidget) - , mMargin(aMargin) - { - } - - NS_IMETHOD Run() override - { - // SetNonClientMargins can dispatch native events, hence doing - // it off a script runner. - mWidget->SetNonClientMargins(mMargin); - return NS_OK; + explicit MarginSetter(nsIWidget* aWidget) : + mWidget(aWidget), mMargin(-1, -1, -1, -1) + {} + MarginSetter(nsIWidget *aWidget, const LayoutDeviceIntMargin& aMargin) : + mWidget(aWidget), mMargin(aMargin) + {} + + NS_IMETHOD Run() override + { + // SetNonClientMargins can dispatch native events, hence doing + // it off a script runner. + mWidget->SetNonClientMargins(mMargin); + return NS_OK; } private: @@ -2640,25 +2629,21 @@ class NotifyOffThreadScriptCompletedRunnable : public Runnable void *mToken; public: - NotifyOffThreadScriptCompletedRunnable(nsIOffThreadScriptReceiver* aReceiver, - void* aToken) - : mozilla::Runnable("NotifyOffThreadScriptCompletedRunnable") - , mReceiver(aReceiver) - , mToken(aToken) - { - } - - static void NoteReceiver(nsIOffThreadScriptReceiver* aReceiver) - { - if (!sSetupClearOnShutdown) { - ClearOnShutdown(&sReceivers); - sSetupClearOnShutdown = true; - sReceivers = new nsTArray>(); - } + NotifyOffThreadScriptCompletedRunnable(nsIOffThreadScriptReceiver* aReceiver, + void *aToken) + : mReceiver(aReceiver), mToken(aToken) + {} + + static void NoteReceiver(nsIOffThreadScriptReceiver* aReceiver) { + if (!sSetupClearOnShutdown) { + ClearOnShutdown(&sReceivers); + sSetupClearOnShutdown = true; + sReceivers = new nsTArray>(); + } - // If we ever crash here, it's because we tried to lazy compile script - // too late in shutdown. - sReceivers->AppendElement(aReceiver); + // If we ever crash here, it's because we tried to lazy compile script + // too late in shutdown. + sReceivers->AppendElement(aReceiver); } NS_DECL_NSIRUNNABLE diff --git a/dom/xul/templates/nsXULTemplateBuilder.cpp b/dom/xul/templates/nsXULTemplateBuilder.cpp index eb6c8b43797c8..7d3317f41e412 100644 --- a/dom/xul/templates/nsXULTemplateBuilder.cpp +++ b/dom/xul/templates/nsXULTemplateBuilder.cpp @@ -1206,18 +1206,14 @@ nsXULTemplateBuilder::AttributeChanged(nsIDocument* aDocument, // case we may need to nuke and rebuild the entire content model // beneath the element. if (aAttribute == nsGkAtoms::ref) - nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsXULTemplateBuilder::RunnableRebuild", - this, - &nsXULTemplateBuilder::RunnableRebuild)); + nsContentUtils::AddScriptRunner( + NewRunnableMethod(this, &nsXULTemplateBuilder::RunnableRebuild)); // Check for a change to the 'datasources' attribute. If so, setup // mDB by parsing the new value and rebuild. else if (aAttribute == nsGkAtoms::datasources) { - nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsXULTemplateBuilder::RunnableLoadAndRebuild", - this, - &nsXULTemplateBuilder::RunnableLoadAndRebuild)); + nsContentUtils::AddScriptRunner( + NewRunnableMethod(this, &nsXULTemplateBuilder::RunnableLoadAndRebuild)); } } } @@ -1237,9 +1233,7 @@ nsXULTemplateBuilder::ContentRemoved(nsIDocument* aDocument, // Pass false to Uninit since content is going away anyway nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsXULTemplateBuilder::UninitFalse", - this, - &nsXULTemplateBuilder::UninitFalse)); + NewRunnableMethod(this, &nsXULTemplateBuilder::UninitFalse)); MOZ_ASSERT(aDocument == mObservedDocument); StopObserving(); @@ -1278,9 +1272,7 @@ nsXULTemplateBuilder::NodeWillBeDestroyed(const nsINode* aNode) mCompDB = nullptr; nsContentUtils::AddScriptRunner( - NewRunnableMethod("nsXULTemplateBuilder::UninitTrue", - this, - &nsXULTemplateBuilder::UninitTrue)); + NewRunnableMethod(this, &nsXULTemplateBuilder::UninitTrue)); } diff --git a/editor/composer/nsEditingSession.cpp b/editor/composer/nsEditingSession.cpp index e00405a4a4176..b95621b61d8a2 100644 --- a/editor/composer/nsEditingSession.cpp +++ b/editor/composer/nsEditingSession.cpp @@ -974,12 +974,10 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress, NS_ENSURE_SUCCESS(rv, rv); mEditorStatus = eEditorCreationInProgress; - mLoadBlankDocTimer->InitWithNamedFuncCallback( - nsEditingSession::TimerCallback, - static_cast(mDocShell.get()), - 10, - nsITimer::TYPE_ONE_SHOT, - "nsEditingSession::EndDocumentLoad"); + mLoadBlankDocTimer->InitWithFuncCallback( + nsEditingSession::TimerCallback, + static_cast (mDocShell.get()), + 10, nsITimer::TYPE_ONE_SHOT); } } } diff --git a/editor/composer/nsEditorSpellCheck.cpp b/editor/composer/nsEditorSpellCheck.cpp index 26b81b7b0a94a..afcf48c54ab6d 100644 --- a/editor/composer/nsEditorSpellCheck.cpp +++ b/editor/composer/nsEditorSpellCheck.cpp @@ -301,10 +301,7 @@ class CallbackCaller final : public Runnable { public: explicit CallbackCaller(nsIEditorSpellCheckCallback* aCallback) - : mozilla::Runnable("CallbackCaller") - , mCallback(aCallback) - { - } + : mCallback(aCallback) {} ~CallbackCaller() { diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index b7500d63645fd..5cedf8dc1e484 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -1840,8 +1840,7 @@ class EditorInputEventDispatcher final : public Runnable EditorInputEventDispatcher(EditorBase* aEditorBase, nsIContent* aTarget, bool aIsComposing) - : Runnable("EditorInputEventDispatcher") - , mEditorBase(aEditorBase) + : mEditorBase(aEditorBase) , mTarget(aTarget) , mIsComposing(aIsComposing) { diff --git a/editor/libeditor/HTMLEditRules.cpp b/editor/libeditor/HTMLEditRules.cpp index f9617ff08b6c1..84ba73db4cca0 100644 --- a/editor/libeditor/HTMLEditRules.cpp +++ b/editor/libeditor/HTMLEditRules.cpp @@ -8955,9 +8955,7 @@ NS_IMETHODIMP HTMLEditRules::DocumentModified() { nsContentUtils::AddScriptRunner( - NewRunnableMethod("HTMLEditRules::DocumentModifiedWorker", - this, - &HTMLEditRules::DocumentModifiedWorker)); + NewRunnableMethod(this, &HTMLEditRules::DocumentModifiedWorker)); return NS_OK; } diff --git a/editor/libeditor/HTMLEditor.cpp b/editor/libeditor/HTMLEditor.cpp index dc47895568f6d..f6c4361741870 100644 --- a/editor/libeditor/HTMLEditor.cpp +++ b/editor/libeditor/HTMLEditor.cpp @@ -3268,10 +3268,8 @@ HTMLEditor::DoContentInserted(nsIDocument* aDocument, nsCOMPtr kungFuDeathGrip(this); if (ShouldReplaceRootElement()) { - nsContentUtils::AddScriptRunner( - NewRunnableMethod("HTMLEditor::ResetRootElementAndEventTarget", - this, - &HTMLEditor::ResetRootElementAndEventTarget)); + nsContentUtils::AddScriptRunner(NewRunnableMethod( + this, &HTMLEditor::ResetRootElementAndEventTarget)); } // We don't need to handle our own modifications else if (!mAction && (aContainer ? aContainer->IsEditable() : aDocument->IsEditable())) { @@ -3318,10 +3316,8 @@ HTMLEditor::ContentRemoved(nsIDocument* aDocument, nsCOMPtr kungFuDeathGrip(this); if (SameCOMIdentity(aChild, mRootElement)) { - nsContentUtils::AddScriptRunner( - NewRunnableMethod("HTMLEditor::ResetRootElementAndEventTarget", - this, - &HTMLEditor::ResetRootElementAndEventTarget)); + nsContentUtils::AddScriptRunner(NewRunnableMethod( + this, &HTMLEditor::ResetRootElementAndEventTarget)); } // We don't need to handle our own modifications else if (!mAction && (aContainer ? aContainer->IsEditable() : aDocument->IsEditable())) { diff --git a/extensions/auth/nsHttpNegotiateAuth.cpp b/extensions/auth/nsHttpNegotiateAuth.cpp index e1fd1af9ac836..1f7f241cade18 100644 --- a/extensions/auth/nsHttpNegotiateAuth.cpp +++ b/extensions/auth/nsHttpNegotiateAuth.cpp @@ -330,26 +330,26 @@ class GetNextTokenRunnable final : public mozilla::Runnable { ~GetNextTokenRunnable() override = default; public: - GetNextTokenRunnable(nsIHttpAuthenticableChannel* authChannel, - const char* challenge, - bool isProxyAuth, - const char16_t* domain, - const char16_t* username, - const char16_t* password, - nsISupports* sessionState, - nsISupports* continuationState, - GetNextTokenCompleteEvent* aCompleteEvent) - : mozilla::Runnable("GetNextTokenRunnable") - , mAuthChannel(authChannel) - , mChallenge(challenge) - , mIsProxyAuth(isProxyAuth) - , mDomain(domain) - , mUsername(username) - , mPassword(password) - , mSessionState(sessionState) - , mContinuationState(continuationState) - , mCompleteEvent(aCompleteEvent) - { + GetNextTokenRunnable(nsIHttpAuthenticableChannel *authChannel, + const char *challenge, + bool isProxyAuth, + const char16_t *domain, + const char16_t *username, + const char16_t *password, + nsISupports *sessionState, + nsISupports *continuationState, + GetNextTokenCompleteEvent *aCompleteEvent + ) + : mAuthChannel(authChannel) + , mChallenge(challenge) + , mIsProxyAuth(isProxyAuth) + , mDomain(domain) + , mUsername(username) + , mPassword(password) + , mSessionState(sessionState) + , mContinuationState(continuationState) + , mCompleteEvent(aCompleteEvent) + { } NS_IMETHODIMP Run() override diff --git a/extensions/spellcheck/src/mozPersonalDictionary.cpp b/extensions/spellcheck/src/mozPersonalDictionary.cpp index 0f3bff145e9a1..19a0af4b0ab12 100644 --- a/extensions/spellcheck/src/mozPersonalDictionary.cpp +++ b/extensions/spellcheck/src/mozPersonalDictionary.cpp @@ -53,9 +53,7 @@ NS_INTERFACE_MAP_END class mozPersonalDictionaryLoader final : public mozilla::Runnable { public: - explicit mozPersonalDictionaryLoader(mozPersonalDictionary* dict) - : mozilla::Runnable("mozPersonalDictionaryLoader") - , mDict(dict) + explicit mozPersonalDictionaryLoader(mozPersonalDictionary *dict) : mDict(dict) { } @@ -78,13 +76,12 @@ class mozPersonalDictionaryLoader final : public mozilla::Runnable class mozPersonalDictionarySave final : public mozilla::Runnable { public: - explicit mozPersonalDictionarySave(mozPersonalDictionary* aDict, + explicit mozPersonalDictionarySave(mozPersonalDictionary *aDict, nsCOMPtr aFile, - nsTArray&& aDictWords) - : mozilla::Runnable("mozPersonalDictionarySave") - , mDictWords(aDictWords) - , mFile(aFile) - , mDict(aDict) + nsTArray &&aDictWords) + : mDictWords(aDictWords), + mFile(aFile), + mDict(aDict) { } diff --git a/gfx/ipc/GPUChild.cpp b/gfx/ipc/GPUChild.cpp index f40cf163304b8..4fdaa2ad220ee 100644 --- a/gfx/ipc/GPUChild.cpp +++ b/gfx/ipc/GPUChild.cpp @@ -269,8 +269,7 @@ class DeferredDeleteGPUChild : public Runnable { public: explicit DeferredDeleteGPUChild(UniquePtr&& aChild) - : Runnable("gfx::DeferredDeleteGPUChild") - , mChild(Move(aChild)) + : mChild(Move(aChild)) { } diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index bb5713b03bf16..2bb0057e791f5 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -127,10 +127,9 @@ void GPUParent::NotifyDeviceReset() { if (!NS_IsMainThread()) { - NS_DispatchToMainThread( - NS_NewRunnableFunction("gfx::GPUParent::NotifyDeviceReset", []() -> void { - GPUParent::GetSingleton()->NotifyDeviceReset(); - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([] () -> void { + GPUParent::GetSingleton()->NotifyDeviceReset(); + })); return; } diff --git a/gfx/ipc/VsyncBridgeChild.cpp b/gfx/ipc/VsyncBridgeChild.cpp index a5bff37253012..a4be827ef9acb 100644 --- a/gfx/ipc/VsyncBridgeChild.cpp +++ b/gfx/ipc/VsyncBridgeChild.cpp @@ -29,10 +29,7 @@ VsyncBridgeChild::Create(RefPtr aThread, RefPtr child = new VsyncBridgeChild(aThread, aProcessToken); RefPtr task = NewRunnableMethod&&>( - "gfx::VsyncBridgeChild::Open", - child, - &VsyncBridgeChild::Open, - Move(aEndpoint)); + child, &VsyncBridgeChild::Open, Move(aEndpoint)); aThread->GetThread()->Dispatch(task.forget(), nsIThread::DISPATCH_NORMAL); return child; @@ -61,10 +58,9 @@ class NotifyVsyncTask : public Runnable NotifyVsyncTask(RefPtr aVsyncBridge, TimeStamp aTimeStamp, const uint64_t& aLayersId) - : Runnable("gfx::NotifyVsyncTask") - , mVsyncBridge(aVsyncBridge) - , mTimeStamp(aTimeStamp) - , mLayersId(aLayersId) + : mVsyncBridge(aVsyncBridge), + mTimeStamp(aTimeStamp), + mLayersId(aLayersId) {} NS_IMETHOD Run() override { @@ -110,8 +106,7 @@ void VsyncBridgeChild::Close() { if (!IsOnVsyncIOThread()) { - mLoop->PostTask(NewRunnableMethod( - "gfx::VsyncBridgeChild::Close", this, &VsyncBridgeChild::Close)); + mLoop->PostTask(NewRunnableMethod(this, &VsyncBridgeChild::Close)); return; } diff --git a/gfx/ipc/VsyncBridgeParent.cpp b/gfx/ipc/VsyncBridgeParent.cpp index 995c461b477eb..5b59f538a99e7 100644 --- a/gfx/ipc/VsyncBridgeParent.cpp +++ b/gfx/ipc/VsyncBridgeParent.cpp @@ -15,10 +15,7 @@ VsyncBridgeParent::Start(Endpoint&& aEndpoint) RefPtr parent = new VsyncBridgeParent(); RefPtr task = NewRunnableMethod&&>( - "gfx::VsyncBridgeParent::Open", - parent, - &VsyncBridgeParent::Open, - Move(aEndpoint)); + parent, &VsyncBridgeParent::Open, Move(aEndpoint)); CompositorThreadHolder::Loop()->PostTask(task.forget()); return parent; @@ -59,9 +56,7 @@ VsyncBridgeParent::Shutdown() { MessageLoop* ccloop = CompositorThreadHolder::Loop(); if (MessageLoop::current() != ccloop) { - ccloop->PostTask(NewRunnableMethod("gfx::VsyncBridgeParent::ShutdownImpl", - this, - &VsyncBridgeParent::ShutdownImpl)); + ccloop->PostTask(NewRunnableMethod(this, &VsyncBridgeParent::ShutdownImpl)); return; } diff --git a/gfx/ipc/VsyncIOThreadHolder.cpp b/gfx/ipc/VsyncIOThreadHolder.cpp index 5c9df5efc9987..8730b72131eb1 100644 --- a/gfx/ipc/VsyncIOThreadHolder.cpp +++ b/gfx/ipc/VsyncIOThreadHolder.cpp @@ -25,8 +25,7 @@ VsyncIOThreadHolder::~VsyncIOThreadHolder() if (NS_IsMainThread()) { mThread->AsyncShutdown(); } else { - NS_DispatchToMainThread(NewRunnableMethod( - "nsIThread::AsyncShutdown", mThread, &nsIThread::AsyncShutdown)); + NS_DispatchToMainThread(NewRunnableMethod(mThread, &nsIThread::AsyncShutdown)); } } diff --git a/gfx/layers/AsyncCanvasRenderer.cpp b/gfx/layers/AsyncCanvasRenderer.cpp index 188b11cf713db..b1e37e7523117 100644 --- a/gfx/layers/AsyncCanvasRenderer.cpp +++ b/gfx/layers/AsyncCanvasRenderer.cpp @@ -47,8 +47,7 @@ AsyncCanvasRenderer::NotifyElementAboutAttributesChanged() { public: explicit Runnable(AsyncCanvasRenderer* aRenderer) - : mozilla::Runnable("Runnable") - , mRenderer(aRenderer) + : mRenderer(aRenderer) {} NS_IMETHOD Run() override @@ -83,8 +82,7 @@ AsyncCanvasRenderer::NotifyElementAboutInvalidation() { public: explicit Runnable(AsyncCanvasRenderer* aRenderer) - : mozilla::Runnable("Runnable") - , mRenderer(aRenderer) + : mRenderer(aRenderer) {} NS_IMETHOD Run() override diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index 66d645051b605..3e01b01b7cc31 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -58,12 +58,7 @@ class nsAutoRefTraits { */ class SurfaceReleaser : public mozilla::Runnable { public: - explicit SurfaceReleaser(RawRef aRef) - : mozilla::Runnable( - "nsAutoRefTraits::SurfaceReleaser") - , mRef(aRef) - { - } + explicit SurfaceReleaser(RawRef aRef) : mRef(aRef) {} NS_IMETHOD Run() override { mRef->Release(); return NS_OK; @@ -101,12 +96,7 @@ class nsAutoRefTraits { */ class SurfaceReleaser : public mozilla::Runnable { public: - explicit SurfaceReleaser(RawRef aRef) - : mozilla::Runnable( - "nsAutoRefTraits::SurfaceReleaser") - , mRef(aRef) - { - } + explicit SurfaceReleaser(RawRef aRef) : mRef(aRef) {} NS_IMETHOD Run() override { mRef->Release(); return NS_OK; diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index 71dcc33fe0b58..d959b64eea9c7 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -344,10 +344,9 @@ class LayerScopeManager class CreateServerSocketRunnable : public Runnable { public: - explicit CreateServerSocketRunnable(LayerScopeManager* aLayerScopeManager) - : Runnable("layers::LayerScopeManager::CreateServerSocketRunnable") - , mLayerScopeManager(aLayerScopeManager) - { + explicit CreateServerSocketRunnable(LayerScopeManager *aLayerScopeManager) + : mLayerScopeManager(aLayerScopeManager) + { } NS_IMETHOD Run() override { mLayerScopeManager->mWebSocketManager = diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 53ec6edd76127..e54075e438fc3 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -176,10 +176,9 @@ APZCTreeManager::APZCTreeManager() mApzcTreeLog("apzctree") { RefPtr self(this); - NS_DispatchToMainThread( - NS_NewRunnableFunction("layers::APZCTreeManager::APZCTreeManager", [self] { - self->mFlushObserver = new CheckerboardFlushObserver(self); - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([self] { + self->mFlushObserver = new CheckerboardFlushObserver(self); + })); AsyncPanZoomController::InitializeGlobalState(); mApzcTreeLog.ConditionOnPrefFunction(gfxPrefs::APZPrintTree); #if defined(MOZ_WIDGET_ANDROID) @@ -855,10 +854,8 @@ APZCTreeManager::FlushApzRepaints(uint64_t aLayersId) const LayerTreeState* state = CompositorBridgeParent::GetIndirectShadowTree(aLayersId); MOZ_ASSERT(state && state->mController); - state->mController->DispatchToRepaintThread( - NewRunnableMethod("layers::GeckoContentController::NotifyFlushComplete", - state->mController, - &GeckoContentController::NotifyFlushComplete)); + state->mController->DispatchToRepaintThread(NewRunnableMethod( + state->mController, &GeckoContentController::NotifyFlushComplete)); } nsEventStatus @@ -1583,8 +1580,7 @@ APZCTreeManager::ClearTree() // Ensure that no references to APZCs are alive in any lingering input // blocks. This breaks cycles from InputBlockState::mTargetApzc back to // the InputQueue. - APZThreadUtils::RunOnControllerThread(NewRunnableMethod( - "layers::InputQueue::Clear", mInputQueue, &InputQueue::Clear)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(mInputQueue, &InputQueue::Clear)); MutexAutoLock lock(mTreeLock); @@ -1605,11 +1601,10 @@ APZCTreeManager::ClearTree() mRootNode = nullptr; RefPtr self(this); - NS_DispatchToMainThread( - NS_NewRunnableFunction("layers::APZCTreeManager::ClearTree", [self] { - self->mFlushObserver->Unregister(); - self->mFlushObserver = nullptr; - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([self] { + self->mFlushObserver->Unregister(); + self->mFlushObserver = nullptr; + })); } RefPtr diff --git a/gfx/layers/apz/src/AndroidAPZ.cpp b/gfx/layers/apz/src/AndroidAPZ.cpp index 1b43962f4d65b..da8b89a3e052d 100644 --- a/gfx/layers/apz/src/AndroidAPZ.cpp +++ b/gfx/layers/apz/src/AndroidAPZ.cpp @@ -245,8 +245,7 @@ AndroidFlingAnimation::DeferHandleFlingOverscroll(ParentLayerPoint& aVelocity) mDeferredTasks.AppendElement( NewRunnableMethod, - RefPtr>("layers::AsyncPanZoomController::HandleFlingOverscroll", - &mApzc, + RefPtr>(&mApzc, &AsyncPanZoomController::HandleFlingOverscroll, aVelocity, mOverscrollHandoffChain, diff --git a/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp b/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp index 5c88e54e3fa37..08548f5980df7 100644 --- a/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp +++ b/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp @@ -536,8 +536,7 @@ AndroidDynamicToolbarAnimator::GetToolbarEffect(CompositorOGL* gl) // Send notification that texture is ready after the current composition has completed. if (mCompositorToolbarTexture && mCompositorSendResponseForSnapshotUpdate) { mCompositorSendResponseForSnapshotUpdate = false; - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod("AndroidDynamicToolbarAnimator::PostToolbarReady", - this, &AndroidDynamicToolbarAnimator::PostToolbarReady)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::PostToolbarReady)); } } @@ -747,8 +746,7 @@ void AndroidDynamicToolbarAnimator::UpdateCompositorToolbarHeight(ScreenIntCoord aHeight) { if (!CompositorThreadHolder::IsInCompositorThread()) { - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod("AndroidDynamicToolbarAnimator::UpdateCompositorToolbarHeight", - this, &AndroidDynamicToolbarAnimator::UpdateCompositorToolbarHeight, aHeight)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::UpdateCompositorToolbarHeight, aHeight)); return; } @@ -760,8 +758,7 @@ void AndroidDynamicToolbarAnimator::UpdateControllerToolbarHeight(ScreenIntCoord aHeight, ScreenIntCoord aMaxHeight) { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::UpdateControllerToolbarHeight", - this, &AndroidDynamicToolbarAnimator::UpdateControllerToolbarHeight, aHeight, aMaxHeight)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::UpdateControllerToolbarHeight, aHeight, aMaxHeight)); return; } @@ -775,8 +772,7 @@ void AndroidDynamicToolbarAnimator::UpdateControllerSurfaceHeight(ScreenIntCoord aHeight) { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::UpdateControllerSurfaceHeight", - this, &AndroidDynamicToolbarAnimator::UpdateControllerSurfaceHeight, aHeight)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::UpdateControllerSurfaceHeight, aHeight)); return; } @@ -787,8 +783,7 @@ void AndroidDynamicToolbarAnimator::UpdateControllerCompositionHeight(ScreenIntCoord aHeight) { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::UpdateControllerCompositionHeight", - this, &AndroidDynamicToolbarAnimator::UpdateControllerCompositionHeight, aHeight)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::UpdateControllerCompositionHeight, aHeight)); return; } @@ -825,8 +820,7 @@ void AndroidDynamicToolbarAnimator::NotifyControllerPendingAnimation(int32_t aDirection, AnimationStyle aAnimationStyle) { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::NotifyControllerPendingAnimation", - this, &AndroidDynamicToolbarAnimator::NotifyControllerPendingAnimation, aDirection, aAnimationStyle)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::NotifyControllerPendingAnimation, aDirection, aAnimationStyle)); return; } @@ -853,7 +847,6 @@ AndroidDynamicToolbarAnimator::StartCompositorAnimation(int32_t aDirection, Anim if (!CompositorThreadHolder::IsInCompositorThread()) { mControllerState = eAnimationStartPending; CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod( - "AndroidDynamicToolbarAnimator::StartCompositorAnimation", this, &AndroidDynamicToolbarAnimator::StartCompositorAnimation, aDirection, aAnimationStyle, aHeight, aWaitForPageResize)); return; } @@ -896,8 +889,7 @@ void AndroidDynamicToolbarAnimator::NotifyControllerAnimationStarted() { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::NotifyControllerAnimationStarted", - this, &AndroidDynamicToolbarAnimator::NotifyControllerAnimationStarted)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::NotifyControllerAnimationStarted)); return; } @@ -913,8 +905,7 @@ AndroidDynamicToolbarAnimator::StopCompositorAnimation() { if (!CompositorThreadHolder::IsInCompositorThread()) { mControllerState = eAnimationStopPending; - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod("AndroidDynamicToolbarAnimator::StopCompositorAnimation", - this, &AndroidDynamicToolbarAnimator::StopCompositorAnimation)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::StopCompositorAnimation)); return; } @@ -940,8 +931,7 @@ void AndroidDynamicToolbarAnimator::NotifyControllerAnimationStopped(ScreenIntCoord aHeight) { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::NotifyControllerAnimationStopped", - this, &AndroidDynamicToolbarAnimator::NotifyControllerAnimationStopped, aHeight)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::NotifyControllerAnimationStopped, aHeight)); return; } @@ -956,8 +946,7 @@ void AndroidDynamicToolbarAnimator::RequestComposite() { if (!CompositorThreadHolder::IsInCompositorThread()) { - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod("AndroidDynamicToolbarAnimator::RequestComposite", - this, &AndroidDynamicToolbarAnimator::RequestComposite)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::RequestComposite)); return; } @@ -1004,8 +993,7 @@ AndroidDynamicToolbarAnimator::UpdateFrameMetrics(ScreenPoint aScrollOffset, CSSRect aCssPageRect) { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::UpdateFrameMetrics", - this, &AndroidDynamicToolbarAnimator::UpdateFrameMetrics, aScrollOffset, aScale, aCssPageRect)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::UpdateFrameMetrics, aScrollOffset, aScale, aCssPageRect)); return; } @@ -1023,7 +1011,6 @@ AndroidDynamicToolbarAnimator::UpdateFrameMetrics(ScreenPoint aScrollOffset, RefPtr uiController = UiCompositorControllerParent::GetFromRootLayerTreeId(mRootLayerTreeId); MOZ_ASSERT(uiController); CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod( - "UiCompositorControllerParent::SendRootFrameMetrics", uiController, &UiCompositorControllerParent::SendRootFrameMetrics, aScrollOffset, aScale, aCssPageRect)); } @@ -1099,8 +1086,7 @@ void AndroidDynamicToolbarAnimator::NotifyControllerSnapshotFailed() { if (!APZThreadUtils::IsControllerThread()) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod("AndroidDynamicToolbarAnimator::NotifyControllerSnapshotFailed", - this, &AndroidDynamicToolbarAnimator::NotifyControllerSnapshotFailed)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::NotifyControllerSnapshotFailed)); return; } @@ -1147,8 +1133,7 @@ void AndroidDynamicToolbarAnimator::QueueMessage(int32_t aMessage) { if (!CompositorThreadHolder::IsInCompositorThread()) { - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod("AndroidDynamicToolbarAnimator::QueueMessage", - this, &AndroidDynamicToolbarAnimator::QueueMessage, aMessage)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &AndroidDynamicToolbarAnimator::QueueMessage, aMessage)); return; } diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 33261aaccd8d3..0c049d5bb2b00 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -636,11 +636,10 @@ class SmoothScrollAnimation : public AsyncPanZoomAnimation { // HandleSmoothScrollOverscroll() (which acquires the tree lock) would violate // the lock ordering. Instead we schedule HandleSmoothScrollOverscroll() to be // called after mMonitor is released. - mDeferredTasks.AppendElement(NewRunnableMethod( - "layers::AsyncPanZoomController::HandleSmoothScrollOverscroll", - &mApzc, - &AsyncPanZoomController::HandleSmoothScrollOverscroll, - velocity)); + mDeferredTasks.AppendElement( + NewRunnableMethod(&mApzc, + &AsyncPanZoomController::HandleSmoothScrollOverscroll, + velocity)); return false; } @@ -1384,11 +1383,8 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) { if (RefPtr controller = GetGeckoContentController()) { mPinchPaintTimerSet = true; controller->PostDelayedTask( - NewRunnableMethod( - "layers::AsyncPanZoomController::" - "DoDelayedRequestContentRepaint", - this, - &AsyncPanZoomController::DoDelayedRequestContentRepaint), + NewRunnableMethod(this, + &AsyncPanZoomController::DoDelayedRequestContentRepaint), delay); } } @@ -2118,18 +2114,12 @@ nsEventStatus AsyncPanZoomController::GenerateSingleTap(TapType aType, // schedule the singletap message to run on the next spin of the event loop. // See bug 965381 for the issue this was causing. RefPtr runnable = - NewRunnableMethod("layers::GeckoContentController::HandleTap", - controller, - &GeckoContentController::HandleTap, - aType, - geckoScreenPoint, - aModifiers, - GetGuid(), - touch ? touch->GetBlockId() : 0); + NewRunnableMethod(controller, + &GeckoContentController::HandleTap, + aType, geckoScreenPoint, + aModifiers, GetGuid(), + touch ? touch->GetBlockId() : 0); controller->PostDelayedTask(runnable.forget(), 0); return nsEventStatus_eConsumeNoDefault; @@ -2976,11 +2966,7 @@ void AsyncPanZoomController::RequestContentRepaint(bool aUserAction) { // use the local variable to resolve the function overload. auto func = static_cast (&AsyncPanZoomController::RequestContentRepaint); - controller->DispatchToRepaintThread(NewRunnableMethod( - "layers::AsyncPanZoomController::RequestContentRepaint", - this, - func, - aUserAction)); + controller->DispatchToRepaintThread(NewRunnableMethod(this, func, aUserAction)); return; } @@ -3764,12 +3750,8 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) { auto func = static_cast (&AsyncPanZoomController::RequestContentRepaint); controller->DispatchToRepaintThread( - NewRunnableMethod( - "layers::AsyncPanZoomController::ZoomToRect", - this, - func, - endZoomToMetrics, - velocity)); + NewRunnableMethod( + this, func, endZoomToMetrics, velocity)); } } } diff --git a/gfx/layers/apz/src/GenericFlingAnimation.h b/gfx/layers/apz/src/GenericFlingAnimation.h index a3c9b3454f599..930937c4551a1 100644 --- a/gfx/layers/apz/src/GenericFlingAnimation.h +++ b/gfx/layers/apz/src/GenericFlingAnimation.h @@ -111,11 +111,10 @@ class GenericFlingAnimation: public AsyncPanZoomAnimation { // while holding mMonitor, because otherwise, if the overscrolled APZC // is this one, then the SetState(NOTHING) in UpdateAnimation will // stomp on the SetState(SNAP_BACK) it does. - mDeferredTasks.AppendElement(NewRunnableMethod( - "layers::OverscrollHandoffChain::SnapBackOverscrolledApzc", - mOverscrollHandoffChain.get(), - &OverscrollHandoffChain::SnapBackOverscrolledApzc, - &mApzc)); + mDeferredTasks.AppendElement( + NewRunnableMethod(mOverscrollHandoffChain.get(), + &OverscrollHandoffChain::SnapBackOverscrolledApzc, + &mApzc)); return false; } @@ -165,15 +164,13 @@ class GenericFlingAnimation: public AsyncPanZoomAnimation { // called after mMonitor is released. FLING_LOG("%p fling went into overscroll, handing off with velocity %s\n", &mApzc, Stringify(velocity).c_str()); mDeferredTasks.AppendElement( - NewRunnableMethod, - RefPtr>( - "layers::AsyncPanZoomController::HandleFlingOverscroll", - &mApzc, - &AsyncPanZoomController::HandleFlingOverscroll, - velocity, - mOverscrollHandoffChain, - mScrolledApzc)); + NewRunnableMethod, + RefPtr>(&mApzc, + &AsyncPanZoomController::HandleFlingOverscroll, + velocity, + mOverscrollHandoffChain, + mScrolledApzc)); // If there is a remaining velocity on this APZC, continue this fling // as well. (This fling and the handed-off fling will run concurrently.) diff --git a/gfx/layers/apz/src/GestureEventListener.cpp b/gfx/layers/apz/src/GestureEventListener.cpp index 4b162fbee2ced..b9efbb26e2703 100644 --- a/gfx/layers/apz/src/GestureEventListener.cpp +++ b/gfx/layers/apz/src/GestureEventListener.cpp @@ -595,10 +595,8 @@ void GestureEventListener::CancelLongTapTimeoutTask() void GestureEventListener::CreateLongTapTimeoutTask() { - RefPtr task = NewCancelableRunnableMethod( - "layers::GestureEventListener::HandleInputTimeoutLongTap", - this, - &GestureEventListener::HandleInputTimeoutLongTap); + RefPtr task = + NewCancelableRunnableMethod(this, &GestureEventListener::HandleInputTimeoutLongTap); mLongTapTimeoutTask = task; mAsyncPanZoomController->PostDelayedTask( @@ -625,11 +623,10 @@ void GestureEventListener::CreateMaxTapTimeoutTask() TouchBlockState* block = mAsyncPanZoomController->GetInputQueue()->GetCurrentTouchBlock(); MOZ_ASSERT(block); - RefPtr task = NewCancelableRunnableMethod( - "layers::GestureEventListener::HandleInputTimeoutMaxTap", - this, - &GestureEventListener::HandleInputTimeoutMaxTap, - block->IsDuringFastFling()); + RefPtr task = + NewCancelableRunnableMethod(this, + &GestureEventListener::HandleInputTimeoutMaxTap, + block->IsDuringFastFling()); mMaxTapTimeoutTask = task; mAsyncPanZoomController->PostDelayedTask( diff --git a/gfx/layers/apz/src/InputQueue.cpp b/gfx/layers/apz/src/InputQueue.cpp index aead4f0bd7716..8c9b222adefb9 100644 --- a/gfx/layers/apz/src/InputQueue.cpp +++ b/gfx/layers/apz/src/InputQueue.cpp @@ -509,12 +509,10 @@ InputQueue::ScheduleMainThreadTimeout(const RefPtr& aTar CancelableBlockState* aBlock) { INPQ_LOG("scheduling main thread timeout for target %p\n", aTarget.get()); aBlock->StartContentResponseTimer(); - aTarget->PostDelayedTask( - NewRunnableMethod("layers::InputQueue::MainThreadTimeout", - this, - &InputQueue::MainThreadTimeout, - aBlock->GetBlockId()), - gfxPrefs::APZContentResponseTimeout()); + aTarget->PostDelayedTask(NewRunnableMethod(this, + &InputQueue::MainThreadTimeout, + aBlock->GetBlockId()), + gfxPrefs::APZContentResponseTimeout()); } CancelableBlockState* diff --git a/gfx/layers/apz/src/Overscroll.h b/gfx/layers/apz/src/Overscroll.h index d620db28f2719..586f104cc2277 100644 --- a/gfx/layers/apz/src/Overscroll.h +++ b/gfx/layers/apz/src/Overscroll.h @@ -48,10 +48,7 @@ class OverscrollAnimation: public AsyncPanZoomAnimation { // The scroll snapping is done in a deferred task, otherwise the state // change to NOTHING caused by the overscroll animation ending would // clobber a possible state change to SMOOTH_SCROLL in ScrollSnap(). - mDeferredTasks.AppendElement( - NewRunnableMethod("layers::AsyncPanZoomController::ScrollSnap", - &mApzc, - &AsyncPanZoomController::ScrollSnap)); + mDeferredTasks.AppendElement(NewRunnableMethod(&mApzc, &AsyncPanZoomController::ScrollSnap)); return false; } return true; diff --git a/gfx/layers/apz/util/ActiveElementManager.cpp b/gfx/layers/apz/util/ActiveElementManager.cpp index e7c3bc3afa8e8..20d34aa2bb1ad 100644 --- a/gfx/layers/apz/util/ActiveElementManager.cpp +++ b/gfx/layers/apz/util/ActiveElementManager.cpp @@ -95,11 +95,9 @@ ActiveElementManager::TriggerElementActivation() MOZ_ASSERT(mSetActiveTask == nullptr); RefPtr task = - NewCancelableRunnableMethod>( - "layers::ActiveElementManager::SetActiveTask", - this, - &ActiveElementManager::SetActiveTask, - mTarget); + NewCancelableRunnableMethod>(this, + &ActiveElementManager::SetActiveTask, + mTarget); mSetActiveTask = task; MessageLoop::current()->PostDelayedTask(task.forget(), sActivationDelayMs); AEM_LOG("Scheduling mSetActiveTask %p\n", mSetActiveTask); diff --git a/gfx/layers/apz/util/CheckerboardReportService.cpp b/gfx/layers/apz/util/CheckerboardReportService.cpp index a8c89152ef250..7e4a9d93e1d1e 100644 --- a/gfx/layers/apz/util/CheckerboardReportService.cpp +++ b/gfx/layers/apz/util/CheckerboardReportService.cpp @@ -42,10 +42,9 @@ void CheckerboardEventStorage::Report(uint32_t aSeverity, const std::string& aLog) { if (!NS_IsMainThread()) { - RefPtr task = NS_NewRunnableFunction( - "layers::CheckerboardEventStorage::Report", [aSeverity, aLog]() -> void { - CheckerboardEventStorage::Report(aSeverity, aLog); - }); + RefPtr task = NS_NewRunnableFunction([aSeverity, aLog] () -> void { + CheckerboardEventStorage::Report(aSeverity, aLog); + }); NS_DispatchToMainThread(task.forget()); return; } diff --git a/gfx/layers/apz/util/ChromeProcessController.cpp b/gfx/layers/apz/util/ChromeProcessController.cpp index dc4a6ddbaaa8a..22f597bc020b7 100644 --- a/gfx/layers/apz/util/ChromeProcessController.cpp +++ b/gfx/layers/apz/util/ChromeProcessController.cpp @@ -36,10 +36,7 @@ ChromeProcessController::ChromeProcessController(nsIWidget* aWidget, MOZ_ASSERT(aAPZEventState); MOZ_ASSERT(aAPZCTreeManager); - mUILoop->PostTask( - NewRunnableMethod("layers::ChromeProcessController::InitializeRoot", - this, - &ChromeProcessController::InitializeRoot)); + mUILoop->PostTask(NewRunnableMethod(this, &ChromeProcessController::InitializeRoot)); } ChromeProcessController::~ChromeProcessController() {} @@ -85,10 +82,7 @@ void ChromeProcessController::Destroy() { if (MessageLoop::current() != mUILoop) { - mUILoop->PostTask( - NewRunnableMethod("layers::ChromeProcessController::Destroy", - this, - &ChromeProcessController::Destroy)); + mUILoop->PostTask(NewRunnableMethod(this, &ChromeProcessController::Destroy)); return; } @@ -170,19 +164,10 @@ ChromeProcessController::HandleTap(TapType aType, uint64_t aInputBlockId) { if (MessageLoop::current() != mUILoop) { - mUILoop->PostTask( - NewRunnableMethod("layers::ChromeProcessController::HandleTap", - this, - &ChromeProcessController::HandleTap, - aType, - aPoint, - aModifiers, - aGuid, - aInputBlockId)); + mUILoop->PostTask(NewRunnableMethod(this, + &ChromeProcessController::HandleTap, + aType, aPoint, aModifiers, aGuid, aInputBlockId)); return; } @@ -232,17 +217,13 @@ ChromeProcessController::NotifyPinchGesture(PinchGestureInput::PinchGestureType Modifiers aModifiers) { if (MessageLoop::current() != mUILoop) { - mUILoop->PostTask(NewRunnableMethod( - "layers::ChromeProcessController::NotifyPinchGesture", - this, - &ChromeProcessController::NotifyPinchGesture, - aType, - aGuid, - aSpanChange, - aModifiers)); + mUILoop->PostTask(NewRunnableMethod + (this, + &ChromeProcessController::NotifyPinchGesture, + aType, aGuid, aSpanChange, aModifiers)); return; } @@ -257,14 +238,11 @@ ChromeProcessController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, int aArg) { if (MessageLoop::current() != mUILoop) { - mUILoop->PostTask( - NewRunnableMethod( - "layers::ChromeProcessController::NotifyAPZStateChange", - this, - &ChromeProcessController::NotifyAPZStateChange, - aGuid, - aChange, - aArg)); + mUILoop->PostTask(NewRunnableMethod + (this, &ChromeProcessController::NotifyAPZStateChange, + aGuid, aChange, aArg)); return; } @@ -279,12 +257,10 @@ void ChromeProcessController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent) { if (MessageLoop::current() != mUILoop) { - mUILoop->PostTask(NewRunnableMethod( - "layers::ChromeProcessController::NotifyMozMouseScrollEvent", - this, - &ChromeProcessController::NotifyMozMouseScrollEvent, - aScrollId, - aEvent)); + mUILoop->PostTask(NewRunnableMethod + (this, &ChromeProcessController::NotifyMozMouseScrollEvent, + aScrollId, aEvent)); return; } @@ -303,11 +279,9 @@ void ChromeProcessController::NotifyAsyncScrollbarDragRejected(const FrameMetrics::ViewID& aScrollId) { if (MessageLoop::current() != mUILoop) { - mUILoop->PostTask(NewRunnableMethod( - "layers::ChromeProcessController::NotifyAsyncScrollbarDragRejected", - this, - &ChromeProcessController::NotifyAsyncScrollbarDragRejected, - aScrollId)); + mUILoop->PostTask(NewRunnableMethod(this, + &ChromeProcessController::NotifyAsyncScrollbarDragRejected, + aScrollId)); return; } diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 68003d99aa4a5..71633c2c00a38 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -1027,9 +1027,9 @@ BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd) const uint32_t retryMs = 2; RefPtr self = this; - RefPtr runnable = - NS_NewRunnableFunction("layers::BasicCompositor::TryToEndRemoteDrawing", - [self]() { self->TryToEndRemoteDrawing(); }); + RefPtr runnable = NS_NewRunnableFunction([self]() { + self->TryToEndRemoteDrawing(); + }); MessageLoop::current()->PostDelayedTask(runnable.forget(), retryMs); return; } diff --git a/gfx/layers/client/CompositableClient.cpp b/gfx/layers/client/CompositableClient.cpp index cedcc176b6eed..785cd8d590675 100644 --- a/gfx/layers/client/CompositableClient.cpp +++ b/gfx/layers/client/CompositableClient.cpp @@ -194,8 +194,8 @@ CompositableClient::GetTextureClientRecycler() ReentrantMonitorAutoEnter mainThreadAutoMon(barrier); bool done = false; - RefPtr runnable = NS_NewRunnableFunction( - "layers::CompositableClient::GetTextureClientRecycler", [&]() { + RefPtr runnable = + NS_NewRunnableFunction([&]() { if (!mTextureClientRecycler) { mTextureClientRecycler = new layers::TextureClientRecycleAllocator(mForwarder); } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 666e3a033d11b..0989c5a4633ab 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -234,11 +234,9 @@ static void DestroyTextureData(TextureData* aTextureData, LayersIPCChannel* aAll if (aMainThreadOnly && !NS_IsMainThread()) { RefPtr allocatorRef = aAllocator; - NS_DispatchToMainThread(NS_NewRunnableFunction( - "layers::DestroyTextureData", - [aTextureData, allocatorRef, aDeallocate]() -> void { - DestroyTextureData(aTextureData, allocatorRef, aDeallocate, true); - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([aTextureData, allocatorRef, aDeallocate]() -> void { + DestroyTextureData(aTextureData, allocatorRef, aDeallocate, true); + })); return; } diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 68f8fb8483e62..edea3e0762042 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -776,10 +776,8 @@ class TextureClient class TextureClientReleaseTask : public Runnable { public: - explicit TextureClientReleaseTask(TextureClient* aClient) - : Runnable("layers::TextureClientReleaseTask") - , mTextureClient(aClient) - { + explicit TextureClientReleaseTask(TextureClient* aClient) + : mTextureClient(aClient) { } NS_IMETHOD Run() override diff --git a/gfx/layers/client/TextureClientPool.cpp b/gfx/layers/client/TextureClientPool.cpp index 0f7aab8185e7a..f7ccad92d02f4 100644 --- a/gfx/layers/client/TextureClientPool.cpp +++ b/gfx/layers/client/TextureClientPool.cpp @@ -179,23 +179,15 @@ TextureClientPool::ResetTimers() if (mShrinkTimeoutMsec && mTextureClients.size() + mTextureClientsDeferred.size() > mPoolUnusedSize) { TCP_LOG("TexturePool %p scheduling a shrink-to-max-size\n", this); - mShrinkTimer->InitWithNamedFuncCallback( - ShrinkCallback, - this, - mShrinkTimeoutMsec, - nsITimer::TYPE_ONE_SHOT, - "layers::TextureClientPool::ResetTimers"); + mShrinkTimer->InitWithFuncCallback(ShrinkCallback, this, mShrinkTimeoutMsec, + nsITimer::TYPE_ONE_SHOT); } // Clear pool after a period of inactivity to reduce memory consumption if (mClearTimeoutMsec) { TCP_LOG("TexturePool %p scheduling a clear\n", this); - mClearTimer->InitWithNamedFuncCallback( - ClearCallback, - this, - mClearTimeoutMsec, - nsITimer::TYPE_ONE_SHOT, - "layers::TextureClientPool::ResetTimers"); + mClearTimer->InitWithFuncCallback(ClearCallback, this, mClearTimeoutMsec, + nsITimer::TYPE_ONE_SHOT); } } diff --git a/gfx/layers/d3d11/DeviceAttachmentsD3D11.cpp b/gfx/layers/d3d11/DeviceAttachmentsD3D11.cpp index 44199395914f2..80f0e937f28d9 100644 --- a/gfx/layers/d3d11/DeviceAttachmentsD3D11.cpp +++ b/gfx/layers/d3d11/DeviceAttachmentsD3D11.cpp @@ -247,8 +247,7 @@ DeviceAttachmentsD3D11::InitSyncObject() if (FAILED(hr) || !mSyncHandle) { gfxCriticalError() << "Failed to get SharedHandle for sync texture. Result: " << hexa(hr); - NS_DispatchToMainThread(NS_NewRunnableFunction("DeviceAttachmentsD3D11::InitSyncObject", - [] () -> void { + NS_DispatchToMainThread(NS_NewRunnableFunction([] () -> void { Accumulate(Telemetry::D3D11_SYNC_HANDLE_FAILURE, 1); })); return false; diff --git a/gfx/layers/ipc/APZCTreeManagerParent.cpp b/gfx/layers/ipc/APZCTreeManagerParent.cpp index 4ac60b7400928..940cdf630f1d1 100644 --- a/gfx/layers/ipc/APZCTreeManagerParent.cpp +++ b/gfx/layers/ipc/APZCTreeManagerParent.cpp @@ -165,12 +165,11 @@ APZCTreeManagerParent::RecvContentReceivedInputBlock( const uint64_t& aInputBlockId, const bool& aPreventDefault) { - APZThreadUtils::RunOnControllerThread(NewRunnableMethod( - "layers::IAPZCTreeManager::ContentReceivedInputBlock", - mTreeManager, - &IAPZCTreeManager::ContentReceivedInputBlock, - aInputBlockId, - aPreventDefault)); + APZThreadUtils::RunOnControllerThread( + NewRunnableMethod(mTreeManager, + &IAPZCTreeManager::ContentReceivedInputBlock, + aInputBlockId, + aPreventDefault)); return IPC_OK(); } @@ -187,14 +186,10 @@ APZCTreeManagerParent::RecvSetTargetAPZC( return IPC_FAIL_NO_REASON(this); } } - APZThreadUtils::RunOnControllerThread( - NewRunnableMethod>>( - "layers::IAPZCTreeManager::SetTargetAPZC", - mTreeManager, - &IAPZCTreeManager::SetTargetAPZC, - aInputBlockId, - aTargets)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod + >> + (mTreeManager, &IAPZCTreeManager::SetTargetAPZC, aInputBlockId, aTargets)); return IPC_OK(); } @@ -239,14 +234,12 @@ APZCTreeManagerParent::RecvSetAllowedTouchBehavior( const uint64_t& aInputBlockId, nsTArray&& aValues) { - APZThreadUtils::RunOnControllerThread( - NewRunnableMethod>>( - "layers::IAPZCTreeManager::SetAllowedTouchBehavior", - mTreeManager, - &IAPZCTreeManager::SetAllowedTouchBehavior, - aInputBlockId, - Move(aValues))); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod + >> + (mTreeManager, + &IAPZCTreeManager::SetAllowedTouchBehavior, + aInputBlockId, Move(aValues))); return IPC_OK(); } @@ -262,13 +255,11 @@ APZCTreeManagerParent::RecvStartScrollbarDrag( return IPC_FAIL_NO_REASON(this); } - APZThreadUtils::RunOnControllerThread( - NewRunnableMethod( - "layers::IAPZCTreeManager::StartScrollbarDrag", - mTreeManager, - &IAPZCTreeManager::StartScrollbarDrag, - aGuid, - aDragMetrics)); + APZThreadUtils::RunOnControllerThread( + NewRunnableMethod( + mTreeManager, + &IAPZCTreeManager::StartScrollbarDrag, + aGuid, aDragMetrics)); return IPC_OK(); } diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp index 59115d80665d2..1f1dd9b727759 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.cpp +++ b/gfx/layers/ipc/CompositorBridgeChild.cpp @@ -463,7 +463,6 @@ static void ScheduleSendAllPluginsCaptured(CompositorBridgeChild* aThis, MessageLoop* aLoop) { aLoop->PostTask(NewNonOwningRunnableMethod( - "CompositorBridgeChild::SendAllPluginsCaptured", aThis, &CompositorBridgeChild::SendAllPluginsCaptured)); } #endif diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 56dd91096715b..0ae259c98ff53 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -667,30 +667,21 @@ CompositorBridgeParent::ActorDestroy(ActorDestroyReason why) // We must keep the compositor parent alive untill the code handling message // reception is finished on this thread. mSelfRef = this; - MessageLoop::current()->PostTask( - NewRunnableMethod("layers::CompositorBridgeParent::DeferredDestroy", - this, - &CompositorBridgeParent::DeferredDestroy)); + MessageLoop::current()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::DeferredDestroy)); } void CompositorBridgeParent::ScheduleRenderOnCompositorThread() { MOZ_ASSERT(CompositorLoop()); - CompositorLoop()->PostTask( - NewRunnableMethod("layers::CompositorBridgeParent::ScheduleComposition", - this, - &CompositorBridgeParent::ScheduleComposition)); + CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::ScheduleComposition)); } void CompositorBridgeParent::InvalidateOnCompositorThread() { MOZ_ASSERT(CompositorLoop()); - CompositorLoop()->PostTask( - NewRunnableMethod("layers::CompositorBridgeParent::Invalidate", - this, - &CompositorBridgeParent::Invalidate)); + CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::Invalidate)); } void @@ -786,10 +777,7 @@ CompositorBridgeParent::SchedulePauseOnCompositorThread() MonitorAutoLock lock(mPauseCompositionMonitor); MOZ_ASSERT(CompositorLoop()); - CompositorLoop()->PostTask( - NewRunnableMethod("layers::CompositorBridgeParent::PauseComposition", - this, - &CompositorBridgeParent::PauseComposition)); + CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::PauseComposition)); // Wait until the pause has actually been processed by the compositor thread lock.Wait(); @@ -801,10 +789,7 @@ CompositorBridgeParent::ScheduleResumeOnCompositorThread() MonitorAutoLock lock(mResumeCompositionMonitor); MOZ_ASSERT(CompositorLoop()); - CompositorLoop()->PostTask( - NewRunnableMethod("layers::CompositorBridgeParent::ResumeComposition", - this, - &CompositorBridgeParent::ResumeComposition)); + CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::ResumeComposition)); // Wait until the resume has actually been processed by the compositor thread lock.Wait(); @@ -818,12 +803,10 @@ CompositorBridgeParent::ScheduleResumeOnCompositorThread(int width, int height) MonitorAutoLock lock(mResumeCompositionMonitor); MOZ_ASSERT(CompositorLoop()); - CompositorLoop()->PostTask(NewRunnableMethod( - "layers::CompositorBridgeParent::ResumeCompositionAndResize", - this, - &CompositorBridgeParent::ResumeCompositionAndResize, - width, - height)); + CompositorLoop()->PostTask(NewRunnableMethod + (this, + &CompositorBridgeParent::ResumeCompositionAndResize, + width, height)); // Wait until the resume has actually been processed by the compositor thread lock.Wait(); @@ -1199,10 +1182,8 @@ CompositorBridgeParent::ScheduleRotationOnCompositorThread(const TargetConfig& a if (mForceCompositionTask != nullptr) { mForceCompositionTask->Cancel(); } - RefPtr task = NewCancelableRunnableMethod( - "layers::CompositorBridgeParent::ForceComposition", - this, - &CompositorBridgeParent::ForceComposition); + RefPtr task = + NewCancelableRunnableMethod(this, &CompositorBridgeParent::ForceComposition); mForceCompositionTask = task; ScheduleTask(task.forget(), gfxPrefs::OrientationSyncMillis()); } @@ -1352,9 +1333,9 @@ CompositorBridgeParent::FlushApzRepaints(const uint64_t& aLayersId) layersId = mRootLayerTreeID; } RefPtr self = this; - APZThreadUtils::RunOnControllerThread(NS_NewRunnableFunction( - "layers::CompositorBridgeParent::FlushApzRepaints", - [=]() { self->mApzcTreeManager->FlushApzRepaints(layersId); })); + APZThreadUtils::RunOnControllerThread(NS_NewRunnableFunction([=] () { + self->mApzcTreeManager->FlushApzRepaints(layersId); + })); } void @@ -1378,14 +1359,9 @@ CompositorBridgeParent::SetConfirmedTargetAPZC(const uint64_t& aLayersId, void (APZCTreeManager::*setTargetApzcFunc) (uint64_t, const nsTArray&) = &APZCTreeManager::SetTargetAPZC; - RefPtr task = - NewRunnableMethod>>( - "layers::CompositorBridgeParent::SetConfirmedTargetAPZC", - mApzcTreeManager.get(), - setTargetApzcFunc, - aInputBlockId, - aTargets); + RefPtr task = NewRunnableMethod + >> + (mApzcTreeManager.get(), setTargetApzcFunc, aInputBlockId, aTargets); APZThreadUtils::RunOnControllerThread(task.forget()); } @@ -2181,10 +2157,7 @@ void CompositorBridgeParent::ScheduleShowAllPluginWindows() { MOZ_ASSERT(CompositorLoop()); - CompositorLoop()->PostTask( - NewRunnableMethod("layers::CompositorBridgeParent::ShowAllPluginWindows", - this, - &CompositorBridgeParent::ShowAllPluginWindows)); + CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::ShowAllPluginWindows)); } void @@ -2199,10 +2172,7 @@ void CompositorBridgeParent::ScheduleHideAllPluginWindows() { MOZ_ASSERT(CompositorLoop()); - CompositorLoop()->PostTask( - NewRunnableMethod("layers::CompositorBridgeParent::HideAllPluginWindows", - this, - &CompositorBridgeParent::HideAllPluginWindows)); + CompositorLoop()->PostTask(NewRunnableMethod(this, &CompositorBridgeParent::HideAllPluginWindows)); } void diff --git a/gfx/layers/ipc/CompositorManagerParent.cpp b/gfx/layers/ipc/CompositorManagerParent.cpp index f95da86256e5f..369839fe581db 100644 --- a/gfx/layers/ipc/CompositorManagerParent.cpp +++ b/gfx/layers/ipc/CompositorManagerParent.cpp @@ -57,7 +57,6 @@ CompositorManagerParent::Create(Endpoint&& aEndpoint) RefPtr bridge = new CompositorManagerParent(); RefPtr runnable = NewRunnableMethod&&>( - "CompositorManagerParent::Bind", bridge, &CompositorManagerParent::Bind, Move(aEndpoint)); diff --git a/gfx/layers/ipc/CompositorVsyncScheduler.cpp b/gfx/layers/ipc/CompositorVsyncScheduler.cpp index 829087efd1eee..40e913c2cc0fe 100644 --- a/gfx/layers/ipc/CompositorVsyncScheduler.cpp +++ b/gfx/layers/ipc/CompositorVsyncScheduler.cpp @@ -122,11 +122,9 @@ CompositorVsyncScheduler::PostCompositeTask(TimeStamp aCompositeTimestamp) // can be called from the compositor or vsync thread MonitorAutoLock lock(mCurrentCompositeTaskMonitor); if (mCurrentCompositeTask == nullptr && CompositorThreadHolder::Loop()) { - RefPtr task = NewCancelableRunnableMethod( - "layers::CompositorVsyncScheduler::Composite", - this, - &CompositorVsyncScheduler::Composite, - aCompositeTimestamp); + RefPtr task = + NewCancelableRunnableMethod(this, &CompositorVsyncScheduler::Composite, + aCompositeTimestamp); mCurrentCompositeTask = task; ScheduleTask(task.forget(), 0); } @@ -183,10 +181,8 @@ CompositorVsyncScheduler::SetNeedsComposite() { if (!CompositorThreadHolder::IsInCompositorThread()) { MonitorAutoLock lock(mSetNeedsCompositeMonitor); - RefPtr task = NewCancelableRunnableMethod( - "layers::CompositorVsyncScheduler::SetNeedsComposite", - this, - &CompositorVsyncScheduler::SetNeedsComposite); + RefPtr task = + NewCancelableRunnableMethod(this, &CompositorVsyncScheduler::SetNeedsComposite); mSetNeedsCompositeTask = task; ScheduleTask(task.forget(), 0); return; diff --git a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp index 1887fc2333fc6..18252c76e2287 100644 --- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp @@ -58,10 +58,7 @@ CrossProcessCompositorBridgeParent::ActorDestroy(ActorDestroyReason aWhy) // We must keep this object alive untill the code handling message // reception is finished on this thread. - MessageLoop::current()->PostTask(NewRunnableMethod( - "layers::CrossProcessCompositorBridgeParent::DeferredDestroy", - this, - &CrossProcessCompositorBridgeParent::DeferredDestroy)); + MessageLoop::current()->PostTask(NewRunnableMethod(this, &CrossProcessCompositorBridgeParent::DeferredDestroy)); } PLayerTransactionParent* diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index 48c3578991594..ade05fb767735 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -578,7 +578,6 @@ ImageBridgeChild::InitForContent(Endpoint&& aEndpoint, uint32 RefPtr child = new ImageBridgeChild(aNamespace); RefPtr runnable = NewRunnableMethod&&>( - "layers::ImageBridgeChild::Bind", child, &ImageBridgeChild::Bind, Move(aEndpoint)); @@ -734,10 +733,7 @@ ImageBridgeChild::InitWithGPUProcess(Endpoint&& aEndpoint, ui MessageLoop* loop = child->GetMessageLoop(); loop->PostTask(NewRunnableMethod&&>( - "layers::ImageBridgeChild::Bind", - child, - &ImageBridgeChild::Bind, - Move(aEndpoint))); + child, &ImageBridgeChild::Bind, Move(aEndpoint))); // Assign this after so other threads can't post messages before we connect to IPDL. { diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index 6553075d37ede..3dc62d69e9670 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -106,10 +106,7 @@ ImageBridgeParent::CreateForGPUProcess(Endpoint&& aEndpoint) RefPtr parent = new ImageBridgeParent(loop, aEndpoint.OtherPid()); loop->PostTask(NewRunnableMethod&&>( - "layers::ImageBridgeParent::Bind", - parent, - &ImageBridgeParent::Bind, - Move(aEndpoint))); + parent, &ImageBridgeParent::Bind, Move(aEndpoint))); sImageBridgeParentSingleton = parent; return true; @@ -125,10 +122,7 @@ ImageBridgeParent::ActorDestroy(ActorDestroyReason aWhy) MonitorAutoLock lock(*sImageBridgesLock); sImageBridges.erase(OtherPid()); } - MessageLoop::current()->PostTask( - NewRunnableMethod("layers::ImageBridgeParent::DeferredDestroy", - this, - &ImageBridgeParent::DeferredDestroy)); + MessageLoop::current()->PostTask(NewRunnableMethod(this, &ImageBridgeParent::DeferredDestroy)); // It is very important that this method gets called at shutdown (be it a clean // or an abnormal shutdown), because DeferredDestroy is what clears mSelfRef. @@ -216,10 +210,7 @@ ImageBridgeParent::CreateForContent(Endpoint&& aEndpoint) RefPtr bridge = new ImageBridgeParent(loop, aEndpoint.OtherPid()); loop->PostTask(NewRunnableMethod&&>( - "layers::ImageBridgeParent::Bind", - bridge, - &ImageBridgeParent::Bind, - Move(aEndpoint))); + bridge, &ImageBridgeParent::Bind, Move(aEndpoint))); return true; } diff --git a/gfx/layers/ipc/RemoteContentController.cpp b/gfx/layers/ipc/RemoteContentController.cpp index d6d23df98c8ec..dd7f7547b9015 100644 --- a/gfx/layers/ipc/RemoteContentController.cpp +++ b/gfx/layers/ipc/RemoteContentController.cpp @@ -89,19 +89,8 @@ RemoteContentController::HandleTap(TapType aTapType, } else { // We don't want to get the TabParent or call TabParent::SendHandleTap() from a non-main thread (this might happen // on Android, where this is called from the Java UI thread) - NS_DispatchToMainThread(NewRunnableMethod( - "layers::RemoteContentController::HandleTapOnMainThread", - this, - &RemoteContentController::HandleTapOnMainThread, - aTapType, - aPoint, - aModifiers, - aGuid, - aInputBlockId)); + NS_DispatchToMainThread(NewRunnableMethod + (this, &RemoteContentController::HandleTapOnMainThread, aTapType, aPoint, aModifiers, aGuid, aInputBlockId)); } } @@ -170,14 +159,11 @@ RemoteContentController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, { if (MessageLoop::current() != mCompositorThread) { // We have to send messages from the compositor thread - mCompositorThread->PostTask( - NewRunnableMethod( - "layers::RemoteContentController::NotifyAPZStateChange", - this, - &RemoteContentController::NotifyAPZStateChange, - aGuid, - aChange, - aArg)); + mCompositorThread->PostTask(NewRunnableMethod(this, + &RemoteContentController::NotifyAPZStateChange, + aGuid, aChange, aArg)); return; } @@ -190,13 +176,10 @@ void RemoteContentController::UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent) { if (MessageLoop::current() != mCompositorThread) { - mCompositorThread->PostTask(NewRunnableMethod( - "layers::RemoteContentController::UpdateOverscrollVelocity", - this, - &RemoteContentController::UpdateOverscrollVelocity, - aX, - aY, - aIsRootContent)); + mCompositorThread->PostTask(NewRunnableMethod(this, + &RemoteContentController::UpdateOverscrollVelocity, + aX, aY, aIsRootContent)); return; } if (mCanSend) { @@ -208,13 +191,10 @@ void RemoteContentController::UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent) { if (MessageLoop::current() != mCompositorThread) { - mCompositorThread->PostTask(NewRunnableMethod( - "layers::RemoteContentController::UpdateOverscrollOffset", - this, - &RemoteContentController::UpdateOverscrollOffset, - aX, - aY, - aIsRootContent)); + mCompositorThread->PostTask(NewRunnableMethod(this, + &RemoteContentController::UpdateOverscrollOffset, + aX, aY, aIsRootContent)); return; } if (mCanSend) { @@ -228,13 +208,10 @@ RemoteContentController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& a { if (MessageLoop::current() != mCompositorThread) { // We have to send messages from the compositor thread - mCompositorThread->PostTask( - NewRunnableMethod( - "layers::RemoteContentController::NotifyMozMouseScrollEvent", - this, - &RemoteContentController::NotifyMozMouseScrollEvent, - aScrollId, - aEvent)); + mCompositorThread->PostTask(NewRunnableMethod(this, + &RemoteContentController::NotifyMozMouseScrollEvent, + aScrollId, aEvent)); return; } @@ -258,11 +235,8 @@ RemoteContentController::NotifyAsyncScrollbarDragRejected(const FrameMetrics::Vi { if (MessageLoop::current() != mCompositorThread) { // We have to send messages from the compositor thread - mCompositorThread->PostTask(NewRunnableMethod( - "layers::RemoteContentController::NotifyAsyncScrollbarDragRejected", - this, - &RemoteContentController::NotifyAsyncScrollbarDragRejected, - aScrollId)); + mCompositorThread->PostTask(NewRunnableMethod(this, + &RemoteContentController::NotifyAsyncScrollbarDragRejected, aScrollId)); return; } diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 6c59f4df4ef07..8ebf761cad2ab 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -208,8 +208,7 @@ struct ReleaseOnMainThreadTask : public Runnable UniquePtr mObj; explicit ReleaseOnMainThreadTask(UniquePtr& aObj) - : Runnable("layers::ReleaseOnMainThreadTask") - , mObj(Move(aObj)) + : mObj(Move(aObj)) {} NS_IMETHOD Run() override { @@ -234,9 +233,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder() nsIEventTarget::DISPATCH_NORMAL); } else { NS_DispatchToMainThread( - NewRunnableMethod("layers::LayerTransactionChild::Destroy", - mShadowManager, - &LayerTransactionChild::Destroy)); + NewRunnableMethod(mShadowManager, &LayerTransactionChild::Destroy)); } } } diff --git a/gfx/layers/ipc/ThreadSafeRefcountingWithMainThreadDestruction.h b/gfx/layers/ipc/ThreadSafeRefcountingWithMainThreadDestruction.h index e86702fccec5c..e64705478e7e1 100644 --- a/gfx/layers/ipc/ThreadSafeRefcountingWithMainThreadDestruction.h +++ b/gfx/layers/ipc/ThreadSafeRefcountingWithMainThreadDestruction.h @@ -42,11 +42,7 @@ template struct DeleteOnMainThreadTask : public Runnable { T* mToDelete; - explicit DeleteOnMainThreadTask(T* aToDelete) - : Runnable("layers::DeleteOnMainThreadTask") - , mToDelete(aToDelete) - { - } + explicit DeleteOnMainThreadTask(T* aToDelete) : mToDelete(aToDelete) {} NS_IMETHOD Run() override { MOZ_ASSERT(NS_IsMainThread()); mToDelete->DeleteToBeCalledOnMainThread(); diff --git a/gfx/layers/ipc/UiCompositorControllerChild.cpp b/gfx/layers/ipc/UiCompositorControllerChild.cpp index 47e16bf2f13eb..60836734a089d 100644 --- a/gfx/layers/ipc/UiCompositorControllerChild.cpp +++ b/gfx/layers/ipc/UiCompositorControllerChild.cpp @@ -48,11 +48,7 @@ UiCompositorControllerChild::CreateForSameProcess(const int64_t& aRootLayerTreeI { RefPtr child = new UiCompositorControllerChild(0); child->mParent = new UiCompositorControllerParent(aRootLayerTreeId); - GetUiThread()->Dispatch( - NewRunnableMethod("layers::UiCompositorControllerChild::OpenForSameProcess", - child, - &UiCompositorControllerChild::OpenForSameProcess), - nsIThread::DISPATCH_NORMAL); + GetUiThread()->Dispatch(NewRunnableMethod(child, &UiCompositorControllerChild::OpenForSameProcess), nsIThread::DISPATCH_NORMAL); return child; } @@ -62,12 +58,8 @@ UiCompositorControllerChild::CreateForGPUProcess(const uint64_t& aProcessToken, { RefPtr child = new UiCompositorControllerChild(aProcessToken); - RefPtr task = - NewRunnableMethod&&>( - "layers::UiCompositorControllerChild::OpenForGPUProcess", - child, - &UiCompositorControllerChild::OpenForGPUProcess, - Move(aEndpoint)); + RefPtr task = NewRunnableMethod&&>( + child, &UiCompositorControllerChild::OpenForGPUProcess, Move(aEndpoint)); GetUiThread()->Dispatch(task.forget(), nsIThread::DISPATCH_NORMAL); return child; @@ -194,11 +186,7 @@ void UiCompositorControllerChild::Destroy() { if (!IsOnUiThread()) { - GetUiThread()->Dispatch( - NewRunnableMethod("layers::UiCompositorControllerChild::Destroy", - this, - &UiCompositorControllerChild::Destroy), - nsIThread::DISPATCH_NORMAL); + GetUiThread()->Dispatch(NewRunnableMethod(this, &UiCompositorControllerChild::Destroy), nsIThread::DISPATCH_NORMAL); return; } diff --git a/gfx/layers/ipc/UiCompositorControllerParent.cpp b/gfx/layers/ipc/UiCompositorControllerParent.cpp index a316f79cef288..34da062950ee2 100644 --- a/gfx/layers/ipc/UiCompositorControllerParent.cpp +++ b/gfx/layers/ipc/UiCompositorControllerParent.cpp @@ -34,12 +34,8 @@ UiCompositorControllerParent::Start(const uint64_t& aRootLayerTreeId, Endpoint

parent = new UiCompositorControllerParent(aRootLayerTreeId); - RefPtr task = - NewRunnableMethod&&>( - "layers::UiCompositorControllerParent::Open", - parent, - &UiCompositorControllerParent::Open, - Move(aEndpoint)); + RefPtr task = NewRunnableMethod&&>( + parent, &UiCompositorControllerParent::Open, Move(aEndpoint)); CompositorThreadHolder::Loop()->PostTask(task.forget()); return parent; @@ -213,12 +209,7 @@ UiCompositorControllerParent::ToolbarAnimatorMessageFromCompositor(int32_t aMess { // This function can be call from ether compositor or controller thread. if (!CompositorThreadHolder::IsInCompositorThread()) { - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod( - "layers::UiCompositorControllerParent::" - "ToolbarAnimatorMessageFromCompositor", - this, - &UiCompositorControllerParent::ToolbarAnimatorMessageFromCompositor, - aMessage)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &UiCompositorControllerParent::ToolbarAnimatorMessageFromCompositor, aMessage)); return; } @@ -250,10 +241,7 @@ UiCompositorControllerParent::InitializeForSameProcess() // This function is called by UiCompositorControllerChild in the main thread. // So dispatch to the compositor thread to Initialize. if (!CompositorThreadHolder::IsInCompositorThread()) { - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod( - "layers::UiCompositorControllerParent::InitializeForSameProcess", - this, - &UiCompositorControllerParent::InitializeForSameProcess)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod(this, &UiCompositorControllerParent::InitializeForSameProcess)); return; } diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index 085420a091d9a..20215963c8685 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -68,7 +68,6 @@ ObserverToDestroyFeaturesAlreadyReported::Observe(nsISupports* aSubject, class RegisterObserverRunnable : public Runnable { public: - RegisterObserverRunnable() : Runnable("RegisterObserverRunnable") {} NS_IMETHOD Run() override { // LeakLog made me do this. Basically, I just wanted gFeaturesAlreadyReported to be a static nsTArray, // and LeakLog was complaining about leaks like this: @@ -88,8 +87,7 @@ class RegisterObserverRunnable : public Runnable { class AppendAppNotesRunnable : public CancelableRunnable { public: explicit AppendAppNotesRunnable(const nsACString& aFeatureStr) - : CancelableRunnable("AppendAppNotesRunnable") - , mFeatureString(aFeatureStr) + : mFeatureString(aFeatureStr) { } diff --git a/gfx/thebes/DeviceManagerDx.cpp b/gfx/thebes/DeviceManagerDx.cpp index 9077d285219f9..dc05a4ef76cca 100644 --- a/gfx/thebes/DeviceManagerDx.cpp +++ b/gfx/thebes/DeviceManagerDx.cpp @@ -976,8 +976,7 @@ DeviceManagerDx::PreloadAttachmentsOnCompositorThread() return; } - RefPtr task = NS_NewRunnableFunction("DeviceManagerDx::PreloadAttachmentsOnCompositorThread", - []() -> void { + RefPtr task = NS_NewRunnableFunction([]() -> void { if (DeviceManagerDx* dm = DeviceManagerDx::Get()) { RefPtr device; RefPtr attachments; diff --git a/gfx/thebes/SoftwareVsyncSource.cpp b/gfx/thebes/SoftwareVsyncSource.cpp index 5776270a85fa6..7e92b89ec462e 100644 --- a/gfx/thebes/SoftwareVsyncSource.cpp +++ b/gfx/thebes/SoftwareVsyncSource.cpp @@ -46,8 +46,8 @@ SoftwareDisplay::EnableVsync() } mVsyncEnabled = true; - mVsyncThread->message_loop()->PostTask(NewRunnableMethod( - "SoftwareDisplay::EnableVsync", this, &SoftwareDisplay::EnableVsync)); + mVsyncThread->message_loop()->PostTask( + NewRunnableMethod(this, &SoftwareDisplay::EnableVsync)); return; } @@ -65,8 +65,8 @@ SoftwareDisplay::DisableVsync() } mVsyncEnabled = false; - mVsyncThread->message_loop()->PostTask(NewRunnableMethod( - "SoftwareDisplay::DisableVsync", this, &SoftwareDisplay::DisableVsync)); + mVsyncThread->message_loop()->PostTask( + NewRunnableMethod(this, &SoftwareDisplay::DisableVsync)); return; } @@ -129,11 +129,10 @@ SoftwareDisplay::ScheduleNextVsync(mozilla::TimeStamp aVsyncTimestamp) nextVsync = mozilla::TimeStamp::Now(); } - mCurrentVsyncTask = NewCancelableRunnableMethod( - "SoftwareDisplay::NotifyVsync", - this, - &SoftwareDisplay::NotifyVsync, - nextVsync); + mCurrentVsyncTask = + NewCancelableRunnableMethod(this, + &SoftwareDisplay::NotifyVsync, + nextVsync); RefPtr addrefedTask = mCurrentVsyncTask; mVsyncThread->message_loop()->PostDelayedTask( diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp index a01c4928598ae..9d4298dd32492 100644 --- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -1181,12 +1181,10 @@ gfxFcPlatformFontList::gfxFcPlatformFontList() mLastConfig = FcConfigGetCurrent(); mCheckFontUpdatesTimer = do_CreateInstance("@mozilla.org/timer;1"); if (mCheckFontUpdatesTimer) { - mCheckFontUpdatesTimer->InitWithNamedFuncCallback( - CheckFontUpdates, - this, - (rescanInterval + 1) * 1000, - nsITimer::TYPE_REPEATING_SLACK, - "gfxFcPlatformFontList::gfxFcPlatformFontList"); + mCheckFontUpdatesTimer-> + InitWithFuncCallback(CheckFontUpdates, this, + (rescanInterval + 1) * 1000, + nsITimer::TYPE_REPEATING_SLACK); } else { NS_WARNING("Failure to create font updates timer"); } diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 0863584d8c5d0..5aaba73517eef 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -189,12 +189,10 @@ gfxFontCache::gfxFontCache(nsIEventTarget* aEventTarget) if (XRE_IsContentProcess() && NS_IsMainThread()) { mWordCacheExpirationTimer->SetTarget(aEventTarget); } - mWordCacheExpirationTimer->InitWithNamedFuncCallback( - WordCacheExpirationTimerCallback, - this, - SHAPED_WORD_TIMEOUT_SECONDS * 1000, - nsITimer::TYPE_REPEATING_SLACK, - "gfxFontCache::gfxFontCache"); + mWordCacheExpirationTimer-> + InitWithFuncCallback(WordCacheExpirationTimerCallback, this, + SHAPED_WORD_TIMEOUT_SECONDS * 1000, + nsITimer::TYPE_REPEATING_SLACK); } #endif } diff --git a/gfx/thebes/gfxFontInfoLoader.cpp b/gfx/thebes/gfxFontInfoLoader.cpp index 47efd180f998a..a53c96369b3dd 100644 --- a/gfx/thebes/gfxFontInfoLoader.cpp +++ b/gfx/thebes/gfxFontInfoLoader.cpp @@ -44,9 +44,8 @@ class FontInfoLoadCompleteEvent : public Runnable { NS_DECL_ISUPPORTS_INHERITED - explicit FontInfoLoadCompleteEvent(FontInfoData* aFontInfo) - : mozilla::Runnable("FontInfoLoadCompleteEvent") - , mFontInfo(aFontInfo) + explicit FontInfoLoadCompleteEvent(FontInfoData *aFontInfo) : + mFontInfo(aFontInfo) {} NS_IMETHOD Run() override; @@ -59,9 +58,8 @@ class AsyncFontInfoLoader : public Runnable { NS_DECL_ISUPPORTS_INHERITED - explicit AsyncFontInfoLoader(FontInfoData* aFontInfo) - : mozilla::Runnable("AsyncFontInfoLoader") - , mFontInfo(aFontInfo) + explicit AsyncFontInfoLoader(FontInfoData *aFontInfo) : + mFontInfo(aFontInfo) { mCompleteEvent = new FontInfoLoadCompleteEvent(aFontInfo); } @@ -77,11 +75,7 @@ class ShutdownThreadEvent : public Runnable { NS_DECL_ISUPPORTS_INHERITED - explicit ShutdownThreadEvent(nsIThread* aThread) - : mozilla::Runnable("ShutdownThreadEvent") - , mThread(aThread) - { - } + explicit ShutdownThreadEvent(nsIThread* aThread) : mThread(aThread) {} NS_IMETHOD Run() override { mThread->Shutdown(); return NS_OK; @@ -164,11 +158,8 @@ gfxFontInfoLoader::StartLoader(uint32_t aDelay, uint32_t aInterval) // delay? ==> start async thread after a delay if (aDelay) { mState = stateTimerOnDelay; - mTimer->InitWithNamedFuncCallback(DelayedStartCallback, - this, - aDelay, - nsITimer::TYPE_ONE_SHOT, - "gfxFontInfoLoader::StartLoader"); + mTimer->InitWithFuncCallback(DelayedStartCallback, this, aDelay, + nsITimer::TYPE_ONE_SHOT); return; } @@ -218,11 +209,8 @@ gfxFontInfoLoader::FinalizeLoader(FontInfoData *aFontInfo) // not all work completed ==> run load on interval mState = stateTimerOnInterval; - mTimer->InitWithNamedFuncCallback(LoadFontInfoCallback, - this, - mInterval, - nsITimer::TYPE_REPEATING_SLACK, - "gfxFontInfoLoader::FinalizeLoader"); + mTimer->InitWithFuncCallback(LoadFontInfoCallback, this, mInterval, + nsITimer::TYPE_REPEATING_SLACK); } void diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 9b1708170b057..9fae40928bffa 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -309,11 +309,7 @@ class LogForwarderEvent : public Runnable NS_DECL_ISUPPORTS_INHERITED - explicit LogForwarderEvent(const nsCString& aMessage) - : mozilla::Runnable("LogForwarderEvent") - , mMessage(aMessage) - { - } + explicit LogForwarderEvent(const nsCString& aMessage) : mMessage(aMessage) {} NS_IMETHOD Run() override { MOZ_ASSERT(NS_IsMainThread() && (XRE_IsContentProcess() || XRE_IsGPUProcess())); @@ -367,11 +363,7 @@ class CrashTelemetryEvent : public Runnable NS_DECL_ISUPPORTS_INHERITED - explicit CrashTelemetryEvent(uint32_t aReason) - : mozilla::Runnable("CrashTelemetryEvent") - , mReason(aReason) - { - } + explicit CrashTelemetryEvent(uint32_t aReason) : mReason(aReason) {} NS_IMETHOD Run() override { MOZ_ASSERT(NS_IsMainThread()); @@ -2704,12 +2696,11 @@ gfxPlatform::NotifyCompositorCreated(LayersBackend aBackend) mCompositorBackend = aBackend; // Notify that we created a compositor, so telemetry can update. - NS_DispatchToMainThread( - NS_NewRunnableFunction("gfxPlatform::NotifyCompositorCreated", [] { - if (nsCOMPtr obsvc = services::GetObserverService()) { - obsvc->NotifyObservers(nullptr, "compositor:created", nullptr); - } - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([] { + if (nsCOMPtr obsvc = services::GetObserverService()) { + obsvc->NotifyObservers(nullptr, "compositor:created", nullptr); + } + })); } /* static */ void diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index 6aa208d827fa0..efa5ac1549893 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -652,10 +652,7 @@ class GLXVsyncSource final : public VsyncSource if (!mVsyncThread.Start()) return false; - RefPtr vsyncSetup = - NewRunnableMethod("GLXVsyncSource::GLXDisplay::SetupGLContext", - this, - &GLXDisplay::SetupGLContext); + RefPtr vsyncSetup = NewRunnableMethod(this, &GLXDisplay::SetupGLContext); mVsyncThread.message_loop()->PostTask(vsyncSetup.forget()); // Wait until the setup has completed. lock.Wait(); @@ -727,8 +724,7 @@ class GLXVsyncSource final : public VsyncSource // If the task has not nulled itself out, it hasn't yet realized // that vsync was disabled earlier, so continue its execution. if (!mVsyncTask) { - mVsyncTask = NewRunnableMethod( - "GLXVsyncSource::GLXDisplay::RunVsync", this, &GLXDisplay::RunVsync); + mVsyncTask = NewRunnableMethod(this, &GLXDisplay::RunVsync); RefPtr addrefedTask = mVsyncTask; mVsyncThread.message_loop()->PostTask(addrefedTask.forget()); } @@ -752,8 +748,7 @@ class GLXVsyncSource final : public VsyncSource DisableVsync(); // Cleanup thread-specific resources before shutting down. - RefPtr shutdownTask = NewRunnableMethod( - "GLXVsyncSource::GLXDisplay::Cleanup", this, &GLXDisplay::Cleanup); + RefPtr shutdownTask = NewRunnableMethod(this, &GLXDisplay::Cleanup); mVsyncThread.message_loop()->PostTask(shutdownTask.forget()); // Stop, waiting for the cleanup task to finish execution. diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 2379dd6ee45c3..90b2f6240c56e 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -1684,8 +1684,7 @@ class D3DVsyncSource final : public VsyncSource } mVsyncThread->message_loop()->PostTask( - NewRunnableMethod("D3DVsyncDisplay::VBlankLoop", - this, &D3DVsyncDisplay::VBlankLoop)); + NewRunnableMethod(this, &D3DVsyncDisplay::VBlankLoop)); } virtual void DisableVsync() override @@ -1723,8 +1722,7 @@ class D3DVsyncSource final : public VsyncSource } mVsyncThread->message_loop()->PostDelayedTask( - NewRunnableMethod("D3DVsyncDisplay::VBlankLoop", - this, &D3DVsyncDisplay::VBlankLoop), + NewRunnableMethod(this, &D3DVsyncDisplay::VBlankLoop), delay.ToMilliseconds()); } diff --git a/gfx/vr/gfxVROculus.cpp b/gfx/vr/gfxVROculus.cpp index 91788a9013660..a58151504313e 100644 --- a/gfx/vr/gfxVROculus.cpp +++ b/gfx/vr/gfxVROculus.cpp @@ -996,10 +996,9 @@ VRControllerOculus::UpdateVibrateHaptic(ovrSession aSession, MOZ_ASSERT(mVibrateThread); RefPtr runnable = - NewRunnableMethod( - "VRControllerOculus::UpdateVibrateHaptic", - this, &VRControllerOculus::UpdateVibrateHaptic, aSession, - aHapticIndex, aIntensity, (duration > kVibrateRate) ? remainingTime : 0, aVibrateIndex, aPromiseID); + NewRunnableMethod + (this, &VRControllerOculus::UpdateVibrateHaptic, aSession, + aHapticIndex, aIntensity, (duration > kVibrateRate) ? remainingTime : 0, aVibrateIndex, aPromiseID); NS_DelayedDispatchToCurrentThread(runnable.forget(), (duration > kVibrateRate) ? kVibrateRate : remainingTime); } else { @@ -1036,9 +1035,8 @@ VRControllerOculus::VibrateHapticComplete(ovrSession aSession, uint32_t aPromise VRManager *vm = VRManager::Get(); MOZ_ASSERT(vm); - CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod( - "VRManager::NotifyVibrateHapticCompleted", - vm, &VRManager::NotifyVibrateHapticCompleted, aPromiseID)); + CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod + (vm, &VRManager::NotifyVibrateHapticCompleted, aPromiseID)); } void @@ -1062,8 +1060,7 @@ VRControllerOculus::VibrateHaptic(ovrSession aSession, RefPtr runnable = NewRunnableMethod - ("VRControllerOculus::UpdateVibrateHaptic", - this, &VRControllerOculus::UpdateVibrateHaptic, aSession, + (this, &VRControllerOculus::UpdateVibrateHaptic, aSession, aHapticIndex, aIntensity, aDuration, mVibrateIndex, aPromiseID); mVibrateThread->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL); } diff --git a/gfx/vr/gfxVROpenVR.cpp b/gfx/vr/gfxVROpenVR.cpp index cd1ab0ffe7d78..e43294f2c3d0b 100644 --- a/gfx/vr/gfxVROpenVR.cpp +++ b/gfx/vr/gfxVROpenVR.cpp @@ -454,8 +454,7 @@ VRControllerOpenVR::UpdateVibrateHaptic(::vr::IVRSystem* aVRSystem, RefPtr runnable = NewRunnableMethod<::vr::IVRSystem*, uint32_t, double, double, uint64_t, uint32_t> - ("VRControllerOpenVR::UpdateVibrateHaptic", - this, &VRControllerOpenVR::UpdateVibrateHaptic, aVRSystem, + (this, &VRControllerOpenVR::UpdateVibrateHaptic, aVRSystem, aHapticIndex, aIntensity, duration - kVibrateRate, aVibrateIndex, aPromiseID); NS_DelayedDispatchToCurrentThread(runnable.forget(), kVibrateRate); } else { @@ -471,8 +470,7 @@ VRControllerOpenVR::VibrateHapticComplete(uint32_t aPromiseID) MOZ_ASSERT(vm); CompositorThreadHolder::Loop()->PostTask(NewRunnableMethod - ("VRManager::NotifyVibrateHapticCompleted", - vm, &VRManager::NotifyVibrateHapticCompleted, aPromiseID)); + (vm, &VRManager::NotifyVibrateHapticCompleted, aPromiseID)); } void @@ -496,8 +494,7 @@ VRControllerOpenVR::VibrateHaptic(::vr::IVRSystem* aVRSystem, RefPtr runnable = NewRunnableMethod<::vr::IVRSystem*, uint32_t, double, double, uint64_t, uint32_t> - ("VRControllerOpenVR::UpdateVibrateHaptic", - this, &VRControllerOpenVR::UpdateVibrateHaptic, aVRSystem, + (this, &VRControllerOpenVR::UpdateVibrateHaptic, aVRSystem, aHapticIndex, aIntensity, aDuration, mVibrateIndex, aPromiseID); mVibrateThread->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL); } diff --git a/gfx/vr/ipc/VRManagerChild.cpp b/gfx/vr/ipc/VRManagerChild.cpp index 9807422b1c90c..20869f38f1cf1 100644 --- a/gfx/vr/ipc/VRManagerChild.cpp +++ b/gfx/vr/ipc/VRManagerChild.cpp @@ -544,9 +544,7 @@ VRManagerChild::RunFrameRequestCallbacks() void VRManagerChild::FireDOMVRDisplayMountedEvent(uint32_t aDisplayID) { - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "gfx::VRManagerChild::FireDOMVRDisplayMountedEventInternal", - this, + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, &VRManagerChild::FireDOMVRDisplayMountedEventInternal, aDisplayID)); } @@ -554,9 +552,7 @@ VRManagerChild::FireDOMVRDisplayMountedEvent(uint32_t aDisplayID) void VRManagerChild::FireDOMVRDisplayUnmountedEvent(uint32_t aDisplayID) { - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "gfx::VRManagerChild::FireDOMVRDisplayUnmountedEventInternal", - this, + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, &VRManagerChild::FireDOMVRDisplayUnmountedEventInternal, aDisplayID)); } @@ -564,9 +560,7 @@ VRManagerChild::FireDOMVRDisplayUnmountedEvent(uint32_t aDisplayID) void VRManagerChild::FireDOMVRDisplayConnectEvent(uint32_t aDisplayID) { - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "gfx::VRManagerChild::FireDOMVRDisplayConnectEventInternal", - this, + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, &VRManagerChild::FireDOMVRDisplayConnectEventInternal, aDisplayID)); } @@ -574,9 +568,7 @@ VRManagerChild::FireDOMVRDisplayConnectEvent(uint32_t aDisplayID) void VRManagerChild::FireDOMVRDisplayDisconnectEvent(uint32_t aDisplayID) { - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "gfx::VRManagerChild::FireDOMVRDisplayDisconnectEventInternal", - this, + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, &VRManagerChild::FireDOMVRDisplayDisconnectEventInternal, aDisplayID)); } @@ -584,9 +576,7 @@ VRManagerChild::FireDOMVRDisplayDisconnectEvent(uint32_t aDisplayID) void VRManagerChild::FireDOMVRDisplayPresentChangeEvent(uint32_t aDisplayID) { - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "gfx::VRManagerChild::FireDOMVRDisplayPresentChangeEventInternal", - this, + nsContentUtils::AddScriptRunner(NewRunnableMethod(this, &VRManagerChild::FireDOMVRDisplayPresentChangeEventInternal, aDisplayID)); } diff --git a/gfx/vr/ipc/VRManagerParent.cpp b/gfx/vr/ipc/VRManagerParent.cpp index a10b234a136e4..6b0dfefa216c6 100644 --- a/gfx/vr/ipc/VRManagerParent.cpp +++ b/gfx/vr/ipc/VRManagerParent.cpp @@ -165,10 +165,7 @@ VRManagerParent::CreateForContent(Endpoint&& aEndpoint) RefPtr vmp = new VRManagerParent(aEndpoint.OtherPid(), true); loop->PostTask(NewRunnableMethod&&>( - "gfx::VRManagerParent::Bind", - vmp, - &VRManagerParent::Bind, - Move(aEndpoint))); + vmp, &VRManagerParent::Bind, Move(aEndpoint))); return true; } @@ -209,10 +206,7 @@ VRManagerParent::CreateForGPUProcess(Endpoint&& aEndpoint) RefPtr vmp = new VRManagerParent(aEndpoint.OtherPid(), false); vmp->mCompositorThreadHolder = layers::CompositorThreadHolder::GetSingleton(); loop->PostTask(NewRunnableMethod&&>( - "gfx::VRManagerParent::Bind", - vmp, - &VRManagerParent::Bind, - Move(aEndpoint))); + vmp, &VRManagerParent::Bind, Move(aEndpoint))); return true; } @@ -227,10 +221,7 @@ void VRManagerParent::ActorDestroy(ActorDestroyReason why) { UnregisterFromManager(); - MessageLoop::current()->PostTask( - NewRunnableMethod("gfx::VRManagerParent::DeferredDestroy", - this, - &VRManagerParent::DeferredDestroy)); + MessageLoop::current()->PostTask(NewRunnableMethod(this, &VRManagerParent::DeferredDestroy)); } void diff --git a/gfx/webrender_bindings/RenderThread.cpp b/gfx/webrender_bindings/RenderThread.cpp index b555c4c93c73c..20ab91f90eddb 100644 --- a/gfx/webrender_bindings/RenderThread.cpp +++ b/gfx/webrender_bindings/RenderThread.cpp @@ -124,11 +124,9 @@ void RenderThread::NewFrameReady(wr::WindowId aWindowId) { if (!IsInRenderThread()) { - Loop()->PostTask( - NewRunnableMethod("wr::RenderThread::NewFrameReady", - this, - &RenderThread::NewFrameReady, - aWindowId)); + Loop()->PostTask(NewRunnableMethod( + this, &RenderThread::NewFrameReady, aWindowId + )); return; } @@ -141,11 +139,8 @@ RenderThread::NewScrollFrameReady(wr::WindowId aWindowId, bool aCompositeNeeded) { if (!IsInRenderThread()) { Loop()->PostTask(NewRunnableMethod( - "wr::RenderThread::NewScrollFrameReady", - this, - &RenderThread::NewScrollFrameReady, - aWindowId, - aCompositeNeeded)); + this, &RenderThread::NewScrollFrameReady, aWindowId, aCompositeNeeded + )); return; } @@ -156,13 +151,10 @@ void RenderThread::RunEvent(wr::WindowId aWindowId, UniquePtr aEvent) { if (!IsInRenderThread()) { - Loop()->PostTask( - NewRunnableMethod&&>( - "wr::RenderThread::RunEvent", - this, - &RenderThread::RunEvent, - aWindowId, - Move(aEvent))); + Loop()->PostTask(NewRunnableMethod&&>( + this, &RenderThread::RunEvent, + aWindowId, Move(aEvent) + )); return; } @@ -310,7 +302,6 @@ RenderThread::UnregisterExternalImage(uint64_t aExternalImageId) RefPtr texture = mRenderTextures.Get(aExternalImageId); mRenderTextures.Remove(aExternalImageId); Loop()->PostTask(NewRunnableMethod>( - "RenderThread::DeferredRenderTextureHostDestroy", this, &RenderThread::DeferredRenderTextureHostDestroy, Move(texture) )); } else { diff --git a/image/DecodePool.cpp b/image/DecodePool.cpp index b6db3a2d0cfe4..92e38404600e7 100644 --- a/image/DecodePool.cpp +++ b/image/DecodePool.cpp @@ -160,8 +160,7 @@ class DecodePoolWorker : public Runnable { public: explicit DecodePoolWorker(DecodePoolImpl* aImpl) - : Runnable("image::DecodePoolWorker") - , mImpl(aImpl) + : mImpl(aImpl) { } NS_IMETHOD Run() override diff --git a/image/Image.cpp b/image/Image.cpp index b2faa61a9c6a4..5436cbb934643 100644 --- a/image/Image.cpp +++ b/image/Image.cpp @@ -157,13 +157,12 @@ ImageResource::SendOnUnlockedDraw(uint32_t aFlags) mProgressTracker->OnUnlockedDraw(); } else { NotNull> image = WrapNotNull(this); - NS_DispatchToMainThread(NS_NewRunnableFunction( - "image::ImageResource::SendOnUnlockedDraw", [=]() -> void { - RefPtr tracker = image->GetProgressTracker(); - if (tracker) { - tracker->OnUnlockedDraw(); - } - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([=]() -> void { + RefPtr tracker = image->GetProgressTracker(); + if (tracker) { + tracker->OnUnlockedDraw(); + } + })); } } diff --git a/image/ProgressTracker.cpp b/image/ProgressTracker.cpp index 936d37af352db..1f51cce3e24f1 100644 --- a/image/ProgressTracker.cpp +++ b/image/ProgressTracker.cpp @@ -204,8 +204,7 @@ class AsyncNotifyCurrentStateRunnable : public Runnable public: AsyncNotifyCurrentStateRunnable(ProgressTracker* aProgressTracker, IProgressObserver* aObserver) - : Runnable("image::AsyncNotifyCurrentStateRunnable") - , mProgressTracker(aProgressTracker) + : mProgressTracker(aProgressTracker) , mObserver(aObserver) { MOZ_ASSERT(NS_IsMainThread(), "Should be created on the main thread"); diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index 01e8dfbbe50ef..8585272ab49c5 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -1610,8 +1610,7 @@ RasterImage::HandleErrorWorker::DispatchIfNeeded(RasterImage* aImage) } RasterImage::HandleErrorWorker::HandleErrorWorker(RasterImage* aImage) - : Runnable("image::RasterImage::HandleErrorWorker") - , mImage(aImage) + : mImage(aImage) { MOZ_ASSERT(mImage, "Should have image"); } diff --git a/image/test/gtest/TestDecodeToSurface.cpp b/image/test/gtest/TestDecodeToSurface.cpp index c2628c8c66656..f5762d84c1723 100644 --- a/image/test/gtest/TestDecodeToSurface.cpp +++ b/image/test/gtest/TestDecodeToSurface.cpp @@ -29,8 +29,7 @@ class DecodeToSurfaceRunnable : public Runnable nsIInputStream* aInputStream, ImageOps::ImageBuffer* aImageBuffer, const ImageTestCase& aTestCase) - : mozilla::Runnable("DecodeToSurfaceRunnable") - , mSurface(aSurface) + : mSurface(aSurface) , mInputStream(aInputStream) , mImageBuffer(aImageBuffer) , mTestCase(aTestCase) diff --git a/ipc/chromium/src/base/message_loop.h b/ipc/chromium/src/base/message_loop.h index 91e2a0fb62ca3..d16aa0cbebecc 100644 --- a/ipc/chromium/src/base/message_loop.h +++ b/ipc/chromium/src/base/message_loop.h @@ -140,7 +140,6 @@ class MessageLoop : public base::MessagePump::Delegate { // arbitrary MessageLoop to Quit. class QuitTask : public mozilla::Runnable { public: - QuitTask() : mozilla::Runnable("QuitTask") {} NS_IMETHOD Run() override { MessageLoop::current()->Quit(); return NS_OK; diff --git a/ipc/chromium/src/base/object_watcher.cc b/ipc/chromium/src/base/object_watcher.cc index 4308fa42a162f..ced911fa20799 100644 --- a/ipc/chromium/src/base/object_watcher.cc +++ b/ipc/chromium/src/base/object_watcher.cc @@ -21,8 +21,6 @@ class ObjectWatcher::Watch : public mozilla::Runnable { Delegate* delegate; // Delegate to notify when signaled bool did_signal; // DoneWaiting was called - Watch() : mozilla::Runnable("ObjectWatcher::Watch") {} - NS_IMETHOD Run() override { // The watcher may have already been torn down, in which case we need to // just get out of dodge. diff --git a/ipc/chromium/src/base/task.h b/ipc/chromium/src/base/task.h index e66e51fe9054f..10dc9c488bbc6 100644 --- a/ipc/chromium/src/base/task.h +++ b/ipc/chromium/src/base/task.h @@ -159,16 +159,12 @@ class ScopedRunnableMethodFactory : public RevocableStore { template class RunnableMethod : public mozilla::Runnable { public: - RunnableMethod() - : mozilla::Runnable("ScopedRunnableMethodFactory::RunnableMethod") - { - } - - void Init(T* obj, Method meth, Params&& params) - { - obj_ = obj; - meth_ = meth; - params_ = mozilla::Forward(params); + RunnableMethod() { } + + void Init(T* obj, Method meth, Params&& params) { + obj_ = obj; + meth_ = meth; + params_ = mozilla::Forward(params); } NS_IMETHOD Run() override { @@ -197,10 +193,7 @@ class ScopedRunnableMethodFactory : public RevocableStore { template class DeleteTask : public mozilla::CancelableRunnable { public: - explicit DeleteTask(T* obj) - : mozilla::CancelableRunnable("DeleteTask") - , obj_(obj) - { + explicit DeleteTask(T* obj) : obj_(obj) { } NS_IMETHOD Run() override { delete obj_; @@ -277,13 +270,9 @@ template class RunnableMethod : public mozilla::CancelableRunnable, public RunnableMethodTraits { public: - RunnableMethod(T* obj, Method meth, Params&& params) - : mozilla::CancelableRunnable("RunnableMethod") - , obj_(obj) - , meth_(meth) - , params_(mozilla::Forward(params)) - { - this->RetainCallee(obj_); + RunnableMethod(T* obj, Method meth, Params&& params) + : obj_(obj), meth_(meth), params_(mozilla::Forward(params)) { + this->RetainCallee(obj_); } ~RunnableMethod() { ReleaseCallee(); @@ -335,11 +324,8 @@ NewRunnableMethod(T* object, Method method, Args&&... args) { template class RunnableFunction : public mozilla::CancelableRunnable { public: - RunnableFunction(Function function, Params&& params) - : mozilla::CancelableRunnable("RunnableFunction") - , function_(function) - , params_(mozilla::Forward(params)) - { + RunnableFunction(Function function, Params&& params) + : function_(function), params_(mozilla::Forward(params)) { } ~RunnableFunction() { diff --git a/ipc/chromium/src/base/thread.cc b/ipc/chromium/src/base/thread.cc index f15de139818ee..d5f0eef354634 100644 --- a/ipc/chromium/src/base/thread.cc +++ b/ipc/chromium/src/base/thread.cc @@ -22,7 +22,6 @@ namespace base { // This task is used to trigger the message loop to exit. class ThreadQuitTask : public mozilla::Runnable { public: - ThreadQuitTask() : mozilla::Runnable("ThreadQuitTask") {} NS_IMETHOD Run() override { MessageLoop::current()->Quit(); Thread::SetThreadWasQuitProperly(true); diff --git a/ipc/chromium/src/base/timer.h b/ipc/chromium/src/base/timer.h index 5703707ca8d7e..b65f89392e98f 100644 --- a/ipc/chromium/src/base/timer.h +++ b/ipc/chromium/src/base/timer.h @@ -87,11 +87,8 @@ class BaseTimer_Helper { // We have access to the timer_ member so we can orphan this task. class TimerTask : public mozilla::Runnable { public: - explicit TimerTask(TimeDelta delay) - : mozilla::Runnable("base::BaseTimer_Helper::TimerTask") - , delay_(delay) - { - // timer_ is set in InitiateDelayedTask. + explicit TimerTask(TimeDelta delay) : delay_(delay) { + // timer_ is set in InitiateDelayedTask. } virtual ~TimerTask() {} BaseTimer_Helper* timer_; diff --git a/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc b/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc index 1b0e626397125..5abe143c15db1 100644 --- a/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc +++ b/ipc/chromium/src/chrome/common/process_watcher_posix_sigchld.cc @@ -79,9 +79,7 @@ class ChildGrimReaper : public ChildReaper, public mozilla::Runnable { public: - explicit ChildGrimReaper(pid_t process) - : ChildReaper(process) - , mozilla::Runnable("ChildGrimReaper") + explicit ChildGrimReaper(pid_t process) : ChildReaper(process) { } diff --git a/ipc/chromium/src/chrome/common/process_watcher_win.cc b/ipc/chromium/src/chrome/common/process_watcher_win.cc index 37d2632fd85db..fccb83999e364 100644 --- a/ipc/chromium/src/chrome/common/process_watcher_win.cc +++ b/ipc/chromium/src/chrome/common/process_watcher_win.cc @@ -20,7 +20,7 @@ class ChildReaper : public mozilla::Runnable, public MessageLoop::DestructionObserver { public: explicit ChildReaper(base::ProcessHandle process, bool force) - : mozilla::Runnable("ChildReaper"), process_(process), force_(force) { + : process_(process), force_(force) { watcher_.StartWatching(process_, this); } diff --git a/ipc/glue/BackgroundImpl.cpp b/ipc/glue/BackgroundImpl.cpp index 93f5310c27433..c37f4b2413a98 100644 --- a/ipc/glue/BackgroundImpl.cpp +++ b/ipc/glue/BackgroundImpl.cpp @@ -428,8 +428,7 @@ class ChildImpl final : public BackgroundChildImpl threadLocalInfo->mActor.forget(&actor); MOZ_ALWAYS_SUCCEEDS( - NS_DispatchToMainThread(NewNonOwningRunnableMethod("ChildImpl::Release", - actor, &ChildImpl::Release))); + NS_DispatchToMainThread(NewNonOwningRunnableMethod(actor, &ChildImpl::Release))); } } delete threadLocalInfo; @@ -955,8 +954,7 @@ ParentImpl::GetContentParent(PBackgroundParent* aBackgroundActor) // will run before the reference we hand out can be released, and the // ContentParent can't die as long as the existing reference is maintained. MOZ_ALWAYS_SUCCEEDS( - NS_DispatchToMainThread(NewNonOwningRunnableMethod("ContentParent::AddRef", - actor->mContent, &ContentParent::AddRef))); + NS_DispatchToMainThread(NewNonOwningRunnableMethod(actor->mContent, &ContentParent::AddRef))); } return already_AddRefed(actor->mContent.get()); @@ -1235,8 +1233,7 @@ ParentImpl::Destroy() AssertIsInMainProcess(); MOZ_ALWAYS_SUCCEEDS( - NS_DispatchToMainThread(NewNonOwningRunnableMethod("ParentImpl::MainThreadActorDestroy", - this, &ParentImpl::MainThreadActorDestroy))); + NS_DispatchToMainThread(NewNonOwningRunnableMethod(this, &ParentImpl::MainThreadActorDestroy))); } void @@ -1282,8 +1279,7 @@ ParentImpl::ActorDestroy(ActorDestroyReason aWhy) // long enough to be cleared in this call stack. MOZ_ALWAYS_SUCCEEDS( - NS_DispatchToCurrentThread(NewNonOwningRunnableMethod("ParentImpl::Destroy", - this, &ParentImpl::Destroy))); + NS_DispatchToCurrentThread(NewNonOwningRunnableMethod(this, &ParentImpl::Destroy))); } NS_IMPL_ISUPPORTS(ParentImpl::ShutdownObserver, nsIObserver) diff --git a/ipc/glue/BackgroundParentImpl.cpp b/ipc/glue/BackgroundParentImpl.cpp index b9cc273c79ff6..319787b3d8857 100644 --- a/ipc/glue/BackgroundParentImpl.cpp +++ b/ipc/glue/BackgroundParentImpl.cpp @@ -404,8 +404,7 @@ class InitUDPSocketParentCallback final : public Runnable public: InitUDPSocketParentCallback(UDPSocketParent* aActor, const nsACString& aFilter) - : Runnable("ipc::InitUDPSocketParentCallback") - , mActor(aActor) + : mActor(aActor) , mFilter(aFilter) { AssertIsInMainProcess(); @@ -529,8 +528,7 @@ class CheckPrincipalRunnable final : public Runnable CheckPrincipalRunnable(already_AddRefed aParent, const PrincipalInfo& aPrincipalInfo, const nsCString& aOrigin) - : Runnable("ipc::CheckPrincipalRunnable") - , mContentParent(aParent) + : mContentParent(aParent) , mPrincipalInfo(aPrincipalInfo) , mOrigin(aOrigin) { diff --git a/ipc/glue/CrashReporterHost.cpp b/ipc/glue/CrashReporterHost.cpp index 75c436e2224ad..ba9af7424887e 100644 --- a/ipc/glue/CrashReporterHost.cpp +++ b/ipc/glue/CrashReporterHost.cpp @@ -109,11 +109,9 @@ CrashReporterHost::NotifyCrashService(GeckoProcessType aProcessType, const AnnotationTable* aNotes) { if (!NS_IsMainThread()) { - RefPtr runnable = NS_NewRunnableFunction( - "ipc::CrashReporterHost::NotifyCrashService", [=]() -> void { - CrashReporterHost::NotifyCrashService( - aProcessType, aChildDumpID, aNotes); - }); + RefPtr runnable = NS_NewRunnableFunction([=] () -> void { + CrashReporterHost::NotifyCrashService(aProcessType, aChildDumpID, aNotes); + }); RefPtr mainThread = do_GetMainThread(); SyncRunnable::DispatchToThread(mainThread, runnable); return; diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index 70279c5356c73..098b27a5852b1 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -359,13 +359,10 @@ GeckoChildProcessHost::SyncLaunch(std::vector aExtraOpts, int aTime MessageLoop* ioLoop = XRE_GetIOMessageLoop(); NS_ASSERTION(MessageLoop::current() != ioLoop, "sync launch from the IO thread NYI"); - ioLoop->PostTask(NewNonOwningRunnableMethod, - base::ProcessArchitecture>( - "ipc::GeckoChildProcessHost::RunPerformAsyncLaunch", - this, - &GeckoChildProcessHost::RunPerformAsyncLaunch, - aExtraOpts, - arch)); + ioLoop->PostTask(NewNonOwningRunnableMethod + , base::ProcessArchitecture> + (this, &GeckoChildProcessHost::RunPerformAsyncLaunch, + aExtraOpts, arch)); return WaitUntilConnected(aTimeoutMs); } @@ -378,13 +375,10 @@ GeckoChildProcessHost::AsyncLaunch(std::vector aExtraOpts, MessageLoop* ioLoop = XRE_GetIOMessageLoop(); - ioLoop->PostTask(NewNonOwningRunnableMethod, - base::ProcessArchitecture>( - "ipc::GeckoChildProcessHost::RunPerformAsyncLaunch", - this, - &GeckoChildProcessHost::RunPerformAsyncLaunch, - aExtraOpts, - arch)); + ioLoop->PostTask(NewNonOwningRunnableMethod + , base::ProcessArchitecture> + (this, &GeckoChildProcessHost::RunPerformAsyncLaunch, + aExtraOpts, arch)); // This may look like the sync launch wait, but we only delay as // long as it takes to create the channel. @@ -440,13 +434,10 @@ GeckoChildProcessHost::LaunchAndWaitForProcessHandle(StringVector aExtraOpts) PrepareLaunch(); MessageLoop* ioLoop = XRE_GetIOMessageLoop(); - ioLoop->PostTask(NewNonOwningRunnableMethod, - base::ProcessArchitecture>( - "ipc::GeckoChildProcessHost::RunPerformAsyncLaunch", - this, - &GeckoChildProcessHost::RunPerformAsyncLaunch, - aExtraOpts, - base::GetCurrentProcessArchitecture())); + ioLoop->PostTask(NewNonOwningRunnableMethod + , base::ProcessArchitecture> + (this, &GeckoChildProcessHost::RunPerformAsyncLaunch, + aExtraOpts, base::GetCurrentProcessArchitecture())); MonitorAutoLock lock(mMonitor); while (mProcessState < PROCESS_CREATED) { diff --git a/ipc/glue/IPCStreamDestination.cpp b/ipc/glue/IPCStreamDestination.cpp index be61f321c6495..8c1757f60a08a 100644 --- a/ipc/glue/IPCStreamDestination.cpp +++ b/ipc/glue/IPCStreamDestination.cpp @@ -177,12 +177,9 @@ class IPCStreamDestination::DelayedStartInputStream::HelperRunnable final eCloseDestination, }; - HelperRunnable( - IPCStreamDestination::DelayedStartInputStream* aDelayedStartInputStream, - Op aOp) - : Runnable( - "ipc::IPCStreamDestination::DelayedStartInputStream::HelperRunnable") - , mDelayedStartInputStream(aDelayedStartInputStream) + HelperRunnable(IPCStreamDestination::DelayedStartInputStream* aDelayedStartInputStream, + Op aOp) + : mDelayedStartInputStream(aDelayedStartInputStream) , mOp(aOp) { MOZ_ASSERT(aDelayedStartInputStream); diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index b20185d357886..3f874ef0e4813 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -546,10 +546,8 @@ MessageChannel::MessageChannel(const char* aName, mIsSyncWaitingOnNonMainThread = false; #endif - mOnChannelConnectedTask = NewNonOwningCancelableRunnableMethod( - "ipc::MessageChannel::DispatchOnChannelConnected", - this, - &MessageChannel::DispatchOnChannelConnected); + mOnChannelConnectedTask = + NewNonOwningCancelableRunnableMethod(this, &MessageChannel::DispatchOnChannelConnected); #ifdef OS_WIN mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr); @@ -801,12 +799,10 @@ MessageChannel::Open(MessageChannel *aTargetChan, MessageLoop *aTargetLoop, Side MonitorAutoLock lock(*mMonitor); mChannelState = ChannelOpening; - aTargetLoop->PostTask(NewNonOwningRunnableMethod( - "ipc::MessageChannel::OnOpenAsSlave", - aTargetChan, - &MessageChannel::OnOpenAsSlave, - this, - oppSide)); + aTargetLoop->PostTask(NewNonOwningRunnableMethod + (aTargetChan, + &MessageChannel::OnOpenAsSlave, + this, oppSide)); while (ChannelOpening == mChannelState) mMonitor->Wait(); @@ -2528,14 +2524,12 @@ MessageChannel::OnNotifyMaybeChannelError() } if (IsOnCxxStack()) { - mChannelErrorTask = NewNonOwningCancelableRunnableMethod( - "ipc::MessageChannel::OnNotifyMaybeChannelError", - this, - &MessageChannel::OnNotifyMaybeChannelError); - RefPtr task = mChannelErrorTask; - // 10 ms delay is completely arbitrary - mWorkerLoop->PostDelayedTask(task.forget(), 10); - return; + mChannelErrorTask = + NewNonOwningCancelableRunnableMethod(this, &MessageChannel::OnNotifyMaybeChannelError); + RefPtr task = mChannelErrorTask; + // 10 ms delay is completely arbitrary + mWorkerLoop->PostDelayedTask(task.forget(), 10); + return; } NotifyMaybeChannelError(); @@ -2550,10 +2544,8 @@ MessageChannel::PostErrorNotifyTask() return; // This must be the last code that runs on this thread! - mChannelErrorTask = NewNonOwningCancelableRunnableMethod( - "ipc::MessageChannel::OnNotifyMaybeChannelError", - this, - &MessageChannel::OnNotifyMaybeChannelError); + mChannelErrorTask = + NewNonOwningCancelableRunnableMethod(this, &MessageChannel::OnNotifyMaybeChannelError); RefPtr task = mChannelErrorTask; mWorkerLoop->PostTask(task.forget()); } diff --git a/ipc/glue/MessageLink.cpp b/ipc/glue/MessageLink.cpp index 4bc46d11c2a41..9bc1a1165e118 100644 --- a/ipc/glue/MessageLink.cpp +++ b/ipc/glue/MessageLink.cpp @@ -102,11 +102,8 @@ ProcessLink::Open(mozilla::ipc::Transport* aTransport, MessageLoop *aIOLoop, Sid // If we were never able to open the transport, immediately post an error message. if (mTransport->Unsound_IsClosed()) { - mIOLoop->PostTask( - NewNonOwningRunnableMethod("ipc::ProcessLink::OnChannelConnectError", - this, - &ProcessLink::OnChannelConnectError)); - return; + mIOLoop->PostTask(NewNonOwningRunnableMethod(this, &ProcessLink::OnChannelConnectError)); + return; } { @@ -116,18 +113,12 @@ ProcessLink::Open(mozilla::ipc::Transport* aTransport, MessageLoop *aIOLoop, Sid // Transport::Connect() has not been called. Call it so // we start polling our pipe and processing outgoing // messages. - mIOLoop->PostTask( - NewNonOwningRunnableMethod("ipc::ProcessLink::OnChannelOpened", - this, - &ProcessLink::OnChannelOpened)); + mIOLoop->PostTask(NewNonOwningRunnableMethod(this, &ProcessLink::OnChannelOpened)); } else { // Transport::Connect() has already been called. Take // over the channel from the previous listener and process // any queued messages. - mIOLoop->PostTask(NewNonOwningRunnableMethod( - "ipc::ProcessLink::OnTakeConnectedChannel", - this, - &ProcessLink::OnTakeConnectedChannel)); + mIOLoop->PostTask(NewNonOwningRunnableMethod(this, &ProcessLink::OnTakeConnectedChannel)); } // Should not wait here if something goes wrong with the channel. @@ -143,11 +134,7 @@ ProcessLink::EchoMessage(Message *msg) mChan->AssertWorkerThread(); mChan->mMonitor->AssertCurrentThreadOwns(); - mIOLoop->PostTask( - NewNonOwningRunnableMethod("ipc::ProcessLink::OnEchoMessage", - this, - &ProcessLink::OnEchoMessage, - msg)); + mIOLoop->PostTask(NewNonOwningRunnableMethod(this, &ProcessLink::OnEchoMessage, msg)); // OnEchoMessage takes ownership of |msg| } @@ -165,8 +152,7 @@ ProcessLink::SendMessage(Message *msg) mChan->AssertWorkerThread(); mChan->mMonitor->AssertCurrentThreadOwns(); - mIOLoop->PostTask(NewNonOwningRunnableMethod( - "IPC::Channel::Send", mTransport, &Transport::Send, msg)); + mIOLoop->PostTask(NewNonOwningRunnableMethod(mTransport, &Transport::Send, msg)); } void @@ -175,8 +161,7 @@ ProcessLink::SendClose() mChan->AssertWorkerThread(); mChan->mMonitor->AssertCurrentThreadOwns(); - mIOLoop->PostTask(NewNonOwningRunnableMethod( - "ipc::ProcessLink::OnCloseChannel", this, &ProcessLink::OnCloseChannel)); + mIOLoop->PostTask(NewNonOwningRunnableMethod(this, &ProcessLink::OnCloseChannel)); } ThreadLink::ThreadLink(MessageChannel *aChan, MessageChannel *aTargetChan) diff --git a/ipc/glue/MessagePump.cpp b/ipc/glue/MessagePump.cpp index 42aeb699d4fa9..c4d2da790929a 100644 --- a/ipc/glue/MessagePump.cpp +++ b/ipc/glue/MessagePump.cpp @@ -42,8 +42,7 @@ class DoWorkRunnable final : public CancelableRunnable, { public: explicit DoWorkRunnable(MessagePump* aPump) - : CancelableRunnable("ipc::DoWorkRunnable") - , mPump(aPump) + : mPump(aPump) { MOZ_ASSERT(aPump); } diff --git a/ipc/glue/TaskFactory.h b/ipc/glue/TaskFactory.h index 80b767ed9b6f0..4852e369cae0b 100644 --- a/ipc/glue/TaskFactory.h +++ b/ipc/glue/TaskFactory.h @@ -76,12 +76,11 @@ class TaskFactory : public RevocableStore template class RunnableMethod : public Runnable { public: - RunnableMethod(T* obj, Method meth, const Params& params) - : Runnable("ipc::TaskFactory::RunnableMethod") - , obj_(obj) - , meth_(meth) - , params_(params) - { + RunnableMethod(T* obj, Method meth, const Params& params) + : obj_(obj) + , meth_(meth) + , params_(params) { + } NS_IMETHOD Run() override { diff --git a/ipc/ipdl/test/cxx/TestCancel.cpp b/ipc/ipdl/test/cxx/TestCancel.cpp index 719a41f81d881..854eb51eec7fd 100644 --- a/ipc/ipdl/test/cxx/TestCancel.cpp +++ b/ipc/ipdl/test/cxx/TestCancel.cpp @@ -76,9 +76,9 @@ TestCancelParent::RecvTest3_2() mozilla::ipc::IPCResult TestCancelParent::RecvDone() { - MessageLoop::current()->PostTask(NewNonOwningRunnableMethod( - "ipc::IToplevelProtocol::Close", this, &TestCancelParent::Close)); - return IPC_OK(); + MessageLoop::current()->PostTask( + NewNonOwningRunnableMethod(this, &TestCancelParent::Close)); + return IPC_OK(); } mozilla::ipc::IPCResult diff --git a/ipc/ipdl/test/cxx/TestDemon.cpp b/ipc/ipdl/test/cxx/TestDemon.cpp index 160cd424516ab..ef87b3b25b0f9 100644 --- a/ipc/ipdl/test/cxx/TestDemon.cpp +++ b/ipc/ipdl/test/cxx/TestDemon.cpp @@ -176,10 +176,7 @@ TestDemonParent::RunUnlimitedSequence() gFlushStack = false; DoAction(); - MessageLoop::current()->PostTask(NewNonOwningRunnableMethod( - "_ipdltest::TestDemonParent::RunUnlimitedSequence", - this, - &TestDemonParent::RunUnlimitedSequence)); + MessageLoop::current()->PostTask(NewNonOwningRunnableMethod(this, &TestDemonParent::RunUnlimitedSequence)); } void @@ -323,10 +320,7 @@ TestDemonChild::RunUnlimitedSequence() gFlushStack = false; DoAction(); - MessageLoop::current()->PostTask(NewNonOwningRunnableMethod( - "_ipdltest::TestDemonChild::RunUnlimitedSequence", - this, - &TestDemonChild::RunUnlimitedSequence)); + MessageLoop::current()->PostTask(NewNonOwningRunnableMethod(this, &TestDemonChild::RunUnlimitedSequence)); } void diff --git a/ipc/ipdl/test/cxx/TestEndpointBridgeMain.cpp b/ipc/ipdl/test/cxx/TestEndpointBridgeMain.cpp index b01c4b81472a3..4120778844933 100644 --- a/ipc/ipdl/test/cxx/TestEndpointBridgeMain.cpp +++ b/ipc/ipdl/test/cxx/TestEndpointBridgeMain.cpp @@ -232,9 +232,7 @@ TestEndpointBridgeMainSubChild::RecvHi() // Need to close the channel without message-processing frames on // the C++ stack MessageLoop::current()->PostTask( - NewNonOwningRunnableMethod("ipc::IToplevelProtocol::Close", - this, - &TestEndpointBridgeMainSubChild::Close)); + NewNonOwningRunnableMethod(this, &TestEndpointBridgeMainSubChild::Close)); return IPC_OK(); } diff --git a/ipc/ipdl/test/cxx/TestEndpointOpens.cpp b/ipc/ipdl/test/cxx/TestEndpointOpens.cpp index 51bd176d8a79a..b99dccb199ca1 100644 --- a/ipc/ipdl/test/cxx/TestEndpointOpens.cpp +++ b/ipc/ipdl/test/cxx/TestEndpointOpens.cpp @@ -232,9 +232,7 @@ TestEndpointOpensOpenedChild::RecvHi() // Need to close the channel without message-processing frames on // the C++ stack MessageLoop::current()->PostTask( - NewNonOwningRunnableMethod("ipc::IToplevelProtocol::Close", - this, - &TestEndpointOpensOpenedChild::Close)); + NewNonOwningRunnableMethod(this, &TestEndpointOpensOpenedChild::Close)); return IPC_OK(); } @@ -255,9 +253,7 @@ ShutdownTestEndpointOpensOpenedChild(TestEndpointOpensOpenedChild* child, // Kick off main-thread shutdown. gMainThread->PostTask( - NewNonOwningRunnableMethod("ipc::IToplevelProtocol::Close", - gOpensChild, - &TestEndpointOpensChild::Close)); + NewNonOwningRunnableMethod(gOpensChild, &TestEndpointOpensChild::Close)); } void diff --git a/ipc/ipdl/test/cxx/TestHangs.cpp b/ipc/ipdl/test/cxx/TestHangs.cpp index 9f639e0777749..178e5fc184d38 100644 --- a/ipc/ipdl/test/cxx/TestHangs.cpp +++ b/ipc/ipdl/test/cxx/TestHangs.cpp @@ -76,8 +76,8 @@ TestHangsParent::ShouldContinueFromReplyTimeout() // reply should be here; we'll post a task to shut things down. // This must be after OnMaybeDequeueOne() in the event queue. - MessageLoop::current()->PostTask(NewNonOwningRunnableMethod( - "_ipdltest::TestHangsParent::CleanUp", this, &TestHangsParent::CleanUp)); + MessageLoop::current()->PostTask( + NewNonOwningRunnableMethod(this, &TestHangsParent::CleanUp)); GetIPCChannel()->CloseWithTimeout(); diff --git a/ipc/ipdl/test/cxx/TestInterruptRaces.cpp b/ipc/ipdl/test/cxx/TestInterruptRaces.cpp index 52306b8eafa81..4de6dc75996d2 100644 --- a/ipc/ipdl/test/cxx/TestInterruptRaces.cpp +++ b/ipc/ipdl/test/cxx/TestInterruptRaces.cpp @@ -27,11 +27,9 @@ TestInterruptRacesParent::Main() mozilla::ipc::IPCResult TestInterruptRacesParent::RecvStartRace() { - MessageLoop::current()->PostTask(NewNonOwningRunnableMethod( - "_ipdltest::TestInterruptRacesParent::OnRaceTime", - this, - &TestInterruptRacesParent::OnRaceTime)); - return IPC_OK(); + MessageLoop::current()->PostTask( + NewNonOwningRunnableMethod(this, &TestInterruptRacesParent::OnRaceTime)); + return IPC_OK(); } void @@ -46,9 +44,7 @@ TestInterruptRacesParent::OnRaceTime() mHasReply = true; MessageLoop::current()->PostTask( - NewNonOwningRunnableMethod("_ipdltest::TestInterruptRacesParent::Test2", - this, - &TestInterruptRacesParent::Test2)); + NewNonOwningRunnableMethod(this, &TestInterruptRacesParent::Test2)); } mozilla::ipc::IPCResult @@ -75,9 +71,7 @@ TestInterruptRacesParent::Test2() puts(" passed"); MessageLoop::current()->PostTask( - NewNonOwningRunnableMethod("_ipdltest::TestInterruptRacesParent::Test3", - this, - &TestInterruptRacesParent::Test3)); + NewNonOwningRunnableMethod(this, &TestInterruptRacesParent::Test3)); } mozilla::ipc::IPCResult diff --git a/ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp b/ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp index 5252f538617c0..650fb985b9b86 100644 --- a/ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp +++ b/ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp @@ -51,10 +51,9 @@ TestInterruptShutdownRaceParent::RecvStartDeath() { // this will be ordered before the OnMaybeDequeueOne event of // Orphan in the queue - MessageLoop::current()->PostTask(NewNonOwningRunnableMethod( - "_ipdltest::TestInterruptShutdownRaceParent::StartShuttingDown", - this, - &TestInterruptShutdownRaceParent::StartShuttingDown)); + MessageLoop::current()->PostTask( + NewNonOwningRunnableMethod(this, + &TestInterruptShutdownRaceParent::StartShuttingDown)); return IPC_OK(); } diff --git a/ipc/ipdl/test/cxx/TestNestedLoops.cpp b/ipc/ipdl/test/cxx/TestNestedLoops.cpp index 09a6ca1eabaf1..3ea4f00ddfcec 100644 --- a/ipc/ipdl/test/cxx/TestNestedLoops.cpp +++ b/ipc/ipdl/test/cxx/TestNestedLoops.cpp @@ -45,10 +45,8 @@ TestNestedLoopsParent::RecvNonce() // if we have an OnMaybeDequeueOne waiting for us (we may not, due // to the inherent race condition in this test, then this event // must be ordered after it in the queue - MessageLoop::current()->PostTask(NewNonOwningRunnableMethod( - "_ipdltest::TestNestedLoopsParent::BreakNestedLoop", - this, - &TestNestedLoopsParent::BreakNestedLoop)); + MessageLoop::current()->PostTask( + NewNonOwningRunnableMethod(this, &TestNestedLoopsParent::BreakNestedLoop)); // sigh ... spin for a while to let the reply to R arrive puts(" (sleeping to wait for reply to R ... sorry)"); diff --git a/ipc/ipdl/test/cxx/TestUrgentHangs.cpp b/ipc/ipdl/test/cxx/TestUrgentHangs.cpp index 91a4f0e9ad1ad..5b3d6093d4db8 100644 --- a/ipc/ipdl/test/cxx/TestUrgentHangs.cpp +++ b/ipc/ipdl/test/cxx/TestUrgentHangs.cpp @@ -49,11 +49,8 @@ TestUrgentHangsParent::Main() // Do a second round of testing once the reply to Test2 comes back. MessageLoop::current()->PostDelayedTask( - NewNonOwningRunnableMethod( - "_ipdltest::TestUrgentHangsParent::SecondStage", - this, - &TestUrgentHangsParent::SecondStage), - 3000); + NewNonOwningRunnableMethod(this, &TestUrgentHangsParent::SecondStage), + 3000); } void @@ -70,10 +67,8 @@ TestUrgentHangsParent::SecondStage() fail("sending Test4_1"); MessageLoop::current()->PostDelayedTask( - NewNonOwningRunnableMethod("_ipdltest::TestUrgentHangsParent::ThirdStage", - this, - &TestUrgentHangsParent::ThirdStage), - 3000); + NewNonOwningRunnableMethod(this, &TestUrgentHangsParent::ThirdStage), + 3000); } void @@ -95,9 +90,8 @@ TestUrgentHangsParent::ThirdStage() // Close the channel after the child finishes its work in RecvTest5. MessageLoop::current()->PostDelayedTask( - NewNonOwningRunnableMethod( - "ipc::IToplevelProtocol::Close", this, &TestUrgentHangsParent::Close), - 3000); + NewNonOwningRunnableMethod(this, &TestUrgentHangsParent::Close), + 3000); } mozilla::ipc::IPCResult diff --git a/ipc/mscom/DispatchForwarder.cpp b/ipc/mscom/DispatchForwarder.cpp index 5cc5b3d15824e..552229b4de656 100644 --- a/ipc/mscom/DispatchForwarder.cpp +++ b/ipc/mscom/DispatchForwarder.cpp @@ -109,7 +109,7 @@ DispatchForwarder::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) hr = mTarget->GetTypeInfo(iTInfo, lcid, ppTInfo); }; MainThreadInvoker invoker; - if (!invoker.Invoke(NS_NewRunnableFunction("DispatchForwarder::GetTypeInfo", fn))) { + if (!invoker.Invoke(NS_NewRunnableFunction(fn))) { return E_UNEXPECTED; } if (FAILED(hr)) { @@ -128,7 +128,7 @@ DispatchForwarder::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, hr = mTarget->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgDispId); }; MainThreadInvoker invoker; - if (!invoker.Invoke(NS_NewRunnableFunction("DispatchForwarder::GetIDsOfNames", fn))) { + if (!invoker.Invoke(NS_NewRunnableFunction(fn))) { return E_UNEXPECTED; } return hr; diff --git a/ipc/mscom/EnsureMTA.cpp b/ipc/mscom/EnsureMTA.cpp index 0c543fd88ab24..f4bc911e9b21d 100644 --- a/ipc/mscom/EnsureMTA.cpp +++ b/ipc/mscom/EnsureMTA.cpp @@ -17,7 +17,6 @@ namespace { class EnterMTARunnable : public mozilla::Runnable { public: - EnterMTARunnable() : mozilla::Runnable("EnterMTARunnable") {} NS_IMETHOD Run() override { mozilla::DebugOnly hr = ::CoInitializeEx(nullptr, @@ -42,7 +41,7 @@ class BackgroundMTAData ~BackgroundMTAData() { if (mThread) { - mThread->Dispatch(NS_NewRunnableFunction("BackgroundMTAData::~BackgroundMTAData", &::CoUninitialize), + mThread->Dispatch(NS_NewRunnableFunction(&::CoUninitialize), NS_DISPATCH_NORMAL); mThread->Shutdown(); } diff --git a/ipc/mscom/EnsureMTA.h b/ipc/mscom/EnsureMTA.h index 8f03942d43893..c0e1b06cb1cbb 100644 --- a/ipc/mscom/EnsureMTA.h +++ b/ipc/mscom/EnsureMTA.h @@ -82,7 +82,7 @@ class MOZ_STACK_CLASS EnsureMTA final }; nsresult rv = - thread->Dispatch(NS_NewRunnableFunction("EnsureMTA", eventSetter), NS_DISPATCH_NORMAL); + thread->Dispatch(NS_NewRunnableFunction(eventSetter), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); if (NS_FAILED(rv)) { return; @@ -117,8 +117,7 @@ class MOZ_STACK_CLASS EnsureMTA final } DebugOnly rv = thread->Dispatch( - NS_NewRunnableFunction("mscom::EnsureMTA::AsyncOperation", - aClosure), NS_DISPATCH_NORMAL); + NS_NewRunnableFunction(aClosure), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); } diff --git a/ipc/mscom/Interceptor.cpp b/ipc/mscom/Interceptor.cpp index 913bafbbfc4dd..4c18bbe267015 100644 --- a/ipc/mscom/Interceptor.cpp +++ b/ipc/mscom/Interceptor.cpp @@ -558,7 +558,7 @@ Interceptor::QueryInterfaceTarget(REFIID aIid, void** aOutput) MOZ_ASSERT(NS_IsMainThread()); hr = mTarget->QueryInterface(aIid, aOutput); }; - if (!invoker.Invoke(NS_NewRunnableFunction("Interceptor::QueryInterface", runOnMainThread))) { + if (!invoker.Invoke(NS_NewRunnableFunction(runOnMainThread))) { return E_FAIL; } return hr; diff --git a/ipc/mscom/InterceptorLog.cpp b/ipc/mscom/InterceptorLog.cpp index b1ec185b8c5c2..7a2944d6108f5 100644 --- a/ipc/mscom/InterceptorLog.cpp +++ b/ipc/mscom/InterceptorLog.cpp @@ -133,7 +133,7 @@ Logger::Logger(const nsACString& aLeafBaseName) } nsCOMPtr openRunnable( - NewNonOwningRunnableMethod("Logger::OpenFile", this, &Logger::OpenFile)); + NewNonOwningRunnableMethod(this, &Logger::OpenFile)); rv = NS_NewNamedThread("COM Intcpt Log", getter_AddRefs(mThread), openRunnable); if (NS_FAILED(rv)) { @@ -181,8 +181,7 @@ nsresult Logger::Shutdown() { MOZ_ASSERT(NS_IsMainThread()); - nsresult rv = mThread->Dispatch(NewNonOwningRunnableMethod("Logger::CloseFile", - this, + nsresult rv = mThread->Dispatch(NewNonOwningRunnableMethod(this, &Logger::CloseFile), NS_DISPATCH_NORMAL); NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Dispatch failed"); @@ -284,8 +283,7 @@ Logger::LogQI(HRESULT aResult, IUnknown* aTarget, REFIID aIid, IUnknown* aInterf MutexAutoLock lock(mMutex); mEntries.AppendElement(line); - mThread->Dispatch(NewNonOwningRunnableMethod("Logger::Flush", - this, &Logger::Flush), + mThread->Dispatch(NewNonOwningRunnableMethod(this, &Logger::Flush), NS_DISPATCH_NORMAL); } @@ -395,8 +393,7 @@ Logger::LogEvent(ICallFrame* aCallFrame, IUnknown* aTargetInterface) // (3) Enqueue event for logging MutexAutoLock lock(mMutex); mEntries.AppendElement(line); - mThread->Dispatch(NewNonOwningRunnableMethod("Logger::Flush", - this, &Logger::Flush), + mThread->Dispatch(NewNonOwningRunnableMethod(this, &Logger::Flush), NS_DISPATCH_NORMAL); } diff --git a/ipc/mscom/MainThreadHandoff.cpp b/ipc/mscom/MainThreadHandoff.cpp index 8eec137d5be13..dad9161bd62d5 100644 --- a/ipc/mscom/MainThreadHandoff.cpp +++ b/ipc/mscom/MainThreadHandoff.cpp @@ -122,8 +122,7 @@ class HandoffRunnable : public mozilla::Runnable { public: explicit HandoffRunnable(ICallFrame* aCallFrame, IUnknown* aTargetInterface) - : Runnable("HandoffRunnable") - , mCallFrame(aCallFrame) + : mCallFrame(aCallFrame) , mTargetInterface(aTargetInterface) , mResult(E_UNEXPECTED) { @@ -549,7 +548,7 @@ MainThreadHandoff::OnWalkInterface(REFIID aIid, PVOID* aInterface, }; MainThreadInvoker invoker; - invoker.Invoke(NS_NewRunnableFunction("MainThreadHandoff::OnWalkInterface", checkFn)); + invoker.Invoke(NS_NewRunnableFunction(checkFn)); } if (areTargetsEqual) { diff --git a/ipc/mscom/MainThreadInvoker.h b/ipc/mscom/MainThreadInvoker.h index e087412cbe264..b81a1eef91b7e 100644 --- a/ipc/mscom/MainThreadInvoker.h +++ b/ipc/mscom/MainThreadInvoker.h @@ -37,12 +37,11 @@ class MainThreadInvoker template inline bool -InvokeOnMainThread(const char* aName, - Class* aObject, void (Class::*aMethod)(Args...), +InvokeOnMainThread(Class* aObject, void (Class::*aMethod)(Args...), Args... aArgs) { nsCOMPtr runnable( - NewNonOwningRunnableMethod(aName, aObject, aMethod, + NewNonOwningRunnableMethod(aObject, aMethod, Forward(aArgs)...)); MainThreadInvoker invoker; diff --git a/ipc/mscom/Ptr.h b/ipc/mscom/Ptr.h index c4fc2d3b6f859..8b83cc7a371a1 100644 --- a/ipc/mscom/Ptr.h +++ b/ipc/mscom/Ptr.h @@ -41,8 +41,7 @@ struct MainThreadRelease return; } DebugOnly rv = - NS_DispatchToMainThread(NewNonOwningRunnableMethod("mscom::MainThreadRelease", - aPtr, + NS_DispatchToMainThread(NewNonOwningRunnableMethod(aPtr, &T::Release)); MOZ_ASSERT(NS_SUCCEEDED(rv)); } diff --git a/js/xpconnect/loader/ChromeScriptLoader.cpp b/js/xpconnect/loader/ChromeScriptLoader.cpp index fb771bcf9a200..6bda60fee844a 100644 --- a/js/xpconnect/loader/ChromeScriptLoader.cpp +++ b/js/xpconnect/loader/ChromeScriptLoader.cpp @@ -37,17 +37,15 @@ class AsyncScriptCompiler final : public nsIIncrementalStreamLoaderObserver NS_DECL_NSIINCREMENTALSTREAMLOADEROBSERVER NS_DECL_NSIRUNNABLE - AsyncScriptCompiler(JSContext* aCx, - nsIGlobalObject* aGlobal, + AsyncScriptCompiler(JSContext* aCx, nsIGlobalObject* aGlobal, const nsACString& aURL, const CompileScriptOptionsDictionary& aOptions, Promise* aPromise) - : mozilla::Runnable("AsyncScriptCompiler") - , mOptions(aCx) - , mURL(aURL) - , mGlobalObject(aGlobal) - , mPromise(aPromise) - , mCharset(aOptions.mCharset) + : mOptions(aCx) + , mURL(aURL) + , mGlobalObject(aGlobal) + , mPromise(aPromise) + , mCharset(aOptions.mCharset) { mOptions.setVersion(JSVERSION_DEFAULT) .setNoScriptRval(!aOptions.mHasReturnValue) diff --git a/js/xpconnect/loader/ScriptPreloader.cpp b/js/xpconnect/loader/ScriptPreloader.cpp index ca33e3a1aa5e2..3152a2335756f 100644 --- a/js/xpconnect/loader/ScriptPreloader.cpp +++ b/js/xpconnect/loader/ScriptPreloader.cpp @@ -571,10 +571,8 @@ ScriptPreloader::WriteCache() MonitorAutoUnlock mau(mSaveMonitor); NS_DispatchToMainThread( - NewRunnableMethod("ScriptPreloader::PrepareCacheWrite", - this, - &ScriptPreloader::PrepareCacheWrite), - NS_DISPATCH_SYNC); + NewRunnableMethod(this, &ScriptPreloader::PrepareCacheWrite), + NS_DISPATCH_SYNC); } if (mSaveComplete) { @@ -804,9 +802,7 @@ ScriptPreloader::OffThreadDecodeCallback(void* token, void* context) if (cache->mToken && !cache->mFinishDecodeRunnablePending) { cache->mFinishDecodeRunnablePending = true; NS_DispatchToMainThread( - NewRunnableMethod("ScriptPreloader::DoFinishOffThreadDecode", - cache, - &ScriptPreloader::DoFinishOffThreadDecode)); + NewRunnableMethod(cache, &ScriptPreloader::DoFinishOffThreadDecode)); } } diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp index d813908725ab7..47777a15c36c7 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -762,11 +762,9 @@ class NotifyPrecompilationCompleteRunnable : public Runnable public: NS_DECL_NSIRUNNABLE - explicit NotifyPrecompilationCompleteRunnable( - ScriptPrecompiler* aPrecompiler) - : mozilla::Runnable("NotifyPrecompilationCompleteRunnable") - , mPrecompiler(aPrecompiler) - , mToken(nullptr) + explicit NotifyPrecompilationCompleteRunnable(ScriptPrecompiler* aPrecompiler) + : mPrecompiler(aPrecompiler) + , mToken(nullptr) {} void SetToken(void* aToken) { diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 95cf5f8796d32..933a918506287 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -2635,11 +2635,7 @@ class PreciseGCRunnable : public Runnable { public: PreciseGCRunnable(ScheduledGCCallback* aCallback, bool aShrinking) - : mozilla::Runnable("PreciseGCRunnable") - , mCallback(aCallback) - , mShrinking(aShrinking) - { - } + : mCallback(aCallback), mShrinking(aShrinking) {} NS_IMETHOD Run() override { diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index f7f2d3d987072..972f72ad04da2 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -746,8 +746,7 @@ XPCJSRuntime::DoCycleCollectionCallback(JSContext* cx) // The GC has detected that a CC at this point would collect a tremendous // amount of garbage that is being revivified unnecessarily. NS_DispatchToCurrentThread( - NS_NewRunnableFunction("XPCJSRuntime::DoCycleCollectionCallback", - []() { nsJSContext::CycleCollectNow(nullptr); })); + NS_NewRunnableFunction([](){nsJSContext::CycleCollectNow(nullptr);})); XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance(); if (!self) @@ -963,10 +962,9 @@ class LargeAllocationFailureRunnable final : public Runnable public: LargeAllocationFailureRunnable() - : mozilla::Runnable("LargeAllocationFailureRunnable") - , mMutex("LargeAllocationFailureRunnable::mMutex") - , mCondVar(mMutex, "LargeAllocationFailureRunnable::mCondVar") - , mWaiting(true) + : mMutex("LargeAllocationFailureRunnable::mMutex"), + mCondVar(mMutex, "LargeAllocationFailureRunnable::mCondVar"), + mWaiting(true) { MOZ_ASSERT(!NS_IsMainThread()); } diff --git a/layout/base/AccessibleCaretEventHub.cpp b/layout/base/AccessibleCaretEventHub.cpp index 2c777396c8579..dded3f6335f4d 100644 --- a/layout/base/AccessibleCaretEventHub.cpp +++ b/layout/base/AccessibleCaretEventHub.cpp @@ -655,12 +655,8 @@ AccessibleCaretEventHub::LaunchLongTapInjector() } int32_t longTapDelay = gfxPrefs::UiClickHoldContextMenusDelay(); - mLongTapInjectorTimer->InitWithNamedFuncCallback( - FireLongTap, - this, - longTapDelay, - nsITimer::TYPE_ONE_SHOT, - "AccessibleCaretEventHub::LaunchLongTapInjector"); + mLongTapInjectorTimer->InitWithFuncCallback(FireLongTap, this, longTapDelay, + nsITimer::TYPE_ONE_SHOT); } void @@ -757,12 +753,8 @@ AccessibleCaretEventHub::LaunchScrollEndInjector() return; } - mScrollEndInjectorTimer->InitWithNamedFuncCallback( - FireScrollEnd, - this, - kScrollEndTimerDelay, - nsITimer::TYPE_ONE_SHOT, - "AccessibleCaretEventHub::LaunchScrollEndInjector"); + mScrollEndInjectorTimer->InitWithFuncCallback( + FireScrollEnd, this, kScrollEndTimerDelay, nsITimer::TYPE_ONE_SHOT); } void diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 6ba4c4c75f918..3a9e3b56d680d 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -542,10 +542,7 @@ class nsBeforeFirstPaintDispatcher : public Runnable { public: explicit nsBeforeFirstPaintDispatcher(nsIDocument* aDocument) - : mozilla::Runnable("nsBeforeFirstPaintDispatcher") - , mDocument(aDocument) - { - } + : mDocument(aDocument) {} // Fires the "before-first-paint" event so that interested parties (right now, the // mobile browser) are aware of it. @@ -2022,8 +2019,8 @@ PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, nscoord a "AsyncResizeEventCallback"); } } else { - RefPtr> event = NewRunnableMethod( - "PresShell::FireResizeEvent", this, &PresShell::FireResizeEvent); + RefPtr> event = + NewRunnableMethod(this, &PresShell::FireResizeEvent); nsresult rv = mDocument->Dispatch("PresShell::FireResizeEvent", TaskCategory::Other, do_AddRef(event)); @@ -6200,9 +6197,7 @@ PresShell::ScheduleApproximateFrameVisibilityUpdateNow() } RefPtr> event = - NewRunnableMethod("PresShell::UpdateApproximateFrameVisibility", - this, - &PresShell::UpdateApproximateFrameVisibility); + NewRunnableMethod(this, &PresShell::UpdateApproximateFrameVisibility); nsresult rv = mDocument->Dispatch("PresShell::UpdateApproximateFrameVisibility", TaskCategory::Other, diff --git a/layout/base/ZoomConstraintsClient.cpp b/layout/base/ZoomConstraintsClient.cpp index 77ccd80eb22bb..b2bdc4cc48707 100644 --- a/layout/base/ZoomConstraintsClient.cpp +++ b/layout/base/ZoomConstraintsClient.cpp @@ -160,9 +160,7 @@ ZoomConstraintsClient::Observe(nsISupports* aSubject, const char* aTopic, const // returns the updated value. RefPtr> event = - NewRunnableMethod("ZoomConstraintsClient::RefreshZoomConstraints", - this, - &ZoomConstraintsClient::RefreshZoomConstraints); + NewRunnableMethod(this, &ZoomConstraintsClient::RefreshZoomConstraints); mDocument->Dispatch("ZoomConstraintsClient::RefreshZoomConstraints", TaskCategory::Other, event.forget()); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 9110394bac67a..acd32c6993cdc 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -7931,23 +7931,19 @@ nsLayoutUtils::PostRestyleEvent(Element* aElement, } } -nsSetAttrRunnable::nsSetAttrRunnable(nsIContent* aContent, - nsIAtom* aAttrName, +nsSetAttrRunnable::nsSetAttrRunnable(nsIContent* aContent, nsIAtom* aAttrName, const nsAString& aValue) - : mozilla::Runnable("nsSetAttrRunnable") - , mContent(aContent) - , mAttrName(aAttrName) - , mValue(aValue) + : mContent(aContent), + mAttrName(aAttrName), + mValue(aValue) { NS_ASSERTION(aContent && aAttrName, "Missing stuff, prepare to crash"); } -nsSetAttrRunnable::nsSetAttrRunnable(nsIContent* aContent, - nsIAtom* aAttrName, +nsSetAttrRunnable::nsSetAttrRunnable(nsIContent* aContent, nsIAtom* aAttrName, int32_t aValue) - : mozilla::Runnable("nsSetAttrRunnable") - , mContent(aContent) - , mAttrName(aAttrName) + : mContent(aContent), + mAttrName(aAttrName) { NS_ASSERTION(aContent && aAttrName, "Missing stuff, prepare to crash"); mValue.AppendInt(aValue); @@ -7961,9 +7957,8 @@ nsSetAttrRunnable::Run() nsUnsetAttrRunnable::nsUnsetAttrRunnable(nsIContent* aContent, nsIAtom* aAttrName) - : mozilla::Runnable("nsUnsetAttrRunnable") - , mContent(aContent) - , mAttrName(aAttrName) + : mContent(aContent), + mAttrName(aAttrName) { NS_ASSERTION(aContent && aAttrName, "Missing stuff, prepare to crash"); } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 4fe3c11fbb232..b8215e9e2ffd4 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1798,9 +1798,7 @@ nsPresContext::ThemeChanged() sThemeChanged = true; nsCOMPtr ev = - NewRunnableMethod("nsPresContext::ThemeChangedInternal", - this, - &nsPresContext::ThemeChangedInternal); + NewRunnableMethod(this, &nsPresContext::ThemeChangedInternal); nsresult rv = Document()->Dispatch("nsPresContext::ThemeChangedInternal", TaskCategory::Other, ev.forget()); @@ -1863,9 +1861,7 @@ nsPresContext::SysColorChanged() if (!mPendingSysColorChanged) { sLookAndFeelChanged = true; nsCOMPtr ev = - NewRunnableMethod("nsPresContext::SysColorChangedInternal", - this, - &nsPresContext::SysColorChangedInternal); + NewRunnableMethod(this, &nsPresContext::SysColorChangedInternal); nsresult rv = Document()->Dispatch("nsPresContext::SysColorChangedInternal", TaskCategory::Other, ev.forget()); @@ -1900,9 +1896,7 @@ nsPresContext::UIResolutionChanged() { if (!mPendingUIResolutionChanged) { nsCOMPtr ev = - NewRunnableMethod("nsPresContext::UIResolutionChangedInternal", - this, - &nsPresContext::UIResolutionChangedInternal); + NewRunnableMethod(this, &nsPresContext::UIResolutionChangedInternal); nsresult rv = Document()->Dispatch("nsPresContext::UIResolutionChangedInternal", TaskCategory::Other, @@ -2668,13 +2662,11 @@ nsPresContext::NotifyDidPaintSubdocumentCallback(nsIDocument* aDocument, void* a class DelayedFireDOMPaintEvent : public Runnable { public: - DelayedFireDOMPaintEvent( - nsPresContext* aPresContext, - nsTArray* aList, - uint64_t aTransactionId, - const mozilla::TimeStamp& aTimeStamp = mozilla::TimeStamp()) - : mozilla::Runnable("DelayedFireDOMPaintEvent") - , mPresContext(aPresContext) + DelayedFireDOMPaintEvent(nsPresContext* aPresContext, + nsTArray* aList, + uint64_t aTransactionId, + const mozilla::TimeStamp& aTimeStamp = mozilla::TimeStamp()) + : mPresContext(aPresContext) , mTransactionId(aTransactionId) , mTimeStamp(aTimeStamp) { diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index df8a42bde4007..e5f7bad37f2f6 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -397,12 +397,7 @@ class SimpleTimerBasedRefreshDriverTimer : mTargetTime = mLastFireTime + mRateDuration; uint32_t delay = static_cast(mRateMilliseconds); - mTimer->InitWithNamedFuncCallback( - TimerTick, - this, - delay, - nsITimer::TYPE_ONE_SHOT, - "SimpleTimerBasedRefreshDriverTimer::StartTimer"); + mTimer->InitWithFuncCallback(TimerTick, this, delay, nsITimer::TYPE_ONE_SHOT); } void StopTimer() override @@ -494,12 +489,7 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer public: ParentProcessVsyncNotifier(RefreshDriverVsyncObserver* aObserver, TimeStamp aVsyncTimestamp) - : Runnable("VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::" - "ParentProcessVsyncNotifier") - , mObserver(aObserver) - , mVsyncTimestamp(aVsyncTimestamp) - { - } + : mObserver(aObserver), mVsyncTimestamp(aVsyncTimestamp) {} NS_DECL_ISUPPORTS_INHERITED @@ -804,12 +794,7 @@ class StartupRefreshDriverTimer : // that we tick at consistent intervals. TimeStamp newTarget = aNowTime + mRateDuration; uint32_t delay = static_cast((newTarget - aNowTime).ToMilliseconds()); - mTimer->InitWithNamedFuncCallback( - TimerTick, - this, - delay, - nsITimer::TYPE_ONE_SHOT, - "StartupRefreshDriverTimer::ScheduleNextTick"); + mTimer->InitWithFuncCallback(TimerTick, this, delay, nsITimer::TYPE_ONE_SHOT); mTargetTime = newTarget; } }; @@ -884,11 +869,7 @@ class InactiveRefreshDriverTimer final : mTargetTime = mLastFireTime + mRateDuration; uint32_t delay = static_cast(mRateMilliseconds); - mTimer->InitWithNamedFuncCallback(TimerTickOne, - this, - delay, - nsITimer::TYPE_ONE_SHOT, - "InactiveRefreshDriverTimer::StartTimer"); + mTimer->InitWithFuncCallback(TimerTickOne, this, delay, nsITimer::TYPE_ONE_SHOT); } void StopTimer() override @@ -915,12 +896,7 @@ class InactiveRefreshDriverTimer final : // this doesn't need to be precise; do a simple schedule uint32_t delay = static_cast(mNextTickDuration); - mTimer->InitWithNamedFuncCallback( - TimerTickOne, - this, - delay, - nsITimer::TYPE_ONE_SHOT, - "InactiveRefreshDriverTimer::ScheduleNextTick"); + mTimer->InitWithFuncCallback(TimerTickOne, this, delay, nsITimer::TYPE_ONE_SHOT); LOG("[%p] inactive timer next tick in %f ms [index %d/%d]", this, mNextTickDuration, mNextDriverIndex, GetRefreshDriverCount()); @@ -2128,8 +2104,8 @@ nsRefreshDriver::Thaw() // updates our mMostRecentRefresh, but the DoRefresh call won't run // and notify our observers until we get back to the event loop. // Thus MostRecentRefresh() will lie between now and the DoRefresh. - RefPtr> event = NewRunnableMethod( - "nsRefreshDriver::DoRefresh", this, &nsRefreshDriver::DoRefresh); + RefPtr> event = + NewRunnableMethod(this, &nsRefreshDriver::DoRefresh); nsPresContext* pc = GetPresContext(); if (pc) { pc->Document()->Dispatch("nsRefreshDriver::DoRefresh", diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 191f16177cacc..77eea317de404 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -383,8 +383,7 @@ class nsResizeDropdownAtFinalPosition final { public: explicit nsResizeDropdownAtFinalPosition(nsComboboxControlFrame* aFrame) - : mozilla::Runnable("nsResizeDropdownAtFinalPosition") - , mFrame(aFrame) + : mFrame(aFrame) { } @@ -520,11 +519,7 @@ nsComboboxControlFrame::GetCSSTransformTranslation() class nsAsyncRollup : public Runnable { public: - explicit nsAsyncRollup(nsComboboxControlFrame* aFrame) - : mozilla::Runnable("nsAsyncRollup") - , mFrame(aFrame) - { - } + explicit nsAsyncRollup(nsComboboxControlFrame* aFrame) : mFrame(aFrame) {} NS_IMETHOD Run() override { if (mFrame.IsAlive()) { @@ -539,11 +534,7 @@ class nsAsyncRollup : public Runnable class nsAsyncResize : public Runnable { public: - explicit nsAsyncResize(nsComboboxControlFrame* aFrame) - : mozilla::Runnable("nsAsyncResize") - , mFrame(aFrame) - { - } + explicit nsAsyncResize(nsComboboxControlFrame* aFrame) : mFrame(aFrame) {} NS_IMETHOD Run() override { if (mFrame.IsAlive()) { diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h index 93eb683b72445..81e76e22c6d22 100644 --- a/layout/forms/nsComboboxControlFrame.h +++ b/layout/forms/nsComboboxControlFrame.h @@ -253,11 +253,7 @@ class nsComboboxControlFrame final : public nsBlockFrame, class RedisplayTextEvent : public mozilla::Runnable { public: NS_DECL_NSIRUNNABLE - explicit RedisplayTextEvent(nsComboboxControlFrame* c) - : mozilla::Runnable("nsComboboxControlFrame::RedisplayTextEvent") - , mControlFrame(c) - { - } + explicit RedisplayTextEvent(nsComboboxControlFrame *c) : mControlFrame(c) {} void Revoke() { mControlFrame = nullptr; } private: nsComboboxControlFrame *mControlFrame; diff --git a/layout/forms/nsDateTimeControlFrame.cpp b/layout/forms/nsDateTimeControlFrame.cpp index 58f661b5c734e..d896ba9308df5 100644 --- a/layout/forms/nsDateTimeControlFrame.cpp +++ b/layout/forms/nsDateTimeControlFrame.cpp @@ -403,9 +403,7 @@ nsDateTimeControlFrame::AttributeChanged(int32_t aNameSpaceID, do_QueryInterface(mInputAreaContent); if (aAttribute == nsGkAtoms::value) { if (inputAreaContent) { - nsContentUtils::AddScriptRunner(NewRunnableMethod( - "nsIDateTimeInputArea::NotifyInputElementValueChanged", - inputAreaContent, + nsContentUtils::AddScriptRunner(NewRunnableMethod(inputAreaContent, &nsIDateTimeInputArea::NotifyInputElementValueChanged)); } } else { diff --git a/layout/forms/nsDateTimeControlFrame.h b/layout/forms/nsDateTimeControlFrame.h index 20f65aca2d69d..2e71f86f4d6fb 100644 --- a/layout/forms/nsDateTimeControlFrame.h +++ b/layout/forms/nsDateTimeControlFrame.h @@ -87,8 +87,7 @@ class nsDateTimeControlFrame final : public nsContainerFrame, { public: explicit SyncDisabledStateEvent(nsDateTimeControlFrame* aFrame) - : mozilla::Runnable("nsDateTimeControlFrame::SyncDisabledStateEvent") - , mFrame(aFrame) + : mFrame(aFrame) {} NS_IMETHOD Run() override diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index efc778c375f31..57f96ac0f4472 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -95,8 +95,7 @@ class nsFileControlFrame : public nsBlockFrame, { public: explicit SyncDisabledStateEvent(nsFileControlFrame* aFrame) - : mozilla::Runnable("nsFileControlFrame::SyncDisabledStateEvent") - , mFrame(aFrame) + : mFrame(aFrame) {} NS_IMETHOD Run() override { diff --git a/layout/forms/nsNumberControlFrame.cpp b/layout/forms/nsNumberControlFrame.cpp index c2c31ef40998e..ab7d3d5a193c7 100644 --- a/layout/forms/nsNumberControlFrame.cpp +++ b/layout/forms/nsNumberControlFrame.cpp @@ -303,9 +303,8 @@ class FocusTextField : public Runnable { public: FocusTextField(nsIContent* aNumber, nsIContent* aTextField) - : mozilla::Runnable("FocusTextField") - , mNumber(aNumber) - , mTextField(aTextField) + : mNumber(aNumber), + mTextField(aTextField) {} NS_IMETHOD Run() override diff --git a/layout/forms/nsNumberControlFrame.h b/layout/forms/nsNumberControlFrame.h index b7a53489fd530..826a0119f0525 100644 --- a/layout/forms/nsNumberControlFrame.h +++ b/layout/forms/nsNumberControlFrame.h @@ -174,8 +174,7 @@ class nsNumberControlFrame final : public nsContainerFrame { public: explicit SyncDisabledStateEvent(nsNumberControlFrame* aFrame) - : mozilla::Runnable("nsNumberControlFrame::SyncDisabledStateEvent") - , mFrame(aFrame) + : mFrame(aFrame) {} NS_IMETHOD Run() override diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index b657ce3f20642..3b04fdb622d92 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -233,11 +233,8 @@ class nsTextControlFrame final : public nsContainerFrame, class EditorInitializer : public mozilla::Runnable { public: - explicit EditorInitializer(nsTextControlFrame* aFrame) - : mozilla::Runnable("nsTextControlFrame::EditorInitializer") - , mFrame(aFrame) - { - } + explicit EditorInitializer(nsTextControlFrame* aFrame) : + mFrame(aFrame) {} NS_IMETHOD Run() override; @@ -255,11 +252,8 @@ class nsTextControlFrame final : public nsContainerFrame, class ScrollOnFocusEvent : public mozilla::Runnable { public: - explicit ScrollOnFocusEvent(nsTextControlFrame* aFrame) - : mozilla::Runnable("nsTextControlFrame::ScrollOnFocusEvent") - , mFrame(aFrame) - { - } + explicit ScrollOnFocusEvent(nsTextControlFrame* aFrame) : + mFrame(aFrame) {} NS_DECL_NSIRUNNABLE diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index b051f93f735cd..cc581b1fe05c8 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2548,12 +2548,9 @@ void ScrollFrameHelper::MarkRecentlyScrolled() void ScrollFrameHelper::ResetDisplayPortExpiryTimer() { if (mDisplayPortExpiryTimer) { - mDisplayPortExpiryTimer->InitWithNamedFuncCallback( - RemoveDisplayPortCallback, - this, - gfxPrefs::APZDisplayPortExpiryTime(), - nsITimer::TYPE_ONE_SHOT, - "ScrollFrameHelper::ResetDisplayPortExpiryTimer"); + mDisplayPortExpiryTimer->InitWithFuncCallback( + RemoveDisplayPortCallback, this, + gfxPrefs::APZDisplayPortExpiryTime(), nsITimer::TYPE_ONE_SHOT); } } @@ -2713,12 +2710,8 @@ ScrollFrameHelper::ScheduleSyntheticMouseMove() } } - mScrollActivityTimer->InitWithNamedFuncCallback( - ScrollActivityCallback, - this, - 100, - nsITimer::TYPE_ONE_SHOT, - "ScrollFrameHelper::ScheduleSyntheticMouseMove"); + mScrollActivityTimer->InitWithFuncCallback( + ScrollActivityCallback, this, 100, nsITimer::TYPE_ONE_SHOT); } void diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 9531cc839f818..4a641b3622415 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -137,11 +137,7 @@ class ScrollFrameHelper : public nsIReflowCallback { class AsyncScrollPortEvent : public Runnable { public: NS_DECL_NSIRUNNABLE - explicit AsyncScrollPortEvent(ScrollFrameHelper* helper) - : Runnable("ScrollFrameHelper::AsyncScrollPortEvent") - , mHelper(helper) - { - } + explicit AsyncScrollPortEvent(ScrollFrameHelper *helper) : mHelper(helper) {} void Revoke() { mHelper = nullptr; } private: ScrollFrameHelper *mHelper; @@ -150,11 +146,7 @@ class ScrollFrameHelper : public nsIReflowCallback { class ScrolledAreaEvent : public Runnable { public: NS_DECL_NSIRUNNABLE - explicit ScrolledAreaEvent(ScrollFrameHelper* helper) - : Runnable("ScrollFrameHelper::ScrolledAreaEvent") - , mHelper(helper) - { - } + explicit ScrolledAreaEvent(ScrollFrameHelper *helper) : mHelper(helper) {} void Revoke() { mHelper = nullptr; } private: ScrollFrameHelper *mHelper; diff --git a/layout/generic/nsPluginFrame.h b/layout/generic/nsPluginFrame.h index 44373bd527c4a..14484223b952e 100644 --- a/layout/generic/nsPluginFrame.h +++ b/layout/generic/nsPluginFrame.h @@ -292,12 +292,9 @@ class nsPluginFrame final class PluginEventNotifier : public mozilla::Runnable { public: - explicit PluginEventNotifier(const nsString& aEventType) - : mozilla::Runnable("nsPluginFrame::PluginEventNotifier") - , mEventType(aEventType) - { - } - + explicit PluginEventNotifier(const nsString &aEventType) : + mEventType(aEventType) {} + NS_IMETHOD Run() override; private: nsString mEventType; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 6fa63a387f859..9bf63a21ea87e 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -84,11 +84,7 @@ NS_QUERYFRAME_TAIL_INHERITING(nsAtomicContainerFrame) class AsyncFrameInit : public Runnable { public: - explicit AsyncFrameInit(nsIFrame* aFrame) - : mozilla::Runnable("AsyncFrameInit") - , mFrame(aFrame) - { - } + explicit AsyncFrameInit(nsIFrame* aFrame) : mFrame(aFrame) {} NS_IMETHOD Run() override { PROFILER_LABEL("mozilla", "AsyncFrameInit::Run", js::ProfileEntry::Category::OTHER); @@ -912,11 +908,10 @@ class nsHideViewer : public Runnable { nsFrameLoader* aFrameLoader, nsIPresShell* aPresShell, bool aHideViewerIfFrameless) - : mozilla::Runnable("nsHideViewer") - , mFrameElement(aFrameElement) - , mFrameLoader(aFrameLoader) - , mPresShell(aPresShell) - , mHideViewerIfFrameless(aHideViewerIfFrameless) + : mFrameElement(aFrameElement), + mFrameLoader(aFrameLoader), + mPresShell(aPresShell), + mHideViewerIfFrameless(aHideViewerIfFrameless) { NS_ASSERTION(mFrameElement, "Must have a frame element"); NS_ASSERTION(mFrameLoader, "Must have a frame loader"); diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index a9d235f199d5b..6ba2cd8705e1c 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -265,10 +265,7 @@ class DispatchResizeToControls : public Runnable { public: explicit DispatchResizeToControls(nsIContent* aContent) - : mozilla::Runnable("DispatchResizeToControls") - , mContent(aContent) - { - } + : mContent(aContent) {} NS_IMETHOD Run() override { nsContentUtils::DispatchTrustedEvent(mContent->OwnerDoc(), mContent, NS_LITERAL_STRING("resizevideocontrols"), diff --git a/layout/ipc/VsyncParent.cpp b/layout/ipc/VsyncParent.cpp index d15e71d41d56b..e0d20101c84c3 100644 --- a/layout/ipc/VsyncParent.cpp +++ b/layout/ipc/VsyncParent.cpp @@ -50,8 +50,7 @@ VsyncParent::NotifyVsync(TimeStamp aTimeStamp) // Called on hardware vsync thread. We should post to current ipc thread. MOZ_ASSERT(!IsOnBackgroundThread()); nsCOMPtr vsyncEvent = - NewRunnableMethod("layout::VsyncParent::DispatchVsyncEvent", - this, + NewRunnableMethod(this, &VsyncParent::DispatchVsyncEvent, aTimeStamp); MOZ_ALWAYS_SUCCEEDS(mBackgroundThread->Dispatch(vsyncEvent, NS_DISPATCH_NORMAL)); diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 711429e23e840..82ba2dc215d1e 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -3690,10 +3690,8 @@ nsPrintEngine::Observe(nsISupports *aSubject, const char *aTopic, const char16_t //--------------------------------------------------------------- class nsPrintCompletionEvent : public Runnable { public: - explicit nsPrintCompletionEvent(nsIDocumentViewerPrint* docViewerPrint) - : mozilla::Runnable("nsPrintCompletionEvent") - , mDocViewerPrint(docViewerPrint) - { + explicit nsPrintCompletionEvent(nsIDocumentViewerPrint *docViewerPrint) + : mDocViewerPrint(docViewerPrint) { NS_ASSERTION(mDocViewerPrint, "mDocViewerPrint is null."); } diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 7de79d532ecc3..44eaded56a60f 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -1498,9 +1498,7 @@ FontFaceSet::DispatchCheckLoadingFinishedAfterDelay() } nsCOMPtr checkTask = - NewRunnableMethod("dom::FontFaceSet::CheckLoadingFinishedAfterDelay", - this, - &FontFaceSet::CheckLoadingFinishedAfterDelay); + NewRunnableMethod(this, &FontFaceSet::CheckLoadingFinishedAfterDelay); mDocument->Dispatch("FontFaceSet::CheckLoadingFinishedAfterDelay", TaskCategory::Other, checkTask.forget()); } diff --git a/layout/style/nsFontFaceLoader.cpp b/layout/style/nsFontFaceLoader.cpp index ddc1068a2b7bb..d8bdee0dd0630 100644 --- a/layout/style/nsFontFaceLoader.cpp +++ b/layout/style/nsFontFaceLoader.cpp @@ -141,12 +141,10 @@ nsFontFaceLoader::LoadTimerCallback(nsITimer* aTimer, void* aClosure) ufe->mFontDataLoadingState = gfxUserFontEntry::LOADING_ALMOST_DONE; uint32_t delay; loader->mLoadTimer->GetDelay(&delay); - loader->mLoadTimer->InitWithNamedFuncCallback( - LoadTimerCallback, - static_cast(loader), - delay >> 1, - nsITimer::TYPE_ONE_SHOT, - "nsFontFaceLoader::LoadTimerCallback"); + loader->mLoadTimer->InitWithFuncCallback(LoadTimerCallback, + static_cast(loader), + delay >> 1, + nsITimer::TYPE_ONE_SHOT); updateUserFontSet = false; LOG(("userfonts (%p) 75%% done, resetting timer\n", loader)); } diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index e4d7d4e21b7de..47b8fad406a7a 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1937,8 +1937,7 @@ class StyleImageRequestCleanupTask : public mozilla::Runnable already_AddRefed aRequestProxy, already_AddRefed aImageValue, already_AddRefed aImageTracker) - : mozilla::Runnable("StyleImageRequestCleanupTask") - , mModeFlags(aModeFlags) + : mModeFlags(aModeFlags) , mRequestProxy(aRequestProxy) , mImageValue(aImageValue) , mImageTracker(aImageTracker) @@ -2128,7 +2127,6 @@ CachedBorderImageData::GetCachedSVGViewportSize() struct PurgeCachedImagesTask : mozilla::Runnable { - PurgeCachedImagesTask() : mozilla::Runnable("PurgeCachedImagesTask") {} NS_IMETHOD Run() final { mSubImages.Clear(); diff --git a/layout/svg/SVGTextFrame.h b/layout/svg/SVGTextFrame.h index bd4c450f8e3ef..6ceb82cf22dd4 100644 --- a/layout/svg/SVGTextFrame.h +++ b/layout/svg/SVGTextFrame.h @@ -130,11 +130,7 @@ struct CharPosition class GlyphMetricsUpdater : public Runnable { public: NS_DECL_NSIRUNNABLE - explicit GlyphMetricsUpdater(SVGTextFrame* aFrame) - : Runnable("GlyphMetricsUpdater") - , mFrame(aFrame) - { - } + explicit GlyphMetricsUpdater(SVGTextFrame* aFrame) : mFrame(aFrame) { } static void Run(SVGTextFrame* aFrame); void Revoke() { mFrame = nullptr; } private: diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 9f56979bdd20b..35da372228467 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -5035,11 +5035,8 @@ GetPaintStyleInfo(const nsIFrame* aFrame, class nsDelayedCalcBCBorders : public Runnable { public: - explicit nsDelayedCalcBCBorders(nsIFrame* aFrame) - : mozilla::Runnable("nsDelayedCalcBCBorders") - , mFrame(aFrame) - { - } + explicit nsDelayedCalcBCBorders(nsIFrame* aFrame) : + mFrame(aFrame) {} NS_IMETHOD Run() override { if (mFrame) { diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index bbb3e721ee617..f43a3d1476f6c 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -64,12 +64,8 @@ using namespace mozilla::layers; class nsImageBoxFrameEvent : public Runnable { public: - nsImageBoxFrameEvent(nsIContent* content, EventMessage message) - : mozilla::Runnable("nsImageBoxFrameEvent") - , mContent(content) - , mMessage(message) - { - } + nsImageBoxFrameEvent(nsIContent *content, EventMessage message) + : mContent(content), mMessage(message) {} NS_IMETHOD Run() override; diff --git a/layout/xul/nsListBoxBodyFrame.h b/layout/xul/nsListBoxBodyFrame.h index f1b4e394c0639..6d60b9c3ad3cb 100644 --- a/layout/xul/nsListBoxBodyFrame.h +++ b/layout/xul/nsListBoxBodyFrame.h @@ -152,11 +152,9 @@ class nsListBoxBodyFrame final : public nsBoxFrame, class nsPositionChangedEvent : public mozilla::Runnable { public: - nsPositionChangedEvent(nsListBoxBodyFrame* aFrame, bool aUp, int32_t aDelta) - : mozilla::Runnable("nsListBoxBodyFrame::nsPositionChangedEvent") - , mFrame(aFrame) - , mUp(aUp) - , mDelta(aDelta) + nsPositionChangedEvent(nsListBoxBodyFrame* aFrame, + bool aUp, int32_t aDelta) : + mFrame(aFrame), mUp(aUp), mDelta(aDelta) {} NS_IMETHOD Run() override diff --git a/layout/xul/nsMenuBarFrame.cpp b/layout/xul/nsMenuBarFrame.cpp index a169f18a9cc4f..1687128cb7bd3 100644 --- a/layout/xul/nsMenuBarFrame.cpp +++ b/layout/xul/nsMenuBarFrame.cpp @@ -257,14 +257,11 @@ class nsMenuBarSwitchMenu : public Runnable { public: nsMenuBarSwitchMenu(nsIContent* aMenuBar, - nsIContent* aOldMenu, - nsIContent* aNewMenu, + nsIContent *aOldMenu, + nsIContent *aNewMenu, bool aSelectFirstItem) - : mozilla::Runnable("nsMenuBarSwitchMenu") - , mMenuBar(aMenuBar) - , mOldMenu(aOldMenu) - , mNewMenu(aNewMenu) - , mSelectFirstItem(aSelectFirstItem) + : mMenuBar(aMenuBar), mOldMenu(aOldMenu), mNewMenu(aNewMenu), + mSelectFirstItem(aSelectFirstItem) { } diff --git a/layout/xul/nsMenuFrame.cpp b/layout/xul/nsMenuFrame.cpp index 72495127a6b66..c7232f85a99da 100644 --- a/layout/xul/nsMenuFrame.cpp +++ b/layout/xul/nsMenuFrame.cpp @@ -68,13 +68,10 @@ const int32_t kBlinkDelay = 67; // milliseconds class nsMenuActivateEvent : public Runnable { public: - nsMenuActivateEvent(nsIContent* aMenu, + nsMenuActivateEvent(nsIContent *aMenu, nsPresContext* aPresContext, bool aIsActivate) - : mozilla::Runnable("nsMenuActivateEvent") - , mMenu(aMenu) - , mPresContext(aPresContext) - , mIsActivate(aIsActivate) + : mMenu(aMenu), mPresContext(aPresContext), mIsActivate(aIsActivate) { } @@ -117,9 +114,7 @@ class nsMenuAttributeChangedEvent : public Runnable { public: nsMenuAttributeChangedEvent(nsIFrame* aFrame, nsIAtom* aAttr) - : mozilla::Runnable("nsMenuAttributeChangedEvent") - , mFrame(aFrame) - , mAttr(aAttr) + : mFrame(aFrame), mAttr(aAttr) { } diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h index 298444ddee8b7..25b893e24ba87 100644 --- a/layout/xul/nsMenuPopupFrame.h +++ b/layout/xul/nsMenuPopupFrame.h @@ -138,10 +138,8 @@ class nsXULPopupShownEvent : public mozilla::Runnable, public nsIDOMEventListener { public: - nsXULPopupShownEvent(nsIContent* aPopup, nsPresContext* aPresContext) - : mozilla::Runnable("nsXULPopupShownEvent") - , mPopup(aPopup) - , mPresContext(aPresContext) + nsXULPopupShownEvent(nsIContent *aPopup, nsPresContext* aPresContext) + : mPopup(aPopup), mPresContext(aPresContext) { } diff --git a/layout/xul/nsProgressMeterFrame.cpp b/layout/xul/nsProgressMeterFrame.cpp index 9efd665b1899a..801732c63e131 100644 --- a/layout/xul/nsProgressMeterFrame.cpp +++ b/layout/xul/nsProgressMeterFrame.cpp @@ -36,14 +36,12 @@ class nsReflowFrameRunnable : public mozilla::Runnable nsFrameState mBitToAdd; }; -nsReflowFrameRunnable::nsReflowFrameRunnable( - nsIFrame* aFrame, - nsIPresShell::IntrinsicDirty aIntrinsicDirty, - nsFrameState aBitToAdd) - : mozilla::Runnable("nsReflowFrameRunnable") - , mWeakFrame(aFrame) - , mIntrinsicDirty(aIntrinsicDirty) - , mBitToAdd(aBitToAdd) +nsReflowFrameRunnable::nsReflowFrameRunnable(nsIFrame* aFrame, + nsIPresShell::IntrinsicDirty aIntrinsicDirty, + nsFrameState aBitToAdd) + : mWeakFrame(aFrame), + mIntrinsicDirty(aIntrinsicDirty), + mBitToAdd(aBitToAdd) { } diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index 12d8c3670317b..1892d835afcf1 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -210,11 +210,8 @@ class nsValueChangedRunnable : public Runnable nsIAtom* aWhich, int32_t aValue, bool aUserChanged) - : mozilla::Runnable("nsValueChangedRunnable") - , mListener(aListener) - , mWhich(aWhich) - , mValue(aValue) - , mUserChanged(aUserChanged) + : mListener(aListener), mWhich(aWhich), + mValue(aValue), mUserChanged(aUserChanged) {} NS_IMETHOD Run() override @@ -232,10 +229,10 @@ class nsValueChangedRunnable : public Runnable class nsDragStateChangedRunnable : public Runnable { public: - nsDragStateChangedRunnable(nsISliderListener* aListener, bool aDragBeginning) - : mozilla::Runnable("nsDragStateChangedRunnable") - , mListener(aListener) - , mDragBeginning(aDragBeginning) + nsDragStateChangedRunnable(nsISliderListener* aListener, + bool aDragBeginning) + : mListener(aListener), + mDragBeginning(aDragBeginning) {} NS_IMETHOD Run() override diff --git a/layout/xul/nsXULPopupManager.h b/layout/xul/nsXULPopupManager.h index 0956a159555ed..25ffa8095b638 100644 --- a/layout/xul/nsXULPopupManager.h +++ b/layout/xul/nsXULPopupManager.h @@ -203,13 +203,12 @@ class nsMenuChainItem class nsXULPopupShowingEvent : public mozilla::Runnable { public: - nsXULPopupShowingEvent(nsIContent* aPopup, + nsXULPopupShowingEvent(nsIContent *aPopup, bool aIsContextMenu, bool aSelectFirstItem) - : mozilla::Runnable("nsXULPopupShowingEvent") - , mPopup(aPopup) - , mIsContextMenu(aIsContextMenu) - , mSelectFirstItem(aSelectFirstItem) + : mPopup(aPopup), + mIsContextMenu(aIsContextMenu), + mSelectFirstItem(aSelectFirstItem) { NS_ASSERTION(aPopup, "null popup supplied to nsXULPopupShowingEvent constructor"); } @@ -226,19 +225,18 @@ class nsXULPopupShowingEvent : public mozilla::Runnable class nsXULPopupHidingEvent : public mozilla::Runnable { public: - nsXULPopupHidingEvent(nsIContent* aPopup, + nsXULPopupHidingEvent(nsIContent *aPopup, nsIContent* aNextPopup, nsIContent* aLastPopup, nsPopupType aPopupType, bool aDeselectMenu, bool aIsCancel) - : mozilla::Runnable("nsXULPopupHidingEvent") - , mPopup(aPopup) - , mNextPopup(aNextPopup) - , mLastPopup(aLastPopup) - , mPopupType(aPopupType) - , mDeselectMenu(aDeselectMenu) - , mIsRollup(aIsCancel) + : mPopup(aPopup), + mNextPopup(aNextPopup), + mLastPopup(aLastPopup), + mPopupType(aPopupType), + mDeselectMenu(aDeselectMenu), + mIsRollup(aIsCancel) { NS_ASSERTION(aPopup, "null popup supplied to nsXULPopupHidingEvent constructor"); // aNextPopup and aLastPopup may be null @@ -259,11 +257,10 @@ class nsXULPopupHidingEvent : public mozilla::Runnable class nsXULPopupPositionedEvent : public mozilla::Runnable { public: - explicit nsXULPopupPositionedEvent(nsIContent* aPopup, + explicit nsXULPopupPositionedEvent(nsIContent *aPopup, bool aIsContextMenu, bool aSelectFirstItem) - : mozilla::Runnable("nsXULPopupPositionedEvent") - , mPopup(aPopup) + : mPopup(aPopup) , mIsContextMenu(aIsContextMenu) , mSelectFirstItem(aSelectFirstItem) { @@ -288,7 +285,7 @@ class nsXULPopupPositionedEvent : public mozilla::Runnable class nsXULMenuCommandEvent : public mozilla::Runnable { public: - nsXULMenuCommandEvent(nsIContent* aMenu, + nsXULMenuCommandEvent(nsIContent *aMenu, bool aIsTrusted, bool aShift, bool aControl, @@ -296,16 +293,15 @@ class nsXULMenuCommandEvent : public mozilla::Runnable bool aMeta, bool aUserInput, bool aFlipChecked) - : mozilla::Runnable("nsXULMenuCommandEvent") - , mMenu(aMenu) - , mIsTrusted(aIsTrusted) - , mShift(aShift) - , mControl(aControl) - , mAlt(aAlt) - , mMeta(aMeta) - , mUserInput(aUserInput) - , mFlipChecked(aFlipChecked) - , mCloseMenuMode(CloseMenuMode_Auto) + : mMenu(aMenu), + mIsTrusted(aIsTrusted), + mShift(aShift), + mControl(aControl), + mAlt(aAlt), + mMeta(aMeta), + mUserInput(aUserInput), + mFlipChecked(aFlipChecked), + mCloseMenuMode(CloseMenuMode_Auto) { NS_ASSERTION(aMenu, "null menu supplied to nsXULMenuCommandEvent constructor"); } diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 6306478671e11..dda2cacc9a65e 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -4936,11 +4936,7 @@ nsTreeBodyFrame::FireInvalidateEvent(int32_t aStartRowIdx, int32_t aEndRowIdx, class nsOverflowChecker : public Runnable { public: - explicit nsOverflowChecker(nsTreeBodyFrame* aFrame) - : mozilla::Runnable("nsOverflowChecker") - , mFrame(aFrame) - { - } + explicit nsOverflowChecker(nsTreeBodyFrame* aFrame) : mFrame(aFrame) {} NS_IMETHOD Run() override { if (mFrame.IsAlive()) { diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h index e68e0b0654e91..b70767399e9ce 100644 --- a/layout/xul/tree/nsTreeBodyFrame.h +++ b/layout/xul/tree/nsTreeBodyFrame.h @@ -482,11 +482,7 @@ class nsTreeBodyFrame final class ScrollEvent : public mozilla::Runnable { public: NS_DECL_NSIRUNNABLE - explicit ScrollEvent(nsTreeBodyFrame* aInner) - : mozilla::Runnable("nsTreeBodyFrame::ScrollEvent") - , mInner(aInner) - { - } + explicit ScrollEvent(nsTreeBodyFrame *aInner) : mInner(aInner) {} void Revoke() { mInner = nullptr; } private: nsTreeBodyFrame* mInner; diff --git a/media/mtransport/nr_socket_prsock.cpp b/media/mtransport/nr_socket_prsock.cpp index c041df0da177d..c4f3c5844a854 100644 --- a/media/mtransport/nr_socket_prsock.cpp +++ b/media/mtransport/nr_socket_prsock.cpp @@ -1673,7 +1673,7 @@ class NrTcpSocketIpc::TcpSocketReadyRunner: public Runnable { public: explicit TcpSocketReadyRunner(NrTcpSocketIpc *sck) - : Runnable("NrTcpSocketIpc::TcpSocketReadyRunner"), socket_(sck) {} + : socket_(sck) {} NS_IMETHOD Run() override { socket_->maybe_post_socket_ready(); diff --git a/media/mtransport/runnable_utils.h b/media/mtransport/runnable_utils.h index b3a04a8af3d17..3a773e3565c43 100644 --- a/media/mtransport/runnable_utils.h +++ b/media/mtransport/runnable_utils.h @@ -53,8 +53,6 @@ RunOnThreadInternal(nsIEventTarget *thread, nsIRunnable *runnable, uint32_t flag template class runnable_args_base : public Runnable { public: - runnable_args_base() : Runnable("media-runnable_args_base") {} - NS_IMETHOD Run() = 0; }; diff --git a/media/mtransport/test/TestSyncRunnable.cpp b/media/mtransport/test/TestSyncRunnable.cpp index a53be04fd1032..02c7d512018fa 100644 --- a/media/mtransport/test/TestSyncRunnable.cpp +++ b/media/mtransport/test/TestSyncRunnable.cpp @@ -14,7 +14,7 @@ nsIThread *gThread = nullptr; class TestRunnable : public Runnable { public: - TestRunnable() : Runnable("TestRunnable"), ran_(false) {} + TestRunnable() : ran_(false) {} NS_IMETHOD Run() override { diff --git a/media/mtransport/test/sockettransportservice_unittest.cpp b/media/mtransport/test/sockettransportservice_unittest.cpp index 0f0e5924ac651..a7edaa193de39 100644 --- a/media/mtransport/test/sockettransportservice_unittest.cpp +++ b/media/mtransport/test/sockettransportservice_unittest.cpp @@ -78,7 +78,7 @@ class SocketTransportServiceTest : public MtransportTest { class EventReceived : public Runnable { public: explicit EventReceived(SocketTransportServiceTest *test) : - Runnable("EventReceived"), test_(test) {} + test_(test) {} NS_IMETHOD Run() override { test_->ReceiveEvent(); @@ -93,7 +93,7 @@ class EventReceived : public Runnable { class RegisterEvent : public Runnable { public: explicit RegisterEvent(SocketTransportServiceTest *test) : - Runnable("RegisterEvent"), test_(test) {} + test_(test) {} NS_IMETHOD Run() override { test_->RegisterHandler(); diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h index b8067a278f18b..2d5c5c4127693 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h @@ -80,7 +80,6 @@ class GmpInitDoneRunnable : public Runnable { public: explicit GmpInitDoneRunnable(const std::string& aPCHandle) : - Runnable("GmpInitDoneRunnable"), mResult(WEBRTC_VIDEO_CODEC_OK), mPCHandle(aPCHandle) { diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp index 4119c21ef7bc5..9b48fa1a78744 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp @@ -260,8 +260,7 @@ class MediaCodecOutputDrain : public Runnable protected: MediaCodecOutputDrain() - : Runnable("MediaCodecOutputDrain") - , mMonitor("MediaCodecOutputDrain monitor") + : mMonitor("MediaCodecOutputDrain monitor") , mEnding(false) {} diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index a542754849b6d..f1f98273aa651 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -206,7 +206,6 @@ class VideoFrameConverter nsCOMPtr runnable = NewRunnableMethod, bool>( - "VideoFrameConverter::ProcessVideoFrame", this, &VideoFrameConverter::ProcessVideoFrame, aChunk.mFrame.GetImage(), forceBlack); mTaskQueue->Dispatch(runnable.forget()); diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h index 19cc9e567eaea..6d7d36b9e3a59 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h @@ -334,7 +334,6 @@ class ConduitDeleteEvent: public Runnable { public: explicit ConduitDeleteEvent(already_AddRefed aConduit) : - Runnable("ConduitDeleteEvent"), mConduit(aConduit) {} /* we exist solely to proxy release of the conduit */ diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index db243ce803f80..924a89d552661 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -1081,8 +1081,7 @@ nsJARChannel::OnDataAvailable(nsIRequest *req, nsISupports *ctx, FireOnProgress(offset + count); } else { NS_DispatchToMainThread(NewRunnableMethod - ("nsJARChannel::FireOnProgress", - this, + (this, &nsJARChannel::FireOnProgress, offset + count)); } diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index a817f3c7be01b..1401f7ee25390 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -314,7 +314,7 @@ class PreferencesWriter final nsCOMPtr target = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) { - target->Dispatch(NS_NewRunnableFunction("Preferences_dummy", [] {}), + target->Dispatch(NS_NewRunnableFunction([] {}), nsIEventTarget::DISPATCH_SYNC); } } @@ -330,10 +330,7 @@ Atomic PreferencesWriter::sPendingWriteData(nullptr); class PWRunnable : public Runnable { public: - explicit PWRunnable(nsIFile* aFile) - : Runnable("PWRunnable") - , mFile(aFile) - {} + explicit PWRunnable(nsIFile* aFile) : mFile(aFile) {} NS_IMETHOD Run() override { @@ -352,7 +349,7 @@ class PWRunnable : public Runnable nsCOMPtr fileCopy(mFile); SystemGroup::Dispatch("Preferences::WriterRunnable", TaskCategory::Other, - NS_NewRunnableFunction("Preferences::WriterRunnable", [fileCopy, rvCopy] { + NS_NewRunnableFunction([fileCopy, rvCopy] { MOZ_RELEASE_ASSERT(NS_IsMainThread()); if (NS_FAILED(rvCopy)) { Preferences::DirtyCallback(); @@ -561,8 +558,6 @@ PreferenceServiceReporter::CollectReports( namespace { class AddPreferencesMemoryReporterRunnable : public Runnable { -public: - AddPreferencesMemoryReporterRunnable() : Runnable("AddPreferencesMemoryReporterRunnable") {} NS_IMETHOD Run() override { return RegisterStrongMemoryReporter(new PreferenceServiceReporter()); diff --git a/netwerk/base/BackgroundFileSaver.cpp b/netwerk/base/BackgroundFileSaver.cpp index 16d7d552166d9..4d9ff97c4cbb8 100644 --- a/netwerk/base/BackgroundFileSaver.cpp +++ b/netwerk/base/BackgroundFileSaver.cpp @@ -66,10 +66,9 @@ static LazyLogModule prlog("BackgroundFileSaver"); class NotifyTargetChangeRunnable final : public Runnable { public: - NotifyTargetChangeRunnable(BackgroundFileSaver* aSaver, nsIFile* aTarget) - : Runnable("net::NotifyTargetChangeRunnable") - , mSaver(aSaver) - , mTarget(aTarget) + NotifyTargetChangeRunnable(BackgroundFileSaver *aSaver, nsIFile *aTarget) + : mSaver(aSaver) + , mTarget(aTarget) { } @@ -326,11 +325,9 @@ BackgroundFileSaver::GetWorkerThreadAttention(bool aShouldInterruptCopy) if (!mAsyncCopyContext) { // Copy is not in progress, post an event to handle the change manually. - rv = mWorkerThread->Dispatch( - NewRunnableMethod("net::BackgroundFileSaver::ProcessAttention", - this, - &BackgroundFileSaver::ProcessAttention), - NS_DISPATCH_NORMAL); + rv = mWorkerThread->Dispatch(NewRunnableMethod(this, + &BackgroundFileSaver::ProcessAttention), + NS_DISPATCH_NORMAL); NS_ENSURE_SUCCESS(rv, rv); } else if (aShouldInterruptCopy) { // Interrupt the copy. The copy will be resumed, if needed, by the @@ -750,8 +747,7 @@ BackgroundFileSaver::CheckCompletion() } // Post an event to notify that the operation completed. - if (NS_FAILED(mControlEventTarget->Dispatch(NewRunnableMethod("BackgroundFileSaver::NotifySaveComplete", - this, + if (NS_FAILED(mControlEventTarget->Dispatch(NewRunnableMethod(this, &BackgroundFileSaver::NotifySaveComplete), NS_DISPATCH_NORMAL))) { NS_WARNING("Unable to post completion event to the control thread."); @@ -1157,8 +1153,7 @@ BackgroundFileSaverStreamListener::AsyncCopyProgressCallback(void *aClosure, self->mReceivedTooMuchData = false; // Post an event to verify if the request should be resumed. - if (NS_FAILED(self->mControlEventTarget->Dispatch(NewRunnableMethod("BackgroundFileSaverStreamListener::NotifySuspendOrResume", - self, + if (NS_FAILED(self->mControlEventTarget->Dispatch(NewRunnableMethod(self, &BackgroundFileSaverStreamListener::NotifySuspendOrResume), NS_DISPATCH_NORMAL))) { NS_WARNING("Unable to post resume event to the control thread."); diff --git a/netwerk/base/Dashboard.cpp b/netwerk/base/Dashboard.cpp index 094b6dba89447..63273be92ba09 100644 --- a/netwerk/base/Dashboard.cpp +++ b/netwerk/base/Dashboard.cpp @@ -200,8 +200,7 @@ ConnectionData::OnTransportStatus(nsITransport *aTransport, nsresult aStatus, GetErrorString(aStatus, mStatus); mEventTarget->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetConnectionStatus", - mDashboard, &Dashboard::GetConnectionStatus, this), + (mDashboard, &Dashboard::GetConnectionStatus, this), NS_DISPATCH_NORMAL); return NS_OK; @@ -222,8 +221,7 @@ ConnectionData::Notify(nsITimer *aTimer) mStatus.AssignLiteral(u"NS_ERROR_NET_TIMEOUT"); mEventTarget->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetConnectionStatus", - mDashboard, &Dashboard::GetConnectionStatus, this), + (mDashboard, &Dashboard::GetConnectionStatus, this), NS_DISPATCH_NORMAL); return NS_OK; @@ -312,8 +310,7 @@ LookupHelper::OnLookupComplete(nsICancelable *aRequest, RefPtr arg = new LookupArgument(aRecord, this); mEventTarget->Dispatch(NewRunnableMethod> - ("net::LookupHelper::ConstructAnswer", - this, &LookupHelper::ConstructAnswer, arg), + (this, &LookupHelper::ConstructAnswer, arg), NS_DISPATCH_NORMAL); return NS_OK; @@ -380,8 +377,7 @@ Dashboard::RequestSockets(NetDashboardCallback *aCallback) "NetDashboardCallback", aCallback, true); socketData->mEventTarget = GetCurrentThreadEventTarget(); gSocketTransportService->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetSocketsDispatch", - this, &Dashboard::GetSocketsDispatch, socketData), + (this, &Dashboard::GetSocketsDispatch, socketData), NS_DISPATCH_NORMAL); return NS_OK; } @@ -396,8 +392,7 @@ Dashboard::GetSocketsDispatch(SocketData *aSocketData) socketData->mTotalRecv = gSocketTransportService->GetReceivedBytes(); } socketData->mEventTarget->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetSockets", - this, &Dashboard::GetSockets, socketData), + (this, &Dashboard::GetSockets, socketData), NS_DISPATCH_NORMAL); return NS_OK; } @@ -452,12 +447,9 @@ Dashboard::RequestHttpConnections(NetDashboardCallback *aCallback) "NetDashboardCallback", aCallback, true); httpData->mEventTarget = GetCurrentThreadEventTarget(); - gSocketTransportService->Dispatch( - NewRunnableMethod>("net::Dashboard::GetHttpDispatch", - this, - &Dashboard::GetHttpDispatch, - httpData), - NS_DISPATCH_NORMAL); + gSocketTransportService->Dispatch(NewRunnableMethod> + (this, &Dashboard::GetHttpDispatch, httpData), + NS_DISPATCH_NORMAL); return NS_OK; } @@ -467,8 +459,7 @@ Dashboard::GetHttpDispatch(HttpData *aHttpData) RefPtr httpData = aHttpData; HttpInfo::GetHttpConnectionData(&httpData->mData); httpData->mEventTarget->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetHttpConnections", - this, &Dashboard::GetHttpConnections, httpData), + (this, &Dashboard::GetHttpConnections, httpData), NS_DISPATCH_NORMAL); return NS_OK; } @@ -634,8 +625,7 @@ Dashboard::RequestWebsocketConnections(NetDashboardCallback *aCallback) wsRequest->mEventTarget = GetCurrentThreadEventTarget(); wsRequest->mEventTarget->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetWebSocketConnections", - this, &Dashboard::GetWebSocketConnections, wsRequest), + (this, &Dashboard::GetWebSocketConnections, wsRequest), NS_DISPATCH_NORMAL); return NS_OK; } @@ -696,12 +686,9 @@ Dashboard::RequestDNSInfo(NetDashboardCallback *aCallback) } } - gSocketTransportService->Dispatch( - NewRunnableMethod>("net::Dashboard::GetDnsInfoDispatch", - this, - &Dashboard::GetDnsInfoDispatch, - dnsData), - NS_DISPATCH_NORMAL); + gSocketTransportService->Dispatch(NewRunnableMethod> + (this, &Dashboard::GetDnsInfoDispatch, dnsData), + NS_DISPATCH_NORMAL); return NS_OK; } @@ -713,8 +700,7 @@ Dashboard::GetDnsInfoDispatch(DnsData *aDnsData) mDnsService->GetDNSCacheEntries(&dnsData->mData); } dnsData->mEventTarget->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetDNSCacheEntries", - this, &Dashboard::GetDNSCacheEntries, dnsData), + (this, &Dashboard::GetDNSCacheEntries, dnsData), NS_DISPATCH_NORMAL); return NS_OK; } @@ -807,8 +793,7 @@ Dashboard::RequestRcwnStats(NetDashboardCallback *aCallback) "NetDashboardCallback", aCallback, true); return rcwnData->mEventTarget->Dispatch( - NewRunnableMethod>("net::Dashboard::GetRcwnData", - this, &Dashboard::GetRcwnData, rcwnData), + NewRunnableMethod>(this, &Dashboard::GetRcwnData, rcwnData), NS_DISPATCH_NORMAL); } @@ -890,8 +875,7 @@ Dashboard::RequestConnection(const nsACString& aHost, uint32_t aPort, if (NS_FAILED(rv)) { mozilla::net::GetErrorString(rv, connectionData->mStatus); connectionData->mEventTarget->Dispatch(NewRunnableMethod> - ("net::Dashboard::GetConnectionStatus", - this, &Dashboard::GetConnectionStatus, connectionData), + (this, &Dashboard::GetConnectionStatus, connectionData), NS_DISPATCH_NORMAL); return rv; } diff --git a/netwerk/base/NetworkActivityMonitor.cpp b/netwerk/base/NetworkActivityMonitor.cpp index ef2698c54b72f..2f7d92628dce6 100644 --- a/netwerk/base/NetworkActivityMonitor.cpp +++ b/netwerk/base/NetworkActivityMonitor.cpp @@ -152,8 +152,7 @@ nsNetMon_AcceptRead(PRFileDesc *listenSock, class NotifyNetworkActivity : public mozilla::Runnable { public: explicit NotifyNetworkActivity(NetworkActivityMonitor::Direction aDirection) - : mozilla::Runnable("NotifyNetworkActivity") - , mDirection(aDirection) + : mDirection(aDirection) {} NS_IMETHOD Run() override { diff --git a/netwerk/base/Predictor.cpp b/netwerk/base/Predictor.cpp index 5912cfc606108..7e969630a8cb0 100644 --- a/netwerk/base/Predictor.cpp +++ b/netwerk/base/Predictor.cpp @@ -615,10 +615,9 @@ namespace { class PredictorThreadShutdownRunner : public Runnable { public: - PredictorThreadShutdownRunner(nsIThread* ioThread, bool success) - : Runnable("net::PredictorThreadShutdownRunner") - , mIOThread(ioThread) - , mSuccess(success) + PredictorThreadShutdownRunner(nsIThread *ioThread, bool success) + :mIOThread(ioThread) + ,mSuccess(success) { } ~PredictorThreadShutdownRunner() { } @@ -641,10 +640,9 @@ class PredictorThreadShutdownRunner : public Runnable class PredictorOldCleanupRunner : public Runnable { public: - PredictorOldCleanupRunner(nsIThread* ioThread, nsIFile* dbFile) - : Runnable("net::PredictorOldCleanupRunner") - , mIOThread(ioThread) - , mDBFile(dbFile) + PredictorOldCleanupRunner(nsIThread *ioThread, nsIFile *dbFile) + :mIOThread(ioThread) + ,mDBFile(dbFile) { } ~PredictorOldCleanupRunner() { } diff --git a/netwerk/base/TLSServerSocket.cpp b/netwerk/base/TLSServerSocket.cpp index 77d209b20e9b3..40dcec75418ca 100644 --- a/netwerk/base/TLSServerSocket.cpp +++ b/netwerk/base/TLSServerSocket.cpp @@ -286,12 +286,10 @@ class TLSServerSecurityObserverProxy final : public nsITLSServerSecurityObserver class OnHandshakeDoneRunnable : public Runnable { public: - OnHandshakeDoneRunnable( - const nsMainThreadPtrHandle& aListener, - nsITLSServerSocket* aServer, - nsITLSClientStatus* aStatus) - : Runnable("net::TLSServerSecurityObserverProxy::OnHandshakeDoneRunnable") - , mListener(aListener) + OnHandshakeDoneRunnable(const nsMainThreadPtrHandle& aListener, + nsITLSServerSocket* aServer, + nsITLSClientStatus* aStatus) + : mListener(aListener) , mServer(aServer) , mStatus(aStatus) { } diff --git a/netwerk/base/Tickler.cpp b/netwerk/base/Tickler.cpp index 62542d6b0a210..555fdbbe5e292 100644 --- a/netwerk/base/Tickler.cpp +++ b/netwerk/base/Tickler.cpp @@ -108,8 +108,7 @@ void Tickler::Tickle() void Tickler::PostCheckTickler() { mLock.AssertCurrentThreadOwns(); - mThread->Dispatch(NewRunnableMethod("net::Tickler::CheckTickler", - this, &Tickler::CheckTickler), + mThread->Dispatch(NewRunnableMethod(this, &Tickler::CheckTickler), NS_DISPATCH_NORMAL); return; } @@ -125,8 +124,7 @@ void Tickler::MaybeStartTickler() mLock.AssertCurrentThreadOwns(); if (!NS_IsMainThread()) { NS_DispatchToMainThread( - NewRunnableMethod("net::Tickler::MaybeStartTicklerUnlocked", - this, &Tickler::MaybeStartTicklerUnlocked)); + NewRunnableMethod(this, &Tickler::MaybeStartTicklerUnlocked)); return; } diff --git a/netwerk/base/nsAsyncStreamCopier.cpp b/netwerk/base/nsAsyncStreamCopier.cpp index 6fbed58cc118d..2923ac9e5a896 100644 --- a/netwerk/base/nsAsyncStreamCopier.cpp +++ b/netwerk/base/nsAsyncStreamCopier.cpp @@ -33,11 +33,9 @@ class AsyncApplyBufferingPolicyEvent final: public Runnable * The nsAsyncStreamCopier requesting the information. */ explicit AsyncApplyBufferingPolicyEvent(nsAsyncStreamCopier* aCopier) - : mozilla::Runnable("AsyncApplyBufferingPolicyEvent") - , mCopier(aCopier) + : mCopier(aCopier) , mTarget(GetCurrentThreadEventTarget()) - {} - + { } NS_IMETHOD Run() override { nsresult rv = mCopier->ApplyBufferingPolicy(); @@ -46,8 +44,7 @@ class AsyncApplyBufferingPolicyEvent final: public Runnable return NS_OK; } - rv = mTarget->Dispatch(NewRunnableMethod("nsAsyncStreamCopier::AsyncCopyInternal", - mCopier, + rv = mTarget->Dispatch(NewRunnableMethod(mCopier, &nsAsyncStreamCopier::AsyncCopyInternal), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); @@ -57,7 +54,6 @@ class AsyncApplyBufferingPolicyEvent final: public Runnable } return NS_OK; } - private: RefPtr mCopier; nsCOMPtr mTarget; diff --git a/netwerk/base/nsBaseChannel.cpp b/netwerk/base/nsBaseChannel.cpp index 9d9b427f1acf4..094ef07c458a6 100644 --- a/netwerk/base/nsBaseChannel.cpp +++ b/netwerk/base/nsBaseChannel.cpp @@ -908,10 +908,9 @@ nsBaseChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, OnTransportStatusAsyncEvent(nsBaseChannel* aChannel, int64_t aProgress, int64_t aContentLength) - : mozilla::Runnable("OnTransportStatusAsyncEvent") - , mChannel(aChannel) - , mProgress(aProgress) - , mContentLength(aContentLength) + : mChannel(aChannel), + mProgress(aProgress), + mContentLength(aContentLength) { } NS_IMETHOD Run() override diff --git a/netwerk/base/nsBaseChannel.h b/netwerk/base/nsBaseChannel.h index 6ae87b37b1805..5427acef132f7 100644 --- a/netwerk/base/nsBaseChannel.h +++ b/netwerk/base/nsBaseChannel.h @@ -261,9 +261,7 @@ class nsBaseChannel : public nsHashPropertyBag { public: RedirectRunnable(nsBaseChannel* chan, nsIChannel* newChannel) - : mozilla::Runnable("nsBaseChannel::RedirectRunnable") - , mChannel(chan) - , mNewChannel(newChannel) + : mChannel(chan), mNewChannel(newChannel) { NS_PRECONDITION(newChannel, "Must have channel to redirect to"); } diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 024877641faa6..48f92048f387c 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -1398,13 +1398,14 @@ nsIOService::GetPrefBranch(nsIPrefBranch **result) class nsWakeupNotifier : public Runnable { public: - explicit nsWakeupNotifier(nsIIOServiceInternal* ioService) - : Runnable("net::nsWakeupNotifier") - , mIOService(ioService) - { - } + explicit nsWakeupNotifier(nsIIOServiceInternal *ioService) + :mIOService(ioService) + { } - NS_IMETHOD Run() override { return mIOService->NotifyWakeup(); } + NS_IMETHOD Run() override + { + return mIOService->NotifyWakeup(); + } private: virtual ~nsWakeupNotifier() { } diff --git a/netwerk/base/nsInputStreamPump.cpp b/netwerk/base/nsInputStreamPump.cpp index 97b2825824186..c57fc1322326c 100644 --- a/netwerk/base/nsInputStreamPump.cpp +++ b/netwerk/base/nsInputStreamPump.cpp @@ -697,9 +697,7 @@ nsInputStreamPump::OnStateStop() MOZ_ASSERT(NS_IsMainThread(), "OnStateStop should only be called on the main thread."); nsresult rv = NS_DispatchToMainThread( - NewRunnableMethod("nsInputStreamPump::CallOnStateStop", - this, - &nsInputStreamPump::CallOnStateStop)); + NewRunnableMethod(this, &nsInputStreamPump::CallOnStateStop)); NS_ENSURE_SUCCESS(rv, STATE_IDLE); return STATE_IDLE; } diff --git a/netwerk/base/nsPACMan.cpp b/netwerk/base/nsPACMan.cpp index 5a43f26e5615a..da8dfefdc6a36 100644 --- a/netwerk/base/nsPACMan.cpp +++ b/netwerk/base/nsPACMan.cpp @@ -85,9 +85,9 @@ GetExtraJSContextHeapSize() class ExecuteCallback final : public Runnable { public: - ExecuteCallback(nsPACManCallback* aCallback, nsresult status) - : Runnable("net::ExecuteCallback") - , mCallback(aCallback) + ExecuteCallback(nsPACManCallback *aCallback, + nsresult status) + : mCallback(aCallback) , mStatus(status) { } @@ -125,9 +125,8 @@ class ExecuteCallback final : public Runnable class ShutdownThread final : public Runnable { public: - explicit ShutdownThread(nsIThread* thread) - : Runnable("net::ShutdownThread") - , mThread(thread) + explicit ShutdownThread(nsIThread *thread) + : mThread(thread) { } @@ -147,9 +146,8 @@ class ShutdownThread final : public Runnable class WaitForThreadShutdown final : public Runnable { public: - explicit WaitForThreadShutdown(nsPACMan* aPACMan) - : Runnable("net::WaitForThreadShutdown") - , mPACMan(aPACMan) + explicit WaitForThreadShutdown(nsPACMan *aPACMan) + : mPACMan(aPACMan) { } @@ -176,9 +174,8 @@ class WaitForThreadShutdown final : public Runnable class PACLoadComplete final : public Runnable { public: - explicit PACLoadComplete(nsPACMan* aPACMan) - : Runnable("net::PACLoadComplete") - , mPACMan(aPACMan) + explicit PACLoadComplete(nsPACMan *aPACMan) + : mPACMan(aPACMan) { } @@ -204,9 +201,8 @@ class ExecutePACThreadAction final : public Runnable { public: // by default we just process the queue - explicit ExecutePACThreadAction(nsPACMan* aPACMan) - : Runnable("net::ExecutePACThreadAction") - , mPACMan(aPACMan) + explicit ExecutePACThreadAction(nsPACMan *aPACMan) + : mPACMan(aPACMan) , mCancel(false) , mCancelStatus(NS_OK) , mSetupPAC(false) @@ -270,12 +266,10 @@ class ExecutePACThreadAction final : public Runnable //----------------------------------------------------------------------------- -PendingPACQuery::PendingPACQuery(nsPACMan* pacMan, - nsIURI* uri, - nsPACManCallback* callback, +PendingPACQuery::PendingPACQuery(nsPACMan *pacMan, nsIURI *uri, + nsPACManCallback *callback, bool mainThreadResponse) - : Runnable("net::PendingPACQuery") - , mPACMan(pacMan) + : mPACMan(pacMan) , mCallback(callback) , mOnMainThreadOnly(mainThreadResponse) { @@ -439,8 +433,7 @@ nsPACMan::LoadPACFromURI(const nsCString &spec) if (!mLoadPending) { nsresult rv; - if (NS_FAILED(rv = NS_DispatchToCurrentThread(NewRunnableMethod("nsPACMan::StartLoading", - this, &nsPACMan::StartLoading)))) + if (NS_FAILED(rv = NS_DispatchToCurrentThread(NewRunnableMethod(this, &nsPACMan::StartLoading)))) return rv; mLoadPending = true; } diff --git a/netwerk/base/nsPreloadedStream.cpp b/netwerk/base/nsPreloadedStream.cpp index dd88e50cb3ec9..d203f550526ea 100644 --- a/netwerk/base/nsPreloadedStream.cpp +++ b/netwerk/base/nsPreloadedStream.cpp @@ -110,19 +110,17 @@ nsPreloadedStream::CloseWithStatus(nsresult aStatus) class RunOnThread : public Runnable { public: - RunOnThread(nsIAsyncInputStream* aStream, nsIInputStreamCallback* aCallback) - : Runnable("net::RunOnThread") - , mStream(aStream) - , mCallback(aCallback) - { - } - - virtual ~RunOnThread() {} - - NS_IMETHOD Run() override - { - mCallback->OnInputStreamReady(mStream); - return NS_OK; + RunOnThread(nsIAsyncInputStream *aStream, + nsIInputStreamCallback *aCallback) + : mStream(aStream), + mCallback(aCallback) {} + + virtual ~RunOnThread() {} + + NS_IMETHOD Run() override + { + mCallback->OnInputStreamReady(mStream); + return NS_OK; } private: diff --git a/netwerk/base/nsRequestObserverProxy.cpp b/netwerk/base/nsRequestObserverProxy.cpp index 939cb87c9e34e..9e95b356ba655 100644 --- a/netwerk/base/nsRequestObserverProxy.cpp +++ b/netwerk/base/nsRequestObserverProxy.cpp @@ -24,9 +24,8 @@ static LazyLogModule gRequestObserverProxyLog("nsRequestObserverProxy"); // nsARequestObserverEvent internal class... //----------------------------------------------------------------------------- -nsARequestObserverEvent::nsARequestObserverEvent(nsIRequest* request) - : Runnable("net::nsARequestObserverEvent") - , mRequest(request) +nsARequestObserverEvent::nsARequestObserverEvent(nsIRequest *request) + : mRequest(request) { NS_PRECONDITION(mRequest, "null pointer"); } diff --git a/netwerk/base/nsServerSocket.cpp b/netwerk/base/nsServerSocket.cpp index c64c19f2f16f1..3c9e12621c776 100644 --- a/netwerk/base/nsServerSocket.cpp +++ b/netwerk/base/nsServerSocket.cpp @@ -27,7 +27,7 @@ typedef void (nsServerSocket:: *nsServerSocketFunc)(void); static nsresult PostEvent(nsServerSocket *s, nsServerSocketFunc func) { - nsCOMPtr ev = NewRunnableMethod("net::PostEvent", s, func); + nsCOMPtr ev = NewRunnableMethod(s, func); if (!gSocketTransportService) return NS_ERROR_FAILURE; @@ -122,8 +122,8 @@ nsServerSocket::TryAttach() // if (!gSocketTransportService->CanAttachSocket()) { - nsCOMPtr event = NewRunnableMethod( - "net::nsServerSocket::OnMsgAttach", this, &nsServerSocket::OnMsgAttach); + nsCOMPtr event = + NewRunnableMethod(this, &nsServerSocket::OnMsgAttach); if (!event) return NS_ERROR_OUT_OF_MEMORY; @@ -434,12 +434,10 @@ class ServerSocketListenerProxy final : public nsIServerSocketListener class OnSocketAcceptedRunnable : public Runnable { public: - OnSocketAcceptedRunnable( - const nsMainThreadPtrHandle& aListener, - nsIServerSocket* aServ, - nsISocketTransport* aTransport) - : Runnable("net::ServerSocketListenerProxy::OnSocketAcceptedRunnable") - , mListener(aListener) + OnSocketAcceptedRunnable(const nsMainThreadPtrHandle& aListener, + nsIServerSocket* aServ, + nsISocketTransport* aTransport) + : mListener(aListener) , mServ(aServ) , mTransport(aTransport) { } @@ -455,12 +453,10 @@ class ServerSocketListenerProxy final : public nsIServerSocketListener class OnStopListeningRunnable : public Runnable { public: - OnStopListeningRunnable( - const nsMainThreadPtrHandle& aListener, - nsIServerSocket* aServ, - nsresult aStatus) - : Runnable("net::ServerSocketListenerProxy::OnStopListeningRunnable") - , mListener(aListener) + OnStopListeningRunnable(const nsMainThreadPtrHandle& aListener, + nsIServerSocket* aServ, + nsresult aStatus) + : mListener(aListener) , mServ(aServ) , mStatus(aStatus) { } diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp index 01deb4a74d3eb..88af2bceefd48 100644 --- a/netwerk/base/nsSocketTransport2.cpp +++ b/netwerk/base/nsSocketTransport2.cpp @@ -73,22 +73,18 @@ namespace net { class nsSocketEvent : public Runnable { public: - nsSocketEvent(nsSocketTransport* transport, - uint32_t type, - nsresult status = NS_OK, - nsISupports* param = nullptr) - : Runnable("net::nsSocketEvent") - , mTransport(transport) - , mType(type) - , mStatus(status) - , mParam(param) - { - } - - NS_IMETHOD Run() override - { - mTransport->OnSocketEvent(mType, mStatus, mParam); - return NS_OK; + nsSocketEvent(nsSocketTransport *transport, uint32_t type, + nsresult status = NS_OK, nsISupports *param = nullptr) + : mTransport(transport) + , mType(type) + , mStatus(status) + , mParam(param) + {} + + NS_IMETHOD Run() override + { + mTransport->OnSocketEvent(mType, mStatus, mParam); + return NS_OK; } private: @@ -1973,11 +1969,7 @@ nsSocketTransport::FastOpenInProgress() class ThunkPRClose : public Runnable { public: - explicit ThunkPRClose(PRFileDesc* fd) - : Runnable("net::ThunkPRClose") - , mFD(fd) - { - } + explicit ThunkPRClose(PRFileDesc *fd) : mFD(fd) {} NS_IMETHOD Run() override { diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 4ecccd6c25234..e458262097b3f 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -948,16 +948,12 @@ nsSocketTransportService::Run() mRawThread->HasPendingEvents(&pendingEvents); if (pendingEvents) { if (!mServingPendingQueue) { - nsresult rv = Dispatch( - NewRunnableMethod("net::nsSocketTransportService::" - "MarkTheLastElementOfPendingQueue", - this, - &nsSocketTransportService:: - MarkTheLastElementOfPendingQueue), - nsIEventTarget::DISPATCH_NORMAL); - if (NS_FAILED(rv)) { - NS_WARNING("Could not dispatch a new event on the " - "socket thread."); + nsresult rv = Dispatch(NewRunnableMethod(this, + &nsSocketTransportService::MarkTheLastElementOfPendingQueue), + nsIEventTarget::DISPATCH_NORMAL); + if (NS_FAILED(rv)) { + NS_WARNING("Could not dispatch a new event on the " + "socket thread."); } else { mServingPendingQueue = true; } @@ -1320,13 +1316,11 @@ nsSocketTransportService::OnKeepaliveEnabledPrefChange() { // Dispatch to socket thread if we're not executing there. if (!OnSocketThread()) { - gSocketTransportService->Dispatch( - NewRunnableMethod( - "net::nsSocketTransportService::OnKeepaliveEnabledPrefChange", - this, - &nsSocketTransportService::OnKeepaliveEnabledPrefChange), - NS_DISPATCH_NORMAL); - return; + gSocketTransportService->Dispatch( + NewRunnableMethod( + this, &nsSocketTransportService::OnKeepaliveEnabledPrefChange), + NS_DISPATCH_NORMAL); + return; } SOCKET_LOG(("nsSocketTransportService::OnKeepaliveEnabledPrefChange %s", @@ -1377,12 +1371,11 @@ nsSocketTransportService::Observe(nsISupports *subject, } if (!strcmp(topic, "last-pb-context-exited")) { - nsCOMPtr ev = NewRunnableMethod( - "net::nsSocketTransportService::ClosePrivateConnections", - this, - &nsSocketTransportService::ClosePrivateConnections); - nsresult rv = Dispatch(ev, nsIEventTarget::DISPATCH_NORMAL); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr ev = + NewRunnableMethod(this, + &nsSocketTransportService::ClosePrivateConnections); + nsresult rv = Dispatch(ev, nsIEventTarget::DISPATCH_NORMAL); + NS_ENSURE_SUCCESS(rv, rv); } if (!strcmp(topic, NS_TIMER_CALLBACK_TOPIC)) { @@ -1629,8 +1622,7 @@ nsSocketTransportService::StartPollWatchdog() // Start off the timer from a runnable off of the main thread in order to // avoid a deadlock, see bug 1370448. RefPtr self(this); - NS_DispatchToMainThread(NS_NewRunnableFunction("nsSocketTransportService::StartPollWatchdog", - [self] { + NS_DispatchToMainThread(NS_NewRunnableFunction([self] { MutexAutoLock lock(self->mLock); // Poll can hang sometimes. If we are in shutdown, we are going to start a diff --git a/netwerk/base/nsStreamTransportService.cpp b/netwerk/base/nsStreamTransportService.cpp index f19ae454a07e4..41e2784777d8a 100644 --- a/netwerk/base/nsStreamTransportService.cpp +++ b/netwerk/base/nsStreamTransportService.cpp @@ -575,18 +575,17 @@ nsStreamTransportService::Observe(nsISupports *subject, const char *topic, class AvailableEvent final : public Runnable { -public: - AvailableEvent(nsIInputStream* stream, - nsIInputAvailableCallback* callback) - : Runnable("net::AvailableEvent") - , mStream(stream) - , mCallback(callback) - , mDoingCallback(false) - , mSize(0) - , mResultForCallback(NS_OK) - { - mCallbackTarget = GetCurrentThreadEventTarget(); - } + public: + AvailableEvent(nsIInputStream *stream, + nsIInputAvailableCallback *callback) + : mStream(stream) + , mCallback(callback) + , mDoingCallback(false) + , mSize(0) + , mResultForCallback(NS_OK) + { + mCallbackTarget = GetCurrentThreadEventTarget(); + } NS_IMETHOD Run() override { diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp index cde4a24465208..4de0dbce75644 100644 --- a/netwerk/base/nsUDPSocket.cpp +++ b/netwerk/base/nsUDPSocket.cpp @@ -48,8 +48,7 @@ PostEvent(nsUDPSocket *s, nsUDPSocketFunc func) if (!gSocketTransportService) return NS_ERROR_FAILURE; - return gSocketTransportService->Dispatch( - NewRunnableMethod("net::PostEvent", s, func), NS_DISPATCH_NORMAL); + return gSocketTransportService->Dispatch(NewRunnableMethod(s, func), NS_DISPATCH_NORMAL); } static nsresult @@ -92,8 +91,7 @@ class SetSocketOptionRunnable : public Runnable { public: SetSocketOptionRunnable(nsUDPSocket* aSocket, const PRSocketOptionData& aOpt) - : Runnable("net::SetSocketOptionRunnable") - , mSocket(aSocket) + : mSocket(aSocket) , mOpt(aOpt) {} @@ -356,8 +354,8 @@ nsUDPSocket::TryAttach() // if (!gSocketTransportService->CanAttachSocket()) { - nsCOMPtr event = NewRunnableMethod( - "net::nsUDPSocket::OnMsgAttach", this, &nsUDPSocket::OnMsgAttach); + nsCOMPtr event = + NewRunnableMethod(this, &nsUDPSocket::OnMsgAttach); nsresult rv = gSocketTransportService->NotifyWhenCanAttachSocket(event); if (NS_FAILED(rv)) @@ -860,12 +858,10 @@ class SocketListenerProxy final : public nsIUDPSocketListener class OnPacketReceivedRunnable : public Runnable { public: - OnPacketReceivedRunnable( - const nsMainThreadPtrHandle& aListener, - nsIUDPSocket* aSocket, - nsIUDPMessage* aMessage) - : Runnable("net::SocketListenerProxy::OnPacketReceivedRunnable") - , mListener(aListener) + OnPacketReceivedRunnable(const nsMainThreadPtrHandle& aListener, + nsIUDPSocket* aSocket, + nsIUDPMessage* aMessage) + : mListener(aListener) , mSocket(aSocket) , mMessage(aMessage) { } @@ -881,12 +877,10 @@ class SocketListenerProxy final : public nsIUDPSocketListener class OnStopListeningRunnable : public Runnable { public: - OnStopListeningRunnable( - const nsMainThreadPtrHandle& aListener, - nsIUDPSocket* aSocket, - nsresult aStatus) - : Runnable("net::SocketListenerProxy::OnStopListeningRunnable") - , mListener(aListener) + OnStopListeningRunnable(const nsMainThreadPtrHandle& aListener, + nsIUDPSocket* aSocket, + nsresult aStatus) + : mListener(aListener) , mSocket(aSocket) , mStatus(aStatus) { } @@ -972,8 +966,7 @@ class SocketListenerProxyBackground final : public nsIUDPSocketListener OnPacketReceivedRunnable(const nsCOMPtr& aListener, nsIUDPSocket* aSocket, nsIUDPMessage* aMessage) - : Runnable("net::SocketListenerProxyBackground::OnPacketReceivedRunnable") - , mListener(aListener) + : mListener(aListener) , mSocket(aSocket) , mMessage(aMessage) { } @@ -992,8 +985,7 @@ class SocketListenerProxyBackground final : public nsIUDPSocketListener OnStopListeningRunnable(const nsCOMPtr& aListener, nsIUDPSocket* aSocket, nsresult aStatus) - : Runnable("net::SocketListenerProxyBackground::OnStopListeningRunnable") - , mListener(aListener) + : mListener(aListener) , mSocket(aSocket) , mStatus(aStatus) { } @@ -1149,11 +1141,10 @@ PendingSendStream::OnLookupComplete(nsICancelable *request, class SendRequestRunnable: public Runnable { public: - SendRequestRunnable(nsUDPSocket* aSocket, - const NetAddr& aAddr, + SendRequestRunnable(nsUDPSocket *aSocket, + const NetAddr &aAddr, FallibleTArray&& aData) - : Runnable("net::SendRequestRunnable") - , mSocket(aSocket) + : mSocket(aSocket) , mAddr(aAddr) , mData(Move(aData)) { } diff --git a/netwerk/cache/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp index 76d02e42dd9db..d78d1c214940b 100644 --- a/netwerk/cache/nsCacheEntryDescriptor.cpp +++ b/netwerk/cache/nsCacheEntryDescriptor.cpp @@ -28,7 +28,6 @@ class nsAsyncDoomEvent : public mozilla::Runnable { public: nsAsyncDoomEvent(nsCacheEntryDescriptor *descriptor, nsICacheListener *listener) - : mozilla::Runnable("nsAsyncDoomEvent") { mDescriptor = descriptor; mListener = listener; diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index 61155b0811ab0..4e251d4de56d0 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -226,35 +226,32 @@ NS_IMPL_ISUPPORTS(nsSetDiskSmartSizeCallback, nsITimerCallback) class nsSetSmartSizeEvent: public Runnable { public: - explicit nsSetSmartSizeEvent(int32_t smartSize) - : mozilla::Runnable("nsSetSmartSizeEvent") - , mSmartSize(smartSize) - { - } - - NS_IMETHOD Run() - { - NS_ASSERTION(NS_IsMainThread(), - "Setting smart size data off the main thread"); - - // Main thread may have already called nsCacheService::Shutdown - if (!nsCacheService::IsInitialized()) - return NS_ERROR_NOT_AVAILABLE; - - // Ensure smart sizing wasn't switched off while event was pending. - // It is safe to access the observer without the lock since we are - // on the main thread and the value changes only on the main thread. - if (!nsCacheService::gService->mObserver->SmartSizeEnabled()) - return NS_OK; - - nsCacheService::SetDiskCacheCapacity(mSmartSize); - - nsCOMPtr ps = do_GetService(NS_PREFSERVICE_CONTRACTID); - if (!ps || - NS_FAILED(ps->SetIntPref(DISK_CACHE_SMART_SIZE_PREF, mSmartSize))) - NS_WARNING("Failed to set smart size pref"); + explicit nsSetSmartSizeEvent(int32_t smartSize) + : mSmartSize(smartSize) {} - return NS_OK; + NS_IMETHOD Run() + { + NS_ASSERTION(NS_IsMainThread(), + "Setting smart size data off the main thread"); + + // Main thread may have already called nsCacheService::Shutdown + if (!nsCacheService::IsInitialized()) + return NS_ERROR_NOT_AVAILABLE; + + // Ensure smart sizing wasn't switched off while event was pending. + // It is safe to access the observer without the lock since we are + // on the main thread and the value changes only on the main thread. + if (!nsCacheService::gService->mObserver->SmartSizeEnabled()) + return NS_OK; + + nsCacheService::SetDiskCacheCapacity(mSmartSize); + + nsCOMPtr ps = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (!ps || + NS_FAILED(ps->SetIntPref(DISK_CACHE_SMART_SIZE_PREF, mSmartSize))) + NS_WARNING("Failed to set smart size pref"); + + return NS_OK; } private: @@ -266,25 +263,23 @@ class nsSetSmartSizeEvent: public Runnable class nsGetSmartSizeEvent: public Runnable { public: - nsGetSmartSizeEvent(const nsAString& cachePath, - uint32_t currentSize, - bool shouldUseOldMaxSmartSize) - : mozilla::Runnable("nsGetSmartSizeEvent") - , mCachePath(cachePath) - , mCurrentSize(currentSize) - , mShouldUseOldMaxSmartSize(shouldUseOldMaxSmartSize) - { - } - - // Calculates user's disk space available on a background thread and - // dispatches this value back to the main thread. - NS_IMETHOD Run() override - { - uint32_t size; - size = nsCacheProfilePrefObserver::GetSmartCacheSize( - mCachePath, mCurrentSize, mShouldUseOldMaxSmartSize); - NS_DispatchToMainThread(new nsSetSmartSizeEvent(size)); - return NS_OK; + nsGetSmartSizeEvent(const nsAString& cachePath, uint32_t currentSize, + bool shouldUseOldMaxSmartSize) + : mCachePath(cachePath) + , mCurrentSize(currentSize) + , mShouldUseOldMaxSmartSize(shouldUseOldMaxSmartSize) + {} + + // Calculates user's disk space available on a background thread and + // dispatches this value back to the main thread. + NS_IMETHOD Run() override + { + uint32_t size; + size = nsCacheProfilePrefObserver::GetSmartCacheSize(mCachePath, + mCurrentSize, + mShouldUseOldMaxSmartSize); + NS_DispatchToMainThread(new nsSetSmartSizeEvent(size)); + return NS_OK; } private: @@ -295,9 +290,8 @@ class nsGetSmartSizeEvent: public Runnable class nsBlockOnCacheThreadEvent : public Runnable { public: - nsBlockOnCacheThreadEvent() - : mozilla::Runnable("nsBlockOnCacheThreadEvent") - { + nsBlockOnCacheThreadEvent() + { } NS_IMETHOD Run() override { @@ -982,10 +976,9 @@ nsCacheProfilePrefObserver::CacheCompressionLevel() class nsProcessRequestEvent : public Runnable { public: - explicit nsProcessRequestEvent(nsCacheRequest* aRequest) - : mozilla::Runnable("nsProcessRequestEvent") - { - mRequest = aRequest; + explicit nsProcessRequestEvent(nsCacheRequest *aRequest) + { + mRequest = aRequest; } NS_IMETHOD Run() override @@ -1024,7 +1017,6 @@ class nsDoomEvent : public Runnable { nsDoomEvent(nsCacheSession *session, const nsACString &key, nsICacheListener *listener) - : mozilla::Runnable("nsDoomEvent") { mKey = *session->ClientID(); mKey.Append(':'); @@ -1341,13 +1333,11 @@ namespace { class EvictionNotifierRunnable : public Runnable { public: - explicit EvictionNotifierRunnable(nsISupports* aSubject) - : mozilla::Runnable("EvictionNotifierRunnable") - , mSubject(aSubject) - { - } + explicit EvictionNotifierRunnable(nsISupports* aSubject) + : mSubject(aSubject) + { } - NS_DECL_NSIRUNNABLE + NS_DECL_NSIRUNNABLE private: nsCOMPtr mSubject; @@ -1541,12 +1531,10 @@ nsresult nsCacheService::EvictEntriesInternal(nsCacheStoragePolicy storagePolicy { if (storagePolicy == nsICache::STORE_ANYWHERE) { // if not called on main thread, dispatch the notification to the main thread to notify observers - if (!NS_IsMainThread()) { - nsCOMPtr event = NewRunnableMethod( - "nsCacheService::FireClearNetworkCacheStoredAnywhereNotification", - this, - &nsCacheService::FireClearNetworkCacheStoredAnywhereNotification); - NS_DispatchToMainThread(event); + if (!NS_IsMainThread()) { + nsCOMPtr event = NewRunnableMethod(this, + &nsCacheService::FireClearNetworkCacheStoredAnywhereNotification); + NS_DispatchToMainThread(event); } else { // else you're already on main thread - notify observers FireClearNetworkCacheStoredAnywhereNotification(); @@ -1657,42 +1645,37 @@ nsCacheService::CreateDiskDevice() class nsDisableOldMaxSmartSizePrefEvent: public Runnable { public: - nsDisableOldMaxSmartSizePrefEvent() - : mozilla::Runnable("nsDisableOldMaxSmartSizePrefEvent") - { - } + nsDisableOldMaxSmartSizePrefEvent() {} - NS_IMETHOD Run() override - { - // Main thread may have already called nsCacheService::Shutdown - if (!nsCacheService::IsInitialized()) - return NS_ERROR_NOT_AVAILABLE; + NS_IMETHOD Run() override + { + // Main thread may have already called nsCacheService::Shutdown + if (!nsCacheService::IsInitialized()) + return NS_ERROR_NOT_AVAILABLE; - nsCOMPtr branch = do_GetService(NS_PREFSERVICE_CONTRACTID); - if (!branch) { - return NS_ERROR_NOT_AVAILABLE; - } + nsCOMPtr branch = do_GetService(NS_PREFSERVICE_CONTRACTID); + if (!branch) { + return NS_ERROR_NOT_AVAILABLE; + } - nsresult rv = - branch->SetBoolPref(DISK_CACHE_USE_OLD_MAX_SMART_SIZE_PREF, false); - if (NS_FAILED(rv)) { - NS_WARNING("Failed to disable old max smart size"); - return rv; - } + nsresult rv = branch->SetBoolPref(DISK_CACHE_USE_OLD_MAX_SMART_SIZE_PREF, false); + if (NS_FAILED(rv)) { + NS_WARNING("Failed to disable old max smart size"); + return rv; + } - // It is safe to call SetDiskSmartSize_Locked() without holding the lock - // when we are on main thread and nsCacheService is initialized. - nsCacheService::gService->SetDiskSmartSize_Locked(); + // It is safe to call SetDiskSmartSize_Locked() without holding the lock + // when we are on main thread and nsCacheService is initialized. + nsCacheService::gService->SetDiskSmartSize_Locked(); - if (nsCacheService::gService->mObserver->PermittedToSmartSize(branch, - false)) { - rv = branch->SetIntPref(DISK_CACHE_CAPACITY_PREF, MAX_CACHE_SIZE); - if (NS_FAILED(rv)) { - NS_WARNING("Failed to set cache capacity pref"); - } - } + if (nsCacheService::gService->mObserver->PermittedToSmartSize(branch, false)) { + rv = branch->SetIntPref(DISK_CACHE_CAPACITY_PREF, MAX_CACHE_SIZE); + if (NS_FAILED(rv)) { + NS_WARNING("Failed to set cache capacity pref"); + } + } - return NS_OK; + return NS_OK; } }; @@ -1873,25 +1856,23 @@ nsCacheService::CreateRequest(nsCacheSession * session, class nsCacheListenerEvent : public Runnable { public: - nsCacheListenerEvent(nsICacheListener* listener, - nsICacheEntryDescriptor* descriptor, - nsCacheAccessMode accessGranted, - nsresult status) - : mozilla::Runnable("nsCacheListenerEvent") - , mListener(listener) // transfers reference - , mDescriptor(descriptor) // transfers reference (may be null) - , mAccessGranted(accessGranted) - , mStatus(status) - { - } - - NS_IMETHOD Run() override - { - mListener->OnCacheEntryAvailable(mDescriptor, mAccessGranted, mStatus); - - NS_RELEASE(mListener); - NS_IF_RELEASE(mDescriptor); - return NS_OK; + nsCacheListenerEvent(nsICacheListener *listener, + nsICacheEntryDescriptor *descriptor, + nsCacheAccessMode accessGranted, + nsresult status) + : mListener(listener) // transfers reference + , mDescriptor(descriptor) // transfers reference (may be null) + , mAccessGranted(accessGranted) + , mStatus(status) + {} + + NS_IMETHOD Run() override + { + mListener->OnCacheEntryAvailable(mDescriptor, mAccessGranted, mStatus); + + NS_RELEASE(mListener); + NS_IF_RELEASE(mDescriptor); + return NS_OK; } private: diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h index c02c7b4d483ab..049a8ddb6b755 100644 --- a/netwerk/cache/nsCacheService.h +++ b/netwerk/cache/nsCacheService.h @@ -40,18 +40,17 @@ class mozIStorageService; class nsNotifyDoomListener : public mozilla::Runnable { public: - nsNotifyDoomListener(nsICacheListener* listener, nsresult status) - : mozilla::Runnable("nsNotifyDoomListener") - , mListener(listener) // transfers reference - , mStatus(status) - { - } - - NS_IMETHOD Run() override - { - mListener->OnCacheEntryDoomed(mStatus); - NS_RELEASE(mListener); - return NS_OK; + nsNotifyDoomListener(nsICacheListener *listener, + nsresult status) + : mListener(listener) // transfers reference + , mStatus(status) + {} + + NS_IMETHOD Run() override + { + mListener->OnCacheEntryDoomed(mStatus); + NS_RELEASE(mListener); + return NS_OK; } private: diff --git a/netwerk/cache/nsCacheUtils.cpp b/netwerk/cache/nsCacheUtils.cpp index 801eaf9900b62..7cb5622747c4c 100644 --- a/netwerk/cache/nsCacheUtils.cpp +++ b/netwerk/cache/nsCacheUtils.cpp @@ -12,9 +12,8 @@ using namespace mozilla; class nsDestroyThreadEvent : public Runnable { public: - explicit nsDestroyThreadEvent(nsIThread* thread) - : mozilla::Runnable("nsDestroyThreadEvent") - , mThread(thread) + explicit nsDestroyThreadEvent(nsIThread *thread) + : mThread(thread) {} NS_IMETHOD Run() override { @@ -25,9 +24,8 @@ class nsDestroyThreadEvent : public Runnable { nsCOMPtr mThread; }; -nsShutdownThread::nsShutdownThread(nsIThread* aThread) - : mozilla::Runnable("nsShutdownThread") - , mMonitor("nsShutdownThread.mMonitor") +nsShutdownThread::nsShutdownThread(nsIThread *aThread) + : mMonitor("nsShutdownThread.mMonitor") , mShuttingDown(false) , mThread(aThread) { diff --git a/netwerk/cache/nsDeleteDir.cpp b/netwerk/cache/nsDeleteDir.cpp index 0f9f3a6fa5b6c..1f3f3934e9700 100644 --- a/netwerk/cache/nsDeleteDir.cpp +++ b/netwerk/cache/nsDeleteDir.cpp @@ -21,10 +21,7 @@ using namespace mozilla; class nsBlockOnBackgroundThreadEvent : public Runnable { public: - nsBlockOnBackgroundThreadEvent() - : mozilla::Runnable("nsBlockOnBackgroundThreadEvent") - { - } + nsBlockOnBackgroundThreadEvent() {} NS_IMETHOD Run() override { MutexAutoLock lock(nsDeleteDir::gInstance->mLock); @@ -393,11 +390,8 @@ nsDeleteDir::PostTimer(void *arg, uint32_t delay) if (NS_FAILED(rv)) return rv; - rv = timer->InitWithNamedFuncCallback(TimerCallback, - arg, - delay, - nsITimer::TYPE_ONE_SHOT, - "nsDeleteDir::PostTimer"); + rv = timer->InitWithFuncCallback(TimerCallback, arg, delay, + nsITimer::TYPE_ONE_SHOT); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index 9cf285a95d78d..d0f18c91c867f 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -52,15 +52,14 @@ using namespace mozilla; class nsDiskCacheDeviceDeactivateEntryEvent : public Runnable { public: - nsDiskCacheDeviceDeactivateEntryEvent(nsDiskCacheDevice* device, - nsCacheEntry* entry, - nsDiskCacheBinding* binding) - : mozilla::Runnable("nsDiskCacheDeviceDeactivateEntryEvent") - , mCanceled(false) - , mEntry(entry) - , mDevice(device) - , mBinding(binding) - { + nsDiskCacheDeviceDeactivateEntryEvent(nsDiskCacheDevice *device, + nsCacheEntry * entry, + nsDiskCacheBinding * binding) + : mCanceled(false), + mEntry(entry), + mDevice(device), + mBinding(binding) + { } NS_IMETHOD Run() override @@ -83,17 +82,14 @@ class nsDiskCacheDeviceDeactivateEntryEvent : public Runnable { class nsEvictDiskCacheEntriesEvent : public Runnable { public: - explicit nsEvictDiskCacheEntriesEvent(nsDiskCacheDevice* device) - : mozilla::Runnable("nsEvictDiskCacheEntriesEvent") - , mDevice(device) - { - } + explicit nsEvictDiskCacheEntriesEvent(nsDiskCacheDevice *device) + : mDevice(device) {} - NS_IMETHOD Run() override - { - nsCacheServiceAutoLock lock; - mDevice->EvictDiskCacheEntries(mDevice->mCacheCapacity); - return NS_OK; + NS_IMETHOD Run() override + { + nsCacheServiceAutoLock lock; + mDevice->EvictDiskCacheEntries(mDevice->mCacheCapacity); + return NS_OK; } private: diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.cpp b/netwerk/cache/nsDiskCacheDeviceSQL.cpp index c72460086d650..a616682674dd7 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp +++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp @@ -299,11 +299,10 @@ nsOfflineCacheEvictionFunction::Apply() class nsOfflineCacheDiscardCache : public Runnable { public: - nsOfflineCacheDiscardCache(nsOfflineCacheDevice* device, - nsCString& group, - nsCString& clientID) - : mozilla::Runnable("nsOfflineCacheDiscardCache") - , mDevice(device) + nsOfflineCacheDiscardCache(nsOfflineCacheDevice *device, + nsCString &group, + nsCString &clientID) + : mDevice(device) , mGroup(group) , mClientID(clientID) { @@ -921,8 +920,7 @@ nsApplicationCache::GetUsage(uint32_t *usage) class nsCloseDBEvent : public Runnable { public: - explicit nsCloseDBEvent(mozIStorageConnection* aDB) - : mozilla::Runnable("nsCloseDBEvent") + explicit nsCloseDBEvent(mozIStorageConnection *aDB) { mDB = aDB; } diff --git a/netwerk/cache/nsDiskCacheMap.cpp b/netwerk/cache/nsDiskCacheMap.cpp index 7d38055637e57..d7ce13a35a742 100644 --- a/netwerk/cache/nsDiskCacheMap.cpp +++ b/netwerk/cache/nsDiskCacheMap.cpp @@ -1350,12 +1350,10 @@ nsresult nsDiskCacheMap::ResetCacheTimer(int32_t timeout) { mCleanCacheTimer->Cancel(); - nsresult rv = mCleanCacheTimer->InitWithNamedFuncCallback( - RevalidateTimerCallback, - nullptr, - timeout, - nsITimer::TYPE_ONE_SHOT, - "nsDiskCacheMap::ResetCacheTimer"); + nsresult rv = + mCleanCacheTimer->InitWithFuncCallback(RevalidateTimerCallback, + nullptr, timeout, + nsITimer::TYPE_ONE_SHOT); NS_ENSURE_SUCCESS(rv, rv); mLastInvalidateTime = PR_IntervalNow(); diff --git a/netwerk/cache2/CacheEntry.cpp b/netwerk/cache2/CacheEntry.cpp index 2bc7b468b7d43..fcfce09de099a 100644 --- a/netwerk/cache2/CacheEntry.cpp +++ b/netwerk/cache2/CacheEntry.cpp @@ -663,8 +663,7 @@ bool CacheEntry::InvokeCallbacks(bool aReadOnly) if (NS_SUCCEEDED(rv) && !onCheckThread) { // Redispatch to the target thread - rv = mCallbacks[i].mTarget->Dispatch(NewRunnableMethod("net::CacheEntry::InvokeCallbacksLock", - this, + rv = mCallbacks[i].mTarget->Dispatch(NewRunnableMethod(this, &CacheEntry::InvokeCallbacksLock), nsIEventTarget::DISPATCH_NORMAL); if (NS_SUCCEEDED(rv)) { @@ -1860,11 +1859,7 @@ void CacheEntry::BackgroundOp(uint32_t aOperations, bool aForceAsync) // Because CacheFile::Set*() are not thread-safe to use (uses WeakReference that // is not thread-safe) we must post to the main thread... - NS_DispatchToMainThread( - NewRunnableMethod("net::CacheEntry::StoreFrecency", - this, - &CacheEntry::StoreFrecency, - mFrecency)); + NS_DispatchToMainThread(NewRunnableMethod(this, &CacheEntry::StoreFrecency, mFrecency)); } if (aOperations & Ops::REGISTER) { @@ -1899,8 +1894,7 @@ void CacheEntry::StoreFrecency(double aFrecency) // CacheOutputCloseListener CacheOutputCloseListener::CacheOutputCloseListener(CacheEntry* aEntry) - : Runnable("net::CacheOutputCloseListener") - , mEntry(aEntry) +: mEntry(aEntry) { } diff --git a/netwerk/cache2/CacheEntry.h b/netwerk/cache2/CacheEntry.h index 044d544bdd9ba..d37cecdbb20f7 100644 --- a/netwerk/cache2/CacheEntry.h +++ b/netwerk/cache2/CacheEntry.h @@ -208,11 +208,7 @@ class CacheEntry final : public nsICacheEntry { public: DoomCallbackRunnable(CacheEntry* aEntry, nsresult aRv) - : Runnable("net::CacheEntry::DoomCallbackRunnable") - , mEntry(aEntry) - , mRv(aRv) - { - } + : mEntry(aEntry), mRv(aRv) {} private: NS_IMETHOD Run() override diff --git a/netwerk/cache2/CacheFile.cpp b/netwerk/cache2/CacheFile.cpp index 89f9a3a73b01e..42c6d3b3c68da 100644 --- a/netwerk/cache2/CacheFile.cpp +++ b/netwerk/cache2/CacheFile.cpp @@ -30,11 +30,10 @@ namespace net { class NotifyCacheFileListenerEvent : public Runnable { public: - NotifyCacheFileListenerEvent(CacheFileListener* aCallback, + NotifyCacheFileListenerEvent(CacheFileListener *aCallback, nsresult aResult, bool aIsNew) - : Runnable("net::NotifyCacheFileListenerEvent") - , mCallback(aCallback) + : mCallback(aCallback) , mRV(aResult) , mIsNew(aIsNew) { @@ -66,12 +65,11 @@ class NotifyCacheFileListenerEvent : public Runnable { class NotifyChunkListenerEvent : public Runnable { public: - NotifyChunkListenerEvent(CacheFileChunkListener* aCallback, + NotifyChunkListenerEvent(CacheFileChunkListener *aCallback, nsresult aResult, uint32_t aChunkIdx, - CacheFileChunk* aChunk) - : Runnable("net::NotifyChunkListenerEvent") - , mCallback(aCallback) + CacheFileChunk *aChunk) + : mCallback(aCallback) , mRV(aResult) , mChunkIdx(aChunkIdx) , mChunk(aChunk) diff --git a/netwerk/cache2/CacheFileChunk.cpp b/netwerk/cache2/CacheFileChunk.cpp index 1cc18d4e9b342..2803fccf5e514 100644 --- a/netwerk/cache2/CacheFileChunk.cpp +++ b/netwerk/cache2/CacheFileChunk.cpp @@ -246,10 +246,9 @@ CacheFileChunkWriteHandle::UpdateDataSize(uint32_t aOffset, uint32_t aLen) class NotifyUpdateListenerEvent : public Runnable { public: - NotifyUpdateListenerEvent(CacheFileChunkListener* aCallback, - CacheFileChunk* aChunk) - : Runnable("net::NotifyUpdateListenerEvent") - , mCallback(aCallback) + NotifyUpdateListenerEvent(CacheFileChunkListener *aCallback, + CacheFileChunk *aChunk) + : mCallback(aCallback) , mChunk(aChunk) { LOG(("NotifyUpdateListenerEvent::NotifyUpdateListenerEvent() [this=%p]", @@ -284,8 +283,7 @@ CacheFileChunk::DispatchRelease() return false; } - NS_DispatchToMainThread(NewNonOwningRunnableMethod( - "net::CacheFileChunk::Release", this, &CacheFileChunk::Release)); + NS_DispatchToMainThread(NewNonOwningRunnableMethod(this, &CacheFileChunk::Release)); return true; } diff --git a/netwerk/cache2/CacheFileContextEvictor.cpp b/netwerk/cache2/CacheFileContextEvictor.cpp index 4328d0bcd6bf4..51c87011a230e 100644 --- a/netwerk/cache2/CacheFileContextEvictor.cpp +++ b/netwerk/cache2/CacheFileContextEvictor.cpp @@ -523,9 +523,7 @@ CacheFileContextEvictor::StartEvicting() } nsCOMPtr ev; - ev = NewRunnableMethod("net::CacheFileContextEvictor::EvictEntries", - this, - &CacheFileContextEvictor::EvictEntries); + ev = NewRunnableMethod(this, &CacheFileContextEvictor::EvictEntries); RefPtr ioThread = CacheFileIOManager::IOThread(); diff --git a/netwerk/cache2/CacheFileIOManager.cpp b/netwerk/cache2/CacheFileIOManager.cpp index f56f5f1067de9..189dd86d73620 100644 --- a/netwerk/cache2/CacheFileIOManager.cpp +++ b/netwerk/cache2/CacheFileIOManager.cpp @@ -69,10 +69,10 @@ CacheFileHandle::DispatchRelease() return false; } - nsresult rv = ioTarget->Dispatch( - NewNonOwningRunnableMethod( - "net::CacheFileHandle::Release", this, &CacheFileHandle::Release), - nsIEventTarget::DISPATCH_NORMAL); + nsresult rv = + ioTarget->Dispatch(NewNonOwningRunnableMethod(this, + &CacheFileHandle::Release), + nsIEventTarget::DISPATCH_NORMAL); if (NS_FAILED(rv)) { return false; } @@ -545,8 +545,7 @@ CacheFileHandles::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const class ShutdownEvent : public Runnable { public: ShutdownEvent() - : Runnable("net::ShutdownEvent") - , mMonitor("ShutdownEvent.mMonitor") + : mMonitor("ShutdownEvent.mMonitor") , mNotified(false) { } @@ -597,11 +596,9 @@ class ShutdownEvent : public Runnable { class OpenFileEvent : public Runnable { public: - OpenFileEvent(const nsACString& aKey, - uint32_t aFlags, - CacheFileIOListener* aCallback) - : Runnable("net::OpenFileEvent") - , mFlags(aFlags) + OpenFileEvent(const nsACString &aKey, uint32_t aFlags, + CacheFileIOListener *aCallback) + : mFlags(aFlags) , mCallback(aCallback) , mKey(aKey) { @@ -657,13 +654,9 @@ class OpenFileEvent : public Runnable { class ReadEvent : public Runnable { public: - ReadEvent(CacheFileHandle* aHandle, - int64_t aOffset, - char* aBuf, - int32_t aCount, - CacheFileIOListener* aCallback) - : Runnable("net::ReadEvent") - , mHandle(aHandle) + ReadEvent(CacheFileHandle *aHandle, int64_t aOffset, char *aBuf, + int32_t aCount, CacheFileIOListener *aCallback) + : mHandle(aHandle) , mOffset(aOffset) , mBuf(aBuf) , mCount(aCount) @@ -702,15 +695,10 @@ class ReadEvent : public Runnable { class WriteEvent : public Runnable { public: - WriteEvent(CacheFileHandle* aHandle, - int64_t aOffset, - const char* aBuf, - int32_t aCount, - bool aValidate, - bool aTruncate, - CacheFileIOListener* aCallback) - : Runnable("net::WriteEvent") - , mHandle(aHandle) + WriteEvent(CacheFileHandle *aHandle, int64_t aOffset, const char *aBuf, + int32_t aCount, bool aValidate, bool aTruncate, + CacheFileIOListener *aCallback) + : mHandle(aHandle) , mOffset(aOffset) , mBuf(aBuf) , mCount(aCount) @@ -771,9 +759,9 @@ class WriteEvent : public Runnable { class DoomFileEvent : public Runnable { public: - DoomFileEvent(CacheFileHandle* aHandle, CacheFileIOListener* aCallback) - : Runnable("net::DoomFileEvent") - , mCallback(aCallback) + DoomFileEvent(CacheFileHandle *aHandle, + CacheFileIOListener *aCallback) + : mCallback(aCallback) , mHandle(aHandle) { } @@ -809,9 +797,9 @@ class DoomFileEvent : public Runnable { class DoomFileByKeyEvent : public Runnable { public: - DoomFileByKeyEvent(const nsACString& aKey, CacheFileIOListener* aCallback) - : Runnable("net::DoomFileByKeyEvent") - , mCallback(aCallback) + DoomFileByKeyEvent(const nsACString &aKey, + CacheFileIOListener *aCallback) + : mCallback(aCallback) { SHA1Sum sum; sum.update(aKey.BeginReading(), aKey.Length()); @@ -852,9 +840,8 @@ class DoomFileByKeyEvent : public Runnable { class ReleaseNSPRHandleEvent : public Runnable { public: - explicit ReleaseNSPRHandleEvent(CacheFileHandle* aHandle) - : Runnable("net::ReleaseNSPRHandleEvent") - , mHandle(aHandle) + explicit ReleaseNSPRHandleEvent(CacheFileHandle *aHandle) + : mHandle(aHandle) { } @@ -879,12 +866,9 @@ class ReleaseNSPRHandleEvent : public Runnable { class TruncateSeekSetEOFEvent : public Runnable { public: - TruncateSeekSetEOFEvent(CacheFileHandle* aHandle, - int64_t aTruncatePos, - int64_t aEOFPos, - CacheFileIOListener* aCallback) - : Runnable("net::TruncateSeekSetEOFEvent") - , mHandle(aHandle) + TruncateSeekSetEOFEvent(CacheFileHandle *aHandle, int64_t aTruncatePos, + int64_t aEOFPos, CacheFileIOListener *aCallback) + : mHandle(aHandle) , mTruncatePos(aTruncatePos) , mEOFPos(aEOFPos) , mCallback(aCallback) @@ -924,11 +908,9 @@ class TruncateSeekSetEOFEvent : public Runnable { class RenameFileEvent : public Runnable { public: - RenameFileEvent(CacheFileHandle* aHandle, - const nsACString& aNewName, - CacheFileIOListener* aCallback) - : Runnable("net::RenameFileEvent") - , mHandle(aHandle) + RenameFileEvent(CacheFileHandle *aHandle, const nsACString &aNewName, + CacheFileIOListener *aCallback) + : mHandle(aHandle) , mNewName(aNewName) , mCallback(aCallback) { @@ -966,12 +948,10 @@ class RenameFileEvent : public Runnable { class InitIndexEntryEvent : public Runnable { public: - InitIndexEntryEvent(CacheFileHandle* aHandle, - OriginAttrsHash aOriginAttrsHash, - bool aAnonymous, + InitIndexEntryEvent(CacheFileHandle *aHandle, + OriginAttrsHash aOriginAttrsHash, bool aAnonymous, bool aPinning) - : Runnable("net::InitIndexEntryEvent") - , mHandle(aHandle) + : mHandle(aHandle) , mOriginAttrsHash(aOriginAttrsHash) , mAnonymous(aAnonymous) , mPinning(aPinning) @@ -1013,14 +993,13 @@ class InitIndexEntryEvent : public Runnable { class UpdateIndexEntryEvent : public Runnable { public: - UpdateIndexEntryEvent(CacheFileHandle* aHandle, - const uint32_t* aFrecency, - const uint32_t* aExpirationTime, - const bool* aHasAltData, - const uint16_t* aOnStartTime, - const uint16_t* aOnStopTime) - : Runnable("net::UpdateIndexEntryEvent") - , mHandle(aHandle) + UpdateIndexEntryEvent(CacheFileHandle *aHandle, + const uint32_t *aFrecency, + const uint32_t *aExpirationTime, + const bool *aHasAltData, + const uint16_t *aOnStartTime, + const uint16_t *aOnStopTime) + : mHandle(aHandle) , mHasFrecency(false) , mHasExpirationTime(false) , mHasHasAltData(false) @@ -1099,11 +1078,10 @@ class MetadataWriteScheduleEvent : public Runnable RefPtr mFile; RefPtr mIOMan; - MetadataWriteScheduleEvent(CacheFileIOManager* aManager, - CacheFile* aFile, + MetadataWriteScheduleEvent(CacheFileIOManager * aManager, + CacheFile * aFile, EMode aMode) - : Runnable("net::MetadataWriteScheduleEvent") - , mMode(aMode) + : mMode(aMode) , mFile(aFile) , mIOMan(aManager) { } @@ -2743,9 +2721,8 @@ CacheFileIOManager::EvictIfOverLimit() } nsCOMPtr ev; - ev = NewRunnableMethod("net::CacheFileIOManager::EvictIfOverLimitInternal", - ioMan, - &CacheFileIOManager::EvictIfOverLimitInternal); + ev = NewRunnableMethod(ioMan, + &CacheFileIOManager::EvictIfOverLimitInternal); rv = ioMan->mIOThread->Dispatch(ev, CacheIOThread::EVICT); NS_ENSURE_SUCCESS(rv, rv); @@ -2808,9 +2785,8 @@ CacheFileIOManager::EvictIfOverLimitInternal() cacheUsage, cacheLimit)); nsCOMPtr ev; - ev = NewRunnableMethod("net::CacheFileIOManager::OverLimitEvictionInternal", - this, - &CacheFileIOManager::OverLimitEvictionInternal); + ev = NewRunnableMethod(this, + &CacheFileIOManager::OverLimitEvictionInternal); rv = mIOThread->Dispatch(ev, CacheIOThread::EVICT); NS_ENSURE_SUCCESS(rv, rv); @@ -2969,9 +2945,7 @@ CacheFileIOManager::EvictAll() } nsCOMPtr ev; - ev = NewRunnableMethod("net::CacheFileIOManager::EvictAllInternal", - ioMan, - &CacheFileIOManager::EvictAllInternal); + ev = NewRunnableMethod(ioMan, &CacheFileIOManager::EvictAllInternal); rv = ioMan->mIOThread->DispatchAfterPendingOpens(ev); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -2986,7 +2960,6 @@ namespace { class EvictionNotifierRunnable : public Runnable { public: - EvictionNotifierRunnable() : Runnable("EvictionNotifierRunnable") {} NS_DECL_NSIRUNNABLE }; @@ -3090,12 +3063,8 @@ CacheFileIOManager::EvictByContext(nsILoadContextInfo *aLoadContextInfo, bool aP } nsCOMPtr ev; - ev = NewRunnableMethod, bool>( - "net::CacheFileIOManager::EvictByContextInternal", - ioMan, - &CacheFileIOManager::EvictByContextInternal, - aLoadContextInfo, - aPinned); + ev = NewRunnableMethod, bool> + (ioMan, &CacheFileIOManager::EvictByContextInternal, aLoadContextInfo, aPinned); rv = ioMan->mIOThread->DispatchAfterPendingOpens(ev); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -3213,10 +3182,8 @@ CacheFileIOManager::CacheIndexStateChanged() // We have to re-distatch even if we are on IO thread to prevent reentering // the lock in CacheIndex nsCOMPtr ev; - ev = - NewRunnableMethod("net::CacheFileIOManager::CacheIndexStateChangedInternal", - gInstance.get(), - &CacheFileIOManager::CacheIndexStateChangedInternal); + ev = NewRunnableMethod( + gInstance.get(), &CacheFileIOManager::CacheIndexStateChangedInternal); nsCOMPtr ioTarget = IOTarget(); MOZ_ASSERT(ioTarget); @@ -3380,12 +3347,9 @@ CacheFileIOManager::StartRemovingTrash() rv = timer->SetTarget(ioTarget); NS_ENSURE_SUCCESS(rv, rv); - rv = timer->InitWithNamedFuncCallback( - CacheFileIOManager::OnTrashTimer, - nullptr, - kRemoveTrashStartDelay - elapsed, - nsITimer::TYPE_ONE_SHOT, - "net::CacheFileIOManager::StartRemovingTrash"); + rv = timer->InitWithFuncCallback(CacheFileIOManager::OnTrashTimer, nullptr, + kRemoveTrashStartDelay - elapsed, + nsITimer::TYPE_ONE_SHOT); NS_ENSURE_SUCCESS(rv, rv); mTrashTimer.swap(timer); @@ -3393,9 +3357,8 @@ CacheFileIOManager::StartRemovingTrash() } nsCOMPtr ev; - ev = NewRunnableMethod("net::CacheFileIOManager::RemoveTrashInternal", - this, - &CacheFileIOManager::RemoveTrashInternal); + ev = NewRunnableMethod(this, + &CacheFileIOManager::RemoveTrashInternal); rv = mIOThread->Dispatch(ev, CacheIOThread::EVICT); NS_ENSURE_SUCCESS(rv, rv); @@ -4256,10 +4219,9 @@ class SizeOfHandlesRunnable : public Runnable { public: SizeOfHandlesRunnable(mozilla::MallocSizeOf mallocSizeOf, - CacheFileHandles const& handles, - nsTArray const& specialHandles) - : Runnable("net::SizeOfHandlesRunnable") - , mMonitor("SizeOfHandlesRunnable.mMonitor") + CacheFileHandles const &handles, + nsTArray const &specialHandles) + : mMonitor("SizeOfHandlesRunnable.mMonitor") , mMallocSizeOf(mallocSizeOf) , mHandles(handles) , mSpecialHandles(specialHandles) diff --git a/netwerk/cache2/CacheIndex.cpp b/netwerk/cache2/CacheIndex.cpp index 7cbc5d6b4cd80..836c0be9cf366 100644 --- a/netwerk/cache2/CacheIndex.cpp +++ b/netwerk/cache2/CacheIndex.cpp @@ -367,9 +367,7 @@ CacheIndex::PreShutdown() } nsCOMPtr event; - event = NewRunnableMethod("net::CacheIndex::PreShutdownInternal", - index, - &CacheIndex::PreShutdownInternal); + event = NewRunnableMethod(index, &CacheIndex::PreShutdownInternal); nsCOMPtr ioTarget = CacheFileIOManager::IOTarget(); MOZ_ASSERT(ioTarget); @@ -1438,18 +1436,15 @@ CacheIndex::AsyncGetDiskConsumption(nsICacheStorageConsumptionObserver* aObserve // Move forward with index re/building if it is pending RefPtr ioThread = CacheFileIOManager::IOThread(); if (ioThread) { - ioThread->Dispatch( - NS_NewRunnableFunction("net::CacheIndex::AsyncGetDiskConsumption", - []() -> void { - StaticMutexAutoLock lock(sLock); + ioThread->Dispatch(NS_NewRunnableFunction([]() -> void { + StaticMutexAutoLock lock(sLock); - RefPtr index = gInstance; - if (index && index->mUpdateTimer) { - index->mUpdateTimer->Cancel(); - index->DelayedUpdateLocked(); - } - }), - CacheIOThread::INDEX); + RefPtr index = gInstance; + if (index && index->mUpdateTimer) { + index->mUpdateTimer->Cancel(); + index->DelayedUpdateLocked(); + } + }), CacheIOThread::INDEX); } return NS_OK; @@ -2661,11 +2656,8 @@ CacheIndex::ScheduleUpdateTimer(uint32_t aDelay) rv = timer->SetTarget(ioTarget); NS_ENSURE_SUCCESS(rv, rv); - rv = timer->InitWithNamedFuncCallback(CacheIndex::DelayedUpdate, - nullptr, - aDelay, - nsITimer::TYPE_ONE_SHOT, - "net::CacheIndex::ScheduleUpdateTimer"); + rv = timer->InitWithFuncCallback(CacheIndex::DelayedUpdate, nullptr, + aDelay, nsITimer::TYPE_ONE_SHOT); NS_ENSURE_SUCCESS(rv, rv); mUpdateTimer.swap(timer); diff --git a/netwerk/cache2/CacheIndex.h b/netwerk/cache2/CacheIndex.h index cfbf46cb681f6..bfd43efd11909 100644 --- a/netwerk/cache2/CacheIndex.h +++ b/netwerk/cache2/CacheIndex.h @@ -1205,11 +1205,8 @@ class CacheIndex : public CacheFileIOListener } private: - explicit DiskConsumptionObserver(nsWeakPtr const& aWeakObserver) - : Runnable("net::CacheIndex::DiskConsumptionObserver") - , mObserver(aWeakObserver) - { - } + explicit DiskConsumptionObserver(nsWeakPtr const &aWeakObserver) + : mObserver(aWeakObserver) { } virtual ~DiskConsumptionObserver() { if (mObserver && !NS_IsMainThread()) { NS_ReleaseOnMainThread( diff --git a/netwerk/cache2/CacheObserver.cpp b/netwerk/cache2/CacheObserver.cpp index 37c834a1e75d3..af03316dbf110 100644 --- a/netwerk/cache2/CacheObserver.cpp +++ b/netwerk/cache2/CacheObserver.cpp @@ -325,9 +325,7 @@ CacheObserver::SetDiskCacheCapacity(uint32_t aCapacity) sSelf->StoreDiskCacheCapacity(); } else { nsCOMPtr event = - NewRunnableMethod("net::CacheObserver::StoreDiskCacheCapacity", - sSelf, - &CacheObserver::StoreDiskCacheCapacity); + NewRunnableMethod(sSelf, &CacheObserver::StoreDiskCacheCapacity); NS_DispatchToMainThread(event); } } @@ -353,9 +351,7 @@ CacheObserver::SetCacheFSReported() sSelf->StoreCacheFSReported(); } else { nsCOMPtr event = - NewRunnableMethod("net::CacheObserver::StoreCacheFSReported", - sSelf, - &CacheObserver::StoreCacheFSReported); + NewRunnableMethod(sSelf, &CacheObserver::StoreCacheFSReported); NS_DispatchToMainThread(event); } } @@ -381,9 +377,7 @@ CacheObserver::SetHashStatsReported() sSelf->StoreHashStatsReported(); } else { nsCOMPtr event = - NewRunnableMethod("net::CacheObserver::StoreHashStatsReported", - sSelf, - &CacheObserver::StoreHashStatsReported); + NewRunnableMethod(sSelf, &CacheObserver::StoreHashStatsReported); NS_DispatchToMainThread(event); } } diff --git a/netwerk/cache2/CacheStorageService.cpp b/netwerk/cache2/CacheStorageService.cpp index 0d66ae5c3ddcc..bbc68f04562a0 100644 --- a/netwerk/cache2/CacheStorageService.cpp +++ b/netwerk/cache2/CacheStorageService.cpp @@ -147,9 +147,7 @@ void CacheStorageService::Shutdown() mShutdown = true; nsCOMPtr event = - NewRunnableMethod("net::CacheStorageService::ShutdownBackground", - this, - &CacheStorageService::ShutdownBackground); + NewRunnableMethod(this, &CacheStorageService::ShutdownBackground); Dispatch(event); #ifdef NS_FREE_PERMANENT_DATA @@ -197,9 +195,9 @@ class WalkCacheRunnable : public Runnable , public CacheStorageService::EntryInfoCallback { protected: - WalkCacheRunnable(nsICacheStorageVisitor* aVisitor, bool aVisitEntries) - : Runnable("net::WalkCacheRunnable") - , mService(CacheStorageService::Self()) + WalkCacheRunnable(nsICacheStorageVisitor* aVisitor, + bool aVisitEntries) + : mService(CacheStorageService::Self()) , mCallback(aVisitor) , mSize(0) , mNotifyStorage(true) @@ -392,8 +390,7 @@ class WalkDiskCacheRunnable : public WalkCacheRunnable { public: explicit OnCacheEntryInfoRunnable(WalkDiskCacheRunnable* aWalker) - : Runnable("net::WalkDiskCacheRunnable::OnCacheEntryInfoRunnable") - , mWalker(aWalker) + : mWalker(aWalker) { } @@ -575,9 +572,7 @@ class CleaupCacheDirectoriesRunnable : public Runnable private: CleaupCacheDirectoriesRunnable(uint32_t aVersion, uint32_t aActive) - : Runnable("net::CleaupCacheDirectoriesRunnable") - , mVersion(aVersion) - , mActive(aActive) + : mVersion(aVersion), mActive(aActive) { nsCacheService::GetDiskCacheDirectory(getter_AddRefs(mCache1Dir)); CacheFileIOManager::GetCacheDirectory(getter_AddRefs(mCache2Dir)); @@ -1270,9 +1265,7 @@ CacheStorageService::OnMemoryConsumptionChange(CacheMemoryConsumer* aConsumer, // Dispatch as a priority task, we want to set the purge timer // ASAP to prevent vain redispatch of this event. nsCOMPtr event = - NewRunnableMethod("net::CacheStorageService::SchedulePurgeOverMemoryLimit", - this, - &CacheStorageService::SchedulePurgeOverMemoryLimit); + NewRunnableMethod(this, &CacheStorageService::SchedulePurgeOverMemoryLimit); cacheIOTarget->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL); } @@ -1328,9 +1321,7 @@ CacheStorageService::Notify(nsITimer* aTimer) mPurgeTimer = nullptr; nsCOMPtr event = - NewRunnableMethod("net::CacheStorageService::PurgeOverMemoryLimit", - this, - &CacheStorageService::PurgeOverMemoryLimit); + NewRunnableMethod(this, &CacheStorageService::PurgeOverMemoryLimit); Dispatch(event); } @@ -1821,11 +1812,7 @@ CacheStorageService::DoomStorageEntry(CacheStorage const* aStorage, class Callback : public Runnable { public: - explicit Callback(nsICacheEntryDoomCallback* aCallback) - : mozilla::Runnable("Callback") - , mCallback(aCallback) - { - } + explicit Callback(nsICacheEntryDoomCallback* aCallback) : mCallback(aCallback) { } NS_IMETHOD Run() override { mCallback->OnCacheEntryDoomed(NS_ERROR_NOT_AVAILABLE); @@ -1949,11 +1936,7 @@ CacheStorageService::DoomStorageEntries(nsCSubstring const& aContextKey, class Callback : public Runnable { public: - explicit Callback(nsICacheEntryDoomCallback* aCallback) - : mozilla::Runnable("Callback") - , mCallback(aCallback) - { - } + explicit Callback(nsICacheEntryDoomCallback* aCallback) : mCallback(aCallback) { } NS_IMETHOD Run() override { mCallback->OnCacheEntryDoomed(NS_OK); diff --git a/netwerk/cache2/CacheStorageService.h b/netwerk/cache2/CacheStorageService.h index 67fbfc4d9f65c..5f3d60cc24eb1 100644 --- a/netwerk/cache2/CacheStorageService.h +++ b/netwerk/cache2/CacheStorageService.h @@ -365,11 +365,7 @@ class CacheStorageService final : public nsICacheStorageService { public: PurgeFromMemoryRunnable(CacheStorageService* aService, uint32_t aWhat) - : Runnable("net::CacheStorageService::PurgeFromMemoryRunnable") - , mService(aService) - , mWhat(aWhat) - { - } + : mService(aService), mWhat(aWhat) { } private: virtual ~PurgeFromMemoryRunnable() { } @@ -390,12 +386,7 @@ class CacheStorageService final : public nsICacheStorageService class IOThreadSuspender : public Runnable { public: - IOThreadSuspender() - : Runnable("net::CacheStorageService::IOThreadSuspender") - , mMon("IOThreadSuspender") - , mSignaled(false) - { - } + IOThreadSuspender() : mMon("IOThreadSuspender"), mSignaled(false) { } void Notify(); private: virtual ~IOThreadSuspender() { } diff --git a/netwerk/cache2/OldWrappers.cpp b/netwerk/cache2/OldWrappers.cpp index ecc1d22e99ffb..e33c23cc45ad4 100644 --- a/netwerk/cache2/OldWrappers.cpp +++ b/netwerk/cache2/OldWrappers.cpp @@ -40,9 +40,7 @@ namespace { class DoomCallbackSynchronizer : public Runnable { public: - explicit DoomCallbackSynchronizer(nsICacheEntryDoomCallback* cb) - : Runnable("net::DoomCallbackSynchronizer") - , mCB(cb) + explicit DoomCallbackSynchronizer(nsICacheEntryDoomCallback* cb) : mCB(cb) { } nsresult Dispatch(); @@ -304,8 +302,7 @@ NS_IMPL_ISUPPORTS_INHERITED(_OldGetDiskConsumption, _OldGetDiskConsumption::_OldGetDiskConsumption( nsICacheStorageConsumptionObserver* aCallback) - : Runnable("net::_OldGetDiskConsumption") - , mCallback(aCallback) + : mCallback(aCallback) , mSize(0) { } @@ -663,8 +660,7 @@ _OldCacheLoad::_OldCacheLoad(nsCSubstring const& aScheme, nsILoadContextInfo* aLoadInfo, bool aWriteToDisk, uint32_t aFlags) - : Runnable("net::_OldCacheLoad") - , mScheme(aScheme) + : mScheme(aScheme) , mCacheKey(aCacheKey) , mCallback(aCallback) , mLoadInfo(GetLoadContextInfo(aLoadInfo)) diff --git a/netwerk/dns/DNSRequestChild.cpp b/netwerk/dns/DNSRequestChild.cpp index 37d428c8502fa..e26078cdca591 100644 --- a/netwerk/dns/DNSRequestChild.cpp +++ b/netwerk/dns/DNSRequestChild.cpp @@ -165,8 +165,7 @@ class CancelDNSRequestEvent : public Runnable { public: CancelDNSRequestEvent(DNSRequestChild* aDnsReq, nsresult aReason) - : Runnable("net::CancelDNSRequestEvent") - , mDnsRequest(aDnsReq) + : mDnsRequest(aDnsReq) , mReasonForCancel(aReason) {} @@ -216,9 +215,7 @@ DNSRequestChild::StartRequest() SystemGroup::Dispatch( "StartDNSRequestChild", TaskCategory::Other, - NewRunnableMethod("net::DNSRequestChild::StartRequest", - this, - &DNSRequestChild::StartRequest)); + NewRunnableMethod(this, &DNSRequestChild::StartRequest)); return; } @@ -282,9 +279,7 @@ DNSRequestChild::RecvLookupCompleted(const DNSRequestResponse& reply) CallOnLookupComplete(); } else { nsCOMPtr event = - NewRunnableMethod("net::DNSRequestChild::CallOnLookupComplete", - this, - &DNSRequestChild::CallOnLookupComplete); + NewRunnableMethod(this, &DNSRequestChild::CallOnLookupComplete); mTarget->Dispatch(event, NS_DISPATCH_NORMAL); } diff --git a/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp b/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp index fd50ea5f943e4..f1779ec9cc890 100644 --- a/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp +++ b/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp @@ -75,8 +75,7 @@ class MDNSResponderOperator::ServiceWatcher final PR_Close(mFD); mFD = nullptr; - mThread->Dispatch(NewRunnableMethod("MDNSResponderOperator::ServiceWatcher::Deallocate", - this, &ServiceWatcher::Deallocate), + mThread->Dispatch(NewRunnableMethod(this, &ServiceWatcher::Deallocate), NS_DISPATCH_NORMAL); } @@ -126,8 +125,7 @@ class MDNSResponderOperator::ServiceWatcher final } mFD = PR_ImportFile(osfd); - return PostEvent("MDNSResponderOperator::ServiceWatcher::OnMsgAttach", - &ServiceWatcher::OnMsgAttach); + return PostEvent(&ServiceWatcher::OnMsgAttach); } void Close() @@ -139,8 +137,7 @@ class MDNSResponderOperator::ServiceWatcher final return; } - PostEvent("MDNSResponderOperator::ServiceWatcher::OnMsgClose", - &ServiceWatcher::OnMsgClose); + PostEvent(&ServiceWatcher::OnMsgClose); } private: @@ -155,10 +152,9 @@ class MDNSResponderOperator::ServiceWatcher final mOperatorHolder = nullptr; } - nsresult PostEvent(const char* aName, - void(ServiceWatcher::*func)(void)) + nsresult PostEvent(void(ServiceWatcher::*func)(void)) { - return gSocketTransportService->Dispatch(NewRunnableMethod(aName, this, func), + return gSocketTransportService->Dispatch(NewRunnableMethod(this, func), NS_DISPATCH_NORMAL); } @@ -223,8 +219,7 @@ class MDNSResponderOperator::ServiceWatcher final // if (!gSocketTransportService->CanAttachSocket()) { nsCOMPtr event = - NewRunnableMethod("MDNSResponderOperator::ServiceWatcher::OnMsgAttach", - this, &ServiceWatcher::OnMsgAttach); + NewRunnableMethod(this, &ServiceWatcher::OnMsgAttach); nsresult rv = gSocketTransportService->NotifyWhenCanAttachSocket(event); if (NS_FAILED(rv)) { diff --git a/netwerk/dns/mdns/libmdns/MDNSResponderReply.cpp b/netwerk/dns/mdns/libmdns/MDNSResponderReply.cpp index e887eba83cae3..5b008b05454cf 100644 --- a/netwerk/dns/mdns/libmdns/MDNSResponderReply.cpp +++ b/netwerk/dns/mdns/libmdns/MDNSResponderReply.cpp @@ -18,8 +18,7 @@ BrowseReplyRunnable::BrowseReplyRunnable(DNSServiceRef aSdRef, const nsACString& aRegType, const nsACString& aReplyDomain, BrowseOperator* aContext) - : Runnable("net::BrowseReplyRunnable") - , mSdRef(aSdRef) + : mSdRef(aSdRef) , mFlags(aFlags) , mInterfaceIndex(aInterfaceIndex) , mErrorCode(aErrorCode) @@ -84,8 +83,7 @@ RegisterReplyRunnable::RegisterReplyRunnable(DNSServiceRef aSdRef, const nsACString& aRegType, const nsACString& domain, RegisterOperator* aContext) - : Runnable("net::RegisterReplyRunnable") - , mSdRef(aSdRef) + : mSdRef(aSdRef) , mFlags(aFlags) , mErrorCode(aErrorCode) , mName(aName) @@ -150,8 +148,7 @@ ResolveReplyRunnable::ResolveReplyRunnable(DNSServiceRef aSdRef, uint16_t aTxtLen, const unsigned char* aTxtRecord, ResolveOperator* aContext) - : Runnable("net::ResolveReplyRunnable") - , mSdRef(aSdRef) + : mSdRef(aSdRef) , mFlags(aFlags) , mInterfaceIndex(aInterfaceIndex) , mErrorCode(aErrorCode) @@ -232,8 +229,7 @@ GetAddrInfoReplyRunnable::GetAddrInfoReplyRunnable(DNSServiceRef aSdRef, const mozilla::net::NetAddr& aAddress, uint32_t aTTL, GetAddrInfoOperator* aContext) - : Runnable("net::GetAddrInfoReplyRunnable") - , mSdRef(aSdRef) + : mSdRef(aSdRef) , mFlags(aFlags) , mInterfaceIndex(aInterfaceIndex) , mErrorCode(aErrorCode) diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index dd1b060a3f3ac..34a3c75b60184 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -453,10 +453,9 @@ nsDNSSyncRequest::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) const class NotifyDNSResolution: public Runnable { public: - explicit NotifyDNSResolution(const nsACString& aHostname) - : mozilla::Runnable("NotifyDNSResolution") - , mHostname(aHostname) - { + explicit NotifyDNSResolution(const nsACString &aHostname) + : mHostname(aHostname) + { } NS_IMETHOD Run() override diff --git a/netwerk/ipc/ChannelEventQueue.cpp b/netwerk/ipc/ChannelEventQueue.cpp index f099d44499cfa..471f88cb7a171 100644 --- a/netwerk/ipc/ChannelEventQueue.cpp +++ b/netwerk/ipc/ChannelEventQueue.cpp @@ -149,8 +149,7 @@ ChannelEventQueue::ResumeInternal() { public: explicit CompleteResumeRunnable(ChannelEventQueue* aQueue, nsISupports* aOwner) - : CancelableRunnable("CompleteResumeRunnable") - , mQueue(aQueue) + : mQueue(aQueue) , mOwner(aOwner) { } diff --git a/netwerk/protocol/about/nsAboutCache.cpp b/netwerk/protocol/about/nsAboutCache.cpp index 8a2857fd6000f..d85738c47796d 100644 --- a/netwerk/protocol/about/nsAboutCache.cpp +++ b/netwerk/protocol/about/nsAboutCache.cpp @@ -224,10 +224,7 @@ nsAboutCache::Channel::VisitNextStorage() // from visitor callback. The cache v1 service doesn't like it. // TODO - mayhemer, bug 913828, remove this dispatch and call // directly. - return NS_DispatchToMainThread( - mozilla::NewRunnableMethod("nsAboutCache::Channel::FireVisitStorage", - this, - &nsAboutCache::Channel::FireVisitStorage)); + return NS_DispatchToMainThread(mozilla::NewRunnableMethod(this, &nsAboutCache::Channel::FireVisitStorage)); } void diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp index 13fd3dc51147d..695aecde8e1d6 100644 --- a/netwerk/protocol/file/nsFileChannel.cpp +++ b/netwerk/protocol/file/nsFileChannel.cpp @@ -35,14 +35,12 @@ using namespace mozilla::net; class nsFileCopyEvent : public Runnable { public: - nsFileCopyEvent(nsIOutputStream* dest, nsIInputStream* source, int64_t len) - : mozilla::Runnable("nsFileCopyEvent") - , mDest(dest) + nsFileCopyEvent(nsIOutputStream *dest, nsIInputStream *source, int64_t len) + : mDest(dest) , mSource(source) , mLen(len) , mStatus(NS_OK) - , mInterruptStatus(NS_OK) - { + , mInterruptStatus(NS_OK) { } // Read the current status of the file copy operation. @@ -235,9 +233,7 @@ nsFileUploadContentStream::AsyncWait(nsIInputStreamCallback *callback, if (IsNonBlocking()) { nsCOMPtr callback = - NewRunnableMethod("nsFileUploadContentStream::OnCopyComplete", - this, - &nsFileUploadContentStream::OnCopyComplete); + NewRunnableMethod(this, &nsFileUploadContentStream::OnCopyComplete); mCopyEvent->Dispatch(callback, mSink, target); } diff --git a/netwerk/protocol/ftp/FTPChannelParent.cpp b/netwerk/protocol/ftp/FTPChannelParent.cpp index 1e89f16cd2898..cf3577bb15019 100644 --- a/netwerk/protocol/ftp/FTPChannelParent.cpp +++ b/netwerk/protocol/ftp/FTPChannelParent.cpp @@ -755,9 +755,7 @@ FTPChannelParent::DivertTo(nsIStreamListener *aListener) // Call OnStartRequest and SendDivertMessages asynchronously to avoid // reentering client context. NS_DispatchToCurrentThread( - NewRunnableMethod("net::FTPChannelParent::StartDiversion", - this, - &FTPChannelParent::StartDiversion)); + NewRunnableMethod(this, &FTPChannelParent::StartDiversion)); return; } @@ -802,11 +800,10 @@ FTPChannelParent::StartDiversion() class FTPFailDiversionEvent : public Runnable { public: - FTPFailDiversionEvent(FTPChannelParent* aChannelParent, + FTPFailDiversionEvent(FTPChannelParent *aChannelParent, nsresult aErrorCode, bool aSkipResume) - : Runnable("net::FTPFailDiversionEvent") - , mChannelParent(aChannelParent) + : mChannelParent(aChannelParent) , mErrorCode(aErrorCode) , mSkipResume(aSkipResume) { diff --git a/netwerk/protocol/ftp/nsFTPChannel.cpp b/netwerk/protocol/ftp/nsFTPChannel.cpp index 06bb3b567bd1e..b6c43f79af314 100644 --- a/netwerk/protocol/ftp/nsFTPChannel.cpp +++ b/netwerk/protocol/ftp/nsFTPChannel.cpp @@ -148,17 +148,15 @@ class FTPEventSinkProxy final : public nsIFTPEventSink class OnFTPControlLogRunnable : public Runnable { public: - OnFTPControlLogRunnable(nsIFTPEventSink* aTarget, - bool aServer, - const char* aMessage) - : mozilla::Runnable("FTPEventSinkProxy::OnFTPControlLogRunnable") - , mTarget(aTarget) - , mServer(aServer) - , mMessage(aMessage) - { - } - - NS_DECL_NSIRUNNABLE + OnFTPControlLogRunnable(nsIFTPEventSink* aTarget, + bool aServer, + const char* aMessage) + : mTarget(aTarget) + , mServer(aServer) + , mMessage(aMessage) + { } + + NS_DECL_NSIRUNNABLE private: nsCOMPtr mTarget; diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp index 79cde813624ba..ae3354881f622 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp @@ -1779,11 +1779,10 @@ nsFtpState::KillControlConnection() class nsFtpAsyncAlert : public Runnable { public: - nsFtpAsyncAlert(nsIPrompt* aPrompter, nsString aResponseMsg) - : mozilla::Runnable("nsFtpAsyncAlert") - , mPrompter(aPrompter) - , mResponseMsg(aResponseMsg) - { + nsFtpAsyncAlert(nsIPrompt *aPrompter, nsString aResponseMsg) + : mPrompter(aPrompter) + , mResponseMsg(aResponseMsg) + { } protected: virtual ~nsFtpAsyncAlert() diff --git a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp index 1e3831be22d20..2724e397bd1d2 100644 --- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp +++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp @@ -331,12 +331,10 @@ nsFtpProtocolHandler::InsertConnection(nsIURI *aKey, nsFtpControlConnection *aCo if (!ts) return NS_ERROR_OUT_OF_MEMORY; - rv = timer->InitWithNamedFuncCallback( - nsFtpProtocolHandler::Timeout, - ts, - mIdleTimeout * 1000, - nsITimer::TYPE_REPEATING_SLACK, - "nsFtpProtocolHandler::InsertConnection"); + rv = timer->InitWithFuncCallback(nsFtpProtocolHandler::Timeout, + ts, + mIdleTimeout*1000, + nsITimer::TYPE_REPEATING_SLACK); if (NS_FAILED(rv)) { delete ts; return rv; diff --git a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp index a1fce01b6bc51..d94fda4ca6437 100644 --- a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp +++ b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp @@ -543,10 +543,8 @@ nsGIOInputStream::DoRead(char *aBuf, uint32_t aCount, uint32_t *aCountRead) class nsGIOSetContentTypeEvent : public mozilla::Runnable { public: - nsGIOSetContentTypeEvent(nsIChannel* channel, const char* contentType) - : mozilla::Runnable("nsGIOSetContentTypeEvent") - , mChannel(channel) - , mContentType(contentType) + nsGIOSetContentTypeEvent(nsIChannel *channel, const char *contentType) + : mChannel(channel), mContentType(contentType) { // stash channel reference in mChannel. no AddRef here! see note // in SetContentTypeOfchannel. diff --git a/netwerk/protocol/http/AlternateServices.cpp b/netwerk/protocol/http/AlternateServices.cpp index 5c01969c3c34b..46accd4237417 100644 --- a/netwerk/protocol/http/AlternateServices.cpp +++ b/netwerk/protocol/http/AlternateServices.cpp @@ -270,8 +270,7 @@ AltSvcMapping::Sync() if (!NS_IsMainThread()) { nsCOMPtr r; - r = NewRunnableMethod("net::AltSvcMapping::SyncString", - this, + r = NewRunnableMethod(this, &AltSvcMapping::SyncString, value); NS_DispatchToMainThread(r, NS_DISPATCH_NORMAL); @@ -985,21 +984,18 @@ AltSvcCache::GetAltServiceMapping(const nsACString &scheme, const nsACString &ho class ProxyClearHostMapping : public Runnable { public: - explicit ProxyClearHostMapping(const nsACString& host, - int32_t port, - const OriginAttributes& originAttributes) - : Runnable("net::ProxyClearHostMapping") - , mHost(host) + explicit ProxyClearHostMapping(const nsACString &host, int32_t port, + const OriginAttributes &originAttributes) + : mHost(host) , mPort(port) , mOriginAttributes(originAttributes) - { - } + {} - NS_IMETHOD Run() override - { - MOZ_ASSERT(NS_IsMainThread()); - gHttpHandler->ConnMgr()->ClearHostMapping(mHost, mPort, mOriginAttributes); - return NS_OK; + NS_IMETHOD Run() override + { + MOZ_ASSERT(NS_IsMainThread()); + gHttpHandler->ConnMgr()->ClearHostMapping(mHost, mPort, mOriginAttributes); + return NS_OK; } private: nsCString mHost; diff --git a/netwerk/protocol/http/Http2Push.cpp b/netwerk/protocol/http/Http2Push.cpp index 34adc008ff6cf..2b1356ba8bb87 100644 --- a/netwerk/protocol/http/Http2Push.cpp +++ b/netwerk/protocol/http/Http2Push.cpp @@ -25,14 +25,13 @@ namespace net { class CallChannelOnPush final : public Runnable { public: - CallChannelOnPush(nsIHttpChannelInternal* associatedChannel, - const nsACString& pushedURI, - Http2PushedStream* pushStream) - : Runnable("net::CallChannelOnPush") - , mAssociatedChannel(associatedChannel) - , mPushedURI(pushedURI) - , mPushedStream(pushStream) - { + CallChannelOnPush(nsIHttpChannelInternal *associatedChannel, + const nsACString &pushedURI, + Http2PushedStream *pushStream) + : mAssociatedChannel(associatedChannel) + , mPushedURI(pushedURI) + , mPushedStream(pushStream) + { } NS_IMETHOD Run() override diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 2ee3a577a27bf..9ae4c31e3c239 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -2107,12 +2107,11 @@ Http2Session::RecvContinuation(Http2Session *self) class UpdateAltSvcEvent : public Runnable { public: - UpdateAltSvcEvent(const nsCString& header, - const nsCString& aOrigin, - nsHttpConnectionInfo* aCI, - nsIInterfaceRequestor* callbacks) - : Runnable("net::UpdateAltSvcEvent") - , mHeader(header) +UpdateAltSvcEvent(const nsCString &header, + const nsCString &aOrigin, + nsHttpConnectionInfo *aCI, + nsIInterfaceRequestor *callbacks) + : mHeader(header) , mOrigin(aOrigin) , mCI(aCI) , mCallbacks(callbacks) diff --git a/netwerk/protocol/http/HttpBackgroundChannelChild.cpp b/netwerk/protocol/http/HttpBackgroundChannelChild.cpp index 82b172870f85b..5adc316df39a9 100644 --- a/netwerk/protocol/http/HttpBackgroundChannelChild.cpp +++ b/netwerk/protocol/http/HttpBackgroundChannelChild.cpp @@ -205,19 +205,12 @@ HttpBackgroundChannelChild::RecvOnTransportAndData( LOG((" > pending until OnStartRequest [offset=%" PRIu64 " count=%" PRIu32 "]\n", aOffset, aCount)); - mQueuedRunnables.AppendElement(NewRunnableMethod( - "net::HttpBackgroundChannelChild::RecvOnTransportAndData", - this, - &HttpBackgroundChannelChild::RecvOnTransportAndData, - aChannelStatus, - aTransportStatus, - aOffset, - aCount, - aData)); + mQueuedRunnables.AppendElement( + NewRunnableMethod( + this, &HttpBackgroundChannelChild::RecvOnTransportAndData, + aChannelStatus, aTransportStatus, aOffset, + aCount, aData)); return IPC_OK(); } @@ -249,11 +242,8 @@ HttpBackgroundChannelChild::RecvOnStopRequest( mQueuedRunnables.AppendElement( NewRunnableMethod( - "net::HttpBackgroundChannelChild::RecvOnStopRequest", - this, - &HttpBackgroundChannelChild::RecvOnStopRequest, - aChannelStatus, - aTiming)); + this, &HttpBackgroundChannelChild::RecvOnStopRequest, + aChannelStatus, aTiming)); return IPC_OK(); } @@ -281,11 +271,8 @@ HttpBackgroundChannelChild::RecvOnProgress(const int64_t& aProgress, mQueuedRunnables.AppendElement( NewRunnableMethod( - "net::HttpBackgroundChannelChild::RecvOnProgress", - this, - &HttpBackgroundChannelChild::RecvOnProgress, - aProgress, - aProgressMax)); + this, &HttpBackgroundChannelChild::RecvOnProgress, + aProgress, aProgressMax)); return IPC_OK(); } @@ -310,11 +297,9 @@ HttpBackgroundChannelChild::RecvOnStatus(const nsresult& aStatus) LOG((" > pending until OnStartRequest [status=%" PRIx32 "]\n", static_cast(aStatus))); - mQueuedRunnables.AppendElement(NewRunnableMethod( - "net::HttpBackgroundChannelChild::RecvOnStatus", - this, - &HttpBackgroundChannelChild::RecvOnStatus, - aStatus)); + mQueuedRunnables.AppendElement( + NewRunnableMethod( + this, &HttpBackgroundChannelChild::RecvOnStatus, aStatus)); return IPC_OK(); } @@ -337,10 +322,8 @@ HttpBackgroundChannelChild::RecvFlushedForDiversion() if (IsWaitingOnStartRequest()) { LOG((" > pending until OnStartRequest\n")); - mQueuedRunnables.AppendElement(NewRunnableMethod( - "net::HttpBackgroundChannelChild::RecvFlushedForDiversion", - this, - &HttpBackgroundChannelChild::RecvFlushedForDiversion)); + mQueuedRunnables.AppendElement( + NewRunnableMethod(this, &HttpBackgroundChannelChild::RecvFlushedForDiversion)); return IPC_OK(); } @@ -364,9 +347,7 @@ HttpBackgroundChannelChild::RecvDivertMessages() LOG((" > pending until OnStartRequest\n")); mQueuedRunnables.AppendElement( - NewRunnableMethod("net::HttpBackgroundChannelChild::RecvDivertMessages", - this, - &HttpBackgroundChannelChild::RecvDivertMessages)); + NewRunnableMethod(this, &HttpBackgroundChannelChild::RecvDivertMessages)); return IPC_OK(); } @@ -439,8 +420,8 @@ HttpBackgroundChannelChild::ActorDestroy(ActorDestroyReason aWhy) if (!mQueuedRunnables.IsEmpty()) { LOG((" > pending until queued messages are flushed\n")); RefPtr self = this; - mQueuedRunnables.AppendElement(NS_NewRunnableFunction( - "net::HttpBackgroundChannelChild::ActorDestroy", [self]() { + mQueuedRunnables.AppendElement( + NS_NewRunnableFunction([self]() { MOZ_ASSERT(NS_IsMainThread()); RefPtr channelChild = self->mChannelChild.forget(); diff --git a/netwerk/protocol/http/HttpBackgroundChannelParent.cpp b/netwerk/protocol/http/HttpBackgroundChannelParent.cpp index 3dc3395f71e36..83167245e0c4b 100644 --- a/netwerk/protocol/http/HttpBackgroundChannelParent.cpp +++ b/netwerk/protocol/http/HttpBackgroundChannelParent.cpp @@ -37,8 +37,7 @@ class ContinueAsyncOpenRunnable final : public Runnable public: ContinueAsyncOpenRunnable(HttpBackgroundChannelParent* aActor, const uint64_t& aChannelId) - : Runnable("net::ContinueAsyncOpenRunnable") - , mActor(aActor) + : mActor(aActor) , mChannelId(aChannelId) { AssertIsInMainProcess(); @@ -123,21 +122,16 @@ HttpBackgroundChannelParent::OnChannelClosed() nsresult rv; RefPtr self = this; - rv = mBackgroundThread->Dispatch( - NS_NewRunnableFunction( - "net::HttpBackgroundChannelParent::OnChannelClosed", - [self]() { - LOG(("HttpBackgroundChannelParent::DeleteRunnable [this=%p]\n", - self.get())); - AssertIsOnBackgroundThread(); - - if (!self->mIPCOpened.compareExchange(true, false)) { - return; - } - - Unused << self->Send__delete__(self); - }), - NS_DISPATCH_NORMAL); + rv = mBackgroundThread->Dispatch(NS_NewRunnableFunction([self]() { + LOG(("HttpBackgroundChannelParent::DeleteRunnable [this=%p]\n", self.get())); + AssertIsOnBackgroundThread(); + + if (!self->mIPCOpened.compareExchange(true, false)) { + return; + } + + Unused << self->Send__delete__(self); + }), NS_DISPATCH_NORMAL); Unused << NS_WARN_IF(NS_FAILED(rv)); } @@ -154,9 +148,7 @@ HttpBackgroundChannelParent::OnStartRequestSent() if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod("net::HttpBackgroundChannelParent::OnStartRequestSent", - this, - &HttpBackgroundChannelParent::OnStartRequestSent), + NewRunnableMethod(this, &HttpBackgroundChannelParent::OnStartRequestSent), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -184,19 +176,10 @@ HttpBackgroundChannelParent::OnTransportAndData( if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod( - "net::HttpBackgroundChannelParent::OnTransportAndData", - this, - &HttpBackgroundChannelParent::OnTransportAndData, - aChannelStatus, - aTransportStatus, - aOffset, - aCount, - aData), + NewRunnableMethod + (this, &HttpBackgroundChannelParent::OnTransportAndData, + aChannelStatus, aTransportStatus, aOffset, aCount, aData), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -222,12 +205,9 @@ HttpBackgroundChannelParent::OnStopRequest(const nsresult& aChannelStatus, if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod( - "net::HttpBackgroundChannelParent::OnStopRequest", - this, - &HttpBackgroundChannelParent::OnStopRequest, - aChannelStatus, - aTiming), + NewRunnableMethod + (this, &HttpBackgroundChannelParent::OnStopRequest, + aChannelStatus, aTiming), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -252,12 +232,9 @@ HttpBackgroundChannelParent::OnProgress(const int64_t& aProgress, if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod( - "net::HttpBackgroundChannelParent::OnProgress", - this, - &HttpBackgroundChannelParent::OnProgress, - aProgress, - aProgressMax), + NewRunnableMethod + (this, &HttpBackgroundChannelParent::OnProgress, + aProgress, aProgressMax), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -281,11 +258,8 @@ HttpBackgroundChannelParent::OnStatus(const nsresult& aStatus) if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod( - "net::HttpBackgroundChannelParent::OnStatus", - this, - &HttpBackgroundChannelParent::OnStatus, - aStatus), + NewRunnableMethod + (this, &HttpBackgroundChannelParent::OnStatus, aStatus), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -308,9 +282,7 @@ HttpBackgroundChannelParent::OnDiversion() if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod("net::HttpBackgroundChannelParent::OnDiversion", - this, - &HttpBackgroundChannelParent::OnDiversion), + NewRunnableMethod(this, &HttpBackgroundChannelParent::OnDiversion), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -343,10 +315,7 @@ HttpBackgroundChannelParent::OnNotifyTrackingProtectionDisabled() if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod( - "net::HttpBackgroundChannelParent::OnNotifyTrackingProtectionDisabled", - this, - &HttpBackgroundChannelParent::OnNotifyTrackingProtectionDisabled), + NewRunnableMethod(this, &HttpBackgroundChannelParent::OnNotifyTrackingProtectionDisabled), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -369,10 +338,7 @@ HttpBackgroundChannelParent::OnNotifyTrackingResource() if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod( - "net::HttpBackgroundChannelParent::OnNotifyTrackingResource", - this, - &HttpBackgroundChannelParent::OnNotifyTrackingResource), + NewRunnableMethod(this, &HttpBackgroundChannelParent::OnNotifyTrackingResource), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -398,13 +364,9 @@ HttpBackgroundChannelParent::OnSetClassifierMatchedInfo( if (!IsOnBackgroundThread()) { nsresult rv = mBackgroundThread->Dispatch( - NewRunnableMethod( - "net::HttpBackgroundChannelParent::OnSetClassifierMatchedInfo", - this, - &HttpBackgroundChannelParent::OnSetClassifierMatchedInfo, - aList, - aProvider, - aPrefix), + NewRunnableMethod + (this, &HttpBackgroundChannelParent::OnSetClassifierMatchedInfo, + aList, aProvider, aPrefix), NS_DISPATCH_NORMAL); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); @@ -430,8 +392,8 @@ HttpBackgroundChannelParent::ActorDestroy(ActorDestroyReason aWhy) mIPCOpened = false; RefPtr self = this; - DebugOnly rv = NS_DispatchToMainThread(NS_NewRunnableFunction( - "net::HttpBackgroundChannelParent::ActorDestroy", [self]() { + DebugOnly rv = + NS_DispatchToMainThread(NS_NewRunnableFunction([self]() { MOZ_ASSERT(NS_IsMainThread()); RefPtr channelParent = diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index cf49784539817..746732acae244 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -916,10 +916,7 @@ HttpBaseChannel::OnCopyComplete(nsresult aStatus) MOZ_ASSERT(XRE_IsParentProcess()); nsCOMPtr runnable = NewRunnableMethod( - "net::HttpBaseChannel::EnsureUploadStreamIsCloneableComplete", - this, - &HttpBaseChannel::EnsureUploadStreamIsCloneableComplete, - aStatus); + this, &HttpBaseChannel::EnsureUploadStreamIsCloneableComplete, aStatus); NS_DispatchToMainThread(runnable.forget()); } diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h index 3bb119cc7b93c..1241a606e6258 100644 --- a/netwerk/protocol/http/HttpBaseChannel.h +++ b/netwerk/protocol/http/HttpBaseChannel.h @@ -724,8 +724,7 @@ nsresult HttpAsyncAborter::AsyncCall(void (T::*funcPtr)(), { nsresult rv; - RefPtr> event = - NewRunnableMethod("net::HttpAsyncAborter::AsyncCall", mThis, funcPtr); + RefPtr> event = NewRunnableMethod(mThis, funcPtr); rv = NS_DispatchToCurrentThread(event); if (NS_SUCCEEDED(rv) && retval) { *retval = event; diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index eabe4bf755b73..701984dc3f303 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -789,13 +789,12 @@ HttpChannelChild::OnTransportAndData(const nsresult& channelStatus, nsCOMPtr neckoTarget = GetNeckoTarget(); MOZ_ASSERT(neckoTarget); - DebugOnly rv = neckoTarget->Dispatch( - NS_NewRunnableFunction("net::HttpChannelChild::OnTransportAndData", - [self, transportStatus, progress, progressMax]() { - self->DoOnStatus(self, transportStatus); - self->DoOnProgress(self, progress, progressMax); - }), - NS_DISPATCH_NORMAL); + DebugOnly rv = + neckoTarget->Dispatch( + NS_NewRunnableFunction([self, transportStatus, progress, progressMax]() { + self->DoOnStatus(self, transportStatus); + self->DoOnProgress(self, progress, progressMax); + }), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); } @@ -988,9 +987,7 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus, MOZ_ASSERT(neckoTarget); DebugOnly rv = neckoTarget->Dispatch( - NewRunnableMethod( - "net::ChannelEventQueue::Resume", mEventQ, &ChannelEventQueue::Resume), - NS_DISPATCH_NORMAL); + NewRunnableMethod(mEventQ, &ChannelEventQueue::Resume), NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); return; } @@ -1304,9 +1301,7 @@ HttpChannelChild::CleanupBackgroundChannel() SystemGroup::Dispatch( "HttpChannelChild::CleanupBackgroundChannel", TaskCategory::Other, - NewRunnableMethod("net::HttpBackgroundChannelChild::OnChannelClosed", - bgChild, - &HttpBackgroundChannelChild::OnChannelClosed)); + NewRunnableMethod(bgChild, &HttpBackgroundChannelChild::OnChannelClosed)); } else { bgChild->OnChannelClosed(); } @@ -1339,13 +1334,11 @@ HttpChannelChild::RecvDeleteSelf() return IPC_OK(); } -HttpChannelChild::OverrideRunnable::OverrideRunnable( - HttpChannelChild* aChannel, - HttpChannelChild* aNewChannel, - InterceptStreamListener* aListener, - nsIInputStream* aInput, - nsAutoPtr& aHead) - : Runnable("net::HttpChannelChild::OverrideRunnable") +HttpChannelChild::OverrideRunnable::OverrideRunnable(HttpChannelChild* aChannel, + HttpChannelChild* aNewChannel, + InterceptStreamListener* aListener, + nsIInputStream* aInput, + nsAutoPtr& aHead) { mChannel = aChannel; mNewChannel = aNewChannel; @@ -1398,11 +1391,9 @@ HttpChannelChild::RecvFinishInterceptedRedirect() nsCOMPtr neckoTarget = GetNeckoTarget(); MOZ_ASSERT(neckoTarget); - Unused << neckoTarget->Dispatch( - NewRunnableMethod("net::HttpChannelChild::FinishInterceptedRedirect", - this, - &HttpChannelChild::FinishInterceptedRedirect), - NS_DISPATCH_NORMAL); + Unused << neckoTarget->Dispatch( + NewRunnableMethod(this, &HttpChannelChild::FinishInterceptedRedirect), + NS_DISPATCH_NORMAL); return IPC_OK(); } @@ -3232,11 +3223,10 @@ HttpChannelChild::TrySendDeletingChannel() nsCOMPtr neckoTarget = GetNeckoTarget(); MOZ_ASSERT(neckoTarget); - DebugOnly rv = neckoTarget->Dispatch( - NewNonOwningRunnableMethod("net::HttpChannelChild::TrySendDeletingChannel", - this, - &HttpChannelChild::TrySendDeletingChannel), - NS_DISPATCH_NORMAL); + DebugOnly rv = + neckoTarget->Dispatch( + NewNonOwningRunnableMethod(this, &HttpChannelChild::TrySendDeletingChannel), + NS_DISPATCH_NORMAL); MOZ_ASSERT(NS_SUCCEEDED(rv)); } @@ -3244,10 +3234,7 @@ void HttpChannelChild::OnCopyComplete(nsresult aStatus) { nsCOMPtr runnable = NewRunnableMethod( - "net::HttpBaseChannel::EnsureUploadStreamIsCloneableComplete", - this, - &HttpChannelChild::EnsureUploadStreamIsCloneableComplete, - aStatus); + this, &HttpChannelChild::EnsureUploadStreamIsCloneableComplete, aStatus); nsCOMPtr neckoTarget = GetNeckoTarget(); MOZ_ASSERT(neckoTarget); @@ -3261,7 +3248,7 @@ HttpChannelChild::AsyncCall(void (HttpChannelChild::*funcPtr)(), nsresult rv; RefPtr> event = - NewRunnableMethod("net::HttpChannelChild::AsyncCall", this, funcPtr); + NewRunnableMethod(this, funcPtr); nsCOMPtr neckoTarget = GetNeckoTarget(); MOZ_ASSERT(neckoTarget); diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 84858280455d2..c12e71ed047e2 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -392,9 +392,8 @@ class InvokeAsyncOpen : public Runnable public: InvokeAsyncOpen(const nsMainThreadPtrHandle& aChannel, nsresult aStatus) - : Runnable("net::InvokeAsyncOpen") - , mChannel(aChannel) - , mStatus(aStatus) + : mChannel(aChannel) + , mStatus(aStatus) { } @@ -1965,9 +1964,7 @@ HttpChannelParent::DivertTo(nsIStreamListener *aListener) // Call OnStartRequest and SendDivertMessages asynchronously to avoid // reentering client context. NS_DispatchToCurrentThread( - NewRunnableMethod("net::HttpChannelParent::StartDiversion", - this, - &HttpChannelParent::StartDiversion)); + NewRunnableMethod(this, &HttpChannelParent::StartDiversion)); return; } @@ -2031,8 +2028,7 @@ class HTTPFailDiversionEvent : public Runnable public: HTTPFailDiversionEvent(HttpChannelParent *aChannelParent, nsresult aErrorCode) - : Runnable("net::HTTPFailDiversionEvent") - , mChannelParent(aChannelParent) + : mChannelParent(aChannelParent) , mErrorCode(aErrorCode) { MOZ_RELEASE_ASSERT(aChannelParent); diff --git a/netwerk/protocol/http/HttpChannelParentListener.cpp b/netwerk/protocol/http/HttpChannelParentListener.cpp index a10dd94f7bfd2..e5170e38cb8c4 100644 --- a/netwerk/protocol/http/HttpChannelParentListener.cpp +++ b/netwerk/protocol/http/HttpChannelParentListener.cpp @@ -305,8 +305,7 @@ class FinishSynthesizedResponse : public Runnable nsCOMPtr mChannel; public: explicit FinishSynthesizedResponse(nsIInterceptedChannel* aChannel) - : Runnable("net::FinishSynthesizedResponse") - , mChannel(aChannel) + : mChannel(aChannel) { } diff --git a/netwerk/protocol/http/nsHttpActivityDistributor.cpp b/netwerk/protocol/http/nsHttpActivityDistributor.cpp index f0db7eb486043..42388f3a27a23 100644 --- a/netwerk/protocol/http/nsHttpActivityDistributor.cpp +++ b/netwerk/protocol/http/nsHttpActivityDistributor.cpp @@ -20,22 +20,21 @@ typedef nsTArray ObserverArray; class nsHttpActivityEvent : public Runnable { public: - nsHttpActivityEvent(nsISupports* aHttpChannel, - uint32_t aActivityType, - uint32_t aActivitySubtype, - PRTime aTimestamp, - uint64_t aExtraSizeData, - const nsACString& aExtraStringData, - ObserverArray* aObservers) - : Runnable("net::nsHttpActivityEvent") - , mHttpChannel(aHttpChannel) - , mActivityType(aActivityType) - , mActivitySubtype(aActivitySubtype) - , mTimestamp(aTimestamp) - , mExtraSizeData(aExtraSizeData) - , mExtraStringData(aExtraStringData) - , mObservers(*aObservers) - { + nsHttpActivityEvent(nsISupports *aHttpChannel, + uint32_t aActivityType, + uint32_t aActivitySubtype, + PRTime aTimestamp, + uint64_t aExtraSizeData, + const nsACString & aExtraStringData, + ObserverArray *aObservers) + : mHttpChannel(aHttpChannel) + , mActivityType(aActivityType) + , mActivitySubtype(aActivitySubtype) + , mTimestamp(aTimestamp) + , mExtraSizeData(aExtraSizeData) + , mExtraStringData(aExtraStringData) + , mObservers(*aObservers) + { } NS_IMETHOD Run() override diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 1f6bb6948edf0..bc8eee4bdcdb2 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -7453,17 +7453,16 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st class OnTransportStatusAsyncEvent : public Runnable { public: - OnTransportStatusAsyncEvent(nsITransportEventSink* aEventSink, - nsresult aTransportStatus, - int64_t aProgress, - int64_t aProgressMax) - : Runnable("net::OnTransportStatusAsyncEvent") - , mEventSink(aEventSink) + OnTransportStatusAsyncEvent(nsITransportEventSink* aEventSink, + nsresult aTransportStatus, + int64_t aProgress, + int64_t aProgressMax) + : mEventSink(aEventSink) , mTransportStatus(aTransportStatus) , mProgress(aProgress) , mProgressMax(aProgressMax) - { - MOZ_ASSERT(!NS_IsMainThread(), "Shouldn't be created on main thread"); + { + MOZ_ASSERT(!NS_IsMainThread(), "Shouldn't be created on main thread"); } NS_IMETHOD Run() override diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index 10d34f64edb30..e77fcd612167a 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -1390,43 +1390,40 @@ nsHttpConnection::PushBack(const char *data, uint32_t length) class HttpConnectionForceIO : public Runnable { public: - HttpConnectionForceIO(nsHttpConnection* aConn, - bool doRecv, + HttpConnectionForceIO(nsHttpConnection *aConn, bool doRecv, bool isFastOpenForce) - : Runnable("net::HttpConnectionForceIO") - , mConn(aConn) - , mDoRecv(doRecv) - , mIsFastOpenForce(isFastOpenForce) - { - } - - NS_IMETHOD Run() override - { - MOZ_ASSERT(OnSocketThread(), "not on socket thread"); + : mConn(aConn) + , mDoRecv(doRecv) + , mIsFastOpenForce(isFastOpenForce) + {} - if (mDoRecv) { - if (!mConn->mSocketIn) - return NS_OK; - return mConn->OnInputStreamReady(mConn->mSocketIn); - } + NS_IMETHOD Run() override + { + MOZ_ASSERT(OnSocketThread(), "not on socket thread"); - // This runnable will be called when the ForceIO timer expires - // (mIsFastOpenForce==false) or during the TCP Fast Open to force - // writes (mIsFastOpenForce==true). - if (mIsFastOpenForce && !mConn->mWaitingFor0RTTResponse) { - // If we have exit the TCP Fast Open in the meantime we can skip - // this. - return NS_OK; - } - if (!mIsFastOpenForce) { - MOZ_ASSERT(mConn->mForceSendPending); - mConn->mForceSendPending = false; - } + if (mDoRecv) { + if (!mConn->mSocketIn) + return NS_OK; + return mConn->OnInputStreamReady(mConn->mSocketIn); + } - if (!mConn->mSocketOut) { - return NS_OK; - } - return mConn->OnOutputStreamReady(mConn->mSocketOut); + // This runnable will be called when the ForceIO timer expires + // (mIsFastOpenForce==false) or during the TCP Fast Open to force + // writes (mIsFastOpenForce==true). + if (mIsFastOpenForce && !mConn->mWaitingFor0RTTResponse) { + // If we have exit the TCP Fast Open in the meantime we can skip + // this. + return NS_OK; + } + if (!mIsFastOpenForce) { + MOZ_ASSERT(mConn->mForceSendPending); + mConn->mForceSendPending = false; + } + + if (!mConn->mSocketOut) { + return NS_OK; + } + return mConn->OnOutputStreamReady(mConn->mSocketOut); } private: RefPtr mConn; @@ -1518,12 +1515,8 @@ nsHttpConnection::MaybeForceSendIO() MOZ_ASSERT(!mForceSendTimer); mForceSendPending = true; mForceSendTimer = do_CreateInstance("@mozilla.org/timer;1"); - return mForceSendTimer->InitWithNamedFuncCallback( - nsHttpConnection::ForceSendIO, - this, - kForceDelay, - nsITimer::TYPE_ONE_SHOT, - "net::nsHttpConnection::MaybeForceSendIO"); + return mForceSendTimer->InitWithFuncCallback( + nsHttpConnection::ForceSendIO, this, kForceDelay, nsITimer::TYPE_ONE_SHOT); } // trigger an asynchronous read @@ -2077,12 +2070,11 @@ nsHttpConnection::StartShortLivedTCPKeepalives() // Add time for final keepalive probes, and 2 seconds for a buffer. time += ((probeCount) * retryIntervalS) - (time % idleTimeS) + 2; } - mTCPKeepaliveTransitionTimer->InitWithNamedFuncCallback( - nsHttpConnection::UpdateTCPKeepalive, - this, - (uint32_t)time * 1000, - nsITimer::TYPE_ONE_SHOT, - "net::nsHttpConnection::StartShortLivedTCPKeepalives"); + mTCPKeepaliveTransitionTimer->InitWithFuncCallback( + nsHttpConnection::UpdateTCPKeepalive, + this, + (uint32_t)time*1000, + nsITimer::TYPE_ONE_SHOT); } else { NS_WARNING("nsHttpConnection::StartShortLivedTCPKeepalives failed to " "create timer."); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 8076cf8f29140..2baf816d0cf3f 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -250,22 +250,17 @@ nsHttpConnectionMgr::Shutdown() class ConnEvent : public Runnable { public: - ConnEvent(nsHttpConnectionMgr* mgr, - nsConnEventHandler handler, - int32_t iparam, - ARefBase* vparam) - : Runnable("net::ConnEvent") - , mMgr(mgr) - , mHandler(handler) - , mIParam(iparam) - , mVParam(vparam) - { - } - - NS_IMETHOD Run() override - { - (mMgr->*mHandler)(mIParam, mVParam); - return NS_OK; + ConnEvent(nsHttpConnectionMgr *mgr, + nsConnEventHandler handler, int32_t iparam, ARefBase *vparam) + : mMgr(mgr) + , mHandler(handler) + , mIParam(iparam) + , mVParam(vparam) {} + + NS_IMETHOD Run() override + { + (mMgr->*mHandler)(mIParam, mVParam); + return NS_OK; } private: diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 093fc1da637ae..05ebfa1f5e129 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -2309,11 +2309,10 @@ nsHttpHandler::Observe(nsISupports *subject, } else if (!strcmp(topic, "browser:purge-session-history")) { if (mConnMgr) { if (gSocketTransportService) { - nsCOMPtr event = NewRunnableMethod( - "net::nsHttpConnectionMgr::ClearConnectionHistory", - mConnMgr, - &nsHttpConnectionMgr::ClearConnectionHistory); - gSocketTransportService->Dispatch(event, NS_DISPATCH_NORMAL); + nsCOMPtr event = + NewRunnableMethod(mConnMgr, + &nsHttpConnectionMgr::ClearConnectionHistory); + gSocketTransportService->Dispatch(event, NS_DISPATCH_NORMAL); } mConnMgr->ClearAltServiceMappings(); } diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 8d169e5341439..c214d553d5817 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -2068,16 +2068,14 @@ nsHttpTransaction::GetResponseEnd() class DeleteHttpTransaction : public Runnable { public: - explicit DeleteHttpTransaction(nsHttpTransaction* trans) - : Runnable("net::DeleteHttpTransaction") - , mTrans(trans) - { - } + explicit DeleteHttpTransaction(nsHttpTransaction *trans) + : mTrans(trans) + {} - NS_IMETHOD Run() override - { - delete mTrans; - return NS_OK; + NS_IMETHOD Run() override + { + delete mTrans; + return NS_OK; } private: nsHttpTransaction *mTrans; diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index d795eef613742..395ae4fd56400 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -233,11 +233,7 @@ class nsHttpTransaction final : public nsAHttpTransaction public: UpdateSecurityCallbacks(nsHttpTransaction* aTrans, nsIInterfaceRequestor* aCallbacks) - : Runnable("net::nsHttpTransaction::UpdateSecurityCallbacks") - , mTrans(aTrans) - , mCallbacks(aCallbacks) - { - } + : mTrans(aTrans), mCallbacks(aCallbacks) {} NS_IMETHOD Run() override { diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 24798d66bff3f..5f6043225a535 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -709,13 +709,11 @@ NS_IMPL_ISUPPORTS(CallOnServerClose, nsIRunnable) class CallAcknowledge final : public CancelableRunnable { public: - CallAcknowledge(WebSocketChannel* aChannel, uint32_t aSize) - : CancelableRunnable("net::CallAcknowledge") - , mChannel(aChannel) - , mListenerMT(mChannel->mListenerMT) - , mSize(aSize) - { - } + CallAcknowledge(WebSocketChannel* aChannel, + uint32_t aSize) + : mChannel(aChannel), + mListenerMT(mChannel->mListenerMT), + mSize(aSize) {} NS_IMETHOD Run() override { @@ -1265,9 +1263,7 @@ WebSocketChannel::Observe(nsISupports *subject, // Next we check mDataStarted, which we need to do on mTargetThread. if (!IsOnTargetThread()) { mTargetThread->Dispatch( - NewRunnableMethod("net::WebSocketChannel::OnNetworkChanged", - this, - &WebSocketChannel::OnNetworkChanged), + NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), NS_DISPATCH_NORMAL); } else { nsresult rv = OnNetworkChanged(); @@ -1295,9 +1291,7 @@ WebSocketChannel::OnNetworkChanged() } return mSocketThread->Dispatch( - NewRunnableMethod("net::WebSocketChannel::OnNetworkChanged", - this, - &WebSocketChannel::OnNetworkChanged), + NewRunnableMethod(this, &WebSocketChannel::OnNetworkChanged), NS_DISPATCH_NORMAL); } @@ -1384,10 +1378,8 @@ WebSocketChannel::BeginOpen(bool aCalledFromAdmissionManager) // When called from nsWSAdmissionManager post an event to avoid potential // re-entering of nsWSAdmissionManager and its lock. NS_DispatchToMainThread( - NewRunnableMethod("net::WebSocketChannel::BeginOpenInternal", - this, - &WebSocketChannel::BeginOpenInternal), - NS_DISPATCH_NORMAL); + NewRunnableMethod(this, &WebSocketChannel::BeginOpenInternal), + NS_DISPATCH_NORMAL); } else { BeginOpenInternal(); } @@ -2304,8 +2296,7 @@ class RemoveObserverRunnable : public Runnable public: explicit RemoveObserverRunnable(WebSocketChannel* aChannel) - : Runnable("net::RemoveObserverRunnable") - , mChannel(aChannel) + : mChannel(aChannel) {} NS_IMETHOD Run() override @@ -2949,9 +2940,7 @@ WebSocketChannel::StartWebsocketData() if (!IsOnTargetThread()) { return mTargetThread->Dispatch( - NewRunnableMethod("net::WebSocketChannel::StartWebsocketData", - this, - &WebSocketChannel::StartWebsocketData), + NewRunnableMethod(this, &WebSocketChannel::StartWebsocketData), NS_DISPATCH_NORMAL); } @@ -2964,8 +2953,7 @@ WebSocketChannel::StartWebsocketData() LOG(("WebSocketChannel::StartWebsocketData mSocketIn->AsyncWait() failed " "with error 0x%08" PRIx32, static_cast(rv))); return mSocketThread->Dispatch( - NewRunnableMethod("net::WebSocketChannel::AbortSession", - this, + NewRunnableMethod(this, &WebSocketChannel::AbortSession, rv), NS_DISPATCH_NORMAL); @@ -2973,9 +2961,7 @@ WebSocketChannel::StartWebsocketData() if (mPingInterval) { rv = mSocketThread->Dispatch( - NewRunnableMethod("net::WebSocketChannel::StartPinging", - this, - &WebSocketChannel::StartPinging), + NewRunnableMethod(this, &WebSocketChannel::StartPinging), NS_DISPATCH_NORMAL); if (NS_FAILED(rv)) { LOG(("WebSocketChannel::StartWebsocketData Could not start pinging, " diff --git a/netwerk/protocol/websocket/WebSocketChannelChild.cpp b/netwerk/protocol/websocket/WebSocketChannelChild.cpp index b037af9218dd7..127325e3b2c94 100644 --- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp @@ -111,8 +111,7 @@ WebSocketChannelChild::MaybeReleaseIPCObject() if (!NS_IsMainThread()) { nsCOMPtr target = GetNeckoTarget(); MOZ_ALWAYS_SUCCEEDS( - target->Dispatch(NewRunnableMethod("WebSocketChannelChild::MaybeReleaseIPCObject", - this, + target->Dispatch(NewRunnableMethod(this, &WebSocketChannelChild::MaybeReleaseIPCObject), NS_DISPATCH_NORMAL)); return; @@ -136,9 +135,8 @@ WebSocketChannelChild::IsEncrypted() const class WrappedChannelEvent : public Runnable { public: - explicit WrappedChannelEvent(ChannelEvent* aChannelEvent) - : Runnable("net::WrappedChannelEvent") - , mChannelEvent(aChannelEvent) + explicit WrappedChannelEvent(ChannelEvent *aChannelEvent) + : mChannelEvent(aChannelEvent) { MOZ_RELEASE_ASSERT(aChannelEvent); } @@ -600,11 +598,10 @@ WebSocketChannelChild::AsyncOpen(nsIURI *aURI, class CloseEvent : public Runnable { public: - CloseEvent(WebSocketChannelChild* aChild, + CloseEvent(WebSocketChannelChild *aChild, uint16_t aCode, const nsACString& aReason) - : Runnable("net::CloseEvent") - , mChild(aChild) + : mChild(aChild) , mCode(aCode) , mReason(aReason) { @@ -651,11 +648,10 @@ WebSocketChannelChild::Close(uint16_t code, const nsACString & reason) class MsgEvent : public Runnable { public: - MsgEvent(WebSocketChannelChild* aChild, - const nsACString& aMsg, + MsgEvent(WebSocketChannelChild *aChild, + const nsACString &aMsg, bool aBinaryMsg) - : Runnable("net::MsgEvent") - , mChild(aChild) + : mChild(aChild) , mMsg(aMsg) , mBinaryMsg(aBinaryMsg) { @@ -731,11 +727,10 @@ WebSocketChannelChild::SendBinaryMsg(const nsACString &aMsg) class BinaryStreamEvent : public Runnable { public: - BinaryStreamEvent(WebSocketChannelChild* aChild, + BinaryStreamEvent(WebSocketChannelChild *aChild, nsIInputStream* aStream, uint32_t aLength) - : Runnable("net::BinaryStreamEvent") - , mChild(aChild) + : mChild(aChild) , mStream(aStream) , mLength(aLength) { diff --git a/netwerk/protocol/websocket/WebSocketEventService.cpp b/netwerk/protocol/websocket/WebSocketEventService.cpp index 963dba28cb791..ffa6e52d01826 100644 --- a/netwerk/protocol/websocket/WebSocketEventService.cpp +++ b/netwerk/protocol/websocket/WebSocketEventService.cpp @@ -35,9 +35,9 @@ IsChildProcess() class WebSocketBaseRunnable : public Runnable { public: - WebSocketBaseRunnable(uint32_t aWebSocketSerialID, uint64_t aInnerWindowID) - : Runnable("net::WebSocketBaseRunnable") - , mWebSocketSerialID(aWebSocketSerialID) + WebSocketBaseRunnable(uint32_t aWebSocketSerialID, + uint64_t aInnerWindowID) + : mWebSocketSerialID(aWebSocketSerialID) , mInnerWindowID(aInnerWindowID) {} diff --git a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp index c6551af163416..7ec3d376f77a5 100644 --- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp +++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp @@ -601,10 +601,8 @@ nsWyciwygChannel::OnCacheEntryAvailable(nsICacheEntry *aCacheEntry, LOG(("channel was canceled [this=%p status=%" PRIx32 "]\n", this, static_cast(mStatus))); // Since OnCacheEntryAvailable can be called directly from AsyncOpen // we must dispatch. - NS_DispatchToCurrentThread( - mozilla::NewRunnableMethod("nsWyciwygChannel::NotifyListener", - this, - &nsWyciwygChannel::NotifyListener)); + NS_DispatchToCurrentThread(mozilla::NewRunnableMethod( + this, &nsWyciwygChannel::NotifyListener)); } return NS_OK; diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index 7d542cc4f530c..efd20a14bcc8c 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -2301,13 +2301,11 @@ DataChannelConnection::SendBinary(DataChannel *channel, const char *data, class ReadBlobRunnable : public Runnable { public: - ReadBlobRunnable(DataChannelConnection* aConnection, - uint16_t aStream, - nsIInputStream* aBlob) - : Runnable("ReadBlobRunnable") - , mConnection(aConnection) - , mStream(aStream) - , mBlob(aBlob) + ReadBlobRunnable(DataChannelConnection* aConnection, uint16_t aStream, + nsIInputStream* aBlob) : + mConnection(aConnection), + mStream(aStream), + mBlob(aBlob) {} NS_IMETHOD Run() override { @@ -2350,14 +2348,10 @@ DataChannelConnection::SendBlob(uint16_t stream, nsIInputStream *aBlob) class DataChannelBlobSendRunnable : public Runnable { public: - DataChannelBlobSendRunnable( - already_AddRefed& aConnection, - uint16_t aStream) - : Runnable("DataChannelBlobSendRunnable") - , mConnection(aConnection) - , mStream(aStream) - { - } + DataChannelBlobSendRunnable(already_AddRefed& aConnection, + uint16_t aStream) + : mConnection(aConnection) + , mStream(aStream) {} ~DataChannelBlobSendRunnable() override { diff --git a/netwerk/sctp/datachannel/DataChannel.h b/netwerk/sctp/datachannel/DataChannel.h index e3616f2b30f00..fec16b4060b3d 100644 --- a/netwerk/sctp/datachannel/DataChannel.h +++ b/netwerk/sctp/datachannel/DataChannel.h @@ -467,49 +467,37 @@ class DataChannelOnMessageAvailable : public Runnable NO_LONGER_BUFFERED, }; /* types */ - DataChannelOnMessageAvailable( - int32_t aType, - DataChannelConnection* aConnection, - DataChannel* aChannel, - nsCString& aData, // XXX this causes inefficiency - int32_t aLen) - : Runnable("DataChannelOnMessageAvailable") - , mType(aType) - , mChannel(aChannel) - , mConnection(aConnection) - , mData(aData) - , mLen(aLen) - { - } - - DataChannelOnMessageAvailable(int32_t aType, DataChannel* aChannel) - : Runnable("DataChannelOnMessageAvailable") - , mType(aType) - , mChannel(aChannel) - { - } + DataChannelOnMessageAvailable(int32_t aType, + DataChannelConnection *aConnection, + DataChannel *aChannel, + nsCString &aData, // XXX this causes inefficiency + int32_t aLen) + : mType(aType), + mChannel(aChannel), + mConnection(aConnection), + mData(aData), + mLen(aLen) {} + + DataChannelOnMessageAvailable(int32_t aType, + DataChannel *aChannel) + : mType(aType), + mChannel(aChannel) {} // XXX is it safe to leave mData/mLen uninitialized? This should only be // used for notifications that don't use them, but I'd like more // bulletproof compile-time checking. - DataChannelOnMessageAvailable(int32_t aType, - DataChannelConnection* aConnection, - DataChannel* aChannel) - : Runnable("DataChannelOnMessageAvailable") - , mType(aType) - , mChannel(aChannel) - , mConnection(aConnection) - { - } + DataChannelOnMessageAvailable(int32_t aType, + DataChannelConnection *aConnection, + DataChannel *aChannel) + : mType(aType), + mChannel(aChannel), + mConnection(aConnection) {} // for ON_CONNECTION/ON_DISCONNECTED - DataChannelOnMessageAvailable(int32_t aType, - DataChannelConnection* aConnection) - : Runnable("DataChannelOnMessageAvailable") - , mType(aType) - , mConnection(aConnection) - { - } + DataChannelOnMessageAvailable(int32_t aType, + DataChannelConnection *aConnection) + : mType(aType), + mConnection(aConnection) {} NS_IMETHOD Run() override { diff --git a/netwerk/socket/nsNamedPipeIOLayer.cpp b/netwerk/socket/nsNamedPipeIOLayer.cpp index 5373d202da6d3..400f61fa5ac71 100644 --- a/netwerk/socket/nsNamedPipeIOLayer.cpp +++ b/netwerk/socket/nsNamedPipeIOLayer.cpp @@ -211,7 +211,7 @@ NamedPipeInfo::OnDataAvailable(uint32_t aBytesTransferred, mErrorCode = ERROR_SUCCESS; // dispatch an empty event to trigger STS thread - gSocketTransportService->Dispatch(NS_NewRunnableFunction("NamedPipeInfo::OnDataAvailable", []{}), + gSocketTransportService->Dispatch(NS_NewRunnableFunction([]{}), NS_DISPATCH_NORMAL); return NS_OK; @@ -229,7 +229,7 @@ NamedPipeInfo::OnError(uint32_t aError, mErrorCode = aError; // dispatch an empty event to trigger STS thread - gSocketTransportService->Dispatch(NS_NewRunnableFunction("NamedPipeInfo::OnError", []{}), + gSocketTransportService->Dispatch(NS_NewRunnableFunction([]{}), NS_DISPATCH_NORMAL); return NS_OK; diff --git a/netwerk/socket/nsNamedPipeService.cpp b/netwerk/socket/nsNamedPipeService.cpp index d273863008908..8e72cc8ef02d0 100644 --- a/netwerk/socket/nsNamedPipeService.cpp +++ b/netwerk/socket/nsNamedPipeService.cpp @@ -42,8 +42,7 @@ NamedPipeService::Init() // nsIObserverService must be accessed in main thread. // register shutdown event to stop NamedPipeSrv thread. nsCOMPtr self(this); - nsCOMPtr r = NS_NewRunnableFunction("NamedPipeService::Init", - [self = Move(self)] () -> void { + nsCOMPtr r = NS_NewRunnableFunction([self = Move(self)] () -> void { MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr svc = mozilla::services::GetObserverService(); diff --git a/netwerk/system/linux/nsNotifyAddrListener_Linux.h b/netwerk/system/linux/nsNotifyAddrListener_Linux.h index d8150d17ff610..a2b8f2277942b 100644 --- a/netwerk/system/linux/nsNotifyAddrListener_Linux.h +++ b/netwerk/system/linux/nsNotifyAddrListener_Linux.h @@ -44,11 +44,8 @@ class nsNotifyAddrListener : public nsINetworkLinkService, class ChangeEvent : public mozilla::Runnable { public: NS_DECL_NSIRUNNABLE - ChangeEvent(nsINetworkLinkService* aService, const char* aEventID) - : mozilla::Runnable("nsNotifyAddrListener::ChangeEvent") - , mService(aService) - , mEventID(aEventID) - { + ChangeEvent(nsINetworkLinkService *aService, const char *aEventID) + : mService(aService), mEventID(aEventID) { } private: nsCOMPtr mService; diff --git a/netwerk/system/win32/nsNotifyAddrListener.h b/netwerk/system/win32/nsNotifyAddrListener.h index d2173aea9caa6..47a9ed64514a7 100644 --- a/netwerk/system/win32/nsNotifyAddrListener.h +++ b/netwerk/system/win32/nsNotifyAddrListener.h @@ -38,10 +38,8 @@ class nsNotifyAddrListener : public nsINetworkLinkService, public: NS_DECL_NSIRUNNABLE ChangeEvent(nsINetworkLinkService *aService, const char *aEventID) - : Runnable("nsNotifyAddrListener::ChangeEvent") - , mService(aService) - , mEventID(aEventID) - {} + : mService(aService), mEventID(aEventID) { + } private: nsCOMPtr mService; const char *mEventID; diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp index 18215b0b363bb..5c5fe3965b3bb 100644 --- a/parser/html/nsHtml5StreamParser.cpp +++ b/parser/html/nsHtml5StreamParser.cpp @@ -1135,12 +1135,12 @@ nsHtml5StreamParser::DoDataAvailable(const uint8_t* aBuffer, uint32_t aLength) { mozilla::MutexAutoLock flushTimerLock(mFlushTimerMutex); - mFlushTimer->InitWithNamedFuncCallback( - nsHtml5StreamParser::TimerCallback, - static_cast(this), - mFlushTimerEverFired ? sTimerInitialDelay : sTimerSubsequentDelay, - nsITimer::TYPE_ONE_SHOT, - "nsHtml5StreamParser::DoDataAvailable"); + mFlushTimer->InitWithFuncCallback(nsHtml5StreamParser::TimerCallback, + static_cast (this), + mFlushTimerEverFired ? + sTimerInitialDelay : + sTimerSubsequentDelay, + nsITimer::TYPE_ONE_SHOT); } mFlushTimerArmed = true; } diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp index df4320a49940e..860196b311686 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp +++ b/parser/html/nsHtml5TreeOpExecutor.cpp @@ -52,8 +52,7 @@ class nsHtml5ExecutorReflusher : public Runnable RefPtr mExecutor; public: explicit nsHtml5ExecutorReflusher(nsHtml5TreeOpExecutor* aExecutor) - : mozilla::Runnable("nsHtml5ExecutorReflusher") - , mExecutor(aExecutor) + : mExecutor(aExecutor) {} NS_IMETHOD Run() override { @@ -242,8 +241,7 @@ nsHtml5TreeOpExecutor::MarkAsBroken(nsresult aReason) // a safer point. if (mParser) { // can mParser ever be null here? MOZ_ALWAYS_SUCCEEDS( - NS_DispatchToMainThread(NewRunnableMethod("nsHtml5Parser::Terminate", - GetParser(), &nsHtml5Parser::Terminate))); + NS_DispatchToMainThread(NewRunnableMethod(GetParser(), &nsHtml5Parser::Terminate))); } return aReason; } diff --git a/parser/htmlparser/nsParser.cpp b/parser/htmlparser/nsParser.cpp index 0dc9beb3c009c..7dbbc840487f8 100644 --- a/parser/htmlparser/nsParser.cpp +++ b/parser/htmlparser/nsParser.cpp @@ -110,8 +110,7 @@ class nsParserContinueEvent : public Runnable RefPtr mParser; explicit nsParserContinueEvent(nsParser* aParser) - : mozilla::Runnable("nsParserContinueEvent") - , mParser(aParser) + : mParser(aParser) {} NS_IMETHOD Run() override diff --git a/security/manager/ssl/CryptoTask.h b/security/manager/ssl/CryptoTask.h index 1d50156b9b3eb..ae107fe307485 100644 --- a/security/manager/ssl/CryptoTask.h +++ b/security/manager/ssl/CryptoTask.h @@ -62,9 +62,8 @@ class CryptoTask : public Runnable, protected: CryptoTask() - : Runnable("CryptoTask") - , mRv(NS_ERROR_NOT_INITIALIZED) - , mReleasedNSSResources(false) + : mRv(NS_ERROR_NOT_INITIALIZED), + mReleasedNSSResources(false) { } diff --git a/security/manager/ssl/DataStorage.cpp b/security/manager/ssl/DataStorage.cpp index 808b2392b5184..99d26ca32a69a 100644 --- a/security/manager/ssl/DataStorage.cpp +++ b/security/manager/ssl/DataStorage.cpp @@ -329,8 +329,7 @@ class DataStorage::Reader : public Runnable { public: explicit Reader(DataStorage* aDataStorage) - : Runnable("DataStorage::Reader") - , mDataStorage(aDataStorage) + : mDataStorage(aDataStorage) { } ~Reader(); @@ -356,8 +355,7 @@ DataStorage::Reader::~Reader() // This is for tests. nsCOMPtr job = - NewRunnableMethod("DataStorage::NotifyObservers", - mDataStorage, + NewRunnableMethod(mDataStorage, &DataStorage::NotifyObservers, "data-storage-ready"); nsresult rv = NS_DispatchToMainThread(job, NS_DISPATCH_NORMAL); @@ -799,8 +797,7 @@ class DataStorage::Writer : public Runnable { public: Writer(nsCString& aData, DataStorage* aDataStorage) - : Runnable("DataStorage::Writer") - , mData(aData) + : mData(aData) , mDataStorage(aDataStorage) { } @@ -853,8 +850,7 @@ DataStorage::Writer::Run() // Observed by tests. nsCOMPtr job = - NewRunnableMethod("DataStorage::NotifyObservers", - mDataStorage, + NewRunnableMethod(mDataStorage, &DataStorage::NotifyObservers, "data-storage-written"); rv = NS_DispatchToMainThread(job, NS_DISPATCH_NORMAL); @@ -945,7 +941,7 @@ DataStorage::AsyncSetTimer(const MutexAutoLock& /*aProofOfLock*/) mPendingWrite = true; nsCOMPtr job = - NewRunnableMethod("DataStorage::SetTimer", this, &DataStorage::SetTimer); + NewRunnableMethod(this, &DataStorage::SetTimer); nsresult rv = mWorkerThread->Dispatch(job, NS_DISPATCH_NORMAL); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -969,11 +965,8 @@ DataStorage::SetTimer() } } - rv = mTimer->InitWithNamedFuncCallback(TimerCallback, - this, - mTimerDelay, - nsITimer::TYPE_ONE_SHOT, - "DataStorage::SetTimer"); + rv = mTimer->InitWithFuncCallback(TimerCallback, this, + mTimerDelay, nsITimer::TYPE_ONE_SHOT); Unused << NS_WARN_IF(NS_FAILED(rv)); } @@ -997,8 +990,8 @@ DataStorage::DispatchShutdownTimer(const MutexAutoLock& /*aProofOfLock*/) { MOZ_ASSERT(XRE_IsParentProcess()); - nsCOMPtr job = NewRunnableMethod( - "DataStorage::ShutdownTimer", this, &DataStorage::ShutdownTimer); + nsCOMPtr job = + NewRunnableMethod(this, &DataStorage::ShutdownTimer); nsresult rv = mWorkerThread->Dispatch(job, NS_DISPATCH_NORMAL); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; diff --git a/security/manager/ssl/PSMContentListener.cpp b/security/manager/ssl/PSMContentListener.cpp index 9edbc6bc464ba..d377bcffe0d29 100644 --- a/security/manager/ssl/PSMContentListener.cpp +++ b/security/manager/ssl/PSMContentListener.cpp @@ -153,9 +153,7 @@ PSMContentStreamListener::OnStopRequest(nsIRequest* request, // Because importing the cert can spin the event loop (via alerts), we can't // do it here. Do it off the event loop instead. nsCOMPtr r = - NewRunnableMethod("psm::PSMContentStreamListener::ImportCertificate", - this, - &PSMContentStreamListener::ImportCertificate); + NewRunnableMethod(this, &PSMContentStreamListener::ImportCertificate); MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(r)); return NS_OK; diff --git a/security/manager/ssl/PSMRunnable.cpp b/security/manager/ssl/PSMRunnable.cpp index e83cf960a473a..9f151a83fde73 100644 --- a/security/manager/ssl/PSMRunnable.cpp +++ b/security/manager/ssl/PSMRunnable.cpp @@ -7,8 +7,7 @@ namespace mozilla { namespace psm { SyncRunnableBase::SyncRunnableBase() - : Runnable("psm::SyncRunnableBase") - , monitor("SyncRunnableBase::monitor") + : monitor("SyncRunnableBase::monitor") { } diff --git a/security/manager/ssl/PSMRunnable.h b/security/manager/ssl/PSMRunnable.h index d8a2fffe039c7..87dada184f186 100644 --- a/security/manager/ssl/PSMRunnable.h +++ b/security/manager/ssl/PSMRunnable.h @@ -32,8 +32,7 @@ class NotifyObserverRunnable : public Runnable public: NotifyObserverRunnable(nsIObserver * observer, const char * topicStringLiteral) - : Runnable("psm::NotifyObserverRunnable"), - mObserver(new nsMainThreadPtrHolder( + : mObserver(new nsMainThreadPtrHolder( "psm::NotifyObserverRunnable::mObserver", observer)), mTopic(topicStringLiteral) { } diff --git a/security/manager/ssl/SSLServerCertVerification.cpp b/security/manager/ssl/SSLServerCertVerification.cpp index 9593fac227ef8..2304753d141fb 100644 --- a/security/manager/ssl/SSLServerCertVerification.cpp +++ b/security/manager/ssl/SSLServerCertVerification.cpp @@ -736,8 +736,7 @@ class CertErrorRunnableRunnable : public Runnable { public: explicit CertErrorRunnableRunnable(CertErrorRunnable* certErrorRunnable) - : Runnable("psm::CertErrorRunnableRunnable") - , mCertErrorRunnable(certErrorRunnable) + : mCertErrorRunnable(certErrorRunnable) { } private: @@ -797,18 +796,12 @@ class SSLServerCertVerificationJob : public Runnable }; SSLServerCertVerificationJob::SSLServerCertVerificationJob( - const RefPtr& certVerifier, - const void* fdForLogging, - nsNSSSocketInfo* infoObject, - const UniqueCERTCertificate& cert, - UniqueCERTCertList peerCertChain, - const SECItem* stapledOCSPResponse, - const SECItem* sctsFromTLSExtension, - uint32_t providerFlags, - Time time, - PRTime prtime) - : Runnable("psm::SSLServerCertVerificationJob") - , mCertVerifier(certVerifier) + const RefPtr& certVerifier, const void* fdForLogging, + nsNSSSocketInfo* infoObject, const UniqueCERTCertificate& cert, + UniqueCERTCertList peerCertChain, const SECItem* stapledOCSPResponse, + const SECItem* sctsFromTLSExtension, + uint32_t providerFlags, Time time, PRTime prtime) + : mCertVerifier(certVerifier) , mFdForLogging(fdForLogging) , mInfoObject(infoObject) , mCert(CERT_DupCertificate(cert.get())) @@ -1824,13 +1817,10 @@ AuthCertificateHook(void* arg, PRFileDesc* fd, PRBool checkSig, PRBool isServer) } SSLServerCertVerificationResult::SSLServerCertVerificationResult( - nsNSSSocketInfo* infoObject, - PRErrorCode errorCode, - Telemetry::HistogramID telemetryID, - uint32_t telemetryValue, - SSLErrorMessageType errorMessageType) - : Runnable("psm::SSLServerCertVerificationResult") - , mInfoObject(infoObject) + nsNSSSocketInfo* infoObject, PRErrorCode errorCode, + Telemetry::HistogramID telemetryID, uint32_t telemetryValue, + SSLErrorMessageType errorMessageType) + : mInfoObject(infoObject) , mErrorCode(errorCode) , mErrorMessageType(errorMessageType) , mTelemetryID(telemetryID) diff --git a/security/manager/ssl/nsNSSCallbacks.cpp b/security/manager/ssl/nsNSSCallbacks.cpp index 1ec6334b452b2..18f1b2ef0a783 100644 --- a/security/manager/ssl/nsNSSCallbacks.cpp +++ b/security/manager/ssl/nsNSSCallbacks.cpp @@ -68,8 +68,7 @@ class nsHTTPDownloadEvent : public Runnable { }; nsHTTPDownloadEvent::nsHTTPDownloadEvent() - : mozilla::Runnable("nsHTTPDownloadEvent") - , mResponsibleForDoneSignal(true) +:mResponsibleForDoneSignal(true) { } @@ -197,7 +196,6 @@ nsHTTPDownloadEvent::Run() struct nsCancelHTTPDownloadEvent : Runnable { RefPtr mListener; - nsCancelHTTPDownloadEvent() : Runnable("nsCancelHTTPDownloadEvent") {} NS_IMETHOD Run() override { mListener->FreeLoadGroup(true); mListener = nullptr; diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp index 8f0619498036d..dc5ab78aa27dd 100644 --- a/security/manager/ssl/nsNSSComponent.cpp +++ b/security/manager/ssl/nsNSSComponent.cpp @@ -99,12 +99,11 @@ bool EnsureNSSInitializedChromeOrContent() } // Forward to the main thread synchronously. - mozilla::SyncRunnable::DispatchToThread( - mainThread, - new SyncRunnable( - NS_NewRunnableFunction("EnsureNSSInitializedChromeOrContent", []() { - initialized = EnsureNSSInitializedChromeOrContent(); - }))); + mozilla::SyncRunnable::DispatchToThread(mainThread, + new SyncRunnable(NS_NewRunnableFunction([]() { + initialized = EnsureNSSInitializedChromeOrContent(); + })) + ); return initialized; } diff --git a/security/manager/ssl/nsNSSIOLayer.cpp b/security/manager/ssl/nsNSSIOLayer.cpp index 89b82679abb34..0c44dc91e3d66 100644 --- a/security/manager/ssl/nsNSSIOLayer.cpp +++ b/security/manager/ssl/nsNSSIOLayer.cpp @@ -1730,8 +1730,7 @@ class FallbackPrefRemover final : public Runnable { public: explicit FallbackPrefRemover(const nsACString& aHost) - : mozilla::Runnable("FallbackPrefRemover") - , mHost(aHost) + : mHost(aHost) {} NS_IMETHOD Run() override; private: diff --git a/security/manager/ssl/nsNSSModule.cpp b/security/manager/ssl/nsNSSModule.cpp index 3214985080952..de47b4ec829fa 100644 --- a/security/manager/ssl/nsNSSModule.cpp +++ b/security/manager/ssl/nsNSSModule.cpp @@ -106,11 +106,11 @@ Constructor(nsISupports* aOuter, REFNSIID aIID, void** aResult) } // Forward to the main thread synchronously. - mozilla::SyncRunnable::DispatchToThread( - mainThread, - new SyncRunnable(NS_NewRunnableFunction("psm::Constructor", [&]() { + mozilla::SyncRunnable::DispatchToThread(mainThread, + new SyncRunnable(NS_NewRunnableFunction([&]() { rv = Instantiate(aIID, aResult); - }))); + })) + ); return rv; } diff --git a/security/sandbox/linux/reporter/SandboxReporter.cpp b/security/sandbox/linux/reporter/SandboxReporter.cpp index a9275f00465a2..8da246b07f181 100644 --- a/security/sandbox/linux/reporter/SandboxReporter.cpp +++ b/security/sandbox/linux/reporter/SandboxReporter.cpp @@ -100,8 +100,9 @@ SandboxReporter::Singleton() // by that point (so it won't race by calling Singleton()), all // non-main XPCOM threads will also be shut down, and currently // the only other user is the main-thread-only Troubleshoot.jsm. - NS_DispatchToMainThread(NS_NewRunnableFunction( - "SandboxReporter::Singleton", [] { ClearOnShutdown(&sSingleton); })); + NS_DispatchToMainThread(NS_NewRunnableFunction([] { + ClearOnShutdown(&sSingleton); + })); } return sSingleton.get(); } diff --git a/services/crypto/component/IdentityCryptoService.cpp b/services/crypto/component/IdentityCryptoService.cpp index 4b36ad09563e3..a4871dfe5079b 100644 --- a/services/crypto/component/IdentityCryptoService.cpp +++ b/services/crypto/component/IdentityCryptoService.cpp @@ -325,10 +325,9 @@ KeyPair::Sign(const nsACString & textToSign, } KeyGenRunnable::KeyGenRunnable(KeyType keyType, - nsIIdentityKeyGenCallback* callback, + nsIIdentityKeyGenCallback * callback, nsIEventTarget* operationThread) - : mozilla::Runnable("KeyGenRunnable") - , mKeyType(keyType) + : mKeyType(keyType) , mCallback(new nsMainThreadPtrHolder( "KeyGenRunnable::mCallback", callback)) , mRv(NS_ERROR_NOT_INITIALIZED) @@ -484,11 +483,10 @@ KeyGenRunnable::Run() return NS_OK; } -SignRunnable::SignRunnable(const nsACString& aText, - SECKEYPrivateKey* privateKey, - nsIIdentitySignCallback* aCallback) - : mozilla::Runnable("SignRunnable") - , mTextToSign(aText) +SignRunnable::SignRunnable(const nsACString & aText, + SECKEYPrivateKey * privateKey, + nsIIdentitySignCallback * aCallback) + : mTextToSign(aText) , mPrivateKey(SECKEY_CopyPrivateKey(privateKey)) , mCallback(new nsMainThreadPtrHolder( "SignRunnable::mCallback", aCallback)) diff --git a/storage/StorageBaseStatementInternal.cpp b/storage/StorageBaseStatementInternal.cpp index 8993a23d551e7..69bf3aeb39688 100644 --- a/storage/StorageBaseStatementInternal.cpp +++ b/storage/StorageBaseStatementInternal.cpp @@ -35,11 +35,10 @@ class AsyncStatementFinalizer : public Runnable * on. We release the statement on that thread since releasing the * statement might end up releasing the connection too. */ - AsyncStatementFinalizer(StorageBaseStatementInternal* aStatement, - Connection* aConnection) - : Runnable("storage::AsyncStatementFinalizer") - , mStatement(aStatement) - , mConnection(aConnection) + AsyncStatementFinalizer(StorageBaseStatementInternal *aStatement, + Connection *aConnection) + : mStatement(aStatement) + , mConnection(aConnection) { } @@ -82,11 +81,10 @@ class LastDitchSqliteStatementFinalizer : public Runnable * responsibility for the instance and all other references to it * should be forgotten. */ - LastDitchSqliteStatementFinalizer(RefPtr& aConnection, - sqlite3_stmt* aStatement) - : Runnable("storage::LastDitchSqliteStatementFinalizer") - , mConnection(aConnection) - , mAsyncStatement(aStatement) + LastDitchSqliteStatementFinalizer(RefPtr &aConnection, + sqlite3_stmt *aStatement) + : mConnection(aConnection) + , mAsyncStatement(aStatement) { NS_PRECONDITION(aConnection, "You must provide a Connection"); } diff --git a/storage/mozStorageConnection.cpp b/storage/mozStorageConnection.cpp index 49571570f118a..903b96adebfe8 100644 --- a/storage/mozStorageConnection.cpp +++ b/storage/mozStorageConnection.cpp @@ -378,8 +378,7 @@ class AsyncCloseConnection final: public Runnable AsyncCloseConnection(Connection *aConnection, sqlite3 *aNativeConnection, nsIRunnable *aCallbackEvent) - : Runnable("storage::AsyncCloseConnection") - , mConnection(aConnection) + : mConnection(aConnection) , mNativeConnection(aNativeConnection) , mCallbackEvent(aCallbackEvent) { @@ -391,8 +390,7 @@ class AsyncCloseConnection final: public Runnable MOZ_ASSERT(NS_GetCurrentThread() != mConnection->threadOpenedOn); nsCOMPtr event = - NewRunnableMethod("storage::Connection::shutdownAsyncThread", - mConnection, &Connection::shutdownAsyncThread); + NewRunnableMethod(mConnection, &Connection::shutdownAsyncThread); MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(event)); // Internal close. @@ -833,8 +831,7 @@ Connection::initializeOnAsyncThread(nsIFile* aStorageFile) { MutexAutoLock lockedScope(sharedAsyncExecutionMutex); mAsyncExecutionThreadShuttingDown = true; nsCOMPtr event = - NewRunnableMethod("Connection::shutdownAsyncThread", - this, &Connection::shutdownAsyncThread); + NewRunnableMethod(this, &Connection::shutdownAsyncThread); Unused << NS_DispatchToMainThread(event); } return rv; diff --git a/storage/mozStoragePrivateHelpers.cpp b/storage/mozStoragePrivateHelpers.cpp index 3c36885837294..91924204f107c 100644 --- a/storage/mozStoragePrivateHelpers.cpp +++ b/storage/mozStoragePrivateHelpers.cpp @@ -251,9 +251,8 @@ namespace { class CallbackEvent : public Runnable { public: - explicit CallbackEvent(mozIStorageCompletionCallback* aCallback) - : Runnable("storage::CallbackEvent") - , mCallback(aCallback) + explicit CallbackEvent(mozIStorageCompletionCallback *aCallback) + : mCallback(aCallback) { } diff --git a/storage/mozStorageService.cpp b/storage/mozStorageService.cpp index 8ca2ae4806f88..7b3d8e738f9cd 100644 --- a/storage/mozStorageService.cpp +++ b/storage/mozStorageService.cpp @@ -387,7 +387,6 @@ Service::minimizeMemory() // dispatch will fail and that's okay. nsCOMPtr event = NewRunnableMethod( - "Connection::ExecuteSimpleSQL", conn, &Connection::ExecuteSimpleSQL, shrinkPragma); Unused << conn->threadOpenedOn->Dispatch(event, NS_DISPATCH_NORMAL); } @@ -678,8 +677,7 @@ class AsyncInitDatabase final : public Runnable nsIFile* aStorageFile, int32_t aGrowthIncrement, mozIStorageCompletionCallback* aCallback) - : Runnable("storage::AsyncInitDatabase") - , mConnection(aConnection) + : mConnection(aConnection) , mStorageFile(aStorageFile) , mGrowthIncrement(aGrowthIncrement) , mCallback(aCallback) diff --git a/storage/test/gtest/storage_test_harness.h b/storage/test/gtest/storage_test_harness.h index 09a01c7f9da58..b1003f043471c 100644 --- a/storage/test/gtest/storage_test_harness.h +++ b/storage/test/gtest/storage_test_harness.h @@ -299,10 +299,9 @@ void watch_for_mutex_use_on_this_thread() class ThreadWedger : public mozilla::Runnable { public: - explicit ThreadWedger(nsIEventTarget* aTarget) - : mozilla::Runnable("ThreadWedger") - , mReentrantMonitor("thread wedger") - , unwedged(false) + explicit ThreadWedger(nsIEventTarget *aTarget) + : mReentrantMonitor("thread wedger") + , unwedged(false) { aTarget->Dispatch(this, aTarget->NS_DISPATCH_NORMAL); } diff --git a/storage/test/gtest/test_service_init_background_thread.cpp b/storage/test/gtest/test_service_init_background_thread.cpp index 5a2c1b5ae92a5..e811e249702b3 100644 --- a/storage/test/gtest/test_service_init_background_thread.cpp +++ b/storage/test/gtest/test_service_init_background_thread.cpp @@ -19,7 +19,6 @@ class ServiceInitializer : public mozilla::Runnable { public: - ServiceInitializer() : mozilla::Runnable("ServiceInitializer") {} NS_IMETHOD Run() override { // Use an explicit do_GetService instead of getService so that the check in diff --git a/storage/test/gtest/test_spinningSynchronousClose.cpp b/storage/test/gtest/test_spinningSynchronousClose.cpp index 5d7c27544da67..1e8d599b33e76 100644 --- a/storage/test/gtest/test_spinningSynchronousClose.cpp +++ b/storage/test/gtest/test_spinningSynchronousClose.cpp @@ -21,8 +21,7 @@ class CompletionRunnable final : public Runnable { public: explicit CompletionRunnable() - : Runnable("CompletionRunnable") - , mDone(false) + : mDone(false) { } diff --git a/storage/test/gtest/test_unlock_notify.cpp b/storage/test/gtest/test_unlock_notify.cpp index b5a4529cd6140..d108f3b16a096 100644 --- a/storage/test/gtest/test_unlock_notify.cpp +++ b/storage/test/gtest/test_unlock_notify.cpp @@ -29,10 +29,9 @@ class DatabaseLocker : public mozilla::Runnable { public: explicit DatabaseLocker(const char* aSQL) - : mozilla::Runnable("DatabaseLocker") - , monitor("DatabaseLocker::monitor") - , mSQL(aSQL) - , mState(STARTING) + : monitor("DatabaseLocker::monitor") + , mSQL(aSQL) + , mState(STARTING) { } diff --git a/toolkit/components/filewatcher/NativeFileWatcherWin.cpp b/toolkit/components/filewatcher/NativeFileWatcherWin.cpp index faf166eff6620..96be46eaef5c0 100644 --- a/toolkit/components/filewatcher/NativeFileWatcherWin.cpp +++ b/toolkit/components/filewatcher/NativeFileWatcherWin.cpp @@ -37,8 +37,7 @@ class WatchedErrorEvent final : public Runnable */ WatchedErrorEvent(const nsMainThreadPtrHandle& aOnError, const nsresult& anError, const DWORD& osError) - : Runnable("WatchedErrorEvent") - , mOnError(aOnError) + : mOnError(aOnError) , mError(anError) { MOZ_ASSERT(!NS_IsMainThread()); @@ -76,8 +75,7 @@ class WatchedSuccessEvent final : public Runnable */ WatchedSuccessEvent(const nsMainThreadPtrHandle& aOnSuccess, const nsAString& aResourcePath) - : Runnable("WatchedSuccessEvent") - , mOnSuccess(aOnSuccess) + : mOnSuccess(aOnSuccess) , mResourcePath(aResourcePath) { MOZ_ASSERT(!NS_IsMainThread()); @@ -114,8 +112,7 @@ class WatchedChangeEvent final : public Runnable */ WatchedChangeEvent(const nsMainThreadPtrHandle& aOnChange, const nsAString& aChangedResource) - : Runnable("WatchedChangeEvent") - , mOnChange(aOnChange) + : mOnChange(aOnChange) , mChangedResource(aChangedResource) { MOZ_ASSERT(!NS_IsMainThread()); @@ -231,8 +228,7 @@ class NativeWatcherIOShutdownTask : public Runnable { public: NativeWatcherIOShutdownTask() - : Runnable("NativeWatcherIOShutdownTask") - , mWorkerThread(do_GetCurrentThread()) + : mWorkerThread(do_GetCurrentThread()) { MOZ_ASSERT(!NS_IsMainThread()); } @@ -263,8 +259,7 @@ class NativeFileWatcherIOTask : public Runnable { public: explicit NativeFileWatcherIOTask(HANDLE aIOCompletionPort) - : Runnable("NativeFileWatcherIOTask") - , mIOCompletionPort(aIOCompletionPort) + : mIOCompletionPort(aIOCompletionPort) , mShuttingDown(false) { } @@ -1329,7 +1324,6 @@ NativeFileWatcherService::AddPath(const nsAString& aPathToWatch, nsresult rv = mIOThread->Dispatch( NewRunnableMethod( - "NativeFileWatcherIOTask::AddPathRunnableMethod", static_cast(mWorkerIORunnable.get()), &NativeFileWatcherIOTask::AddPathRunnableMethod, wrappedCallbacks.get()), @@ -1403,7 +1397,6 @@ NativeFileWatcherService::RemovePath(const nsAString& aPathToRemove, nsresult rv = mIOThread->Dispatch( NewRunnableMethod( - "NativeFileWatcherIOTask::RemovePathRunnableMethod", static_cast(mWorkerIORunnable.get()), &NativeFileWatcherIOTask::RemovePathRunnableMethod, wrappedCallbacks.get()), @@ -1453,7 +1446,6 @@ NativeFileWatcherService::Uninit() nsresult rv = ioThread->Dispatch( NewRunnableMethod( - "NativeFileWatcherIOTask::DeactivateRunnableMethod", static_cast(mWorkerIORunnable.get()), &NativeFileWatcherIOTask::DeactivateRunnableMethod), nsIEventTarget::DISPATCH_NORMAL); diff --git a/toolkit/components/osfile/NativeOSFileInternals.cpp b/toolkit/components/osfile/NativeOSFileInternals.cpp index 63003e3acf1aa..c671cfeae3098 100644 --- a/toolkit/components/osfile/NativeOSFileInternals.cpp +++ b/toolkit/components/osfile/NativeOSFileInternals.cpp @@ -411,14 +411,13 @@ class ErrorEvent final : public Runnable { already_AddRefed& aDiscardedResult, const nsACString& aOperation, int32_t aOSError) - : Runnable("ErrorEvent") - , mOnSuccess(aOnSuccess) + : mOnSuccess(aOnSuccess) , mOnError(aOnError) , mDiscardedResult(aDiscardedResult) , mOSError(aOSError) , mOperation(aOperation) - { - MOZ_ASSERT(!NS_IsMainThread()); + { + MOZ_ASSERT(!NS_IsMainThread()); } NS_IMETHOD Run() override { @@ -461,16 +460,14 @@ class SuccessEvent final : public Runnable { * we do not manipulate xpconnect refcounters off the main thread * (which is illegal). */ - SuccessEvent( - nsMainThreadPtrHandle& aOnSuccess, - nsMainThreadPtrHandle& aOnError, - already_AddRefed& aResult) - : Runnable("SuccessEvent") - , mOnSuccess(aOnSuccess) + SuccessEvent(nsMainThreadPtrHandle& aOnSuccess, + nsMainThreadPtrHandle& aOnError, + already_AddRefed& aResult) + : mOnSuccess(aOnSuccess) , mOnError(aOnError) , mResult(aResult) - { - MOZ_ASSERT(!NS_IsMainThread()); + { + MOZ_ASSERT(!NS_IsMainThread()); } NS_IMETHOD Run() override { @@ -503,11 +500,9 @@ class SuccessEvent final : public Runnable { */ class AbstractDoEvent: public Runnable { public: - AbstractDoEvent( - nsMainThreadPtrHandle& aOnSuccess, - nsMainThreadPtrHandle& aOnError) - : Runnable("AbstractDoEvent") - , mOnSuccess(aOnSuccess) + AbstractDoEvent(nsMainThreadPtrHandle& aOnSuccess, + nsMainThreadPtrHandle& aOnError) + : mOnSuccess(aOnSuccess) , mOnError(aOnError) #if defined(DEBUG) , mResolved(false) diff --git a/toolkit/components/places/FaviconHelpers.cpp b/toolkit/components/places/FaviconHelpers.cpp index 2960e2f0fac84..b34267fd88ebb 100644 --- a/toolkit/components/places/FaviconHelpers.cpp +++ b/toolkit/components/places/FaviconHelpers.cpp @@ -504,8 +504,7 @@ AsyncFetchAndSetIconForPage::AsyncFetchAndSetIconForPage( , bool aFaviconLoadPrivate , nsIFaviconDataCallback* aCallback , nsIPrincipal* aLoadingPrincipal -) : Runnable("places::AsyncFetchAndSetIconForPage") - , mCallback(new nsMainThreadPtrHolder( +) : mCallback(new nsMainThreadPtrHolder( "AsyncFetchAndSetIconForPage::mCallback", aCallback)) , mIcon(aIcon) , mPage(aPage) @@ -544,9 +543,7 @@ AsyncFetchAndSetIconForPage::Run() // Fetch the icon from the network, the request starts from the main-thread. // When done this will associate the icon to the page and notify. nsCOMPtr event = - NewRunnableMethod("places::AsyncFetchAndSetIconForPage::FetchFromNetwork", - this, - &AsyncFetchAndSetIconForPage::FetchFromNetwork); + NewRunnableMethod(this, &AsyncFetchAndSetIconForPage::FetchFromNetwork); return NS_DispatchToMainThread(event); } @@ -789,11 +786,10 @@ AsyncFetchAndSetIconForPage::OnStopRequest(nsIRequest* aRequest, //// AsyncAssociateIconToPage AsyncAssociateIconToPage::AsyncAssociateIconToPage( - const IconData& aIcon, - const PageData& aPage, - const nsMainThreadPtrHandle& aCallback) - : Runnable("places::AsyncAssociateIconToPage") - , mCallback(aCallback) + const IconData& aIcon +, const PageData& aPage +, const nsMainThreadPtrHandle& aCallback +) : mCallback(aCallback) , mIcon(aIcon) , mPage(aPage) { @@ -942,8 +938,7 @@ AsyncGetFaviconURLForPage::AsyncGetFaviconURLForPage( , const nsACString& aPageHost , uint16_t aPreferredWidth , nsIFaviconDataCallback* aCallback -) : Runnable("places::AsyncGetFaviconURLForPage") - , mPreferredWidth(aPreferredWidth == 0 ? UINT16_MAX : aPreferredWidth) +) : mPreferredWidth(aPreferredWidth == 0 ? UINT16_MAX : aPreferredWidth) , mCallback(new nsMainThreadPtrHolder( "AsyncGetFaviconURLForPage::mCallback", aCallback)) { @@ -983,8 +978,7 @@ AsyncGetFaviconDataForPage::AsyncGetFaviconDataForPage( , const nsACString& aPageHost , uint16_t aPreferredWidth , nsIFaviconDataCallback* aCallback -) : Runnable("places::AsyncGetFaviconDataForPage") - , mPreferredWidth(aPreferredWidth == 0 ? UINT16_MAX : aPreferredWidth) +) : mPreferredWidth(aPreferredWidth == 0 ? UINT16_MAX : aPreferredWidth) , mCallback(new nsMainThreadPtrHolder( "AsyncGetFaviconDataForPage::mCallback", aCallback)) { @@ -1024,9 +1018,8 @@ AsyncGetFaviconDataForPage::Run() //////////////////////////////////////////////////////////////////////////////// //// AsyncReplaceFaviconData -AsyncReplaceFaviconData::AsyncReplaceFaviconData(const IconData& aIcon) - : Runnable("places::AsyncReplaceFaviconData") - , mIcon(aIcon) +AsyncReplaceFaviconData::AsyncReplaceFaviconData(const IconData &aIcon) + : mIcon(aIcon) { MOZ_ASSERT(NS_IsMainThread()); } @@ -1051,10 +1044,8 @@ AsyncReplaceFaviconData::Run() NS_ENSURE_SUCCESS(rv, rv); // We can invalidate the cache version since we now persist the icon. - nsCOMPtr event = NewRunnableMethod( - "places::AsyncReplaceFaviconData::RemoveIconDataCacheEntry", - this, - &AsyncReplaceFaviconData::RemoveIconDataCacheEntry); + nsCOMPtr event = + NewRunnableMethod(this, &AsyncReplaceFaviconData::RemoveIconDataCacheEntry); rv = NS_DispatchToMainThread(event); NS_ENSURE_SUCCESS(rv, rv); @@ -1082,13 +1073,13 @@ AsyncReplaceFaviconData::RemoveIconDataCacheEntry() //// NotifyIconObservers NotifyIconObservers::NotifyIconObservers( - const IconData& aIcon, - const PageData& aPage, - const nsMainThreadPtrHandle& aCallback) - : Runnable("places::NotifyIconObservers") - , mCallback(aCallback) - , mIcon(aIcon) - , mPage(aPage) + const IconData& aIcon +, const PageData& aPage +, const nsMainThreadPtrHandle& aCallback +) +: mCallback(aCallback) +, mIcon(aIcon) +, mPage(aPage) { } @@ -1159,10 +1150,9 @@ NotifyIconObservers::SendGlobalNotifications(nsIURI* aIconURI) //////////////////////////////////////////////////////////////////////////////// //// FetchAndConvertUnsupportedPayloads -FetchAndConvertUnsupportedPayloads::FetchAndConvertUnsupportedPayloads( - mozIStorageConnection* aDBConn) - : Runnable("places::FetchAndConvertUnsupportedPayloads") - , mDB(aDBConn) +FetchAndConvertUnsupportedPayloads::FetchAndConvertUnsupportedPayloads ( + mozIStorageConnection* aDBConn +) : mDB(aDBConn) { } @@ -1391,11 +1381,11 @@ FetchAndConvertUnsupportedPayloads::StorePayload(int64_t aId, //////////////////////////////////////////////////////////////////////////////// //// AsyncCopyFavicons -AsyncCopyFavicons::AsyncCopyFavicons(PageData& aFromPage, - PageData& aToPage, - nsIFaviconDataCallback* aCallback) - : Runnable("places::AsyncCopyFavicons") - , mFromPage(aFromPage) +AsyncCopyFavicons::AsyncCopyFavicons( + PageData& aFromPage +, PageData& aToPage +, nsIFaviconDataCallback* aCallback +) : mFromPage(aFromPage) , mToPage(aToPage) , mCallback(new nsMainThreadPtrHolder( "AsyncCopyFavicons::mCallback", aCallback)) diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index 39580041382a8..33aa89e88f06c 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -321,8 +321,7 @@ GetHiddenState(bool aIsRedirect, //// PlacesEvent PlacesEvent::PlacesEvent(const char* aTopic) - : Runnable("places::PlacesEvent") - , mTopic(aTopic) +: mTopic(aTopic) { } diff --git a/toolkit/components/places/Helpers.h b/toolkit/components/places/Helpers.h index 514d679d9e82b..854105f940045 100644 --- a/toolkit/components/places/Helpers.h +++ b/toolkit/components/places/Helpers.h @@ -193,11 +193,11 @@ class FinalizeStatementCacheProxy : public Runnable */ FinalizeStatementCacheProxy( mozilla::storage::StatementCache& aStatementCache, - nsISupports* aOwner) - : Runnable("places::FinalizeStatementCacheProxy") - , mStatementCache(aStatementCache) - , mOwner(aOwner) - , mCallingThread(do_GetCurrentThread()) + nsISupports* aOwner + ) + : mStatementCache(aStatementCache) + , mOwner(aOwner) + , mCallingThread(do_GetCurrentThread()) { } diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 04f1b1d4cc5dd..3410e75e89e07 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -503,10 +503,7 @@ class VisitedQuery final : public AsyncStatementCallback, RefPtr cb = new VisitedQuery(aURI, callback, true); NS_ENSURE_TRUE(cb, NS_ERROR_OUT_OF_MEMORY); // As per IHistory contract, we must notify asynchronously. - NS_DispatchToMainThread( - NewRunnableMethod("places::VisitedQuery::NotifyVisitedStatus", - cb, - &VisitedQuery::NotifyVisitedStatus)); + NS_DispatchToMainThread(NewRunnableMethod(cb, &VisitedQuery::NotifyVisitedStatus)); return NS_OK; } @@ -626,9 +623,8 @@ class NotifyVisitObservers : public Runnable { public: explicit NotifyVisitObservers(VisitData& aPlace) - : Runnable("places::NotifyVisitObservers") - , mPlace(aPlace) - , mHistory(History::GetService()) + : mPlace(aPlace) + , mHistory(History::GetService()) { } @@ -704,10 +700,9 @@ class NotifyTitleObservers : public Runnable NotifyTitleObservers(const nsCString& aSpec, const nsString& aTitle, const nsCString& aGUID) - : Runnable("places::NotifyTitleObservers") - , mSpec(aSpec) - , mTitle(aTitle) - , mGUID(aGUID) + : mSpec(aSpec) + , mTitle(aTitle) + , mGUID(aGUID) { } @@ -740,16 +735,14 @@ class NotifyTitleObservers : public Runnable class NotifyPlaceInfoCallback : public Runnable { public: - NotifyPlaceInfoCallback( - const nsMainThreadPtrHandle& aCallback, - const VisitData& aPlace, - bool aIsSingleVisit, - nsresult aResult) - : Runnable("places::NotifyPlaceInfoCallback") - , mCallback(aCallback) - , mPlace(aPlace) - , mResult(aResult) - , mIsSingleVisit(aIsSingleVisit) + NotifyPlaceInfoCallback(const nsMainThreadPtrHandle& aCallback, + const VisitData& aPlace, + bool aIsSingleVisit, + nsresult aResult) + : mCallback(aCallback) + , mPlace(aPlace) + , mResult(aResult) + , mIsSingleVisit(aIsSingleVisit) { MOZ_ASSERT(aCallback, "Must pass a non-null callback!"); } @@ -812,12 +805,10 @@ class NotifyPlaceInfoCallback : public Runnable class NotifyCompletion : public Runnable { public: - explicit NotifyCompletion( - const nsMainThreadPtrHandle& aCallback, - uint32_t aUpdatedCount = 0) - : Runnable("places::NotifyCompletion") - , mCallback(aCallback) - , mUpdatedCount(aUpdatedCount) + explicit NotifyCompletion(const nsMainThreadPtrHandle& aCallback, + uint32_t aUpdatedCount = 0) + : mCallback(aCallback) + , mUpdatedCount(aUpdatedCount) { MOZ_ASSERT(aCallback, "Must pass a non-null callback!"); } @@ -883,10 +874,7 @@ CanAddURI(nsIURI* aURI, class NotifyManyFrecenciesChanged final : public Runnable { public: - NotifyManyFrecenciesChanged() - : Runnable("places::NotifyManyFrecenciesChanged") - { - } + NotifyManyFrecenciesChanged() {} NS_IMETHOD Run() override { @@ -1075,22 +1063,20 @@ class InsertVisitedURIs final: public Runnable return NS_OK; } private: - InsertVisitedURIs( - mozIStorageConnection* aConnection, - nsTArray& aPlaces, - const nsMainThreadPtrHandle& aCallback, - bool aGroupNotifications, - bool aIgnoreErrors, - bool aIgnoreResults, - uint32_t aInitialUpdatedCount) - : Runnable("places::InsertVisitedURIs") - , mDBConn(aConnection) - , mCallback(aCallback) - , mGroupNotifications(aGroupNotifications) - , mIgnoreErrors(aIgnoreErrors) - , mIgnoreResults(aIgnoreResults) - , mSuccessfulUpdatedCount(aInitialUpdatedCount) - , mHistory(History::GetService()) + InsertVisitedURIs(mozIStorageConnection* aConnection, + nsTArray& aPlaces, + const nsMainThreadPtrHandle& aCallback, + bool aGroupNotifications, + bool aIgnoreErrors, + bool aIgnoreResults, + uint32_t aInitialUpdatedCount) + : mDBConn(aConnection) + , mCallback(aCallback) + , mGroupNotifications(aGroupNotifications) + , mIgnoreErrors(aIgnoreErrors) + , mIgnoreResults(aIgnoreResults) + , mSuccessfulUpdatedCount(aInitialUpdatedCount) + , mHistory(History::GetService()) { MOZ_ASSERT(NS_IsMainThread(), "This should be called on the main thread"); @@ -1414,9 +1400,9 @@ class SetPageTitle : public Runnable } private: - SetPageTitle(const nsCString& aSpec, const nsAString& aTitle) - : Runnable("places::SetPageTitle") - , mHistory(History::GetService()) + SetPageTitle(const nsCString& aSpec, + const nsAString& aTitle) + : mHistory(History::GetService()) { mPlace.spec = aSpec; mPlace.title = aTitle; @@ -1545,9 +1531,9 @@ NS_IMPL_ISUPPORTS( class NotifyRemoveVisits : public Runnable { public: + explicit NotifyRemoveVisits(nsTHashtable& aPlaces) - : Runnable("places::NotifyRemoveVisits") - , mPlaces(VISITS_REMOVAL_INITIAL_HASH_LENGTH) + : mPlaces(VISITS_REMOVAL_INITIAL_HASH_LENGTH) , mHistory(History::GetService()) { MOZ_ASSERT(!NS_IsMainThread(), @@ -1694,11 +1680,11 @@ class RemoveVisits : public Runnable } private: - RemoveVisits(mozIStorageConnection* aConnection, RemoveVisitsFilter& aFilter) - : Runnable("places::RemoveVisits") - , mDBConn(aConnection) - , mHasTransitionType(false) - , mHistory(History::GetService()) + RemoveVisits(mozIStorageConnection* aConnection, + RemoveVisitsFilter& aFilter) + : mDBConn(aConnection) + , mHasTransitionType(false) + , mHistory(History::GetService()) { MOZ_ASSERT(NS_IsMainThread(), "This should be called on the main thread"); diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 3693c1512ab95..edf37a7ea3c4f 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -564,8 +564,7 @@ class FrecencyNotification : public Runnable const nsACString& aGUID, bool aHidden, PRTime aLastVisitDate) - : mozilla::Runnable("FrecencyNotification") - , mSpec(aSpec) + : mSpec(aSpec) , mNewFrecency(aNewFrecency) , mGUID(aGUID) , mHidden(aHidden) @@ -676,11 +675,9 @@ nsNavHistory::GetNow() if (!mExpireNowTimer) mExpireNowTimer = do_CreateInstance("@mozilla.org/timer;1"); if (mExpireNowTimer) - mExpireNowTimer->InitWithNamedFuncCallback(expireNowTimerCallback, - this, - RENEW_CACHED_NOW_TIMEOUT, - nsITimer::TYPE_ONE_SHOT, - "nsNavHistory::GetNow"); + mExpireNowTimer->InitWithFuncCallback(expireNowTimerCallback, this, + RENEW_CACHED_NOW_TIMEOUT, + nsITimer::TYPE_ONE_SHOT); } return mCachedNow; } diff --git a/toolkit/components/places/tests/gtest/places_test_harness_tail.h b/toolkit/components/places/tests/gtest/places_test_harness_tail.h index a6e3e0c54963b..fc363cb6a7344 100644 --- a/toolkit/components/places/tests/gtest/places_test_harness_tail.h +++ b/toolkit/components/places/tests/gtest/places_test_harness_tail.h @@ -21,7 +21,6 @@ int gTestsIndex = 0; class RunNextTest : public mozilla::Runnable { public: - RunNextTest() : mozilla::Runnable("RunNextTest") {} NS_IMETHOD Run() override { NS_ASSERTION(NS_IsMainThread(), "Not running on the main thread?"); diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index f277cce17ff23..b613e86a5c205 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -149,11 +149,8 @@ nsFormFillController::AttributeChanged(nsIDocument* aDocument, // to avoid ending up in an endless loop due to re-registering our // mutation observer (which would notify us again for *this* event). nsCOMPtr event = - mozilla::NewRunnableMethod>( - "nsFormFillController::MaybeStartControllingInput", - this, - &nsFormFillController::MaybeStartControllingInput, - focusedInput); + mozilla::NewRunnableMethod> + (this, &nsFormFillController::MaybeStartControllingInput, focusedInput); NS_DispatchToCurrentThread(event); } diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index 75b418754773a..e824e91dedafb 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -103,11 +103,7 @@ class nsAppExitEvent : public mozilla::Runnable { RefPtr mService; public: - explicit nsAppExitEvent(nsAppStartup* service) - : mozilla::Runnable("nsAppExitEvent") - , mService(service) - { - } + explicit nsAppExitEvent(nsAppStartup *service) : mService(service) {} NS_IMETHOD Run() override { // Tell the appshell to exit diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 4f340facc3c12..0694633f02638 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -553,11 +553,10 @@ class nsFetchTelemetryData : public Runnable nsFetchTelemetryData(const char* aShutdownTimeFilename, nsIFile* aFailedProfileLockFile, nsIFile* aProfileDir) - : mozilla::Runnable("nsFetchTelemetryData") - , mShutdownTimeFilename(aShutdownTimeFilename) - , mFailedProfileLockFile(aFailedProfileLockFile) - , mTelemetry(TelemetryImpl::sTelemetry) - , mProfileDir(aProfileDir) + : mShutdownTimeFilename(aShutdownTimeFilename), + mFailedProfileLockFile(aFailedProfileLockFile), + mTelemetry(TelemetryImpl::sTelemetry), + mProfileDir(aProfileDir) { } @@ -582,9 +581,7 @@ class nsFetchTelemetryData : public Runnable ReadLastShutdownDuration(mShutdownTimeFilename); mTelemetry->ReadLateWritesStacks(mProfileDir); nsCOMPtr e = - NewRunnableMethod("nsFetchTelemetryData::MainThread", - this, - &nsFetchTelemetryData::MainThread); + NewRunnableMethod(this, &nsFetchTelemetryData::MainThread); NS_ENSURE_STATE(e); NS_DispatchToMainThread(e); return NS_OK; @@ -1059,10 +1056,8 @@ class GetLoadedModulesResultRunnable final : public Runnable nsCOMPtr mWorkerThread; public: - GetLoadedModulesResultRunnable(const nsMainThreadPtrHandle& aPromise, - const SharedLibraryInfo& rawModules) - : mozilla::Runnable("GetLoadedModulesResultRunnable") - , mPromise(aPromise) + GetLoadedModulesResultRunnable(const nsMainThreadPtrHandle& aPromise, const SharedLibraryInfo& rawModules) + : mPromise(aPromise) , mRawModules(rawModules) , mWorkerThread(do_GetCurrentThread()) { @@ -1180,10 +1175,8 @@ class GetLoadedModulesRunnable final : public Runnable nsMainThreadPtrHandle mPromise; public: - explicit GetLoadedModulesRunnable( - const nsMainThreadPtrHandle& aPromise) - : mozilla::Runnable("GetLoadedModulesRunnable") - , mPromise(aPromise) + explicit GetLoadedModulesRunnable(const nsMainThreadPtrHandle& aPromise) + : mPromise(aPromise) { } NS_IMETHOD diff --git a/toolkit/components/telemetry/TelemetryCommon.cpp b/toolkit/components/telemetry/TelemetryCommon.cpp index 77fdf77a6d51b..5d813c601aaac 100644 --- a/toolkit/components/telemetry/TelemetryCommon.cpp +++ b/toolkit/components/telemetry/TelemetryCommon.cpp @@ -102,9 +102,8 @@ LogToBrowserConsole(uint32_t aLogLevel, const nsAString& aMsg) { if (!NS_IsMainThread()) { nsString msg(aMsg); - nsCOMPtr task = NS_NewRunnableFunction( - "Telemetry::Common::LogToBrowserConsole", - [aLogLevel, msg]() { LogToBrowserConsole(aLogLevel, msg); }); + nsCOMPtr task = + NS_NewRunnableFunction([aLogLevel, msg]() { LogToBrowserConsole(aLogLevel, msg); }); NS_DispatchToMainThread(task.forget(), NS_DISPATCH_NORMAL); return; } diff --git a/toolkit/components/telemetry/tests/gtest/TestScalars.cpp b/toolkit/components/telemetry/tests/gtest/TestScalars.cpp index 1efed54069c9f..1ce7fb758a6ec 100644 --- a/toolkit/components/telemetry/tests/gtest/TestScalars.cpp +++ b/toolkit/components/telemetry/tests/gtest/TestScalars.cpp @@ -301,11 +301,9 @@ TEST_F(TelemetryTestFixture, NonMainThreadAdd) { Unused << mTelemetry->ClearScalars(); // Define the function that will be called on the testing thread. - nsCOMPtr runnable = NS_NewRunnableFunction( - "TelemetryTestFixture_NonMainThreadAdd_Test::TestBody", []() -> void { - Telemetry::ScalarAdd( - Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, 37); - }); + nsCOMPtr runnable = NS_NewRunnableFunction([]() -> void { + Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, 37); + }); // Spawn the testing thread and run the function. nsCOMPtr testingThread; diff --git a/toolkit/components/url-classifier/Classifier.cpp b/toolkit/components/url-classifier/Classifier.cpp index aaa53dd84886d..1ee35dd593d3f 100644 --- a/toolkit/components/url-classifier/Classifier.cpp +++ b/toolkit/components/url-classifier/Classifier.cpp @@ -302,8 +302,7 @@ Classifier::Reset() return; } - nsCOMPtr r = - NS_NewRunnableFunction("safebrowsing::Classifier::Reset", resetFunc); + nsCOMPtr r = NS_NewRunnableFunction(resetFunc); SyncRunnable::DispatchToThread(mUpdateThread, r); } @@ -739,30 +738,25 @@ Classifier::AsyncApplyUpdates(nsTArray* aUpdates, nsCOMPtr callerThread = NS_GetCurrentThread(); MOZ_ASSERT(callerThread != mUpdateThread); - nsCOMPtr bgRunnable = - NS_NewRunnableFunction("safebrowsing::Classifier::AsyncApplyUpdates", [=] { - MOZ_ASSERT(NS_GetCurrentThread() == mUpdateThread, - "MUST be on update thread"); + nsCOMPtr bgRunnable = NS_NewRunnableFunction([=] { + MOZ_ASSERT(NS_GetCurrentThread() == mUpdateThread, "MUST be on update thread"); - LOG(("Step 1. ApplyUpdatesBackground on update thread.")); - nsCString failedTableName; - nsresult bgRv = ApplyUpdatesBackground(aUpdates, failedTableName); + LOG(("Step 1. ApplyUpdatesBackground on update thread.")); + nsCString failedTableName; + nsresult bgRv = ApplyUpdatesBackground(aUpdates, failedTableName); - nsCOMPtr fgRunnable = NS_NewRunnableFunction( - "safebrowsing::Classifier::AsyncApplyUpdates", [=] { - MOZ_ASSERT(NS_GetCurrentThread() == callerThread, - "MUST be on caller thread"); + nsCOMPtr fgRunnable = NS_NewRunnableFunction([=] { + MOZ_ASSERT(NS_GetCurrentThread() == callerThread, "MUST be on caller thread"); - LOG(("Step 2. ApplyUpdatesForeground on caller thread")); - nsresult rv = ApplyUpdatesForeground(bgRv, failedTableName); - ; + LOG(("Step 2. ApplyUpdatesForeground on caller thread")); + nsresult rv = ApplyUpdatesForeground(bgRv, failedTableName);; - LOG(("Step 3. Updates applied! Fire callback.")); + LOG(("Step 3. Updates applied! Fire callback.")); - aCallback(rv); - }); - callerThread->Dispatch(fgRunnable, NS_DISPATCH_NORMAL); + aCallback(rv); }); + callerThread->Dispatch(fgRunnable, NS_DISPATCH_NORMAL); + }); return mUpdateThread->Dispatch(bgRunnable, NS_DISPATCH_NORMAL); } diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 398929dc7b516..aad5fcbcb469a 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -1830,41 +1830,39 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithTables(nsIURI *aURI, new nsMainThreadPtrHolder( "nsIURIClassifierCallback", aCallback)); - nsCOMPtr r = NS_NewRunnableFunction( - "nsUrlClassifierDBService::AsyncClassifyLocalWithTables", - [worker, key, tables, callback, startTime]() -> void { - - nsCString matchedLists; - nsAutoPtr results(new LookupResultArray()); - if (results) { - nsresult rv = worker->DoLocalLookup(key, tables, results); - if (NS_SUCCEEDED(rv)) { - for (uint32_t i = 0; i < results->Length(); i++) { - if (i > 0) { - matchedLists.AppendLiteral(","); - } - matchedLists.Append(results->ElementAt(i).mTableName); + nsCOMPtr r = + NS_NewRunnableFunction([worker, key, tables, callback, startTime] () -> void { + + nsCString matchedLists; + nsAutoPtr results(new LookupResultArray()); + if (results) { + nsresult rv = worker->DoLocalLookup(key, tables, results); + if (NS_SUCCEEDED(rv)) { + for (uint32_t i = 0; i < results->Length(); i++) { + if (i > 0) { + matchedLists.AppendLiteral(","); } + matchedLists.Append(results->ElementAt(i).mTableName); } } + } - nsCOMPtr cbRunnable = NS_NewRunnableFunction( - "nsUrlClassifierDBService::AsyncClassifyLocalWithTables", - [callback, matchedLists, startTime]() -> void { - // Measure the time diff between calling and callback. - AccumulateDelta_impl::compute( - Telemetry::URLCLASSIFIER_ASYNC_CLASSIFYLOCAL_TIME, startTime); - - // |callback| is captured as const value so ... - auto cb = const_cast(callback.get()); - cb->OnClassifyComplete(NS_OK, // Not used. - matchedLists, - EmptyCString(), // provider. (Not used) - EmptyCString()); // prefix. (Not used) - }); - - NS_DispatchToMainThread(cbRunnable); - }); + nsCOMPtr cbRunnable = + NS_NewRunnableFunction([callback, matchedLists, startTime] () -> void { + // Measure the time diff between calling and callback. + AccumulateDelta_impl::compute( + Telemetry::URLCLASSIFIER_ASYNC_CLASSIFYLOCAL_TIME, startTime); + + // |callback| is captured as const value so ... + auto cb = const_cast(callback.get()); + cb->OnClassifyComplete(NS_OK, // Not used. + matchedLists, + EmptyCString(), // provider. (Not used) + EmptyCString()); // prefix. (Not used) + }); + + NS_DispatchToMainThread(cbRunnable); + }); return gDbBackgroundThread->Dispatch(r, NS_DISPATCH_NORMAL); } @@ -2268,10 +2266,8 @@ nsUrlClassifierDBService::Shutdown() // between main thread and the worker thread. (Both threads // would access Classifier::mUpdateThread.) using Worker = nsUrlClassifierDBServiceWorker; - RefPtr r = NewRunnableMethod( - "nsUrlClassifierDBServiceWorker::FlushAndDisableAsyncUpdate", - mWorker, - &Worker::FlushAndDisableAsyncUpdate); + RefPtr r = + NewRunnableMethod(mWorker, &Worker::FlushAndDisableAsyncUpdate); SyncRunnable::DispatchToThread(gDbBackgroundThread, r); // At this point the update thread has been shut down and diff --git a/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp b/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp index e5ff0dbc1604a..b48ae6bd666d7 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp @@ -113,8 +113,7 @@ NS_IMETHODIMP UrlClassifierDBServiceWorkerProxy::FinishStream() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::FinishStream", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::FinishStream); return DispatchToWorkerThread(r); } @@ -148,8 +147,7 @@ NS_IMETHODIMP UrlClassifierDBServiceWorkerProxy::FinishUpdate() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::FinishUpdate", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::FinishUpdate); return DispatchToWorkerThread(r); } @@ -158,8 +156,7 @@ NS_IMETHODIMP UrlClassifierDBServiceWorkerProxy::CancelUpdate() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::CancelUpdate", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::CancelUpdate); return DispatchToWorkerThread(r); } @@ -168,8 +165,7 @@ NS_IMETHODIMP UrlClassifierDBServiceWorkerProxy::ResetDatabase() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::ResetDatabase", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::ResetDatabase); return DispatchToWorkerThread(r); } @@ -178,8 +174,7 @@ NS_IMETHODIMP UrlClassifierDBServiceWorkerProxy::ReloadDatabase() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::ReloadDatabase", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::ReloadDatabase); return DispatchToWorkerThread(r); } @@ -188,8 +183,7 @@ NS_IMETHODIMP UrlClassifierDBServiceWorkerProxy::ClearCache() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::ClearCache", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::ClearCache); return DispatchToWorkerThread(r); } @@ -198,8 +192,7 @@ nsresult UrlClassifierDBServiceWorkerProxy::OpenDb() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::OpenDb", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::OpenDb); return DispatchToWorkerThread(r); } @@ -208,8 +201,7 @@ nsresult UrlClassifierDBServiceWorkerProxy::CloseDb() { nsCOMPtr r = - NewRunnableMethod("nsUrlClassifierDBServiceWorker::CloseDb", - mTarget, + NewRunnableMethod(mTarget, &nsUrlClassifierDBServiceWorker::CloseDb); return DispatchToWorkerThread(r); } diff --git a/toolkit/components/url-classifier/nsUrlClassifierProxies.h b/toolkit/components/url-classifier/nsUrlClassifierProxies.h index f337ed0fe2d24..cad88316657c1 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierProxies.h +++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.h @@ -35,8 +35,7 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService nsIPrincipal* aPrincipal, const nsACString& aTables, nsIUrlClassifierCallback* aCB) - : mozilla::Runnable("UrlClassifierDBServiceWorkerProxy::LookupRunnable") - , mTarget(aTarget) + : mTarget(aTarget) , mPrincipal(aPrincipal) , mLookupTables(aTables) , mCB(aCB) @@ -56,9 +55,7 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService public: GetTablesRunnable(nsUrlClassifierDBServiceWorker* aTarget, nsIUrlClassifierCallback* aCB) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::GetTablesRunnable") - , mTarget(aTarget) + : mTarget(aTarget) , mCB(aCB) { } @@ -75,9 +72,7 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService BeginUpdateRunnable(nsUrlClassifierDBServiceWorker* aTarget, nsIUrlClassifierUpdateObserver* aUpdater, const nsACString& aTables) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::BeginUpdateRunnable") - , mTarget(aTarget) + : mTarget(aTarget) , mUpdater(aUpdater) , mTables(aTables) { } @@ -95,9 +90,7 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService public: BeginStreamRunnable(nsUrlClassifierDBServiceWorker* aTarget, const nsACString& aTable) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::BeginStreamRunnable") - , mTarget(aTarget) + : mTarget(aTarget) , mTable(aTable) { } @@ -113,9 +106,7 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService public: UpdateStreamRunnable(nsUrlClassifierDBServiceWorker* aTarget, const nsACString& aUpdateChunk) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::UpdateStreamRunnable") - , mTarget(aTarget) + : mTarget(aTarget) , mUpdateChunk(aUpdateChunk) { } @@ -130,10 +121,8 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService { public: CacheCompletionsRunnable(nsUrlClassifierDBServiceWorker* aTarget, - mozilla::safebrowsing::CacheResultArray* aEntries) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::CacheCompletionsRunnable") - , mTarget(aTarget) + mozilla::safebrowsing::CacheResultArray *aEntries) + : mTarget(aTarget) , mEntries(aEntries) { } @@ -151,9 +140,7 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService const nsACString& spec, const nsACString& tables, mozilla::safebrowsing::LookupResultArray* results) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::DoLocalLookupRunnable") - , mTarget(aTarget) + : mTarget(aTarget) , mSpec(spec) , mTables(tables) , mResults(results) @@ -172,9 +159,7 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService { public: explicit ClearLastResultsRunnable(nsUrlClassifierDBServiceWorker* aTarget) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::ClearLastResultsRunnable") - , mTarget(aTarget) + : mTarget(aTarget) { } NS_DECL_NSIRUNNABLE @@ -188,11 +173,9 @@ class UrlClassifierDBServiceWorkerProxy final : public nsIUrlClassifierDBService explicit GetCacheInfoRunnable(nsUrlClassifierDBServiceWorker* aTarget, const nsACString& aTable, nsIUrlClassifierCacheInfo** aCache) - : mozilla::Runnable( - "UrlClassifierDBServiceWorkerProxy::GetCacheInfoRunnable") - , mTarget(aTarget) - , mTable(aTable) - , mCache(aCache) + : mTarget(aTarget), + mTable(aTable), + mCache(aCache) { } NS_DECL_NSIRUNNABLE @@ -237,12 +220,9 @@ class UrlClassifierLookupCallbackProxy final : class LookupCompleteRunnable : public mozilla::Runnable { public: - LookupCompleteRunnable( - const nsMainThreadPtrHandle& aTarget, - mozilla::safebrowsing::LookupResultArray* aResults) - : mozilla::Runnable( - "UrlClassifierLookupCallbackProxy::LookupCompleteRunnable") - , mTarget(aTarget) + LookupCompleteRunnable(const nsMainThreadPtrHandle& aTarget, + mozilla::safebrowsing::LookupResultArray *aResults) + : mTarget(aTarget) , mResults(aResults) { } @@ -273,11 +253,9 @@ class UrlClassifierCallbackProxy final : public nsIUrlClassifierCallback class HandleEventRunnable : public mozilla::Runnable { public: - HandleEventRunnable( - const nsMainThreadPtrHandle& aTarget, - const nsACString& aValue) - : mozilla::Runnable("UrlClassifierCallbackProxy::HandleEventRunnable") - , mTarget(aTarget) + HandleEventRunnable(const nsMainThreadPtrHandle& aTarget, + const nsACString& aValue) + : mTarget(aTarget) , mValue(aValue) { } @@ -309,13 +287,10 @@ class UrlClassifierUpdateObserverProxy final : class UpdateUrlRequestedRunnable : public mozilla::Runnable { public: - UpdateUrlRequestedRunnable( - const nsMainThreadPtrHandle& aTarget, - const nsACString& aURL, - const nsACString& aTable) - : mozilla::Runnable( - "UrlClassifierUpdateObserverProxy::UpdateUrlRequestedRunnable") - , mTarget(aTarget) + UpdateUrlRequestedRunnable(const nsMainThreadPtrHandle& aTarget, + const nsACString& aURL, + const nsACString& aTable) + : mTarget(aTarget) , mURL(aURL) , mTable(aTable) { } @@ -330,13 +305,9 @@ class UrlClassifierUpdateObserverProxy final : class StreamFinishedRunnable : public mozilla::Runnable { public: - StreamFinishedRunnable( - const nsMainThreadPtrHandle& aTarget, - nsresult aStatus, - uint32_t aDelay) - : mozilla::Runnable( - "UrlClassifierUpdateObserverProxy::StreamFinishedRunnable") - , mTarget(aTarget) + StreamFinishedRunnable(const nsMainThreadPtrHandle& aTarget, + nsresult aStatus, uint32_t aDelay) + : mTarget(aTarget) , mStatus(aStatus) , mDelay(aDelay) { } @@ -352,12 +323,9 @@ class UrlClassifierUpdateObserverProxy final : class UpdateErrorRunnable : public mozilla::Runnable { public: - UpdateErrorRunnable( - const nsMainThreadPtrHandle& aTarget, - nsresult aError) - : mozilla::Runnable( - "UrlClassifierUpdateObserverProxy::UpdateErrorRunnable") - , mTarget(aTarget) + UpdateErrorRunnable(const nsMainThreadPtrHandle& aTarget, + nsresult aError) + : mTarget(aTarget) , mError(aError) { } @@ -371,12 +339,9 @@ class UrlClassifierUpdateObserverProxy final : class UpdateSuccessRunnable : public mozilla::Runnable { public: - UpdateSuccessRunnable( - const nsMainThreadPtrHandle& aTarget, - uint32_t aRequestedTimeout) - : mozilla::Runnable( - "UrlClassifierUpdateObserverProxy::UpdateSuccessRunnable") - , mTarget(aTarget) + UpdateSuccessRunnable(const nsMainThreadPtrHandle& aTarget, + uint32_t aRequestedTimeout) + : mTarget(aTarget) , mRequestedTimeout(aRequestedTimeout) { } diff --git a/toolkit/components/url-classifier/tests/gtest/Common.cpp b/toolkit/components/url-classifier/tests/gtest/Common.cpp index 2d11cf87cccab..e8f89e854cd53 100644 --- a/toolkit/components/url-classifier/tests/gtest/Common.cpp +++ b/toolkit/components/url-classifier/tests/gtest/Common.cpp @@ -15,8 +15,7 @@ using namespace mozilla::safebrowsing; template void RunTestInNewThread(Function&& aFunction) { - nsCOMPtr r = NS_NewRunnableFunction( - "RunTestInNewThread", mozilla::Forward(aFunction)); + nsCOMPtr r = NS_NewRunnableFunction(mozilla::Forward(aFunction)); nsCOMPtr testingThread; nsresult rv = NS_NewNamedThread("Testing Thread", getter_AddRefs(testingThread), r); @@ -36,15 +35,14 @@ nsresult SyncApplyUpdates(Classifier* aClassifier, auto onUpdateComplete = [&done, &ret](nsresult rv) { // We are on the "ApplyUpdate" thread. Post an event to main thread // so that we can avoid busy waiting on the main thread. - nsCOMPtr r = - NS_NewRunnableFunction("SyncApplyUpdates", [&done, &ret, rv] { - ret = rv; - done = true; - }); + nsCOMPtr r = NS_NewRunnableFunction([&done, &ret, rv] { + ret = rv; + done = true; + }); NS_DispatchToMainThread(r); }; - nsCOMPtr r = NS_NewRunnableFunction("SyncApplyUpdates", [&]() { + nsCOMPtr r = NS_NewRunnableFunction([&]() { nsresult rv = aClassifier->AsyncApplyUpdates(aUpdates, onUpdateComplete); if (NS_FAILED(rv)) { onUpdateComplete(rv); diff --git a/toolkit/crashreporter/InjectCrashReporter.cpp b/toolkit/crashreporter/InjectCrashReporter.cpp index 22c200f1b028e..e82c8ee4d86ba 100644 --- a/toolkit/crashreporter/InjectCrashReporter.cpp +++ b/toolkit/crashreporter/InjectCrashReporter.cpp @@ -17,8 +17,7 @@ using CrashReporter::GetChildNotificationPipe; namespace mozilla { InjectCrashRunnable::InjectCrashRunnable(DWORD pid) - : Runnable("InjectCrashRunnable") - , mPID(pid) + : mPID(pid) { nsCOMPtr dll; nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(dll)); diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 97f636a45c512..f9eed55cd4c49 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -321,7 +321,7 @@ static nsIThread* sInjectorThread; class ReportInjectedCrash : public Runnable { public: - explicit ReportInjectedCrash(uint32_t pid) : Runnable("ReportInjectedCrash"), mPID(pid) { } + explicit ReportInjectedCrash(uint32_t pid) : mPID(pid) { } NS_IMETHOD Run(); @@ -3444,7 +3444,6 @@ OOPInit() class ProxyToMainThread : public Runnable { public: - ProxyToMainThread() : Runnable("nsExceptionHandler::ProxyToMainThread") {} NS_IMETHOD Run() override { OOPInit(); return NS_OK; diff --git a/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp b/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp index 7cb84905ee868..a4325e6dd42f8 100644 --- a/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp +++ b/toolkit/crashreporter/test/gtest/TestCrashThreadAnnotation.cpp @@ -79,14 +79,13 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_AfterShutdown) already_AddRefed CreateTestThread(const char* aName, Monitor& aMonitor, bool& aDone) { - nsCOMPtr setNameRunnable = NS_NewRunnableFunction( - "CrashReporter::CreateTestThread", [aName, &aMonitor, &aDone]() -> void { - NS_SetCurrentThreadName(aName); - - MonitorAutoLock lock(aMonitor); - aDone = true; - aMonitor.NotifyAll(); - }); + nsCOMPtr setNameRunnable = NS_NewRunnableFunction([aName, &aMonitor, &aDone] () -> void { + NS_SetCurrentThreadName(aName); + + MonitorAutoLock lock(aMonitor); + aDone = true; + aMonitor.NotifyAll(); + }); nsCOMPtr thread; mozilla::Unused << NS_NewThread(getter_AddRefs(thread), setNameRunnable); @@ -127,18 +126,15 @@ TEST(TestCrashThreadAnnotation, TestGetFlatThreadAnnotation_SetNameTwice) Monitor monitor("TestCrashThreadAnnotation"); bool threadNameSet = false; - nsCOMPtr setNameRunnable = NS_NewRunnableFunction( - "CrashReporter::TestCrashThreadAnnotation_TestGetFlatThreadAnnotation_" - "SetNameTwice_Test::TestBody", - [&]() -> void { - NS_SetCurrentThreadName("Thread1"); - // Set the name again. We should get the latest name. - NS_SetCurrentThreadName("Thread1Again"); - - MonitorAutoLock lock(monitor); - threadNameSet = true; - monitor.NotifyAll(); - }); + nsCOMPtr setNameRunnable = NS_NewRunnableFunction([&] () -> void { + NS_SetCurrentThreadName("Thread1"); + // Set the name again. We should get the latest name. + NS_SetCurrentThreadName("Thread1Again"); + + MonitorAutoLock lock(monitor); + threadNameSet = true; + monitor.NotifyAll(); + }); nsCOMPtr thread; nsresult rv = NS_NewThread(getter_AddRefs(thread), setNameRunnable); ASSERT_TRUE(NS_SUCCEEDED(rv)); diff --git a/toolkit/xre/ProfileReset.h b/toolkit/xre/ProfileReset.h index 503ef6035086d..a164fe07513b2 100644 --- a/toolkit/xre/ProfileReset.h +++ b/toolkit/xre/ProfileReset.h @@ -20,8 +20,7 @@ class ProfileResetCleanupResultTask : public mozilla::Runnable { public: ProfileResetCleanupResultTask() - : mozilla::Runnable("ProfileResetCleanupResultTask") - , mWorkerThread(do_GetCurrentThread()) + : mWorkerThread(do_GetCurrentThread()) { MOZ_ASSERT(!NS_IsMainThread()); } @@ -39,12 +38,9 @@ class ProfileResetCleanupResultTask : public mozilla::Runnable class ProfileResetCleanupAsyncTask : public mozilla::Runnable { public: - ProfileResetCleanupAsyncTask(nsIFile* aProfileDir, - nsIFile* aProfileLocalDir, - nsIFile* aTargetDir, - const nsAString& aLeafName) - : mozilla::Runnable("ProfileResetCleanupAsyncTask") - , mProfileDir(aProfileDir) + ProfileResetCleanupAsyncTask(nsIFile* aProfileDir, nsIFile* aProfileLocalDir, + nsIFile* aTargetDir, const nsAString &aLeafName) + : mProfileDir(aProfileDir) , mProfileLocalDir(aProfileLocalDir) , mTargetDir(aTargetDir) , mLeafName(aLeafName) diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 8d40f84db1ed1..1fbcc961a728d 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -751,10 +751,10 @@ class MainFunctionRunnable : public Runnable public: NS_DECL_NSIRUNNABLE - MainFunctionRunnable(MainFunction aFunction, void* aData) - : mozilla::Runnable("MainFunctionRunnable") - , mFunction(aFunction) - , mData(aData) + MainFunctionRunnable(MainFunction aFunction, + void* aData) + : mFunction(aFunction), + mData(aData) { NS_ASSERTION(aFunction, "Don't give me a null pointer!"); } diff --git a/toolkit/xre/nsNativeAppSupportUnix.cpp b/toolkit/xre/nsNativeAppSupportUnix.cpp index 0fb613bef33b3..a04a79953cb01 100644 --- a/toolkit/xre/nsNativeAppSupportUnix.cpp +++ b/toolkit/xre/nsNativeAppSupportUnix.cpp @@ -254,10 +254,7 @@ nsNativeAppSupportUnix::InteractCB(SmcConn smc_conn, SmPointer client_data) // means we won't process any more. libsm hates us if we do the InteractDone // with a pending ShutdownCancelled, and we would certainly like to handle Die // whilst a dialog is displayed - NS_DispatchToCurrentThread( - NewRunnableMethod("nsNativeAppSupportUnix::DoInteract", - self, - &nsNativeAppSupportUnix::DoInteract)); + NS_DispatchToCurrentThread(NewRunnableMethod(self, &nsNativeAppSupportUnix::DoInteract)); } void diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index e79a49061ef6c..79ff15d7e277c 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -83,8 +83,7 @@ UpdateDriverSetupMacCommandLine(int& argc, char**& argv, bool restart) Monitor monitor("nsUpdateDriver SetupMacCommandLine"); nsresult rv = NS_DispatchToMainThread( - NS_NewRunnableFunction("UpdateDriverSetupMacCommandLine", - [&argc, &argv, restart, &monitor]() -> void + NS_NewRunnableFunction([&argc, &argv, restart, &monitor]() -> void { CommandLineServiceMac::SetupMacCommandLine(argc, argv, restart); MonitorAutoLock(monitor).Notify(); @@ -918,10 +917,7 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) mInfo.mAppVersion = appVersion; MOZ_ASSERT(NS_IsMainThread(), "not main thread"); - nsCOMPtr r = - NewRunnableMethod("nsUpdateProcessor::StartStagedUpdate", - this, - &nsUpdateProcessor::StartStagedUpdate); + nsCOMPtr r = NewRunnableMethod(this, &nsUpdateProcessor::StartStagedUpdate); return NS_NewNamedThread("Update Watcher", getter_AddRefs(mProcessWatcher), r); } @@ -945,19 +941,13 @@ nsUpdateProcessor::StartStagedUpdate() if (mUpdaterPID) { // Track the state of the updater process while it is staging an update. - rv = NS_DispatchToCurrentThread( - NewRunnableMethod("nsUpdateProcessor::WaitForProcess", - this, - &nsUpdateProcessor::WaitForProcess)); + rv = NS_DispatchToCurrentThread(NewRunnableMethod(this, &nsUpdateProcessor::WaitForProcess)); NS_ENSURE_SUCCESS_VOID(rv); } else { // Failed to launch the updater process for some reason. // We need to shutdown the current thread as there isn't anything more for // us to do... - rv = NS_DispatchToMainThread( - NewRunnableMethod("nsUpdateProcessor::ShutdownWatcherThread", - this, - &nsUpdateProcessor::ShutdownWatcherThread)); + rv = NS_DispatchToMainThread(NewRunnableMethod(this, &nsUpdateProcessor::ShutdownWatcherThread)); NS_ENSURE_SUCCESS_VOID(rv); } } @@ -975,13 +965,9 @@ nsUpdateProcessor::WaitForProcess() { MOZ_ASSERT(!NS_IsMainThread(), "main thread"); if (ProcessHasTerminated(mUpdaterPID)) { - NS_DispatchToMainThread(NewRunnableMethod( - "nsUpdateProcessor::UpdateDone", this, &nsUpdateProcessor::UpdateDone)); + NS_DispatchToMainThread(NewRunnableMethod(this, &nsUpdateProcessor::UpdateDone)); } else { - NS_DispatchToCurrentThread( - NewRunnableMethod("nsUpdateProcessor::WaitForProcess", - this, - &nsUpdateProcessor::WaitForProcess)); + NS_DispatchToCurrentThread(NewRunnableMethod(this, &nsUpdateProcessor::WaitForProcess)); } } diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 13aea4476dd33..24f50b4ec9c70 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -337,10 +337,9 @@ class ActivePS IOInterposer::Register(IOInterposeObserver::OpAll, mInterposeObserver); } else { RefPtr observer = mInterposeObserver; - NS_DispatchToMainThread( - NS_NewRunnableFunction("ActivePS::ActivePS", [=]() { - IOInterposer::Register(IOInterposeObserver::OpAll, observer); - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([=]() { + IOInterposer::Register(IOInterposeObserver::OpAll, observer); + })); } } } @@ -354,10 +353,9 @@ class ActivePS IOInterposer::Unregister(IOInterposeObserver::OpAll, mInterposeObserver); } else { RefPtr observer = mInterposeObserver; - NS_DispatchToMainThread( - NS_NewRunnableFunction("ActivePS::~ActivePS", [=]() { - IOInterposer::Unregister(IOInterposeObserver::OpAll, observer); - })); + NS_DispatchToMainThread(NS_NewRunnableFunction([=]() { + IOInterposer::Unregister(IOInterposeObserver::OpAll, observer); + })); } } } @@ -2048,8 +2046,9 @@ NotifyObservers(const char* aTopic, nsISupports* aSubject = nullptr) // these notifications are only observed in the parent process, where the // profiler_* functions are currently only called on the main thread. nsCOMPtr subject = aSubject; - NS_DispatchToMainThread(NS_NewRunnableFunction( - "NotifyObservers", [=] { NotifyObservers(aTopic, subject); })); + NS_DispatchToMainThread(NS_NewRunnableFunction([=] { + NotifyObservers(aTopic, subject); + })); return; } diff --git a/tools/profiler/gecko/ChildProfilerController.cpp b/tools/profiler/gecko/ChildProfilerController.cpp index 230a9cdf95b39..9ecdf22819925 100644 --- a/tools/profiler/gecko/ChildProfilerController.cpp +++ b/tools/profiler/gecko/ChildProfilerController.cpp @@ -32,11 +32,8 @@ ChildProfilerController::Init(Endpoint&& aEndpoint) if (NS_SUCCEEDED(NS_NewNamedThread("ProfilerChild", getter_AddRefs(mThread)))) { // Now that mThread has been set, run SetupProfilerChild on the thread. mThread->Dispatch(NewRunnableMethod&&>( - "ChildProfilerController::SetupProfilerChild", - this, - &ChildProfilerController::SetupProfilerChild, - Move(aEndpoint)), - NS_DISPATCH_NORMAL); + this, &ChildProfilerController::SetupProfilerChild, Move(aEndpoint)), + NS_DISPATCH_NORMAL); } } @@ -59,11 +56,8 @@ ChildProfilerController::ShutdownAndMaybeGrabShutdownProfileFirst(nsCString* aOu { if (mThread) { mThread->Dispatch(NewRunnableMethod( - "ChildProfilerController::ShutdownProfilerChild", - this, - &ChildProfilerController::ShutdownProfilerChild, - aOutShutdownProfile), - NS_DISPATCH_NORMAL); + this, &ChildProfilerController::ShutdownProfilerChild, aOutShutdownProfile), + NS_DISPATCH_NORMAL); // Shut down the thread. This call will spin until all runnables (including // the ShutdownProfilerChild runnable) have been processed. mThread->Shutdown(); diff --git a/tools/profiler/gecko/ThreadResponsiveness.cpp b/tools/profiler/gecko/ThreadResponsiveness.cpp index 8cc7d20ef359d..4f411f0754a87 100644 --- a/tools/profiler/gecko/ThreadResponsiveness.cpp +++ b/tools/profiler/gecko/ThreadResponsiveness.cpp @@ -18,8 +18,7 @@ class CheckResponsivenessTask : public mozilla::Runnable, public nsITimerCallback { public: CheckResponsivenessTask() - : mozilla::Runnable("CheckResponsivenessTask") - , mLastTracerTime(TimeStamp::Now()) + : mLastTracerTime(TimeStamp::Now()) , mMutex("CheckResponsivenessTask") , mTimer(nullptr) , mHasEverBeenSuccessfullyDispatched(false) diff --git a/tools/profiler/tests/gtest/GeckoProfiler.cpp b/tools/profiler/tests/gtest/GeckoProfiler.cpp index dc883b99d5c99..e4befc4622b8a 100644 --- a/tools/profiler/tests/gtest/GeckoProfiler.cpp +++ b/tools/profiler/tests/gtest/GeckoProfiler.cpp @@ -184,16 +184,10 @@ TEST(GeckoProfiler, DifferentThreads) uint32_t features = ProfilerFeature::JS | ProfilerFeature::Threads; const char* filters[] = { "GeckoMain", "Compositor" }; - thread->Dispatch( - NS_NewRunnableFunction("GeckoProfiler_DifferentThreads_Test::TestBody", - [&]() { - profiler_start(PROFILER_DEFAULT_ENTRIES, - PROFILER_DEFAULT_INTERVAL, - features, - filters, - MOZ_ARRAY_LENGTH(filters)); - }), - NS_DISPATCH_SYNC); + thread->Dispatch(NS_NewRunnableFunction([&]() { + profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, + features, filters, MOZ_ARRAY_LENGTH(filters)); + }), NS_DISPATCH_SYNC); ASSERT_TRUE(profiler_is_active()); ASSERT_TRUE(!profiler_feature_active(ProfilerFeature::GPU)); @@ -203,10 +197,9 @@ TEST(GeckoProfiler, DifferentThreads) ActiveParamsCheck(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, features, filters, MOZ_ARRAY_LENGTH(filters)); - thread->Dispatch( - NS_NewRunnableFunction("GeckoProfiler_DifferentThreads_Test::TestBody", - [&]() { profiler_stop(); }), - NS_DISPATCH_SYNC); + thread->Dispatch(NS_NewRunnableFunction([&]() { + profiler_stop(); + }), NS_DISPATCH_SYNC); InactiveFeaturesAndParamsCheck(); } @@ -220,29 +213,21 @@ TEST(GeckoProfiler, DifferentThreads) profiler_start(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, features, filters, MOZ_ARRAY_LENGTH(filters)); - thread->Dispatch( - NS_NewRunnableFunction( - "GeckoProfiler_DifferentThreads_Test::TestBody", - [&]() { - ASSERT_TRUE(profiler_is_active()); - ASSERT_TRUE(!profiler_feature_active(ProfilerFeature::GPU)); - ASSERT_TRUE(!profiler_feature_active(ProfilerFeature::Privacy)); - ASSERT_TRUE(!profiler_feature_active(ProfilerFeature::Restyle)); - - ActiveParamsCheck(PROFILER_DEFAULT_ENTRIES, - PROFILER_DEFAULT_INTERVAL, - features, - filters, - MOZ_ARRAY_LENGTH(filters)); - }), - NS_DISPATCH_SYNC); + thread->Dispatch(NS_NewRunnableFunction([&]() { + ASSERT_TRUE(profiler_is_active()); + ASSERT_TRUE(!profiler_feature_active(ProfilerFeature::GPU)); + ASSERT_TRUE(!profiler_feature_active(ProfilerFeature::Privacy)); + ASSERT_TRUE(!profiler_feature_active(ProfilerFeature::Restyle)); + + ActiveParamsCheck(PROFILER_DEFAULT_ENTRIES, PROFILER_DEFAULT_INTERVAL, + features, filters, MOZ_ARRAY_LENGTH(filters)); + }), NS_DISPATCH_SYNC); profiler_stop(); - thread->Dispatch( - NS_NewRunnableFunction("GeckoProfiler_DifferentThreads_Test::TestBody", - [&]() { InactiveFeaturesAndParamsCheck(); }), - NS_DISPATCH_SYNC); + thread->Dispatch(NS_NewRunnableFunction([&]() { + InactiveFeaturesAndParamsCheck(); + }), NS_DISPATCH_SYNC); } thread->Shutdown(); @@ -557,15 +542,11 @@ TEST(GeckoProfiler, StreamJSONForThisProcessThreaded) features, filters, MOZ_ARRAY_LENGTH(filters)); // Call profiler_stream_json_for_this_process on a background thread. - thread->Dispatch( - NS_NewRunnableFunction( - "GeckoProfiler_StreamJSONForThisProcessThreaded_Test::TestBody", - [&]() { - w.Start(SpliceableJSONWriter::SingleLineStyle); - ASSERT_TRUE(profiler_stream_json_for_this_process(w)); - w.End(); - }), - NS_DISPATCH_SYNC); + thread->Dispatch(NS_NewRunnableFunction([&]() { + w.Start(SpliceableJSONWriter::SingleLineStyle); + ASSERT_TRUE(profiler_stream_json_for_this_process(w)); + w.End(); + }), NS_DISPATCH_SYNC); UniquePtr profile = w.WriteFunc()->CopyData(); @@ -573,14 +554,10 @@ TEST(GeckoProfiler, StreamJSONForThisProcessThreaded) // Stop the profiler and call profiler_stream_json_for_this_process on a // background thread. - thread->Dispatch( - NS_NewRunnableFunction( - "GeckoProfiler_StreamJSONForThisProcessThreaded_Test::TestBody", - [&]() { - profiler_stop(); - ASSERT_TRUE(!profiler_stream_json_for_this_process(w)); - }), - NS_DISPATCH_SYNC); + thread->Dispatch(NS_NewRunnableFunction([&]() { + profiler_stop(); + ASSERT_TRUE(!profiler_stream_json_for_this_process(w)); + }), NS_DISPATCH_SYNC); thread->Shutdown(); // Call profiler_stream_json_for_this_process on the main thread. diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index ab3a57ea97e0b..6081797bedab7 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -1751,10 +1751,8 @@ nsOfflineCacheUpdate::Begin() mItemsInProgress = 0; if (mState == STATE_CANCELLED) { - nsresult rv = NS_DispatchToMainThread( - NewRunnableMethod("nsOfflineCacheUpdate::AsyncFinishWithError", - this, - &nsOfflineCacheUpdate::AsyncFinishWithError)); + nsresult rv = NS_DispatchToMainThread(NewRunnableMethod(this, + &nsOfflineCacheUpdate::AsyncFinishWithError)); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; diff --git a/view/nsView.cpp b/view/nsView.cpp index d4e0bfb22e4f2..c1de2ecca4e14 100644 --- a/view/nsView.cpp +++ b/view/nsView.cpp @@ -134,11 +134,7 @@ class DestroyWidgetRunnable : public Runnable { public: NS_DECL_NSIRUNNABLE - explicit DestroyWidgetRunnable(nsIWidget* aWidget) - : mozilla::Runnable("DestroyWidgetRunnable") - , mWidget(aWidget) - { - } + explicit DestroyWidgetRunnable(nsIWidget* aWidget) : mWidget(aWidget) {} private: nsCOMPtr mWidget; diff --git a/widget/VsyncDispatcher.cpp b/widget/VsyncDispatcher.cpp index cac138b7b08e4..f6aeee54d4a03 100644 --- a/widget/VsyncDispatcher.cpp +++ b/widget/VsyncDispatcher.cpp @@ -73,11 +73,9 @@ CompositorVsyncDispatcher::SetCompositorVsyncObserver(VsyncObserver* aVsyncObser } bool observeVsync = aVsyncObserver != nullptr; - nsCOMPtr vsyncControl = - NewRunnableMethod("CompositorVsyncDispatcher::ObserveVsync", - this, - &CompositorVsyncDispatcher::ObserveVsync, - observeVsync); + nsCOMPtr vsyncControl = NewRunnableMethod(this, + &CompositorVsyncDispatcher::ObserveVsync, + observeVsync); NS_DispatchToMainThread(vsyncControl); } @@ -166,10 +164,8 @@ void RefreshTimerVsyncDispatcher::UpdateVsyncStatus() { if (!NS_IsMainThread()) { - NS_DispatchToMainThread( - NewRunnableMethod("RefreshTimerVsyncDispatcher::UpdateVsyncStatus", - this, - &RefreshTimerVsyncDispatcher::UpdateVsyncStatus)); + NS_DispatchToMainThread(NewRunnableMethod(this, + &RefreshTimerVsyncDispatcher::UpdateVsyncStatus)); return; } diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index f97b2052c727e..adeac2357c479 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -564,7 +564,7 @@ AndroidBridge::GetStaticStringField(const char *className, const char *fieldName namespace mozilla { class TracerRunnable : public Runnable{ public: - TracerRunnable() : Runnable("TracerRunnable") { + TracerRunnable() { mTracerLock = new Mutex("TracerRunnable"); mTracerCondVar = new CondVar(*mTracerLock, "TracerRunnable"); mMainThread = do_GetMainThread(); diff --git a/widget/android/AndroidJNIWrapper.cpp b/widget/android/AndroidJNIWrapper.cpp index 14af0e02fedc4..e549c6fc7ca53 100644 --- a/widget/android/AndroidJNIWrapper.cpp +++ b/widget/android/AndroidJNIWrapper.cpp @@ -20,7 +20,6 @@ extern "C" { class GetGlobalClassRefRunnable : public mozilla::Runnable { public: GetGlobalClassRefRunnable(const char *className, jclass *foundClass) : - mozilla::Runnable("GetGlobalClassRefRunnable"), mClassName(className), mResult(foundClass) {} NS_IMETHOD Run() override { *mResult = __jsjni_GetGlobalClassRef(mClassName); diff --git a/widget/android/AndroidUiThread.cpp b/widget/android/AndroidUiThread.cpp index ac97d289c370d..98b876b2bb29c 100644 --- a/widget/android/AndroidUiThread.cpp +++ b/widget/android/AndroidUiThread.cpp @@ -105,7 +105,7 @@ NS_IMPL_ISUPPORTS(ThreadObserver, nsIThreadObserver) NS_IMETHODIMP ThreadObserver::OnDispatchedEvent(nsIThreadInternal *thread) { - AndroidBridge::Bridge()->PostTaskToUiThread(NS_NewRunnableFunction("PumpEvents", &PumpEvents), 0); + AndroidBridge::Bridge()->PostTaskToUiThread(NS_NewRunnableFunction(&PumpEvents), 0); return NS_OK; } @@ -123,7 +123,7 @@ ThreadObserver::AfterProcessNextEvent(nsIThreadInternal *thread, bool eventWasPr class CreateOnUiThread : public Runnable { public: - CreateOnUiThread() : Runnable("CreateOnUiThread") + CreateOnUiThread() {} NS_IMETHOD Run() override { @@ -141,7 +141,7 @@ class CreateOnUiThread : public Runnable { class DestroyOnUiThread : public Runnable { public: - DestroyOnUiThread() : Runnable("DestroyOnUiThread"), mDestroyed(false) + DestroyOnUiThread() : mDestroyed(false) {} NS_IMETHOD Run() override { diff --git a/widget/android/EventDispatcher.cpp b/widget/android/EventDispatcher.cpp index d188563f5e26a..736889ba926fc 100644 --- a/widget/android/EventDispatcher.cpp +++ b/widget/android/EventDispatcher.cpp @@ -650,7 +650,7 @@ class NativeCallbackDelegateSupport final : // Invoke callbacks synchronously if we're already on Gecko thread. return aCall(); } - NS_DispatchToMainThread(NS_NewRunnableFunction("OnNativeCall", Move(aCall))); + NS_DispatchToMainThread(NS_NewRunnableFunction(Move(aCall))); } static void Finalize(const CallbackDelegate::LocalRef& aInstance) diff --git a/widget/android/fennec/ThumbnailHelper.h b/widget/android/fennec/ThumbnailHelper.h index 8908a55e85fdd..192e15c5271fc 100644 --- a/widget/android/fennec/ThumbnailHelper.h +++ b/widget/android/fennec/ThumbnailHelper.h @@ -206,7 +206,7 @@ class ThumbnailHelper final void Run() override { MessageLoop::current()->PostIdleTask( - NS_NewRunnableFunction("OnNativeCall", Move(Base::lambda))); + NS_NewRunnableFunction(Move(Base::lambda))); } }; diff --git a/widget/android/jni/Natives.h b/widget/android/jni/Natives.h index 427de483e21d8..13c93a61c29bd 100644 --- a/widget/android/jni/Natives.h +++ b/widget/android/jni/Natives.h @@ -529,7 +529,7 @@ struct Dispatcher // For a static method, do not forward the "this arg" (i.e. the class // local ref) if the implementation does not request it. This saves us // a pair of calls to add/delete global ref. - NS_DispatchToMainThread(NS_NewRunnableFunction("ProxyNativeCall", ProxyNativeCall< + NS_DispatchToMainThread(NS_NewRunnableFunction(ProxyNativeCall< Impl, typename Traits::Owner, IsStatic, HasThisArg, Args...>(HasThisArg || !IsStatic ? thisArg : nullptr, Forward(args)...))); diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index d896de80404b3..d83d07a16f1a6 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -149,7 +149,6 @@ class GeckoThreadSupport final { struct NoOpRunnable : Runnable { - NoOpRunnable() : Runnable("NoOpRunnable") {} NS_IMETHOD Run() override { return NS_OK; } }; diff --git a/widget/android/nsScreenManagerAndroid.cpp b/widget/android/nsScreenManagerAndroid.cpp index 1feafb2e9bab9..3256a19876fdc 100644 --- a/widget/android/nsScreenManagerAndroid.cpp +++ b/widget/android/nsScreenManagerAndroid.cpp @@ -120,7 +120,6 @@ class nsScreenManagerAndroid::ScreenManagerHelperSupport final int32_t screenId = -1; // return value nsCOMPtr mainThread = do_GetMainThread(); SyncRunnable::DispatchToThread(mainThread, NS_NewRunnableFunction( - "nsScreenManagerAndroid::ScreenManagerHelperSupport::AddDisplay", [&aDisplayType, &aWidth, &aHeight, &aDensity, &screenId] { MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr screenMgr = @@ -142,7 +141,6 @@ class nsScreenManagerAndroid::ScreenManagerHelperSupport final static void RemoveDisplay(int32_t aScreenId) { nsCOMPtr mainThread = do_GetMainThread(); SyncRunnable::DispatchToThread(mainThread, NS_NewRunnableFunction( - "nsScreenManagerAndroid::ScreenManagerHelperSupport::RemoveDisplay", [&aScreenId] { MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr screenMgr = diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index cefaf234f8386..555982aca033d 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -1008,8 +1008,7 @@ class nsWindow::LayerViewSupport final if (!AndroidBridge::IsJavaUiThread()) { RefPtr uiThread = GetAndroidUiThread(); if (uiThread) { - uiThread->Dispatch(NewRunnableMethod("layers::UiCompositorControllerChild::InvalidateAndRender", - child, + uiThread->Dispatch(NewRunnableMethod(child, &UiCompositorControllerChild::InvalidateAndRender), nsIThread::DISPATCH_NORMAL); } @@ -1039,7 +1038,6 @@ class nsWindow::LayerViewSupport final RefPtr uiThread = GetAndroidUiThread(); if (uiThread) { uiThread->Dispatch(NewRunnableMethod( - "layers::UiCompositorControllerChild::SetPinned", child, &UiCompositorControllerChild::SetPinned, aPinned, aReason), nsIThread::DISPATCH_NORMAL); } @@ -1062,7 +1060,6 @@ class nsWindow::LayerViewSupport final RefPtr uiThread = GetAndroidUiThread(); if (uiThread) { uiThread->Dispatch(NewRunnableMethod( - "layers::UiCompositorControllerChild::ToolbarAnimatorMessageFromUI", child, &UiCompositorControllerChild::ToolbarAnimatorMessageFromUI, aMessage), nsIThread::DISPATCH_NORMAL); } diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 1e07d123eef5f..c258b673e7bc1 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -3224,7 +3224,7 @@ explicit AutoBackgroundSetter(NSView* aView) { { public: explicit WidgetsReleaserRunnable(nsTArray>&& aWidgetArray) - : mozilla::Runnable("WidgetsReleaserRunnable"), mWidgetArray(aWidgetArray) + : mWidgetArray(aWidgetArray) { } diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp index 3dadc17d0adde..294c7dd52d987 100644 --- a/widget/gtk/nsDeviceContextSpecG.cpp +++ b/widget/gtk/nsDeviceContextSpecG.cpp @@ -258,10 +258,7 @@ gboolean nsDeviceContextSpecGTK::PrinterEnumerator(GtkPrinter *aPrinter, // misunderstanding what the capabilities of the printer are due to a // GTK bug (https://bugzilla.gnome.org/show_bug.cgi?id=753041). We // sidestep this by deferring the print to the next tick. - NS_DispatchToCurrentThread( - NewRunnableMethod("nsDeviceContextSpecGTK::StartPrintJob", - spec, - &nsDeviceContextSpecGTK::StartPrintJob)); + NS_DispatchToCurrentThread(NewRunnableMethod(spec, &nsDeviceContextSpecGTK::StartPrintJob)); return TRUE; } } @@ -319,10 +316,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument() } else { // We don't have a printer. We have to enumerate the printers and find // one with a matching name. - NS_DispatchToCurrentThread( - NewRunnableMethod("nsDeviceContextSpecGTK::EnumeratePrinters", - this, - &nsDeviceContextSpecGTK::EnumeratePrinters)); + NS_DispatchToCurrentThread(NewRunnableMethod(this, &nsDeviceContextSpecGTK::EnumeratePrinters)); } } else { // Handle print-to-file ourselves for the benefit of embedders diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 5e3d0b6f0d6ed..f91c9acf7ee24 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -2443,8 +2443,7 @@ nsWindow::OnSizeAllocate(GtkAllocation *aAllocation) // GtkWindow callers of gtk_widget_size_allocate expect the signal // handlers to return sometime in the near future. mNeedsDispatchResized = true; - NS_DispatchToCurrentThread(NewRunnableMethod( - "nsWindow::MaybeDispatchResized", this, &nsWindow::MaybeDispatchResized)); + NS_DispatchToCurrentThread(NewRunnableMethod(this, &nsWindow::MaybeDispatchResized)); } void @@ -4732,9 +4731,7 @@ nsWindow::GrabPointer(guint32 aTime) // popups don't rollup while potentially adjusting the grab for // this popup. nsCOMPtr event = - NewRunnableMethod("nsWindow::CheckForRollupDuringGrab", - this, - &nsWindow::CheckForRollupDuringGrab); + NewRunnableMethod(this, &nsWindow::CheckForRollupDuringGrab); NS_DispatchToCurrentThread(event.forget()); } } diff --git a/widget/nsBaseFilePicker.cpp b/widget/nsBaseFilePicker.cpp index 40d4ca69ea195..1ddfdba055a66 100644 --- a/widget/nsBaseFilePicker.cpp +++ b/widget/nsBaseFilePicker.cpp @@ -67,11 +67,10 @@ LocalFileToDirectoryOrBlob(nsPIDOMWindowInner* aWindow, class AsyncShowFilePicker : public mozilla::Runnable { public: - AsyncShowFilePicker(nsIFilePicker* aFilePicker, - nsIFilePickerShownCallback* aCallback) - : mozilla::Runnable("AsyncShowFilePicker") - , mFilePicker(aFilePicker) - , mCallback(aCallback) + AsyncShowFilePicker(nsIFilePicker *aFilePicker, + nsIFilePickerShownCallback *aCallback) : + mFilePicker(aFilePicker), + mCallback(aCallback) { } diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index df8959ece56ad..22b90aa6c7b50 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -927,12 +927,11 @@ void nsBaseWidget::ConfigureAPZCTreeManager() bool aPreventDefault) { MOZ_ASSERT(NS_IsMainThread()); - APZThreadUtils::RunOnControllerThread(NewRunnableMethod( - "layers::IAPZCTreeManager::ContentReceivedInputBlock", - treeManager, - &IAPZCTreeManager::ContentReceivedInputBlock, - aInputBlockId, - aPreventDefault)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod + (treeManager, + &IAPZCTreeManager::ContentReceivedInputBlock, + aInputBlockId, + aPreventDefault)); }); mAPZEventState = new APZEventState(this, mozilla::Move(callback)); @@ -940,14 +939,11 @@ void nsBaseWidget::ConfigureAPZCTreeManager() const nsTArray& aFlags) { MOZ_ASSERT(NS_IsMainThread()); - APZThreadUtils::RunOnControllerThread( - NewRunnableMethod>>( - "layers::IAPZCTreeManager::SetAllowedTouchBehavior", - treeManager, - &IAPZCTreeManager::SetAllowedTouchBehavior, - aInputBlockId, - aFlags)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod + >>(treeManager, + &IAPZCTreeManager::SetAllowedTouchBehavior, + aInputBlockId, aFlags)); }; mRootContentController = CreateRootContentController(); @@ -974,14 +970,10 @@ void nsBaseWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId, const nsTArray& aTargets) const { - APZThreadUtils::RunOnControllerThread( - NewRunnableMethod>>( - "layers::IAPZCTreeManager::SetTargetAPZC", - mAPZC, - &IAPZCTreeManager::SetTargetAPZC, - aInputBlockId, - aTargets)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod + >>(mAPZC, + &IAPZCTreeManager::SetTargetAPZC, + aInputBlockId, aTargets)); } void @@ -1086,8 +1078,7 @@ class DispatchWheelEventOnMainThread : public Runnable nsEventStatus aAPZResult, uint64_t aInputBlockId, ScrollableLayerGuid aGuid) - : mozilla::Runnable("DispatchWheelEventOnMainThread") - , mWheelInput(aWheelInput) + : mWheelInput(aWheelInput) , mWidget(aWidget) , mAPZResult(aAPZResult) , mInputBlockId(aInputBlockId) @@ -1116,8 +1107,7 @@ class DispatchWheelInputOnControllerThread : public Runnable DispatchWheelInputOnControllerThread(const WidgetWheelEvent& aWheelEvent, IAPZCTreeManager* aAPZC, nsBaseWidget* aWidget) - : mozilla::Runnable("DispatchWheelInputOnControllerThread") - , mMainMessageLoop(MessageLoop::current()) + : mMainMessageLoop(MessageLoop::current()) , mWheelInput(aWheelEvent) , mAPZC(aAPZC) , mWidget(aWidget) @@ -1888,13 +1878,10 @@ nsBaseWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) uint64_t layersId = mCompositorSession->RootLayerTreeId(); ScrollableLayerGuid guid(layersId, aDragMetrics.mPresShellId, aDragMetrics.mViewId); - APZThreadUtils::RunOnControllerThread( - NewRunnableMethod( - "layers::IAPZCTreeManager::StartScrollbarDrag", - mAPZC, - &IAPZCTreeManager::StartScrollbarDrag, - guid, - aDragMetrics)); + APZThreadUtils::RunOnControllerThread(NewRunnableMethod + (mAPZC, + &IAPZCTreeManager::StartScrollbarDrag, + guid, aDragMetrics)); } already_AddRefed @@ -1953,12 +1940,9 @@ nsIWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint, bool aLongTap, if (timeout > TOUCH_INJECT_PUMP_TIMER_MSEC) { timeout = TOUCH_INJECT_PUMP_TIMER_MSEC; } - mLongTapTimer->InitWithNamedFuncCallback( - OnLongTapTimerCallback, - this, - timeout, - nsITimer::TYPE_REPEATING_SLACK, - "nsIWidget::SynthesizeNativeTouchTap"); + mLongTapTimer->InitWithFuncCallback(OnLongTapTimerCallback, this, + timeout, + nsITimer::TYPE_REPEATING_SLACK); } // If we already have a long tap pending, cancel it. We only allow one long diff --git a/widget/nsIdleService.cpp b/widget/nsIdleService.cpp index d2d9daf18447e..80392322a0291 100644 --- a/widget/nsIdleService.cpp +++ b/widget/nsIdleService.cpp @@ -143,11 +143,10 @@ nsIdleServiceDaily::Observe(nsISupports *, ("nsIdleServiceDaily: Restarting daily timer")); // Start timer for the next check in one day. - (void)mTimer->InitWithNamedFuncCallback(DailyCallback, - this, - SECONDS_PER_DAY * PR_MSEC_PER_SEC, - nsITimer::TYPE_ONE_SHOT, - "nsIdleServiceDaily::Observe"); + (void)mTimer->InitWithFuncCallback(DailyCallback, + this, + SECONDS_PER_DAY * PR_MSEC_PER_SEC, + nsITimer::TYPE_ONE_SHOT); return NS_OK; } @@ -219,11 +218,10 @@ nsIdleServiceDaily::Init() mExpectedTriggerTime = PR_Now() + (milliSecLeftUntilDaily * PR_USEC_PER_MSEC); - (void)mTimer->InitWithNamedFuncCallback(DailyCallback, - this, - milliSecLeftUntilDaily, - nsITimer::TYPE_ONE_SHOT, - "nsIdleServiceDaily::Init"); + (void)mTimer->InitWithFuncCallback(DailyCallback, + this, + milliSecLeftUntilDaily, + nsITimer::TYPE_ONE_SHOT); } // Register for when we should terminate/pause @@ -294,12 +292,10 @@ nsIdleServiceDaily::DailyCallback(nsITimer* aTimer, void* aClosure) delayTime / PR_USEC_PER_MSEC); #endif - (void)self->mTimer->InitWithNamedFuncCallback( - DailyCallback, - self, - delayTime / PR_USEC_PER_MSEC, - nsITimer::TYPE_ONE_SHOT, - "nsIdleServiceDaily::DailyCallback"); + (void)self->mTimer->InitWithFuncCallback(DailyCallback, + self, + delayTime / PR_USEC_PER_MSEC, + nsITimer::TYPE_ONE_SHOT); return; } @@ -832,11 +828,11 @@ nsIdleService::SetTimerExpiryIfBefore(TimeStamp aNextTimeout) #endif // Start the timer - mTimer->InitWithNamedFuncCallback(StaticIdleTimerCallback, - this, - deltaTime.ToMilliseconds(), - nsITimer::TYPE_ONE_SHOT, - "nsIdleService::SetTimerExpiryIfBefore"); + mTimer->InitWithFuncCallback(StaticIdleTimerCallback, + this, + deltaTime.ToMilliseconds(), + nsITimer::TYPE_ONE_SHOT); + } } diff --git a/widget/windows/AudioSession.cpp b/widget/windows/AudioSession.cpp index f077dd48a1134..5a5db2f02fc56 100644 --- a/widget/windows/AudioSession.cpp +++ b/widget/windows/AudioSession.cpp @@ -409,8 +409,7 @@ AudioSession::OnSessionDisconnected(AudioSessionDisconnectReason aReason) // Run our code asynchronously. Per MSDN we can't do anything interesting // in this callback. nsCOMPtr runnable = - NewRunnableMethod("widget::AudioSession::OnSessionDisconnectedInternal", - this, &AudioSession::OnSessionDisconnectedInternal); + NewRunnableMethod(this, &AudioSession::OnSessionDisconnectedInternal); NS_DispatchToMainThread(runnable); return S_OK; } diff --git a/widget/windows/LSPAnnotator.cpp b/widget/windows/LSPAnnotator.cpp index 5a36bc26d10c7..9132ceb2b02f9 100644 --- a/widget/windows/LSPAnnotator.cpp +++ b/widget/windows/LSPAnnotator.cpp @@ -29,7 +29,6 @@ class LSPAnnotationGatherer : public Runnable ~LSPAnnotationGatherer() {} public: - LSPAnnotationGatherer() : Runnable("crashreporter::LSPAnnotationGatherer") {} NS_DECL_NSIRUNNABLE void Annotate(); @@ -138,8 +137,7 @@ LSPAnnotationGatherer::Run() } mString = str; - NS_DispatchToMainThread(NewRunnableMethod("crashreporter::LSPAnnotationGatherer::Annotate", - this, &LSPAnnotationGatherer::Annotate)); + NS_DispatchToMainThread(NewRunnableMethod(this, &LSPAnnotationGatherer::Annotate)); return NS_OK; } diff --git a/widget/windows/WidgetTraceEvent.cpp b/widget/windows/WidgetTraceEvent.cpp index 915a72fd7747f..4e4be3af3ca7b 100644 --- a/widget/windows/WidgetTraceEvent.cpp +++ b/widget/windows/WidgetTraceEvent.cpp @@ -34,7 +34,7 @@ HANDLE sEventHandle = nullptr; // thread. class HWNDGetter : public mozilla::Runnable { public: - HWNDGetter() : Runnable("HWNDGetter"), hidden_window_hwnd(nullptr) {} + HWNDGetter() : hidden_window_hwnd(nullptr) {} HWND hidden_window_hwnd; diff --git a/widget/windows/nsColorPicker.cpp b/widget/windows/nsColorPicker.cpp index c4a9d6823ecee..777169f9783d7 100644 --- a/widget/windows/nsColorPicker.cpp +++ b/widget/windows/nsColorPicker.cpp @@ -96,8 +96,7 @@ static AsyncColorChooser* gColorChooser; AsyncColorChooser::AsyncColorChooser(COLORREF aInitialColor, nsIWidget* aParentWidget, nsIColorPickerShownCallback* aCallback) - : mozilla::Runnable("AsyncColorChooser") - , mInitialColor(aInitialColor) + : mInitialColor(aInitialColor) , mColor(aInitialColor) , mParentWidget(aParentWidget) , mCallback(aCallback) diff --git a/widget/windows/nsSound.cpp b/widget/windows/nsSound.cpp index 7086ef8319360..7c8b73d656276 100644 --- a/widget/windows/nsSound.cpp +++ b/widget/windows/nsSound.cpp @@ -34,13 +34,13 @@ static mozilla::LazyLogModule gWin32SoundLog("nsSound"); class nsSoundPlayer: public mozilla::Runnable { public: nsSoundPlayer(nsSound *aSound, const wchar_t* aSoundName) : - Runnable("nsSoundPlayer"), mSoundName(aSoundName), mSound(aSound) + mSoundName(aSoundName), mSound(aSound) { Init(); } nsSoundPlayer(nsSound *aSound, const nsAString& aSoundName) : - Runnable("nsSoundPlayer"), mSoundName(aSoundName), mSound(aSound) + mSoundName(aSoundName), mSound(aSound) { Init(); } @@ -62,7 +62,6 @@ class nsSoundPlayer: public mozilla::Runnable { class SoundReleaser: public mozilla::Runnable { public: explicit SoundReleaser(nsSound* aSound) : - Runnable("SoundReleaser"), mSound(aSound) { } diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 30c8c6a5d89e9..bf8d1f5736343 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -5333,8 +5333,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, if (wParam == TRUE && !gfxEnv::DisableForcePresent() && gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) { - NS_DispatchToMainThread(NewRunnableMethod("nsWindow::ForcePresent", - this, &nsWindow::ForcePresent)); + NS_DispatchToMainThread(NewRunnableMethod(this, &nsWindow::ForcePresent)); } // let the dwm handle nc painting on glass diff --git a/widget/windows/nsWindowGfx.cpp b/widget/windows/nsWindowGfx.cpp index e4b6989fa028b..ccc07480f9782 100644 --- a/widget/windows/nsWindowGfx.cpp +++ b/widget/windows/nsWindowGfx.cpp @@ -394,7 +394,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) this, LayoutDeviceIntRegion::FromUnknownRegion(region)); if (!gfxEnv::DisableForcePresent() && gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) { nsCOMPtr event = - NewRunnableMethod("nsWindow::ForcePresent", this, &nsWindow::ForcePresent); + NewRunnableMethod(this, &nsWindow::ForcePresent); NS_DispatchToMainThread(event); } } diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp index 0da8c5703f1f6..8347159eeefe5 100644 --- a/xpcom/base/CycleCollectedJSContext.cpp +++ b/xpcom/base/CycleCollectedJSContext.cpp @@ -186,12 +186,9 @@ CycleCollectedJSContext::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const class PromiseJobRunnable final : public Runnable { public: - PromiseJobRunnable(JS::HandleObject aCallback, - JS::HandleObject aAllocationSite, + PromiseJobRunnable(JS::HandleObject aCallback, JS::HandleObject aAllocationSite, nsIGlobalObject* aIncumbentGlobal) - : Runnable("PromiseJobRunnable") - , mCallback( - new PromiseJobCallback(aCallback, aAllocationSite, aIncumbentGlobal)) + : mCallback(new PromiseJobCallback(aCallback, aAllocationSite, aIncumbentGlobal)) { } diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index 125aafcad6c59..2283f2c9faccc 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -127,9 +127,7 @@ nsConsoleService::~nsConsoleService() class AddConsolePrefWatchers : public Runnable { public: - explicit AddConsolePrefWatchers(nsConsoleService* aConsole) - : mozilla::Runnable("AddConsolePrefWatchers") - , mConsole(aConsole) + explicit AddConsolePrefWatchers(nsConsoleService* aConsole) : mConsole(aConsole) { } @@ -170,8 +168,7 @@ class LogMessageRunnable : public Runnable { public: LogMessageRunnable(nsIConsoleMessage* aMessage, nsConsoleService* aService) - : mozilla::Runnable("LogMessageRunnable") - , mMessage(aMessage) + : mMessage(aMessage) , mService(aService) { } diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 5fc3778651d5f..128d99a2c8e5a 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1488,9 +1488,7 @@ struct CCGraphDescriber : public LinkedListElement class LogStringMessageAsync : public CancelableRunnable { public: - explicit LogStringMessageAsync(const nsAString& aMsg) - : mozilla::CancelableRunnable("LogStringMessageAsync") - , mMsg(aMsg) + explicit LogStringMessageAsync(const nsAString& aMsg) : mMsg(aMsg) {} NS_IMETHOD Run() override diff --git a/xpcom/base/nsDumpUtils.cpp b/xpcom/base/nsDumpUtils.cpp index 8e822457ccea7..c68862d08a47c 100644 --- a/xpcom/base/nsDumpUtils.cpp +++ b/xpcom/base/nsDumpUtils.cpp @@ -74,8 +74,7 @@ FdWatcher::Init() nsCOMPtr os = services::GetObserverService(); os->AddObserver(this, "xpcom-shutdown", /* ownsWeak = */ false); - XRE_GetIOMessageLoop()->PostTask(NewRunnableMethod( - "FdWatcher::StartWatching", this, &FdWatcher::StartWatching)); + XRE_GetIOMessageLoop()->PostTask(NewRunnableMethod(this, &FdWatcher::StartWatching)); } // Implementations may call this function multiple times if they ensure that diff --git a/xpcom/base/nsDumpUtils.h b/xpcom/base/nsDumpUtils.h index 86c74dbdcd6bf..12a99da18dc93 100644 --- a/xpcom/base/nsDumpUtils.h +++ b/xpcom/base/nsDumpUtils.h @@ -89,8 +89,7 @@ class FdWatcher MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown")); - XRE_GetIOMessageLoop()->PostTask(mozilla::NewRunnableMethod( - "FdWatcher::StopWatching", this, &FdWatcher::StopWatching)); + XRE_GetIOMessageLoop()->PostTask(mozilla::NewRunnableMethod(this, &FdWatcher::StopWatching)); return NS_OK; } diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 867b9eb2ed03f..06453b126ffdf 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -61,10 +61,8 @@ class DumpMemoryInfoToTempDirRunnable : public Runnable { public: DumpMemoryInfoToTempDirRunnable(const nsAString& aIdentifier, - bool aAnonymize, - bool aMinimizeMemoryUsage) - : mozilla::Runnable("DumpMemoryInfoToTempDirRunnable") - , mIdentifier(aIdentifier) + bool aAnonymize, bool aMinimizeMemoryUsage) + : mIdentifier(aIdentifier) , mAnonymize(aAnonymize) , mMinimizeMemoryUsage(aMinimizeMemoryUsage) { @@ -95,8 +93,7 @@ class GCAndCCLogDumpRunnable final GCAndCCLogDumpRunnable(const nsAString& aIdentifier, bool aDumpAllTraces, bool aDumpChildProcesses) - : mozilla::Runnable("GCAndCCLogDumpRunnable") - , mIdentifier(aIdentifier) + : mIdentifier(aIdentifier) , mDumpAllTraces(aDumpAllTraces) , mDumpChildProcesses(aDumpChildProcesses) { diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index f34ba97b56280..323a753f75c6d 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1679,9 +1679,7 @@ nsMemoryReporterManager::GetReportsExtended( if (aMinimize) { nsCOMPtr callback = - NewRunnableMethod("nsMemoryReporterManager::StartGettingReports", - this, - &nsMemoryReporterManager::StartGettingReports); + NewRunnableMethod(this, &nsMemoryReporterManager::StartGettingReports); rv = MinimizeMemoryUsage(callback); } else { rv = StartGettingReports(); @@ -1739,12 +1737,9 @@ nsMemoryReporterManager::StartGettingReports() FinishReporting(); return NS_ERROR_FAILURE; } - rv = timer->InitWithNamedFuncCallback( - TimeoutCallback, - this, - kTimeoutLengthMS, - nsITimer::TYPE_ONE_SHOT, - "nsMemoryReporterManager::StartGettingReports"); + rv = timer->InitWithFuncCallback(TimeoutCallback, + this, kTimeoutLengthMS, + nsITimer::TYPE_ONE_SHOT); if (NS_WARN_IF(NS_FAILED(rv))) { FinishReporting(); return rv; @@ -1773,8 +1768,7 @@ nsMemoryReporterManager::DispatchReporter( nsCOMPtr handleReportData = aHandleReportData; nsCOMPtr event = NS_NewRunnableFunction( - "nsMemoryReporterManager::DispatchReporter", - [self, reporter, aIsAsync, handleReport, handleReportData, aAnonymize]() { + [self, reporter, aIsAsync, handleReport, handleReportData, aAnonymize] () { reporter->CollectReports(handleReport, handleReportData, aAnonymize); if (!aIsAsync) { self->EndReport(); @@ -2516,8 +2510,7 @@ class MinimizeMemoryUsageRunnable : public Runnable { public: explicit MinimizeMemoryUsageRunnable(nsIRunnable* aCallback) - : mozilla::Runnable("MinimizeMemoryUsageRunnable") - , mCallback(aCallback) + : mCallback(aCallback) , mRemainingIters(sNumIters) { } diff --git a/xpcom/base/nsMessageLoop.cpp b/xpcom/base/nsMessageLoop.cpp index 52da4412a7f07..fabf6b9f52206 100644 --- a/xpcom/base/nsMessageLoop.cpp +++ b/xpcom/base/nsMessageLoop.cpp @@ -72,8 +72,7 @@ class MessageLoopTimerCallback MessageLoopIdleTask::MessageLoopIdleTask(nsIRunnable* aTask, uint32_t aEnsureRunsAfterMS) - : mozilla::Runnable("MessageLoopIdleTask") - , mTask(aTask) + : mTask(aTask) { // Init() really shouldn't fail, but if it does, we schedule our runnable // immediately, because it's more important to guarantee that we run the task diff --git a/xpcom/base/nsStatusReporterManager.cpp b/xpcom/base/nsStatusReporterManager.cpp index ccd0a21e92d9a..f20d0d59e4902 100644 --- a/xpcom/base/nsStatusReporterManager.cpp +++ b/xpcom/base/nsStatusReporterManager.cpp @@ -32,7 +32,6 @@ class DumpStatusInfoToTempDirRunnable : public mozilla::Runnable { public: DumpStatusInfoToTempDirRunnable() - : mozilla::Runnable("DumpStatusInfoToTempDirRunnable") { } diff --git a/xpcom/ds/nsHashPropertyBag.cpp b/xpcom/ds/nsHashPropertyBag.cpp index 0585e850a6c44..4dbcc6a2a687f 100644 --- a/xpcom/ds/nsHashPropertyBag.cpp +++ b/xpcom/ds/nsHashPropertyBag.cpp @@ -276,8 +276,7 @@ class ProxyHashtableDestructor final : public mozilla::Runnable public: using HashtableType = nsInterfaceHashtable; explicit ProxyHashtableDestructor(HashtableType&& aTable) - : mozilla::Runnable("ProxyHashtableDestructor") - , mPropertyHash(mozilla::Move(aTable)) + : mPropertyHash(mozilla::Move(aTable)) {} NS_IMETHODIMP diff --git a/xpcom/ds/nsObserverService.cpp b/xpcom/ds/nsObserverService.cpp index 56765a274f361..f375766c0e9de 100644 --- a/xpcom/ds/nsObserverService.cpp +++ b/xpcom/ds/nsObserverService.cpp @@ -182,10 +182,7 @@ nsObserverService::Create(nsISupports* aOuter, const nsIID& aIID, // The memory reporter can not be immediately registered here because // the nsMemoryReporterManager may attempt to get the nsObserverService // during initialization, causing a recursive GetService. - NS_DispatchToCurrentThread( - NewRunnableMethod("nsObserverService::RegisterReporter", - os, - &nsObserverService::RegisterReporter)); + NS_DispatchToCurrentThread(NewRunnableMethod(os, &nsObserverService::RegisterReporter)); return os->QueryInterface(aIID, aInstancePtr); } diff --git a/xpcom/io/nsInputStreamTee.cpp b/xpcom/io/nsInputStreamTee.cpp index 968282b5e6129..f6f9b7e80fe08 100644 --- a/xpcom/io/nsInputStreamTee.cpp +++ b/xpcom/io/nsInputStreamTee.cpp @@ -61,11 +61,8 @@ class nsInputStreamTeeWriteEvent : public Runnable { public: // aTee's lock is held across construction of this object - nsInputStreamTeeWriteEvent(const char* aBuf, - uint32_t aCount, - nsIOutputStream* aSink, - nsInputStreamTee* aTee) - : mozilla::Runnable("nsInputStreamTeeWriteEvent") + nsInputStreamTeeWriteEvent(const char* aBuf, uint32_t aCount, + nsIOutputStream* aSink, nsInputStreamTee* aTee) { // copy the buffer - will be free'd by dtor mBuf = (char*)malloc(aCount); diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index b5b7dbe184c53..16fd575cb067c 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -114,7 +114,6 @@ class AsyncLocalFileWinDone : public Runnable { public: AsyncLocalFileWinDone() : - Runnable("AsyncLocalFileWinDone"), mWorkerThread(do_GetCurrentThread()) { // Objects of this type must only be created on worker threads @@ -144,8 +143,7 @@ class AsyncRevealOperation : public Runnable { public: explicit AsyncRevealOperation(const nsAString& aResolvedPath) - : Runnable("AsyncRevealOperation"), - mResolvedPath(aResolvedPath) + : mResolvedPath(aResolvedPath) { } diff --git a/xpcom/tests/gtest/TestMozPromise.cpp b/xpcom/tests/gtest/TestMozPromise.cpp index 6038fd6dc9b64..0d82fc9fdad62 100644 --- a/xpcom/tests/gtest/TestMozPromise.cpp +++ b/xpcom/tests/gtest/TestMozPromise.cpp @@ -43,11 +43,10 @@ class DelayedResolveOrReject : public Runnable TestPromise::Private* aPromise, const TestPromise::ResolveOrRejectValue& aValue, int aIterations) - : mozilla::Runnable("DelayedResolveOrReject") - , mTaskQueue(aTaskQueue) - , mPromise(aPromise) - , mValue(aValue) - , mIterations(aIterations) + : mTaskQueue(aTaskQueue) + , mPromise(aPromise) + , mValue(aValue) + , mIterations(aIterations) {} NS_IMETHOD Run() override @@ -86,7 +85,7 @@ template void RunOnTaskQueue(TaskQueue* aQueue, FunctionType aFun) { - nsCOMPtr r = NS_NewRunnableFunction("RunOnTaskQueue", aFun); + nsCOMPtr r = NS_NewRunnableFunction(aFun); aQueue->Dispatch(r.forget()); } diff --git a/xpcom/tests/gtest/TestRWLock.cpp b/xpcom/tests/gtest/TestRWLock.cpp index 4dcd83b7ab615..65de524f279ab 100644 --- a/xpcom/tests/gtest/TestRWLock.cpp +++ b/xpcom/tests/gtest/TestRWLock.cpp @@ -22,8 +22,7 @@ static const size_t sWriteLockIteration = 10; class RWLockRunnable : public mozilla::Runnable { public: RWLockRunnable(RWLock* aRWLock, mozilla::Atomic* aSharedData) - : mozilla::Runnable("RWLockRunnable") - , mRWLock(aRWLock) + : mRWLock(aRWLock) , mSharedData(aSharedData) {} diff --git a/xpcom/tests/gtest/TestRacingServiceManager.cpp b/xpcom/tests/gtest/TestRacingServiceManager.cpp index ae5d9348dbcdb..1309083ed8537 100644 --- a/xpcom/tests/gtest/TestRacingServiceManager.cpp +++ b/xpcom/tests/gtest/TestRacingServiceManager.cpp @@ -183,11 +183,7 @@ class TestRunnable : public Runnable public: NS_DECL_NSIRUNNABLE - TestRunnable() - : mozilla::Runnable("TestRacingServiceManager::TestRunnable") - , mFirstRunnableDone(false) - { - } + TestRunnable() : mFirstRunnableDone(false) { } bool mFirstRunnableDone; }; diff --git a/xpcom/tests/gtest/TestStateWatching.cpp b/xpcom/tests/gtest/TestStateWatching.cpp index e083dc5e5772c..16d06a5fff5a7 100644 --- a/xpcom/tests/gtest/TestStateWatching.cpp +++ b/xpcom/tests/gtest/TestStateWatching.cpp @@ -32,12 +32,11 @@ TEST(WatchManager, Shutdown) WatchManager manager(p, queue); Watchable notifier(false, "notifier"); - queue->Dispatch(NS_NewRunnableFunction( - "TestStateWatching::WatchManager_Shutdown_Test::TestBody", [&]() { - manager.Watch(notifier, &Foo::Notify); - notifier = true; // Trigger the call to Foo::Notify(). - manager.Shutdown(); // Shutdown() should cancel the call. - })); + queue->Dispatch(NS_NewRunnableFunction([&] () { + manager.Watch(notifier, &Foo::Notify); + notifier = true; // Trigger the call to Foo::Notify(). + manager.Shutdown(); // Shutdown() should cancel the call. + })); queue->BeginShutdown(); queue->AwaitShutdownAndIdle(); diff --git a/xpcom/tests/gtest/TestTaskQueue.cpp b/xpcom/tests/gtest/TestTaskQueue.cpp index 0f320f529db0b..1e764fcc1ea26 100644 --- a/xpcom/tests/gtest/TestTaskQueue.cpp +++ b/xpcom/tests/gtest/TestTaskQueue.cpp @@ -29,39 +29,26 @@ TEST(TaskQueue, EventOrder) // We expect task1 happens before task3. for (int i = 0; i < 10000; ++i) { - tq1->Dispatch( - NS_NewRunnableFunction( - "TestTaskQueue::TaskQueue_EventOrder_Test::TestBody", - [&]() { - tq2->Dispatch(NS_NewRunnableFunction( - "TestTaskQueue::TaskQueue_EventOrder_Test::TestBody", - []() { // task0 - })); - tq3->Dispatch(NS_NewRunnableFunction( - "TestTaskQueue::TaskQueue_EventOrder_Test::TestBody", - [&]() { // task1 - EXPECT_EQ(1, ++counter); - errored = counter != 1; - MonitorAutoLock mon(monitor); - ++sync; - mon.Notify(); - })); - tq2->Dispatch(NS_NewRunnableFunction( - "TestTaskQueue::TaskQueue_EventOrder_Test::TestBody", - [&]() { // task2 - tq3->Dispatch(NS_NewRunnableFunction( - "TestTaskQueue::TaskQueue_EventOrder_Test::TestBody", - [&]() { // task3 - EXPECT_EQ(0, --counter); - errored = counter != 0; - MonitorAutoLock mon(monitor); - ++sync; - mon.Notify(); - })); - })); - }), - AbstractThread::AssertDispatchSuccess, - AbstractThread::TailDispatch); + tq1->Dispatch(NS_NewRunnableFunction([&] () { + tq2->Dispatch(NS_NewRunnableFunction([] () { // task0 + })); + tq3->Dispatch(NS_NewRunnableFunction([&] () { // task1 + EXPECT_EQ(1, ++counter); + errored = counter != 1; + MonitorAutoLock mon(monitor); + ++sync; + mon.Notify(); + })); + tq2->Dispatch(NS_NewRunnableFunction([&] () { // task2 + tq3->Dispatch(NS_NewRunnableFunction([&] () { // task3 + EXPECT_EQ(0, --counter); + errored = counter != 0; + MonitorAutoLock mon(monitor); + ++sync; + mon.Notify(); + })); + })); + }), AbstractThread::AssertDispatchSuccess, AbstractThread::TailDispatch); // Ensure task1 and task3 are done before next loop. MonitorAutoLock mon(monitor); diff --git a/xpcom/tests/gtest/TestThreadPool.cpp b/xpcom/tests/gtest/TestThreadPool.cpp index 76e56236ea337..56abf7608d534 100644 --- a/xpcom/tests/gtest/TestThreadPool.cpp +++ b/xpcom/tests/gtest/TestThreadPool.cpp @@ -69,18 +69,14 @@ TEST(ThreadPool, Parallelism) EXPECT_TRUE(pool); // Dispatch and sleep to ensure we have an idle thread - nsCOMPtr r0 = new Runnable("TestRunnable"); + nsCOMPtr r0 = new Runnable(); pool->Dispatch(r0, NS_DISPATCH_SYNC); PR_Sleep(PR_SecondsToInterval(2)); class Runnable1 : public Runnable { public: Runnable1(Monitor& aMonitor, bool& aDone) - : mozilla::Runnable("Runnable1") - , mMonitor(aMonitor) - , mDone(aDone) - { - } + : mMonitor(aMonitor), mDone(aDone) {} NS_IMETHOD Run() override { MonitorAutoLock mon(mMonitor); @@ -100,11 +96,7 @@ TEST(ThreadPool, Parallelism) class Runnable2 : public Runnable { public: Runnable2(Monitor& aMonitor, bool& aDone) - : mozilla::Runnable("Runnable2") - , mMonitor(aMonitor) - , mDone(aDone) - { - } + : mMonitor(aMonitor), mDone(aDone) {} NS_IMETHOD Run() override { MonitorAutoLock mon(mMonitor); diff --git a/xpcom/tests/gtest/TestThreadPoolListener.cpp b/xpcom/tests/gtest/TestThreadPoolListener.cpp index 01ecff49a73ca..f95106fa855fa 100644 --- a/xpcom/tests/gtest/TestThreadPoolListener.cpp +++ b/xpcom/tests/gtest/TestThreadPoolListener.cpp @@ -159,7 +159,7 @@ TEST(ThreadPoolListener, Test) ReentrantMonitorAutoEnter mon(*gReentrantMonitor); for (uint32_t i = 0; i < NUMBER_OF_THREADS; i++) { - nsCOMPtr runnable = new Runnable("TestRunnable"); + nsCOMPtr runnable = new Runnable(); ASSERT_TRUE(runnable); rv = pool->Dispatch(runnable, NS_DISPATCH_NORMAL); diff --git a/xpcom/tests/gtest/TestThreadUtils.cpp b/xpcom/tests/gtest/TestThreadUtils.cpp index 30baea27d5094..d779e013284ef 100644 --- a/xpcom/tests/gtest/TestThreadUtils.cpp +++ b/xpcom/tests/gtest/TestThreadUtils.cpp @@ -45,8 +45,6 @@ class nsFoo : public nsISupports { NS_IMPL_ISUPPORTS0(nsFoo) class TestSuicide : public mozilla::Runnable { -public: - TestSuicide() : mozilla::Runnable("TestSuicide") {} NS_IMETHOD Run() override { // Runs first time on thread "Suicide", then dies on MainThread if (!NS_IsMainThread()) { @@ -187,9 +185,8 @@ static void TestNewRunnableFunction(bool aNamed) nsCOMPtr trackedRunnable; { TestCopyWithNoMove tracker(©Counter); - trackedRunnable = - aNamed ? NS_NewRunnableFunction("unused", tracker) - : NS_NewRunnableFunction("TestNewRunnableFunction", tracker); + trackedRunnable = aNamed ? NS_NewRunnableFunction("unused", tracker) : + NS_NewRunnableFunction(tracker); // Original 'tracker' is destroyed here. } // Verify that the runnable contains a non-destroyed function object. @@ -205,11 +202,9 @@ static void TestNewRunnableFunction(bool aNamed) { // Passing as rvalue, but using copy. // (TestCopyWithDeletedMove wouldn't allow this.) - trackedRunnable = - aNamed - ? NS_NewRunnableFunction("unused", TestCopyWithNoMove(©Counter)) - : NS_NewRunnableFunction("TestNewRunnableFunction", - TestCopyWithNoMove(©Counter)); + trackedRunnable = aNamed ? + NS_NewRunnableFunction("unused", TestCopyWithNoMove(©Counter)) : + NS_NewRunnableFunction(TestCopyWithNoMove(©Counter)); } trackedRunnable->Run(); } @@ -222,9 +217,8 @@ static void TestNewRunnableFunction(bool aNamed) nsCOMPtr trackedRunnable; { TestCopyWithDeletedMove tracker(©Counter); - trackedRunnable = - aNamed ? NS_NewRunnableFunction("unused", tracker) - : NS_NewRunnableFunction("TestNewRunnableFunction", tracker); + trackedRunnable = aNamed ? NS_NewRunnableFunction("unused", tracker) : + NS_NewRunnableFunction(tracker); } trackedRunnable->Run(); } @@ -239,10 +233,8 @@ static void TestNewRunnableFunction(bool aNamed) nsCOMPtr trackedRunnable; { TestMove tracker(&moveCounter); - trackedRunnable = - aNamed - ? NS_NewRunnableFunction("unused", Move(tracker)) - : NS_NewRunnableFunction("TestNewRunnableFunction", Move(tracker)); + trackedRunnable = aNamed ? NS_NewRunnableFunction("unused", Move(tracker)) : + NS_NewRunnableFunction(Move(tracker)); } trackedRunnable->Run(); } @@ -254,10 +246,9 @@ static void TestNewRunnableFunction(bool aNamed) { nsCOMPtr trackedRunnable; { - trackedRunnable = - aNamed ? NS_NewRunnableFunction("unused", TestMove(&moveCounter)) - : NS_NewRunnableFunction("TestNewRunnableFunction", - TestMove(&moveCounter)); + trackedRunnable = aNamed ? + NS_NewRunnableFunction("unused", TestMove(&moveCounter)) : + NS_NewRunnableFunction(TestMove(&moveCounter)); } trackedRunnable->Run(); } @@ -273,10 +264,8 @@ static void TestNewRunnableFunction(bool aNamed) nsCOMPtr trackedRunnable; { TestCopyMove tracker(©Counter, &moveCounter); - trackedRunnable = - aNamed - ? NS_NewRunnableFunction("unused", Move(tracker)) - : NS_NewRunnableFunction("TestNewRunnableFunction", Move(tracker)); + trackedRunnable = aNamed ? NS_NewRunnableFunction("unused", Move(tracker)) : + NS_NewRunnableFunction(Move(tracker)); } trackedRunnable->Run(); } @@ -291,12 +280,9 @@ static void TestNewRunnableFunction(bool aNamed) { nsCOMPtr trackedRunnable; { - trackedRunnable = - aNamed - ? NS_NewRunnableFunction("unused", - TestCopyMove(©Counter, &moveCounter)) - : NS_NewRunnableFunction("TestNewRunnableFunction", - TestCopyMove(©Counter, &moveCounter)); + trackedRunnable = aNamed ? + NS_NewRunnableFunction("unused", TestCopyMove(©Counter, &moveCounter)) : + NS_NewRunnableFunction(TestCopyMove(©Counter, &moveCounter)); } trackedRunnable->Run(); } @@ -314,11 +300,9 @@ static void TestNewRunnableFunction(bool aNamed) { TestCopyWithNoMove tracker(©Counter); // Expect 2 copies (here -> local lambda -> runnable lambda). - trackedRunnable = - aNamed ? NS_NewRunnableFunction("unused", - [tracker]() mutable { tracker(); }) - : NS_NewRunnableFunction("TestNewRunnableFunction", - [tracker]() mutable { tracker(); }); + trackedRunnable = aNamed ? + NS_NewRunnableFunction("unused", [tracker]() mutable { tracker(); }) : + NS_NewRunnableFunction([tracker]() mutable { tracker(); }); } trackedRunnable->Run(); } @@ -332,11 +316,9 @@ static void TestNewRunnableFunction(bool aNamed) { TestCopyWithDeletedMove tracker(©Counter); // Expect 2 copies (here -> local lambda -> runnable lambda). - trackedRunnable = - aNamed ? NS_NewRunnableFunction("unused", - [tracker]() mutable { tracker(); }) - : NS_NewRunnableFunction("TestNewRunnableFunction", - [tracker]() mutable { tracker(); }); + trackedRunnable = aNamed ? + NS_NewRunnableFunction("unused", [tracker]() mutable { tracker(); }) : + NS_NewRunnableFunction([tracker]() mutable { tracker(); }); } trackedRunnable->Run(); } @@ -355,11 +337,9 @@ static void TestNewRunnableFunction(bool aNamed) nsCOMPtr trackedRunnable; { TestCopyMove tracker(©Counter, &moveCounter); - trackedRunnable = - aNamed ? NS_NewRunnableFunction("unused", - [tracker]() mutable { tracker(); }) - : NS_NewRunnableFunction("TestNewRunnableFunction", - [tracker]() mutable { tracker(); }); + trackedRunnable = aNamed ? + NS_NewRunnableFunction("unused", [tracker]() mutable { tracker(); }) : + NS_NewRunnableFunction([tracker]() mutable { tracker(); }); // Expect 1 copy (here -> local lambda) and 1 move (local -> runnable lambda). } trackedRunnable->Run(); @@ -384,8 +364,7 @@ TEST(ThreadUtils, NewNamedRunnableFunction) // Test naming. { const char* expectedName = "NamedRunnable"; - RefPtr NamedRunnable = - NS_NewRunnableFunction(expectedName, [] {}); + RefPtr NamedRunnable = NS_NewRunnableFunction(expectedName, []{}); ExpectRunnableName(NamedRunnable, expectedName); } } @@ -406,34 +385,27 @@ static void TestNewRunnableMethod(bool aNamed) // Read only string. Dereferencing in runnable method to check this works. char* message = (char*)"Test message"; - NS_DispatchToMainThread( - aNamed ? NewRunnableMethod("unused", bar, &nsBar::DoBar1) - : NewRunnableMethod("nsBar::DoBar1", bar, &nsBar::DoBar1)); - NS_DispatchToMainThread( - aNamed ? NewRunnableMethod("unused", constBar, &nsBar::DoBar1Const) - : NewRunnableMethod( - "nsBar::DoBar1Const", constBar, &nsBar::DoBar1Const)); - NS_DispatchToMainThread( - aNamed ? NewRunnableMethod("unused", bar, &nsBar::DoBar2) - : NewRunnableMethod("nsBar::DoBar2", bar, &nsBar::DoBar2)); - NS_DispatchToMainThread( - aNamed - ? NewRunnableMethod>("unused", bar, &nsBar::DoBar3, foo) - : NewRunnableMethod>( - "nsBar::DoBar3", bar, &nsBar::DoBar3, foo)); - NS_DispatchToMainThread( - aNamed - ? NewRunnableMethod>("unused", bar, &nsBar::DoBar4, foo) - : NewRunnableMethod>( - "nsBar::DoBar4", bar, &nsBar::DoBar4, foo)); - NS_DispatchToMainThread( - aNamed ? NewRunnableMethod("unused", bar, &nsBar::DoBar5, rawFoo) - : NewRunnableMethod( - "nsBar::DoBar5", bar, &nsBar::DoBar5, rawFoo)); - NS_DispatchToMainThread( - aNamed ? NewRunnableMethod("unused", bar, &nsBar::DoBar6, message) - : NewRunnableMethod( - "nsBar::DoBar6", bar, &nsBar::DoBar6, message)); + NS_DispatchToMainThread(aNamed ? + NewRunnableMethod("unused", bar, &nsBar::DoBar1) : + NewRunnableMethod(bar, &nsBar::DoBar1)); + NS_DispatchToMainThread(aNamed ? + NewRunnableMethod("unused", constBar, &nsBar::DoBar1Const) : + NewRunnableMethod(constBar, &nsBar::DoBar1Const)); + NS_DispatchToMainThread(aNamed ? + NewRunnableMethod("unused", bar, &nsBar::DoBar2) : + NewRunnableMethod(bar, &nsBar::DoBar2)); + NS_DispatchToMainThread(aNamed ? + NewRunnableMethod>("unused", bar, &nsBar::DoBar3, foo) : + NewRunnableMethod>(bar, &nsBar::DoBar3, foo)); + NS_DispatchToMainThread(aNamed ? + NewRunnableMethod>("unused", bar, &nsBar::DoBar4, foo) : + NewRunnableMethod>(bar, &nsBar::DoBar4, foo)); + NS_DispatchToMainThread(aNamed ? + NewRunnableMethod("unused", bar, &nsBar::DoBar5, rawFoo) : + NewRunnableMethod(bar, &nsBar::DoBar5, rawFoo)); + NS_DispatchToMainThread(aNamed ? + NewRunnableMethod("unused", bar, &nsBar::DoBar6, message) : + NewRunnableMethod(bar, &nsBar::DoBar6, message)); #ifdef HAVE_STDCALL NS_DispatchToMainThread(aNamed ? NewRunnableMethod("unused", bar, &nsBar::DoBar1std) : @@ -583,7 +555,7 @@ class IdleObject final ASSERT_TRUE(mSetIdleDeadlineCalled); mRunnableExecuted[2] = true; mSetIdleDeadlineCalled = false; - NS_DispatchToCurrentThread(NewRunnableMethod("IdleObject::Method3", this, &IdleObject::Method3)); + NS_DispatchToCurrentThread(NewRunnableMethod(this, &IdleObject::Method3)); } void Method3() @@ -591,13 +563,11 @@ class IdleObject final CheckExecutedMethods("Method3", 3); mTimer = do_CreateInstance(NS_TIMER_CONTRACTID); - mTimer->InitWithNamedFuncCallback( - Method4, this, 10, nsITimer::TYPE_ONE_SHOT, "IdleObject::Method3"); + mTimer->InitWithFuncCallback(Method4, this, 10, nsITimer::TYPE_ONE_SHOT); NS_IdleDispatchToCurrentThread( - NewIdleRunnableMethodWithTimer("IdleObject::Method5", this, &IdleObject::Method5), 50); + NewIdleRunnableMethodWithTimer(this, &IdleObject::Method5), 50); NS_IdleDispatchToCurrentThread( - NewRunnableMethod("IdleObject::Method6", this, &IdleObject::Method6), - 100); + NewRunnableMethod(this, &IdleObject::Method6), 100); PR_Sleep(PR_MillisecondsToInterval(200)); mRunnableExecuted[3] = true; @@ -651,21 +621,18 @@ TEST(ThreadUtils, IdleRunnableMethod) RefPtr idleInheritedSetDeadline = new IdleObjectInheritedSetDeadline(); - NS_DispatchToCurrentThread( - NewRunnableMethod("IdleObject::Method0", idle, &IdleObject::Method0)); + NS_DispatchToCurrentThread(NewRunnableMethod(idle, &IdleObject::Method0)); NS_IdleDispatchToCurrentThread( - NewIdleRunnableMethod("IdleObject::Method1", idle, &IdleObject::Method1)); + NewIdleRunnableMethod(idle, &IdleObject::Method1)); NS_IdleDispatchToCurrentThread( - NewIdleRunnableMethodWithTimer("IdleObject::Method2", idle, &IdleObject::Method2), 60000); + NewIdleRunnableMethodWithTimer(idle, &IdleObject::Method2), 60000); NS_IdleDispatchToCurrentThread( - NewIdleRunnableMethod("IdleObject::Method7", idle, &IdleObject::Method7)); + NewIdleRunnableMethod(idle, &IdleObject::Method7)); NS_IdleDispatchToCurrentThread(NewIdleRunnableMethod( - "IdleObject::CheckExecutedMethods", idle, &IdleObject::CheckExecutedMethods, "final", 8)); + idle, &IdleObject::CheckExecutedMethods, "final", 8)); NS_IdleDispatchToCurrentThread(NewIdleRunnableMethod( - "IdleObjectWithoutSetDeadline::Method", idleNoSetDeadline, &IdleObjectWithoutSetDeadline::Method)); NS_IdleDispatchToCurrentThread(NewIdleRunnableMethod( - "IdleObjectInheritedSetDeadline::Method", idleInheritedSetDeadline, &IdleObjectInheritedSetDeadline::Method)); NS_ProcessPendingEvents(nullptr); @@ -1109,34 +1076,24 @@ TEST(ThreadUtils, main) // Test legacy functions. nsCOMPtr r1 = - NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test0", - rpt, - &ThreadUtilsObject::Test0); + NewRunnableMethod(rpt, &ThreadUtilsObject::Test0); r1->Run(); EXPECT_EQ(count += 1, rpt->mCount); - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test1i", - rpt, - &ThreadUtilsObject::Test1i, - 11); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test1i, 11); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(11, rpt->mA0); // Test calling a method from a non-ref-counted base. - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObjectNonRefCountedBase::" - "MethodFromNonRefCountedBase", - rpt, - &ThreadUtilsObject::MethodFromNonRefCountedBase); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::MethodFromNonRefCountedBase); r1->Run(); EXPECT_EQ(count, rpt->mCount); // Test variadic function with simple POD arguments. - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test0", - rpt, - &ThreadUtilsObject::Test0); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test0); r1->Run(); EXPECT_EQ(count += 1, rpt->mCount); @@ -1149,31 +1106,20 @@ TEST(ThreadUtils, main) StoreCopyPassByValue>::value, "detail::ParameterStorage>::Type should be StoreCopyPassByValue"); - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test1i", - rpt, - &ThreadUtilsObject::Test1i, - 12); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test1i, 12); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(12, rpt->mA0); - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test2i", - rpt, - &ThreadUtilsObject::Test2i, - 21, - 22); + r1 = NewRunnableMethod( + rpt, &ThreadUtilsObject::Test2i, 21, 22); r1->Run(); EXPECT_EQ(count += 3, rpt->mCount); EXPECT_EQ(21, rpt->mA0); EXPECT_EQ(22, rpt->mA1); r1 = NewRunnableMethod( - "TestThreadUtils::ThreadUtilsObject::Test3i", - rpt, - &ThreadUtilsObject::Test3i, - 31, - 32, - 33); + rpt, &ThreadUtilsObject::Test3i, 31, 32, 33); r1->Run(); EXPECT_EQ(count += 4, rpt->mCount); EXPECT_EQ(31, rpt->mA0); @@ -1181,13 +1127,7 @@ TEST(ThreadUtils, main) EXPECT_EQ(33, rpt->mA2); r1 = NewRunnableMethod( - "TestThreadUtils::ThreadUtilsObject::Test4i", - rpt, - &ThreadUtilsObject::Test4i, - 41, - 42, - 43, - 44); + rpt, &ThreadUtilsObject::Test4i, 41, 42, 43, 44); r1->Run(); EXPECT_EQ(count += 5, rpt->mCount); EXPECT_EQ(41, rpt->mA0); @@ -1199,10 +1139,7 @@ TEST(ThreadUtils, main) // Passing a short to make sure forwarding works with an inexact type match. short int si = 11; - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test1i", - rpt, - &ThreadUtilsObject::Test1i, - si); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test1i, si); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(si, rpt->mA0); @@ -1228,10 +1165,7 @@ TEST(ThreadUtils, main) "detail::ParameterStorage::Type::passed_type should be int*"); { int i = 12; - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test1pi", - rpt, - &ThreadUtilsObject::Test1pi, - &i); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test1pi, &i); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(i, rpt->mA0); @@ -1258,11 +1192,7 @@ TEST(ThreadUtils, main) "detail::ParameterStorage::Type::passed_type should be const int*"); { int i = 1201; - r1 = NewRunnableMethod( - "TestThreadUtils::ThreadUtilsObject::Test1pci", - rpt, - &ThreadUtilsObject::Test1pci, - &i); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test1pci, &i); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(i, rpt->mA0); @@ -1278,10 +1208,7 @@ TEST(ThreadUtils, main) { int i = 1202; r1 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::Test1pi", - rpt, - &ThreadUtilsObject::Test1pi, - i); + rpt, &ThreadUtilsObject::Test1pi, i); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(i, rpt->mA0); @@ -1297,10 +1224,7 @@ TEST(ThreadUtils, main) { int i = 1203; r1 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::Test1pci", - rpt, - &ThreadUtilsObject::Test1pci, - i); + rpt, &ThreadUtilsObject::Test1pci, i); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(i, rpt->mA0); @@ -1359,10 +1283,7 @@ TEST(ThreadUtils, main) "ParameterStorage::Type::passed_type should be int&"); { int i = 13; - r1 = NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test1ri", - rpt, - &ThreadUtilsObject::Test1ri, - i); + r1 = NewRunnableMethod(rpt, &ThreadUtilsObject::Test1ri, i); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(i, rpt->mA0); @@ -1383,11 +1304,8 @@ TEST(ThreadUtils, main) "ParameterStorage::Type::passed_type should be int&&"); { int i = 14; - r1 = - NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::Test1rri", - rpt, - &ThreadUtilsObject::Test1rri, - mozilla::Move(i)); + r1 = NewRunnableMethod( + rpt, &ThreadUtilsObject::Test1rri, mozilla::Move(i)); } r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); @@ -1409,10 +1327,7 @@ TEST(ThreadUtils, main) { mozilla::UniquePtr upi; r1 = NewRunnableMethod&&>( - "TestThreadUtils::ThreadUtilsObject::Test1upi", - rpt, - &ThreadUtilsObject::Test1upi, - mozilla::Move(upi)); + rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi)); } r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); @@ -1434,11 +1349,9 @@ TEST(ThreadUtils, main) "ParameterStorage>>::Type::passed_type should be UniquePtr&&"); { mozilla::UniquePtr upi; - r1 = NewRunnableMethod>>( - "TestThreadUtils::ThreadUtilsObject::Test1upi", - rpt, - &ThreadUtilsObject::Test1upi, - mozilla::Move(upi)); + r1 = NewRunnableMethod + >>( + rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi)); } r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); @@ -1448,10 +1361,7 @@ TEST(ThreadUtils, main) { mozilla::UniquePtr upi = mozilla::MakeUnique(1); r1 = NewRunnableMethod&&>( - "TestThreadUtils::ThreadUtilsObject::Test1upi", - rpt, - &ThreadUtilsObject::Test1upi, - mozilla::Move(upi)); + rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi)); } r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); @@ -1459,11 +1369,9 @@ TEST(ThreadUtils, main) { mozilla::UniquePtr upi = mozilla::MakeUnique(1); - r1 = NewRunnableMethod>>( - "TestThreadUtils::ThreadUtilsObject::Test1upi", - rpt, - &ThreadUtilsObject::Test1upi, - mozilla::Move(upi)); + r1 = NewRunnableMethod + >> + (rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi)); } r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); @@ -1471,10 +1379,7 @@ TEST(ThreadUtils, main) // Unique pointer as prvalue. r1 = NewRunnableMethod&&>( - "TestThreadUtils::ThreadUtilsObject::Test1upi", - rpt, - &ThreadUtilsObject::Test1upi, - mozilla::MakeUnique(2)); + rpt, &ThreadUtilsObject::Test1upi, mozilla::MakeUnique(2)); r1->Run(); EXPECT_EQ(count += 2, rpt->mCount); EXPECT_EQ(2, rpt->mA0); @@ -1483,10 +1388,7 @@ TEST(ThreadUtils, main) { mozilla::UniquePtr upi; r1 = NewRunnableMethod&>( - "TestThreadUtils::ThreadUtilsObject::Test1rupi", - rpt, - &ThreadUtilsObject::Test1rupi, - upi); + rpt, &ThreadUtilsObject::Test1rupi, upi); // Passed as lref, so Run() must be called while local upi is still alive! r1->Run(); } @@ -1506,10 +1408,7 @@ TEST(ThreadUtils, main) EXPECT_EQ(1, gAlive); if (gDebug) { printf("%d - r2 = NewRunnableMethod>(&TestByValue, s)\n", __LINE__); } r2 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByValue", - rpt, - &ThreadUtilsObject::TestByValue, - s); + rpt, &ThreadUtilsObject::TestByValue, s); EXPECT_EQ(2, gAlive); EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction. Spy::ClearActions(); @@ -1535,11 +1434,9 @@ TEST(ThreadUtils, main) if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by value\n", __LINE__); } { if (gDebug) { printf("%d - r3 = NewRunnableMethod>(&TestByValue, Spy(11))\n", __LINE__); } - nsCOMPtr r3 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByValue", - rpt, - &ThreadUtilsObject::TestByValue, - Spy(11)); + nsCOMPtr r3 = + NewRunnableMethod>( + rpt, &ThreadUtilsObject::TestByValue, Spy(11)); EXPECT_EQ(1, gAlive); EXPECT_EQ(1, gConstructions); EXPECT_LE(1, gMoveConstructions); @@ -1566,10 +1463,7 @@ TEST(ThreadUtils, main) EXPECT_EQ(1, gAlive); Spy::ClearActions(); r4 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByValue", - rpt, - &ThreadUtilsObject::TestByValue, - mozilla::Move(s)); + rpt, &ThreadUtilsObject::TestByValue, mozilla::Move(s)); EXPECT_LE(1, gMoveConstructions); EXPECT_EQ(1, gAlive); EXPECT_EQ(1, gZombies); @@ -1601,10 +1495,7 @@ TEST(ThreadUtils, main) EXPECT_EQ(1, gAlive); if (gDebug) { printf("%d - r5 = NewRunnableMethod>(&TestByConstLRef, s)\n", __LINE__); } r5 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByConstLRef", - rpt, - &ThreadUtilsObject::TestByConstLRef, - s); + rpt, &ThreadUtilsObject::TestByConstLRef, s); EXPECT_EQ(2, gAlive); EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction. Spy::ClearActions(); @@ -1630,11 +1521,9 @@ TEST(ThreadUtils, main) if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by const lvalue ref\n", __LINE__); } { if (gDebug) { printf("%d - r6 = NewRunnableMethod>(&TestByConstLRef, Spy(21))\n", __LINE__); } - nsCOMPtr r6 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByConstLRef", - rpt, - &ThreadUtilsObject::TestByConstLRef, - Spy(21)); + nsCOMPtr r6 = + NewRunnableMethod>( + rpt, &ThreadUtilsObject::TestByConstLRef, Spy(21)); EXPECT_EQ(1, gAlive); EXPECT_EQ(1, gConstructions); EXPECT_LE(1, gMoveConstructions); @@ -1663,10 +1552,7 @@ TEST(ThreadUtils, main) EXPECT_EQ(1, gAlive); if (gDebug) { printf("%d - r7 = NewRunnableMethod>(&TestByRRef, s)\n", __LINE__); } r7 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByRRef", - rpt, - &ThreadUtilsObject::TestByRRef, - s); + rpt, &ThreadUtilsObject::TestByRRef, s); EXPECT_EQ(2, gAlive); EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction. Spy::ClearActions(); @@ -1693,11 +1579,9 @@ TEST(ThreadUtils, main) if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by rvalue ref\n", __LINE__); } { if (gDebug) { printf("%d - r8 = NewRunnableMethod>(&TestByRRef, Spy(31))\n", __LINE__); } - nsCOMPtr r8 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByRRef", - rpt, - &ThreadUtilsObject::TestByRRef, - Spy(31)); + nsCOMPtr r8 = + NewRunnableMethod>( + rpt, &ThreadUtilsObject::TestByRRef, Spy(31)); EXPECT_EQ(1, gAlive); EXPECT_EQ(1, gConstructions); EXPECT_LE(1, gMoveConstructions); @@ -1726,10 +1610,8 @@ TEST(ThreadUtils, main) Spy::ClearActions(); if (gDebug) { printf("%d - r9 = NewRunnableMethod(&TestByLRef, s)\n", __LINE__); } nsCOMPtr r9 = - NewRunnableMethod("TestThreadUtils::ThreadUtilsObject::TestByLRef", - rpt, - &ThreadUtilsObject::TestByLRef, - s); + NewRunnableMethod( + rpt, &ThreadUtilsObject::TestByLRef, s); EXPECT_EQ(0, gAllConstructions); EXPECT_EQ(0, gDestructions); EXPECT_EQ(1, gAlive); @@ -1761,10 +1643,7 @@ TEST(ThreadUtils, main) EXPECT_EQ(1, gAlive); if (gDebug) { printf("%d - r10 = NewRunnableMethod>(&TestByRRef, s.get())\n", __LINE__); } r10 = NewRunnableMethod>( - "TestThreadUtils::ThreadUtilsObject::TestByPointer", - rpt, - &ThreadUtilsObject::TestByPointer, - s.get()); + rpt, &ThreadUtilsObject::TestByPointer, s.get()); EXPECT_LE(0, gAllConstructions); EXPECT_EQ(1, gAlive); Spy::ClearActions(); @@ -1796,11 +1675,9 @@ TEST(ThreadUtils, main) EXPECT_EQ(1, gAlive); Spy::ClearActions(); if (gDebug) { printf("%d - r11 = NewRunnableMethod(&TestByPointer, s)\n", __LINE__); } - nsCOMPtr r11 = NewRunnableMethod( - "TestThreadUtils::ThreadUtilsObject::TestByPointer", - rpt, - &ThreadUtilsObject::TestByPointer, - &s); + nsCOMPtr r11 = + NewRunnableMethod( + rpt, &ThreadUtilsObject::TestByPointer, &s); EXPECT_EQ(0, gAllConstructions); EXPECT_EQ(0, gDestructions); EXPECT_EQ(1, gAlive); @@ -1828,11 +1705,9 @@ TEST(ThreadUtils, main) EXPECT_EQ(1, gAlive); Spy::ClearActions(); if (gDebug) { printf("%d - r12 = NewRunnableMethod(&TestByPointer, s)\n", __LINE__); } - nsCOMPtr r12 = NewRunnableMethod( - "TestThreadUtils::ThreadUtilsObject::TestByPointerToConst", - rpt, - &ThreadUtilsObject::TestByPointerToConst, - &s); + nsCOMPtr r12 = + NewRunnableMethod( + rpt, &ThreadUtilsObject::TestByPointerToConst, &s); EXPECT_EQ(0, gAllConstructions); EXPECT_EQ(0, gDestructions); EXPECT_EQ(1, gAlive); diff --git a/xpcom/tests/gtest/TestTimers.cpp b/xpcom/tests/gtest/TestTimers.cpp index 2ca87f89a2d3a..ce8bba028c3b0 100644 --- a/xpcom/tests/gtest/TestTimers.cpp +++ b/xpcom/tests/gtest/TestTimers.cpp @@ -242,17 +242,15 @@ class FindExpirationTimeState final timer->SetTarget(aTarget); } - timer->InitWithNamedFuncCallback(&UnusedCallbackFunc, - nullptr, - kTimerOffset + kTimerInterval * i, - aType, - "FindExpirationTimeState::InitTimers"); + timer->InitWithFuncCallback(&UnusedCallbackFunc, + nullptr, + kTimerOffset + kTimerInterval * i, + aType); } else { - timer->InitWithNamedFuncCallback(&UnusedCallbackFunc, - nullptr, - kTimerOffset + kTimerInterval * i, - nsITimer::TYPE_ONE_SHOT, - "FindExpirationTimeState::InitTimers"); + timer->InitWithFuncCallback(&UnusedCallbackFunc, + nullptr, + kTimerOffset + kTimerInterval * i, + nsITimer::TYPE_ONE_SHOT); } mTimers.push_front(timer.get()); } @@ -428,9 +426,8 @@ class FuzzTestThreadState final : public nsITimerCallback { class StartRunnable final : public mozilla::Runnable { public: - explicit StartRunnable(FuzzTestThreadState* threadState) - : mozilla::Runnable("FuzzTestThreadState::StartRunnable") - , mThreadState(threadState) + explicit StartRunnable(FuzzTestThreadState* threadState) : + mThreadState(threadState) {} NS_IMETHOD Run() override diff --git a/xpcom/threads/AbstractThread.cpp b/xpcom/threads/AbstractThread.cpp index d8f9c944a42b2..fc0dd2ec9e89d 100644 --- a/xpcom/threads/AbstractThread.cpp +++ b/xpcom/threads/AbstractThread.cpp @@ -104,10 +104,7 @@ class EventTargetWrapper : public AbstractThread if (!mTailDispatcher.isSome()) { mTailDispatcher.emplace(/* aIsTailDispatcher = */ true); - nsCOMPtr event = - NewRunnableMethod("EventTargetWrapper::FireTailDispatcher", - this, - &EventTargetWrapper::FireTailDispatcher); + nsCOMPtr event = NewRunnableMethod(this, &EventTargetWrapper::FireTailDispatcher); nsContentUtils::RunInStableState(event.forget()); } @@ -157,8 +154,7 @@ class EventTargetWrapper : public AbstractThread explicit Runner(EventTargetWrapper* aThread, already_AddRefed aRunnable, bool aDrainDirectTasks) - : CancelableRunnable("EventTargetWrapper::Runner") - , mThread(aThread) + : mThread(aThread) , mRunnable(aRunnable) , mDrainDirectTasks(aDrainDirectTasks) { @@ -348,8 +344,7 @@ AbstractThread::CreateXPCOMThreadWrapper(nsIThread* aThread, bool aRequireTailDi // target thread. This ensures that sCurrentThreadTLS is as expected by // AbstractThread::GetCurrent() on the target thread. nsCOMPtr r = - NS_NewRunnableFunction("AbstractThread::CreateXPCOMThreadWrapper", - [wrapper]() { sCurrentThreadTLS.set(wrapper); }); + NS_NewRunnableFunction([wrapper]() { sCurrentThreadTLS.set(wrapper); }); aThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL); return wrapper.forget(); } diff --git a/xpcom/threads/BackgroundHangMonitor.cpp b/xpcom/threads/BackgroundHangMonitor.cpp index 3e6d0694f887c..cd40198c6fa46 100644 --- a/xpcom/threads/BackgroundHangMonitor.cpp +++ b/xpcom/threads/BackgroundHangMonitor.cpp @@ -446,8 +446,7 @@ class ProcessHangRunnable final BackgroundHangThread* aThread, Telemetry::HangHistogram&& aHistogram, Telemetry::NativeHangStack&& aNativeStack) - : CancelableRunnable("ProcessHangRunnable") - , mManager(aManager) + : mManager(aManager) , mNativeStack(mozilla::Move(aNativeStack)) , mThread(aThread) , mHistogram(mozilla::Move(aHistogram)) diff --git a/xpcom/threads/LazyIdleThread.cpp b/xpcom/threads/LazyIdleThread.cpp index b5b761ed84e42..001c4e5893e91 100644 --- a/xpcom/threads/LazyIdleThread.cpp +++ b/xpcom/threads/LazyIdleThread.cpp @@ -104,7 +104,7 @@ LazyIdleThread::EnableIdleTimeout() } if (mThread) { - nsCOMPtr runnable(new Runnable("LazyIdleThreadDummyRunnable")); + nsCOMPtr runnable(new Runnable()); if (NS_FAILED(Dispatch(runnable.forget(), NS_DISPATCH_NORMAL))) { NS_WARNING("Failed to dispatch!"); } @@ -158,8 +158,8 @@ LazyIdleThread::EnsureThread() return NS_ERROR_UNEXPECTED; } - nsCOMPtr runnable = NewRunnableMethod( - "LazyIdleThread::InitThread", this, &LazyIdleThread::InitThread); + nsCOMPtr runnable = + NewRunnableMethod(this, &LazyIdleThread::InitThread); if (NS_WARN_IF(!runnable)) { return NS_ERROR_UNEXPECTED; } @@ -279,8 +279,8 @@ LazyIdleThread::ShutdownThread() } #endif - nsCOMPtr runnable = NewRunnableMethod( - "LazyIdleThread::CleanupThread", this, &LazyIdleThread::CleanupThread); + nsCOMPtr runnable = + NewRunnableMethod(this, &LazyIdleThread::CleanupThread); if (NS_WARN_IF(!runnable)) { return NS_ERROR_UNEXPECTED; } @@ -356,8 +356,8 @@ LazyIdleThread::Release() // Stabilize refcount. mRefCnt = 1; - nsCOMPtr runnable = NewNonOwningRunnableMethod( - "LazyIdleThread::SelfDestruct", this, &LazyIdleThread::SelfDestruct); + nsCOMPtr runnable = + NewNonOwningRunnableMethod(this, &LazyIdleThread::SelfDestruct); NS_WARNING_ASSERTION(runnable, "Couldn't make runnable!"); if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { @@ -591,8 +591,8 @@ LazyIdleThread::AfterProcessNextEvent(nsIThreadInternal* /* aThread */, } if (shouldNotifyIdle) { - nsCOMPtr runnable = NewRunnableMethod( - "LazyIdleThread::ScheduleTimer", this, &LazyIdleThread::ScheduleTimer); + nsCOMPtr runnable = + NewRunnableMethod(this, &LazyIdleThread::ScheduleTimer); if (NS_WARN_IF(!runnable)) { return NS_ERROR_UNEXPECTED; } diff --git a/xpcom/threads/MozPromise.h b/xpcom/threads/MozPromise.h index 2c8011f1d43cc..9933a32a36cad 100644 --- a/xpcom/threads/MozPromise.h +++ b/xpcom/threads/MozPromise.h @@ -380,9 +380,7 @@ class MozPromise : public MozPromiseBase { public: ResolveOrRejectRunnable(ThenValueBase* aThenValue, MozPromise* aPromise) - : CancelableRunnable( - "MozPromise::ThenValueBase::ResolveOrRejectRunnable") - , mThenValue(aThenValue) + : mThenValue(aThenValue) , mPromise(aPromise) { MOZ_DIAGNOSTIC_ASSERT(!mPromise->IsPending()); @@ -1380,14 +1378,9 @@ template* aMethodCall) - : CancelableRunnable("detail::ProxyRunnable") - , mProxyPromise(aProxyPromise) - , mMethodCall(aMethodCall) - { - } + ProxyRunnable(typename PromiseType::Private* aProxyPromise, + MethodCall* aMethodCall) + : mProxyPromise(aProxyPromise), mMethodCall(aMethodCall) {} NS_IMETHOD Run() override { @@ -1496,14 +1489,11 @@ class ProxyFunctionRunnable : public CancelableRunnable { typedef typename Decay::Type FunctionStorage; public: - template + template ProxyFunctionRunnable(typename PromiseType::Private* aProxyPromise, F&& aFunction) - : CancelableRunnable("detail::ProxyFunctionRunnable") - , mProxyPromise(aProxyPromise) - , mFunction(new FunctionStorage(Forward(aFunction))) - { - } + : mProxyPromise(aProxyPromise) + , mFunction(new FunctionStorage(Forward(aFunction))) {} NS_IMETHOD Run() override { diff --git a/xpcom/threads/SchedulerGroup.cpp b/xpcom/threads/SchedulerGroup.cpp index 8bd0f60ccb57a..81e14d05bf7c7 100644 --- a/xpcom/threads/SchedulerGroup.cpp +++ b/xpcom/threads/SchedulerGroup.cpp @@ -331,9 +331,8 @@ SchedulerGroup::SetValidatingAccess(ValidationType aType) SchedulerGroup::Runnable::Runnable(already_AddRefed&& aRunnable, SchedulerGroup* aGroup) - : mozilla::Runnable("SchedulerGroup::Runnable") - , mRunnable(Move(aRunnable)) - , mGroup(aGroup) + : mRunnable(Move(aRunnable)), + mGroup(aGroup) { } diff --git a/xpcom/threads/SharedThreadPool.cpp b/xpcom/threads/SharedThreadPool.cpp index 314b0cc2a0c52..d52878c741aa7 100644 --- a/xpcom/threads/SharedThreadPool.cpp +++ b/xpcom/threads/SharedThreadPool.cpp @@ -143,8 +143,7 @@ NS_IMETHODIMP_(MozExternalRefCountType) SharedThreadPool::Release(void) // Dispatch an event to the main thread to call Shutdown() on // the nsIThreadPool. The Runnable here will add a refcount to the pool, // and when the Runnable releases the nsIThreadPool it will be deleted. - NS_DispatchToMainThread(NewRunnableMethod( - "nsIThreadPool::Shutdown", mPool, &nsIThreadPool::Shutdown)); + NS_DispatchToMainThread(NewRunnableMethod(mPool, &nsIThreadPool::Shutdown)); // Stabilize refcount, so that if something in the dtor QIs, it won't explode. mRefCnt = 1; diff --git a/xpcom/threads/StateMirroring.h b/xpcom/threads/StateMirroring.h index ef883f9061db8..669e928a666f7 100644 --- a/xpcom/threads/StateMirroring.h +++ b/xpcom/threads/StateMirroring.h @@ -152,11 +152,9 @@ class Canonical { MIRROR_LOG("%s [%p] Disconnecting all mirrors", mName, this); for (size_t i = 0; i < mMirrors.Length(); ++i) { - mMirrors[i]->OwnerThread()->Dispatch( - NewRunnableMethod("AbstractMirror::NotifyDisconnected", - mMirrors[i], - &AbstractMirror::NotifyDisconnected), - AbstractThread::DontAssertDispatchSuccess); + mMirrors[i]->OwnerThread()->Dispatch(NewRunnableMethod(mMirrors[i], + &AbstractMirror::NotifyDisconnected), + AbstractThread::DontAssertDispatchSuccess); } mMirrors.Clear(); } @@ -193,8 +191,7 @@ class Canonical // we can avoid sending multiple updates, and possibly avoid sending any // updates at all if the value ends up where it started. if (!alreadyNotifying) { - AbstractThread::DispatchDirectTask(NewRunnableMethod( - "Canonical::Impl::DoNotify", this, &Impl::DoNotify)); + AbstractThread::DispatchDirectTask(NewRunnableMethod(this, &Impl::DoNotify)); } } @@ -225,11 +222,7 @@ class Canonical already_AddRefed MakeNotifier(AbstractMirror* aMirror) { - return NewRunnableMethod("AbstractMirror::UpdateValue", - aMirror, - &AbstractMirror::UpdateValue, - mValue); - ; + return NewRunnableMethod(aMirror, &AbstractMirror::UpdateValue, mValue);; } T mValue; @@ -332,12 +325,8 @@ class Mirror MOZ_ASSERT(!IsConnected()); MOZ_ASSERT(OwnerThread()->RequiresTailDispatch(aCanonical->OwnerThread()), "Can't get coherency without tail dispatch"); - nsCOMPtr r = - NewRunnableMethod>>( - "AbstractCanonical::AddMirror", - aCanonical, - &AbstractCanonical::AddMirror, - this); + nsCOMPtr r = NewRunnableMethod>> + (aCanonical, &AbstractCanonical::AddMirror, this); aCanonical->OwnerThread()->Dispatch(r.forget(), AbstractThread::DontAssertDispatchSuccess); mCanonical = aCanonical; } @@ -351,12 +340,8 @@ class Mirror } MIRROR_LOG("%s [%p] Disconnecting from %p", mName, this, mCanonical.get()); - nsCOMPtr r = - NewRunnableMethod>>( - "AbstractCanonical::RemoveMirror", - mCanonical, - &AbstractCanonical::RemoveMirror, - this); + nsCOMPtr r = NewRunnableMethod>> + (mCanonical, &AbstractCanonical::RemoveMirror, this); mCanonical->OwnerThread()->Dispatch(r.forget(), AbstractThread::DontAssertDispatchSuccess); mCanonical = nullptr; } diff --git a/xpcom/threads/StateWatching.h b/xpcom/threads/StateWatching.h index 351f59915b58e..99d521603e3aa 100644 --- a/xpcom/threads/StateWatching.h +++ b/xpcom/threads/StateWatching.h @@ -256,10 +256,7 @@ class WatchManager mStrongRef = mOwner; // Hold the owner alive while notifying. // Queue up our notification jobs to run in a stable state. - mOwnerThread->TailDispatcher().AddDirectTask( - NewRunnableMethod("WatchManager::PerCallbackWatcher::DoNotify", - this, - &PerCallbackWatcher::DoNotify)); + mOwnerThread->TailDispatcher().AddDirectTask(NewRunnableMethod(this, &PerCallbackWatcher::DoNotify)); } bool CallbackMethodIs(CallbackMethod aMethod) const diff --git a/xpcom/threads/SyncRunnable.h b/xpcom/threads/SyncRunnable.h index ff617e5a70699..d96bac7ba9071 100644 --- a/xpcom/threads/SyncRunnable.h +++ b/xpcom/threads/SyncRunnable.h @@ -34,16 +34,14 @@ class SyncRunnable : public Runnable { public: explicit SyncRunnable(nsIRunnable* aRunnable) - : Runnable("SyncRunnable") - , mRunnable(aRunnable) + : mRunnable(aRunnable) , mMonitor("SyncRunnable") , mDone(false) { } explicit SyncRunnable(already_AddRefed aRunnable) - : Runnable("SyncRunnable") - , mRunnable(Move(aRunnable)) + : mRunnable(Move(aRunnable)) , mMonitor("SyncRunnable") , mDone(false) { diff --git a/xpcom/threads/TaskDispatcher.h b/xpcom/threads/TaskDispatcher.h index a23f017d2ca2d..52e810ffb531f 100644 --- a/xpcom/threads/TaskDispatcher.h +++ b/xpcom/threads/TaskDispatcher.h @@ -185,11 +185,7 @@ class AutoTaskDispatcher : public TaskDispatcher class TaskGroupRunnable : public Runnable { public: - explicit TaskGroupRunnable(UniquePtr&& aTasks) - : Runnable("AutoTaskDispatcher::TaskGroupRunnable") - , mTasks(Move(aTasks)) - { - } + explicit TaskGroupRunnable(UniquePtr&& aTasks) : mTasks(Move(aTasks)) {} NS_IMETHOD Run() override { diff --git a/xpcom/threads/TaskQueue.h b/xpcom/threads/TaskQueue.h index b97586c8eccb4..b5f71ec756c12 100644 --- a/xpcom/threads/TaskQueue.h +++ b/xpcom/threads/TaskQueue.h @@ -203,8 +203,7 @@ class TaskQueue : public AbstractThread class Runner : public Runnable { public: explicit Runner(TaskQueue* aQueue) - : Runnable("TaskQueue::Runner") - , mQueue(aQueue) + : mQueue(aQueue) { } NS_IMETHOD Run() override; diff --git a/xpcom/threads/ThrottledEventQueue.cpp b/xpcom/threads/ThrottledEventQueue.cpp index 37afc70fae7a3..501157a1fb51e 100644 --- a/xpcom/threads/ThrottledEventQueue.cpp +++ b/xpcom/threads/ThrottledEventQueue.cpp @@ -65,8 +65,7 @@ class ThrottledEventQueue::Inner final : public nsIObserver public: explicit Executor(Inner* aInner) - : Runnable("ThrottledEventQueue::Inner::Executor") - , mInner(aInner) + : mInner(aInner) { } NS_IMETHODIMP diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp index b91b27b2073ac..3a889549534b9 100644 --- a/xpcom/threads/TimerThread.cpp +++ b/xpcom/threads/TimerThread.cpp @@ -58,8 +58,7 @@ class TimerObserverRunnable : public Runnable { public: explicit TimerObserverRunnable(nsIObserver* aObserver) - : mozilla::Runnable("TimerObserverRunnable") - , mObserver(aObserver) + : mObserver(aObserver) { } @@ -148,8 +147,7 @@ class nsTimerEvent final : public CancelableRunnable NS_IMETHOD GetName(nsACString& aName) override; nsTimerEvent() - : mozilla::CancelableRunnable("nsTimerEvent") - , mTimer() + : mTimer() , mGeneration(0) { // Note: We override operator new for this class, and the override is diff --git a/xpcom/threads/nsMemoryPressure.cpp b/xpcom/threads/nsMemoryPressure.cpp index 30d27c2989e02..fea9b04378886 100644 --- a/xpcom/threads/nsMemoryPressure.cpp +++ b/xpcom/threads/nsMemoryPressure.cpp @@ -49,6 +49,6 @@ nsresult NS_DispatchMemoryPressure(MemoryPressureState aState) { NS_DispatchEventualMemoryPressure(aState); - nsCOMPtr event = new Runnable("NS_DispatchEventualMemoryPressure"); + nsCOMPtr event = new Runnable; return NS_DispatchToMainThread(event); } diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index 844139a5635ae..7c4a4856d57c5 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -307,8 +307,7 @@ nsProcess::Monitor(void* aArg) if (NS_IsMainThread()) { process->ProcessComplete(); } else { - NS_DispatchToMainThread(NewRunnableMethod( - "nsProcess::ProcessComplete", process, &nsProcess::ProcessComplete)); + NS_DispatchToMainThread(NewRunnableMethod(process, &nsProcess::ProcessComplete)); } if (!process->mBlocking) { diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 5c78a0fadb5a0..84a7dc19a86f1 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -240,11 +240,10 @@ class DelayedRunnable : public Runnable, DelayedRunnable(already_AddRefed aTargetThread, already_AddRefed aRunnable, uint32_t aDelay) - : mozilla::Runnable("DelayedRunnable") - , mTargetThread(aTargetThread) - , mWrappedRunnable(aRunnable) - , mDelayedFrom(TimeStamp::NowLoRes()) - , mDelay(aDelay) + : mTargetThread(aTargetThread), + mWrappedRunnable(aRunnable), + mDelayedFrom(TimeStamp::NowLoRes()), + mDelay(aDelay) { } NS_DECL_ISUPPORTS_INHERITED diff --git a/xpcom/threads/nsThreadUtils.cpp b/xpcom/threads/nsThreadUtils.cpp index 77c3f7fe93a90..d85d5afd7e551 100644 --- a/xpcom/threads/nsThreadUtils.cpp +++ b/xpcom/threads/nsThreadUtils.cpp @@ -342,11 +342,8 @@ class IdleRunnableWrapper : public IdleRunnable mTimer = do_CreateInstance(NS_TIMER_CONTRACTID); if (mTimer) { mTimer->SetTarget(aTarget); - mTimer->InitWithNamedFuncCallback(TimedOut, - this, - aDelay, - nsITimer::TYPE_ONE_SHOT, - "IdleRunnableWrapper::SetTimer"); + mTimer->InitWithFuncCallback(TimedOut, this, aDelay, + nsITimer::TYPE_ONE_SHOT); } } private: diff --git a/xpcom/threads/nsThreadUtils.h b/xpcom/threads/nsThreadUtils.h index d0db6e2c7074a..a8e8c898377f6 100644 --- a/xpcom/threads/nsThreadUtils.h +++ b/xpcom/threads/nsThreadUtils.h @@ -472,10 +472,7 @@ class IdleRunnable : public CancelableRunnable, public: NS_DECL_ISUPPORTS_INHERITED - IdleRunnable() - : CancelableRunnable("IdleRunnable") - { - } + IdleRunnable() {} explicit IdleRunnable(const char* aName) : CancelableRunnable(aName) {} protected: @@ -497,8 +494,7 @@ class RunnableFunction : public Runnable public: template explicit RunnableFunction(F&& aFunction) - : Runnable("RunnableFunction") - , mFunction(Forward(aFunction)) + : mFunction(Forward(aFunction)) { } NS_IMETHOD Run() override { @@ -617,7 +613,7 @@ ToSupports(mozilla::Runnable *p) template already_AddRefed -NS_NewRunnableFunctionXXX(Function&& aFunction) +NS_NewRunnableFunction(Function&& aFunction) { // We store a non-reference in RunnableFunction, but still forward aFunction // to move if possible. @@ -630,7 +626,7 @@ already_AddRefed NS_NewRunnableFunction(const char* aName, Function&& aFunction) { return mozilla::detail::SetRunnableName( - NS_NewRunnableFunctionXXX(mozilla::Forward(aFunction)), aName); + NS_NewRunnableFunction(mozilla::Forward(aFunction)), aName); } namespace mozilla { @@ -697,15 +693,7 @@ class nsRunnableMethod mozilla::IdleRunnable>::Type>::Type, protected mozilla::detail::TimerBehaviour { - using BaseType = typename mozilla::Conditional::Type>::Type; public: - nsRunnableMethod() : BaseType("nsRunnableMethod") {} - virtual void Revoke() = 0; // These ReturnTypeEnforcer classes set up a blacklist for return types that @@ -1222,11 +1210,8 @@ class RunnableMethodImpl final if (nsCOMPtr timer = GetTimer()) { timer->Cancel(); timer->SetTarget(aTarget); - timer->InitWithNamedFuncCallback(TimedOut, - this, - aDelay, - nsITimer::TYPE_ONE_SHOT, - "detail::RunnableMethodImpl::SetTimer"); + timer->InitWithFuncCallback(TimedOut, this, aDelay, + nsITimer::TYPE_ONE_SHOT); } } }; @@ -1385,7 +1370,7 @@ using NonOwningIdleRunnableMethodWithTimerImpl = RunnableMethodImpl< template already_AddRefed> -NewRunnableMethodXXX(PtrType&& aPtr, Method aMethod) +NewRunnableMethod(PtrType&& aPtr, Method aMethod) { return do_AddRef( new detail::OwningRunnableMethodImpl @@ -1397,12 +1382,12 @@ already_AddRefed> NewRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod) { return detail::SetRunnableName( - NewRunnableMethodXXX(Forward(aPtr), aMethod), aName); + NewRunnableMethod(Forward(aPtr), aMethod), aName); } template already_AddRefed> -NewCancelableRunnableMethodXXX(PtrType&& aPtr, Method aMethod) +NewCancelableRunnableMethod(PtrType&& aPtr, Method aMethod) { return do_AddRef( new detail::CancelableRunnableMethodImpl @@ -1414,12 +1399,12 @@ already_AddRefed> NewCancelableRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod) { return detail::SetRunnableName( - NewCancelableRunnableMethodXXX(Forward(aPtr), aMethod), aName); + NewCancelableRunnableMethod(Forward(aPtr), aMethod), aName); } template already_AddRefed> -NewIdleRunnableMethodXXX(PtrType&& aPtr, Method aMethod) +NewIdleRunnableMethod(PtrType&& aPtr, Method aMethod) { return do_AddRef(new detail::IdleRunnableMethodImpl( Forward(aPtr), aMethod)); @@ -1430,12 +1415,12 @@ already_AddRefed> NewIdleRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod) { return detail::SetRunnableName( - NewIdleRunnableMethodXXX(Forward(aPtr), aMethod), aName); + NewIdleRunnableMethod(Forward(aPtr), aMethod), aName); } template already_AddRefed> -NewIdleRunnableMethodWithTimerXXX(PtrType&& aPtr, Method aMethod) +NewIdleRunnableMethodWithTimer(PtrType&& aPtr, Method aMethod) { return do_AddRef(new detail::IdleRunnableMethodWithTimerImpl( Forward(aPtr), aMethod)); @@ -1448,13 +1433,13 @@ NewIdleRunnableMethodWithTimer(const char* aName, Method aMethod) { return detail::SetRunnableName( - NewIdleRunnableMethodWithTimerXXX(Forward(aPtr), aMethod), + NewIdleRunnableMethodWithTimer(Forward(aPtr), aMethod), aName); } template already_AddRefed> -NewNonOwningRunnableMethodXXX(PtrType&& aPtr, Method aMethod) +NewNonOwningRunnableMethod(PtrType&& aPtr, Method aMethod) { return do_AddRef( new detail::NonOwningRunnableMethodImpl @@ -1466,12 +1451,12 @@ already_AddRefed> NewNonOwningRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod) { return detail::SetRunnableName( - NewNonOwningRunnableMethodXXX(Forward(aPtr), aMethod), aName); + NewNonOwningRunnableMethod(Forward(aPtr), aMethod), aName); } template already_AddRefed> -NewNonOwningCancelableRunnableMethodXXX(PtrType&& aPtr, Method aMethod) +NewNonOwningCancelableRunnableMethod(PtrType&& aPtr, Method aMethod) { return do_AddRef( new detail::NonOwningCancelableRunnableMethodImpl @@ -1484,12 +1469,12 @@ NewNonOwningCancelableRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod) { return detail::SetRunnableName( - NewNonOwningCancelableRunnableMethodXXX(Forward(aPtr), aMethod), aName); + NewNonOwningCancelableRunnableMethod(Forward(aPtr), aMethod), aName); } template already_AddRefed> -NewNonOwningIdleRunnableMethodXXX(PtrType&& aPtr, Method aMethod) +NewNonOwningIdleRunnableMethod(PtrType&& aPtr, Method aMethod) { return do_AddRef( new detail::NonOwningIdleRunnableMethodImpl( @@ -1503,12 +1488,12 @@ NewNonOwningIdleRunnableMethod(const char* aName, Method aMethod) { return detail::SetRunnableName( - NewNonOwningIdleRunnableMethodXXX(Forward(aPtr), aMethod), aName); + NewNonOwningIdleRunnableMethod(Forward(aPtr), aMethod), aName); } template already_AddRefed> -NewNonOwningIdleRunnableMethodWithTimerXXX(PtrType&& aPtr, +NewNonOwningIdleRunnableMethodWithTimer(PtrType&& aPtr, Method aMethod) { return do_AddRef( @@ -1522,7 +1507,7 @@ NewNonOwningIdleRunnableMethodWithTimer(const char* aName, PtrType&& aPtr, Method aMethod) { - return detail::SetRunnableName(NewNonOwningIdleRunnableMethodWithTimerXXX( + return detail::SetRunnableName(NewNonOwningIdleRunnableMethodWithTimer( Forward(aPtr), aMethod), aName); } @@ -1533,7 +1518,7 @@ NewNonOwningIdleRunnableMethodWithTimer(const char* aName, // 'Types' are the stored type for each argument, see ParameterStorage for details. template already_AddRefed> -NewRunnableMethodXXX(PtrType&& aPtr, Method aMethod, Args&&... aArgs) +NewRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs) { static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); @@ -1549,13 +1534,13 @@ NewRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod, Args&&... a static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); return detail::SetRunnableName( - NewRunnableMethodXXX + NewRunnableMethod (Forward(aPtr), aMethod, mozilla::Forward(aArgs)...), aName); } template already_AddRefed> -NewNonOwningRunnableMethodXXX(PtrType&& aPtr, Method aMethod, Args&&... aArgs) +NewNonOwningRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs) { static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); @@ -1572,13 +1557,13 @@ NewNonOwningRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod, static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); return detail::SetRunnableName( - NewNonOwningRunnableMethodXXX + NewNonOwningRunnableMethod (Forward(aPtr), aMethod, mozilla::Forward(aArgs)...), aName); } template already_AddRefed> -NewCancelableRunnableMethodXXX(PtrType&& aPtr, Method aMethod, Args&&... aArgs) +NewCancelableRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs) { static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); @@ -1595,13 +1580,13 @@ NewCancelableRunnableMethod(const char* aName, PtrType&& aPtr, Method aMethod, static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); return detail::SetRunnableName( - NewCancelableRunnableMethodXXX + NewCancelableRunnableMethod (Forward(aPtr), aMethod, mozilla::Forward(aArgs)...), aName); } template already_AddRefed> -NewNonOwningCancelableRunnableMethodXXX(PtrType&& aPtr, Method aMethod, +NewNonOwningCancelableRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs) { static_assert(sizeof...(Storages) == sizeof...(Args), @@ -1619,7 +1604,7 @@ NewNonOwningCancelableRunnableMethod(const char* aName, PtrType&& aPtr, static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); return detail::SetRunnableName( - NewNonOwningCancelableRunnableMethodXXX + NewNonOwningCancelableRunnableMethod (Forward(aPtr), aMethod, mozilla::Forward(aArgs)...), aName); } @@ -1628,7 +1613,7 @@ template already_AddRefed> -NewIdleRunnableMethodXXX(PtrType&& aPtr, Method aMethod, Args&&... aArgs) +NewIdleRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs) { static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); @@ -1650,7 +1635,7 @@ NewIdleRunnableMethod(const char* aName, static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); return detail::SetRunnableName( - NewIdleRunnableMethodXXX( + NewIdleRunnableMethod( Forward(aPtr), aMethod, mozilla::Forward(aArgs)...), aName); } @@ -1660,7 +1645,7 @@ template already_AddRefed> -NewNonOwningIdleRunnableMethodXXX(PtrType&& aPtr, Method aMethod, Args&&... aArgs) +NewNonOwningIdleRunnableMethod(PtrType&& aPtr, Method aMethod, Args&&... aArgs) { static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); @@ -1682,7 +1667,7 @@ NewNonOwningIdleRunnableMethod(const char* aName, static_assert(sizeof...(Storages) == sizeof...(Args), " size should be equal to number of arguments"); return detail::SetRunnableName( - NewNonOwningIdleRunnableMethodXXX( + NewNonOwningIdleRunnableMethod( Forward(aPtr), aMethod, mozilla::Forward(aArgs)...), aName); } diff --git a/xpfe/appshell/nsAppShellService.cpp b/xpfe/appshell/nsAppShellService.cpp index f93528a05b3c2..63aa3699e8162 100644 --- a/xpfe/appshell/nsAppShellService.cpp +++ b/xpfe/appshell/nsAppShellService.cpp @@ -404,10 +404,9 @@ WebBrowserChrome2Stub::Blur() class BrowserDestroyer final : public Runnable { public: - BrowserDestroyer(nsIWebBrowser* aBrowser, nsISupports* aContainer) - : mozilla::Runnable("BrowserDestroyer") - , mBrowser(aBrowser) - , mContainer(aContainer) + BrowserDestroyer(nsIWebBrowser *aBrowser, nsISupports *aContainer) : + mBrowser(aBrowser), + mContainer(aContainer) { } diff --git a/xpfe/appshell/nsContentTreeOwner.cpp b/xpfe/appshell/nsContentTreeOwner.cpp index 1a73de11a5dfa..d9067cea541a4 100644 --- a/xpfe/appshell/nsContentTreeOwner.cpp +++ b/xpfe/appshell/nsContentTreeOwner.cpp @@ -942,8 +942,7 @@ class nsContentTitleSettingEvent : public Runnable { public: nsContentTitleSettingEvent(dom::Element* dse, const nsAString& wtm) - : Runnable("nsContentTitleSettingEvent"), - mElement(dse), + : mElement(dse), mTitleDefault(wtm) {} NS_IMETHOD Run() override diff --git a/xpfe/components/directory/nsDirectoryViewer.cpp b/xpfe/components/directory/nsDirectoryViewer.cpp index f1dff24fe569a..6acda8805c095 100644 --- a/xpfe/components/directory/nsDirectoryViewer.cpp +++ b/xpfe/components/directory/nsDirectoryViewer.cpp @@ -863,15 +863,11 @@ nsHTTPIndex::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aProperty, bool NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create a timer"); if (NS_SUCCEEDED(rv)) { - mTimer->InitWithNamedFuncCallback( - nsHTTPIndex::FireTimer, - this, - 1, - nsITimer::TYPE_ONE_SHOT, - "nsHTTPIndex::GetTargets"); - // Note: don't addref "this" as we'll cancel the - // timer in the httpIndex destructor - } + mTimer->InitWithFuncCallback(nsHTTPIndex::FireTimer, this, 1, + nsITimer::TYPE_ONE_SHOT); + // Note: don't addref "this" as we'll cancel the + // timer in the httpIndex destructor + } } } } @@ -902,14 +898,11 @@ nsHTTPIndex::AddElement(nsIRDFResource *parent, nsIRDFResource *prop, nsIRDFNode NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create a timer"); if (NS_FAILED(rv)) return(rv); - mTimer->InitWithNamedFuncCallback(nsHTTPIndex::FireTimer, - this, - 1, - nsITimer::TYPE_ONE_SHOT, - "nsHTTPIndex::AddElement"); - // Note: don't addref "this" as we'll cancel the - // timer in the httpIndex destructor - } + mTimer->InitWithFuncCallback(nsHTTPIndex::FireTimer, this, 1, + nsITimer::TYPE_ONE_SHOT); + // Note: don't addref "this" as we'll cancel the + // timer in the httpIndex destructor + } return(NS_OK); } @@ -1038,11 +1031,8 @@ nsHTTPIndex::FireTimer(nsITimer* aTimer, void* aClosure) httpIndex->mTimer = do_CreateInstance("@mozilla.org/timer;1"); if (httpIndex->mTimer) { - httpIndex->mTimer->InitWithNamedFuncCallback(nsHTTPIndex::FireTimer, - aClosure, - 10, - nsITimer::TYPE_ONE_SHOT, - "nsHTTPIndex::FireTimer"); + httpIndex->mTimer->InitWithFuncCallback(nsHTTPIndex::FireTimer, aClosure, 10, + nsITimer::TYPE_ONE_SHOT); // Note: don't addref "this" as we'll cancel the // timer in the httpIndex destructor }