Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)

MozReview-Commit-ID: DKR6ROiHRS7
This commit is contained in:
Bill McCloskey 2017-06-12 12:34:10 -07:00
parent 3c1581f160
commit 6b3e84ed5f
617 changed files with 6334 additions and 3563 deletions

View File

@ -1799,8 +1799,13 @@ Accessible::DoCommand(nsIContent *aContent, uint32_t aActionIndex)
class Runnable final : public mozilla::Runnable
{
public:
Runnable(Accessible* aAcc, nsIContent* aContent, uint32_t aIdx) :
mAcc(aAcc), mContent(aContent), mIdx(aIdx) { }
Runnable(Accessible* aAcc, nsIContent* aContent, uint32_t aIdx)
: mozilla::Runnable("Runnable")
, mAcc(aAcc)
, mContent(aContent)
, mIdx(aIdx)
{
}
NS_IMETHOD Run() override
{

View File

@ -649,9 +649,12 @@ DocAccessible::ScrollPositionDidChange(nscoord aX, nscoord aY)
mScrollWatchTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mScrollWatchTimer) {
NS_ADDREF_THIS(); // Kung fu death grip
mScrollWatchTimer->InitWithFuncCallback(ScrollTimerCallback, this,
kScrollPosCheckWait,
nsITimer::TYPE_REPEATING_SLACK);
mScrollWatchTimer->InitWithNamedFuncCallback(
ScrollTimerCallback,
this,
kScrollPosCheckWait,
nsITimer::TYPE_REPEATING_SLACK,
"a11y::DocAccessible::ScrollPositionDidChange");
}
}
mScrollPositionChangedTicks = 1;

View File

@ -95,7 +95,8 @@ HandlerProvider::GetAndSerializePayload(const MutexAutoLock&)
IA2Payload payload{};
if (!mscom::InvokeOnMainThread(this, &HandlerProvider::BuildIA2Data,
if (!mscom::InvokeOnMainThread("HandlerProvider::BuildIA2Data",
this, &HandlerProvider::BuildIA2Data,
&payload.mData) ||
!payload.mData.mUniqueId) {
return;
@ -236,7 +237,8 @@ HandlerProvider::put_HandlerControl(long aPid, IHandlerControl* aCtrl)
auto ptrProxy = mscom::ToProxyUniquePtr(aCtrl);
if (!mscom::InvokeOnMainThread(this,
if (!mscom::InvokeOnMainThread("HandlerProvider::SetHandlerControlOnMainThread",
this,
&HandlerProvider::SetHandlerControlOnMainThread,
static_cast<DWORD>(aPid), Move(ptrProxy))) {
return E_FAIL;
@ -250,7 +252,8 @@ HandlerProvider::Refresh(IA2Data* aOutData)
{
MOZ_ASSERT(mscom::IsCurrentThreadMTA());
if (!mscom::InvokeOnMainThread(this, &HandlerProvider::BuildIA2Data,
if (!mscom::InvokeOnMainThread("HandlerProvider::BuildIA2Data",
this, &HandlerProvider::BuildIA2Data,
aOutData)) {
return E_FAIL;
}

View File

@ -841,7 +841,8 @@ AccessibleWrap::accSelect(
// is happening, so we dispatch TakeFocus from the main thread to
// guarantee that we are outside any IPC.
nsCOMPtr<nsIRunnable> runnable =
mozilla::NewRunnableMethod(this, &Accessible::TakeFocus);
mozilla::NewRunnableMethod("Accessible::TakeFocus",
this, &Accessible::TakeFocus);
NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
return S_OK;
}

View File

@ -251,7 +251,8 @@ 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<nsIRunnable> runnable(
NewRunnableMethod<nsCOMPtr<nsIFile>>(this,
NewRunnableMethod<nsCOMPtr<nsIFile>>("LazyInstantiator::GatherTelemetry",
this,
&LazyInstantiator::GatherTelemetry,
clientExe));
NS_NewThread(getter_AddRefs(mTelemetryThread), runnable);
@ -327,7 +328,9 @@ 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<nsString>(this,
NS_DispatchToMainThread(NewNonOwningRunnableMethod<nsString>(
"LazyInstantiator::AccumulateTelemetry",
this,
&LazyInstantiator::AccumulateTelemetry, value));
}

View File

@ -79,8 +79,12 @@ xpcAccessibilityService::Release(void)
if (count == 1 && !mShutdownTimer) {
mShutdownTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
if (mShutdownTimer) {
mShutdownTimer->InitWithFuncCallback(ShutdownCallback, this, 100,
nsITimer::TYPE_ONE_SHOT);
mShutdownTimer->InitWithNamedFuncCallback(
ShutdownCallback,
this,
100,
nsITimer::TYPE_ONE_SHOT,
"xpcAccessibilityService::Release");
}
}

View File

@ -454,9 +454,12 @@ nsPingListener::StartTimeout(DocGroup* aDocGroup)
timer->SetTarget(aDocGroup->EventTargetFor(TaskCategory::Network));
if (timer) {
nsresult rv = timer->InitWithFuncCallback(OnPingTimeout, mLoadGroup,
PING_TIMEOUT,
nsITimer::TYPE_ONE_SHOT);
nsresult rv =
timer->InitWithNamedFuncCallback(OnPingTimeout,
mLoadGroup,
PING_TIMEOUT,
nsITimer::TYPE_ONE_SHOT,
"nsPingListener::StartTimeout");
if (NS_SUCCEEDED(rv)) {
mTimer = timer;
return NS_OK;
@ -1767,10 +1770,12 @@ nsDocShell::DispatchToTabGroup(const char* aName,
NS_IMETHODIMP
nsDocShell::DispatchLocationChangeEvent()
{
return DispatchToTabGroup("nsDocShell::FireDummyOnLocationChange",
TaskCategory::Other,
NewRunnableMethod(this,
&nsDocShell::FireDummyOnLocationChange));
return DispatchToTabGroup(
"nsDocShell::FireDummyOnLocationChange",
TaskCategory::Other,
NewRunnableMethod("nsDocShell::FireDummyOnLocationChange",
this,
&nsDocShell::FireDummyOnLocationChange));
}
bool
@ -9644,13 +9649,20 @@ public:
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)
: 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)
: mozilla::Runnable("InternalLoadEvent")
, mSrcdoc(aSrcdoc)
, mDocShell(aDocShell)
, mURI(aURI)
, mOriginalURI(aOriginalURI)
@ -14040,7 +14052,8 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
bool aNoOpenerImplied,
bool aIsTrusted,
nsIPrincipal* aTriggeringPrincipal)
: mHandler(aHandler)
: mozilla::Runnable("OnLinkClickEvent")
, mHandler(aHandler)
, mURI(aURI)
, mTargetSpec(aTargetSpec)
, mFileName(aFileName)

View File

@ -777,7 +777,11 @@ public:
{
public:
NS_DECL_NSIRUNNABLE
explicit RestorePresentationEvent(nsDocShell* aDs) : mDocShell(aDs) {}
explicit RestorePresentationEvent(nsDocShell* aDs)
: mozilla::Runnable("nsDocShell::RestorePresentationEvent")
, mDocShell(aDs)
{
}
void Revoke() { mDocShell = nullptr; }
private:
RefPtr<nsDocShell> mDocShell;

View File

@ -1260,10 +1260,12 @@ ChromeTooltipListener::MouseMove(nsIDOMEvent* aMouseEvent)
}
}
if (mPossibleTooltipNode) {
nsresult rv = mTooltipTimer->InitWithFuncCallback(
sTooltipCallback, this,
nsresult rv = mTooltipTimer->InitWithNamedFuncCallback(
sTooltipCallback,
this,
LookAndFeel::GetInt(LookAndFeel::eIntID_TooltipDelay, 500),
nsITimer::TYPE_ONE_SHOT);
nsITimer::TYPE_ONE_SHOT,
"ChromeTooltipListener::MouseMove");
if (NS_FAILED(rv)) {
mPossibleTooltipNode = nullptr;
}

View File

@ -185,7 +185,8 @@ class DestroyViewerEvent : public mozilla::Runnable
{
public:
DestroyViewerEvent(nsIContentViewer* aViewer, nsIDocument* aDocument)
: mViewer(aViewer)
: mozilla::Runnable("DestroyViewerEvent")
, mViewer(aViewer)
, mDocument(aDocument)
{
}

View File

@ -1453,7 +1453,9 @@ Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag)
DoFinishNotificationImmediately();
} else if (!mFinishNotificationTask.IsPending()) {
RefPtr<nsRunnableMethod<Animation>> runnable =
NewRunnableMethod(this, &Animation::DoFinishNotificationImmediately);
NewRunnableMethod("dom::Animation::DoFinishNotificationImmediately",
this,
&Animation::DoFinishNotificationImmediately);
context->DispatchToMicroTask(do_AddRef(runnable));
mFinishNotificationTask = runnable.forget();
}

View File

@ -242,11 +242,12 @@ class FileDescriptorHolder : public Runnable
{
public:
FileDescriptorHolder()
: mQuotaObject(nullptr),
mFileSize(INT64_MIN),
mFileDesc(nullptr),
mFileMap(nullptr),
mMappedMemory(nullptr)
: Runnable("dom::asmjscache::FileDescriptorHolder")
, mQuotaObject(nullptr)
, mFileSize(INT64_MIN)
, mFileDesc(nullptr)
, mFileMap(nullptr)
, mMappedMemory(nullptr)
{ }
~FileDescriptorHolder() override

View File

@ -85,9 +85,11 @@ private:
class AudioPlaybackRunnable final : public Runnable
{
public:
AudioPlaybackRunnable(nsPIDOMWindowOuter* aWindow, bool aActive,
AudioPlaybackRunnable(nsPIDOMWindowOuter* aWindow,
bool aActive,
AudioChannelService::AudibleChangedReasons aReason)
: mWindow(aWindow)
: mozilla::Runnable("AudioPlaybackRunnable")
, mWindow(aWindow)
, mActive(aActive)
, mReason(aReason)
{}
@ -874,7 +876,9 @@ AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop(nsPIDOMWindowOuter
mShouldSendBlockStopEvent = false;
// Can't use raw pointer for lamba variable capturing, use smart ptr.
nsCOMPtr<nsPIDOMWindowOuter> window = aWindow;
NS_DispatchToCurrentThread(NS_NewRunnableFunction([window] () -> void {
NS_DispatchToCurrentThread(NS_NewRunnableFunction(
"dom::AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop",
[window]() -> void {
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
@ -884,8 +888,7 @@ AudioChannelService::AudioChannelWindow::NotifyMediaBlockStop(nsPIDOMWindowOuter
observerService->NotifyObservers(ToSupports(window),
"audio-playback",
u"blockStop");
})
);
}));
}
void
@ -1049,18 +1052,19 @@ AudioChannelService::AudioChannelWindow::MaybeNotifyMediaBlockStart(AudioChannel
if (!mShouldSendBlockStopEvent) {
mShouldSendBlockStopEvent = true;
NS_DispatchToCurrentThread(NS_NewRunnableFunction([window] () -> void {
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
return;
}
NS_DispatchToCurrentThread(NS_NewRunnableFunction(
"dom::AudioChannelService::AudioChannelWindow::"
"MaybeNotifyMediaBlockStart",
[window]() -> void {
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
return;
}
observerService->NotifyObservers(ToSupports(window),
"audio-playback",
u"blockStart");
})
);
observerService->NotifyObservers(
ToSupports(window), "audio-playback", u"blockStart");
}));
}
}

View File

@ -454,8 +454,9 @@ 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<nsIRunnable> runnable =
NS_NewRunnableFunction(&CustomElementRegistry::ProcessTopElementQueue);
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
"dom::CustomElementRegistry::EnqueueLifecycleCallback",
&CustomElementRegistry::ProcessTopElementQueue);
nsContentUtils::AddScriptRunner(runnable);
}
}

View File

@ -243,8 +243,11 @@ private:
private:
class ProcessBackupQueueRunnable : public mozilla::Runnable {
public:
explicit ProcessBackupQueueRunnable(CustomElementReactionsStack* aReactionStack)
: mReactionStack(aReactionStack)
explicit ProcessBackupQueueRunnable(
CustomElementReactionsStack* aReactionStack)
: Runnable(
"dom::CustomElementReactionsStack::ProcessBackupQueueRunnable")
, mReactionStack(aReactionStack)
{
MOZ_ASSERT(!mReactionStack->mIsBackupQueueProcessing,
"mIsBackupQueueProcessing should be initially false");

View File

@ -299,10 +299,10 @@ DOMRequestService::FireDetailedError(nsIDOMDOMRequest* aRequest,
class FireSuccessAsyncTask : public mozilla::Runnable
{
FireSuccessAsyncTask(DOMRequest* aRequest,
const JS::Value& aResult) :
mReq(aRequest),
mResult(RootingCx(), aResult)
FireSuccessAsyncTask(DOMRequest* aRequest, const JS::Value& aResult)
: mozilla::Runnable("FireSuccessAsyncTask")
, mReq(aRequest)
, mResult(RootingCx(), aResult)
{
}
@ -336,10 +336,10 @@ private:
class FireErrorAsyncTask : public mozilla::Runnable
{
public:
FireErrorAsyncTask(DOMRequest* aRequest,
const nsAString& aError) :
mReq(aRequest),
mError(aError)
FireErrorAsyncTask(DOMRequest* aRequest, const nsAString& aError)
: mozilla::Runnable("FireErrorAsyncTask")
, mReq(aRequest)
, mError(aError)
{
}

View File

@ -613,7 +613,9 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
binding->ExecuteAttachedHandler();
} else {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler));
NewRunnableMethod("nsXBLBinding::ExecuteAttachedHandler",
binding,
&nsXBLBinding::ExecuteAttachedHandler));
}
}
}
@ -1788,10 +1790,14 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
return NS_OK;
}
RemoveFromBindingManagerRunnable::RemoveFromBindingManagerRunnable(nsBindingManager* aManager,
nsIContent* aContent,
nsIDocument* aDoc):
mManager(aManager), mContent(aContent), mDoc(aDoc)
RemoveFromBindingManagerRunnable::RemoveFromBindingManagerRunnable(
nsBindingManager* aManager,
nsIContent* aContent,
nsIDocument* aDoc)
: mozilla::Runnable("dom::RemoveFromBindingManagerRunnable")
, mManager(aManager)
, mContent(aContent)
, mDoc(aDoc)
{}
RemoveFromBindingManagerRunnable::~RemoveFromBindingManagerRunnable() {}

View File

@ -391,7 +391,9 @@ EventSourceImpl::Close()
// Asynchronously call CloseInternal to prevent EventSourceImpl from being
// synchronously destoryed while dispatching DOM event.
DebugOnly<nsresult> rv =
Dispatch(NewRunnableMethod(this, &EventSourceImpl::CloseInternal),
Dispatch(NewRunnableMethod("dom::EventSourceImpl::CloseInternal",
this,
&EventSourceImpl::CloseInternal),
NS_DISPATCH_NORMAL);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
@ -683,7 +685,9 @@ EventSourceImpl::OnStartRequest(nsIRequest* aRequest, nsISupports* aCtxt)
}
}
}
rv = Dispatch(NewRunnableMethod(this, &EventSourceImpl::AnnounceConnection),
rv = Dispatch(NewRunnableMethod("dom::EventSourceImpl::AnnounceConnection",
this,
&EventSourceImpl::AnnounceConnection),
NS_DISPATCH_NORMAL);
NS_ENSURE_SUCCESS(rv, rv);
mStatus = PARSE_STATE_BEGIN_OF_STREAM;
@ -752,7 +756,8 @@ class DataAvailableRunnable final : public Runnable
DataAvailableRunnable(EventSourceImpl* aEventSourceImpl,
UniquePtr<char[]> aData,
uint32_t aLength)
: mEventSourceImpl(aEventSourceImpl)
: Runnable("dom::DataAvailableRunnable")
, mEventSourceImpl(aEventSourceImpl)
, mData(Move(aData))
, mLength(aLength)
{
@ -840,9 +845,10 @@ EventSourceImpl::OnStopRequest(nsIRequest* aRequest,
nsresult rv = CheckHealthOfRequestCallback(aRequest);
NS_ENSURE_SUCCESS(rv, rv);
rv = Dispatch(
NewRunnableMethod(this, &EventSourceImpl::ReestablishConnection),
NS_DISPATCH_NORMAL);
rv = Dispatch(NewRunnableMethod("dom::EventSourceImpl::ReestablishConnection",
this,
&EventSourceImpl::ReestablishConnection),
NS_DISPATCH_NORMAL);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1245,9 +1251,12 @@ EventSourceImpl::SetReconnectionTimeout()
NS_ENSURE_STATE(mTimer);
}
nsresult rv = mTimer->InitWithFuncCallback(TimerCallback, this,
mReconnectionTime,
nsITimer::TYPE_ONE_SHOT);
nsresult rv = mTimer->InitWithNamedFuncCallback(
TimerCallback,
this,
mReconnectionTime,
nsITimer::TYPE_ONE_SHOT,
"dom::EventSourceImpl::SetReconnectionTimeout");
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -1341,7 +1350,9 @@ EventSourceImpl::DispatchFailConnection()
if (NS_FAILED(rv)) {
NS_WARNING("Failed to print to the console error");
}
rv = Dispatch(NewRunnableMethod(this, &EventSourceImpl::FailConnection),
rv = Dispatch(NewRunnableMethod("dom::EventSourceImpl::FailConnection",
this,
&EventSourceImpl::FailConnection),
NS_DISPATCH_NORMAL);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
@ -1407,7 +1418,9 @@ EventSourceImpl::Thaw()
nsresult rv;
if (!mGoingToDispatchAllMessages && mMessagesToDispatch.GetSize() > 0) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &EventSourceImpl::DispatchAllMessageEvents);
NewRunnableMethod("dom::EventSourceImpl::DispatchAllMessageEvents",
this,
&EventSourceImpl::DispatchAllMessageEvents);
NS_ENSURE_STATE(event);
mGoingToDispatchAllMessages = true;
@ -1468,7 +1481,9 @@ EventSourceImpl::DispatchCurrentMessageEvent()
if (!mGoingToDispatchAllMessages) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &EventSourceImpl::DispatchAllMessageEvents);
NewRunnableMethod("dom::EventSourceImpl::DispatchAllMessageEvents",
this,
&EventSourceImpl::DispatchAllMessageEvents);
NS_ENSURE_STATE(event);
mGoingToDispatchAllMessages = true;

View File

@ -552,9 +552,9 @@ ImageEncoder::EnsureThreadPool()
sThreadPool = threadPool;
if (!NS_IsMainThread()) {
NS_DispatchToMainThread(NS_NewRunnableFunction([]() -> void {
RegisterEncoderThreadPoolTerminatorObserver();
}));
NS_DispatchToMainThread(NS_NewRunnableFunction(
"dom::ImageEncoder::EnsureThreadPool",
[]() -> void { RegisterEncoderThreadPoolTerminatorObserver(); }));
} else {
RegisterEncoderThreadPoolTerminatorObserver();
}

View File

@ -35,14 +35,16 @@ PostMessageEvent::PostMessageEvent(nsGlobalWindow* aSource,
nsIPrincipal* aProvidedPrincipal,
nsIDocument* aSourceDocument,
bool aTrustedCaller)
: StructuredCloneHolder(CloningSupported, TransferringSupported,
StructuredCloneScope::SameProcessSameThread),
mSource(aSource),
mCallerOrigin(aCallerOrigin),
mTargetWindow(aTargetWindow),
mProvidedPrincipal(aProvidedPrincipal),
mSourceDocument(aSourceDocument),
mTrustedCaller(aTrustedCaller)
: Runnable("dom::PostMessageEvent")
, StructuredCloneHolder(CloningSupported,
TransferringSupported,
StructuredCloneScope::SameProcessSameThread)
, mSource(aSource)
, mCallerOrigin(aCallerOrigin)
, mTargetWindow(aTargetWindow)
, mProvidedPrincipal(aProvidedPrincipal)
, mSourceDocument(aSourceDocument)
, mTrustedCaller(aTrustedCaller)
{
}

View File

@ -553,8 +553,10 @@ ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration)
doc->SetOrientationPendingPromise(nullptr);
}
nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod(this,
&ScreenOrientation::DispatchChangeEvent);
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod("dom::ScreenOrientation::DispatchChangeEvent",
this,
&ScreenOrientation::DispatchChangeEvent);
rv = NS_DispatchToMainThread(runnable);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
}
@ -640,8 +642,10 @@ ScreenOrientation::VisibleEventListener::HandleEvent(nsIDOMEvent* aEvent)
doc->SetOrientationPendingPromise(nullptr);
}
nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod(orientation,
&ScreenOrientation::DispatchChangeEvent);
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod("dom::ScreenOrientation::DispatchChangeEvent",
orientation,
&ScreenOrientation::DispatchChangeEvent);
rv = NS_DispatchToMainThread(runnable);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();

View File

@ -323,11 +323,13 @@ private:
nsIPresShell::ScrollAxis aVertical,
nsIPresShell::ScrollAxis aHorizontal,
int32_t aFlags)
: mSelection(aSelection),
mRegion(aRegion),
mVerticalScroll(aVertical),
mHorizontalScroll(aHorizontal),
mFlags(aFlags) {
: Runnable("dom::Selection::ScrollSelectionIntoViewEvent")
, mSelection(aSelection)
, mRegion(aRegion)
, mVerticalScroll(aVertical)
, mHorizontalScroll(aHorizontal)
, mFlags(aFlags)
{
NS_ASSERTION(aSelection, "null parameter");
}
void Revoke() { mSelection = nullptr; }

View File

@ -268,7 +268,8 @@ class CallDispatchConnectionCloseEvents final : public CancelableRunnable
{
public:
explicit CallDispatchConnectionCloseEvents(WebSocketImpl* aWebSocketImpl)
: mWebSocketImpl(aWebSocketImpl)
: CancelableRunnable("dom::CallDispatchConnectionCloseEvents")
, mWebSocketImpl(aWebSocketImpl)
{
aWebSocketImpl->AssertIsOnTargetThread();
}
@ -404,9 +405,11 @@ namespace {
class CancelWebSocketRunnable final : public Runnable
{
public:
CancelWebSocketRunnable(nsIWebSocketChannel* aChannel, uint16_t aReasonCode,
CancelWebSocketRunnable(nsIWebSocketChannel* aChannel,
uint16_t aReasonCode,
const nsACString& aReasonString)
: mChannel(aChannel)
: Runnable("dom::CancelWebSocketRunnable")
, mChannel(aChannel)
, mReasonCode(aReasonCode)
, mReasonString(aReasonString)
{}
@ -458,7 +461,8 @@ public:
CloseConnectionRunnable(WebSocketImpl* aImpl,
uint16_t aReasonCode,
const nsACString& aReasonString)
: mImpl(aImpl)
: Runnable("dom::CloseConnectionRunnable")
, mImpl(aImpl)
, mReasonCode(aReasonCode)
, mReasonString(aReasonString)
{}

View File

@ -285,8 +285,9 @@ nsContentSink::ProcessHTTPHeaders(nsIChannel* aChannel)
"Already dispatched an event?");
mProcessLinkHeaderEvent =
NewNonOwningRunnableMethod(this,
&nsContentSink::DoProcessLinkHeader);
NewNonOwningRunnableMethod("nsContentSink::DoProcessLinkHeader",
this,
&nsContentSink::DoProcessLinkHeader);
rv = NS_DispatchToCurrentThread(mProcessLinkHeaderEvent.get());
if (NS_FAILED(rv)) {
mProcessLinkHeaderEvent.Forget();

View File

@ -5322,12 +5322,16 @@ nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode,
class AnonymousContentDestroyer : public Runnable {
public:
explicit AnonymousContentDestroyer(nsCOMPtr<nsIContent>* aContent) {
explicit AnonymousContentDestroyer(nsCOMPtr<nsIContent>* aContent)
: mozilla::Runnable("AnonymousContentDestroyer")
{
mContent.swap(*aContent);
mParent = mContent->GetParent();
mDoc = mContent->OwnerDoc();
}
explicit AnonymousContentDestroyer(nsCOMPtr<Element>* aElement) {
explicit AnonymousContentDestroyer(nsCOMPtr<Element>* aElement)
: mozilla::Runnable("AnonymousContentDestroyer")
{
mContent = aElement->forget();
mParent = mContent->GetParent();
mDoc = mContent->OwnerDoc();
@ -10560,9 +10564,9 @@ nsContentUtils::UserInteractionObserver::Init()
// started yet. It will have started by the time we have the chance to spin
// the event loop.
RefPtr<UserInteractionObserver> self = this;
NS_DispatchToMainThread(NS_NewRunnableFunction([=] () {
HangMonitor::RegisterAnnotator(*self);
}));
NS_DispatchToMainThread(
NS_NewRunnableFunction("nsContentUtils::UserInteractionObserver::Init",
[=]() { HangMonitor::RegisterAnnotator(*self); }));
}
void

View File

@ -867,6 +867,7 @@ nsDOMMutationObserver::HandleMutation()
class AsyncMutationHandler : public mozilla::Runnable
{
public:
AsyncMutationHandler() : mozilla::Runnable("AsyncMutationHandler") {}
NS_IMETHOD Run() override
{
nsDOMMutationObserver::HandleMutations();

View File

@ -1109,10 +1109,21 @@ nsDOMWindowUtils::SendNativeKeyEvent(int32_t aNativeKeyboardLayout,
if (!widget)
return NS_ERROR_FAILURE;
NS_DispatchToMainThread(NewRunnableMethod
<int32_t, int32_t, uint32_t, nsString, nsString, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeKeyEvent, aNativeKeyboardLayout,
aNativeKeyCode, aModifiers, aCharacters, aUnmodifiedCharacters, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<int32_t,
int32_t,
uint32_t,
nsString,
nsString,
nsIObserver*>("nsIWidget::SynthesizeNativeKeyEvent",
widget,
&nsIWidget::SynthesizeNativeKeyEvent,
aNativeKeyboardLayout,
aNativeKeyCode,
aModifiers,
aCharacters,
aUnmodifiedCharacters,
aObserver));
return NS_OK;
}
@ -1129,11 +1140,15 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX,
if (!widget)
return NS_ERROR_FAILURE;
NS_DispatchToMainThread(NewRunnableMethod
<LayoutDeviceIntPoint, int32_t, int32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeMouseEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aModifierFlags,
aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<LayoutDeviceIntPoint, int32_t, int32_t, nsIObserver*>(
"nsIWidget::SynthesizeNativeMouseEvent",
widget,
&nsIWidget::SynthesizeNativeMouseEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aNativeMessage,
aModifierFlags,
aObserver));
return NS_OK;
}
@ -1148,10 +1163,12 @@ nsDOMWindowUtils::SendNativeMouseMove(int32_t aScreenX,
if (!widget)
return NS_ERROR_FAILURE;
NS_DispatchToMainThread(NewRunnableMethod
<LayoutDeviceIntPoint, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeMouseMove,
LayoutDeviceIntPoint(aScreenX, aScreenY), aObserver));
NS_DispatchToMainThread(NewRunnableMethod<LayoutDeviceIntPoint, nsIObserver*>(
"nsIWidget::SynthesizeNativeMouseMove",
widget,
&nsIWidget::SynthesizeNativeMouseMove,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aObserver));
return NS_OK;
}
@ -1173,11 +1190,25 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NewRunnableMethod
<mozilla::LayoutDeviceIntPoint, uint32_t, double, double, double, uint32_t, uint32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeMouseScrollEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aDeltaX, aDeltaY,
aDeltaZ, aModifierFlags, aAdditionalFlags, aObserver));
NS_DispatchToMainThread(NewRunnableMethod<mozilla::LayoutDeviceIntPoint,
uint32_t,
double,
double,
double,
uint32_t,
uint32_t,
nsIObserver*>(
"nsIWidget::SynthesizeNativeMouseScrollEvent",
widget,
&nsIWidget::SynthesizeNativeMouseScrollEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aNativeMessage,
aDeltaX,
aDeltaY,
aDeltaZ,
aModifierFlags,
aAdditionalFlags,
aObserver));
return NS_OK;
}
@ -1199,12 +1230,21 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
return NS_ERROR_INVALID_ARG;
}
NS_DispatchToMainThread(NewRunnableMethod
<uint32_t, nsIWidget::TouchPointerState, LayoutDeviceIntPoint, double, uint32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId,
(nsIWidget::TouchPointerState)aTouchState,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aPressure, aOrientation, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<uint32_t,
nsIWidget::TouchPointerState,
LayoutDeviceIntPoint,
double,
uint32_t,
nsIObserver*>("nsIWidget::SynthesizeNativeTouchPoint",
widget,
&nsIWidget::SynthesizeNativeTouchPoint,
aPointerId,
(nsIWidget::TouchPointerState)aTouchState,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aPressure,
aOrientation,
aObserver));
return NS_OK;
}
@ -1219,10 +1259,14 @@ nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NewRunnableMethod
<LayoutDeviceIntPoint, bool, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchTap,
LayoutDeviceIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<LayoutDeviceIntPoint, bool, nsIObserver*>(
"nsIWidget::SynthesizeNativeTouchTap",
widget,
&nsIWidget::SynthesizeNativeTouchTap,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aLongTap,
aObserver));
return NS_OK;
}
@ -1234,8 +1278,11 @@ nsDOMWindowUtils::ClearNativeTouchSequence(nsIObserver* aObserver)
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NewRunnableMethod<nsIObserver*>
(widget, &nsIWidget::ClearNativeTouchSequence, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<nsIObserver*>("nsIWidget::ClearNativeTouchSequence",
widget,
&nsIWidget::ClearNativeTouchSequence,
aObserver));
return NS_OK;
}

View File

@ -18,7 +18,8 @@ class nsDocElementCreatedNotificationRunner : public mozilla::Runnable
{
public:
explicit nsDocElementCreatedNotificationRunner(nsIDocument* aDoc)
: mDoc(aDoc)
: mozilla::Runnable("nsDocElementCreatedNotificationRunner")
, mDoc(aDoc)
{
}

View File

@ -4434,8 +4434,10 @@ nsDocument::SetStyleSheetApplicableState(StyleSheet* aSheet,
if (!mSSApplicableStateNotificationPending) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> notification = NewRunnableMethod(this,
&nsDocument::NotifyStyleSheetApplicableStateChanged);
nsCOMPtr<nsIRunnable> notification =
NewRunnableMethod("nsDocument::NotifyStyleSheetApplicableStateChanged",
this,
&nsDocument::NotifyStyleSheetApplicableStateChanged);
mSSApplicableStateNotificationPending =
NS_SUCCEEDED(
Dispatch("nsDocument::NotifyStyleSheetApplicableStateChanged",
@ -5050,7 +5052,9 @@ nsDocument::MaybeEndOutermostXBLUpdate()
} else if (!mInDestructor) {
if (!mMaybeEndOutermostXBLUpdateRunner) {
mMaybeEndOutermostXBLUpdateRunner =
NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate);
NewRunnableMethod("nsDocument::MaybeEndOutermostXBLUpdate",
this,
&nsDocument::MaybeEndOutermostXBLUpdate);
}
nsContentUtils::AddScriptRunner(mMaybeEndOutermostXBLUpdateRunner);
}
@ -5381,7 +5385,9 @@ nsDocument::UnblockDOMContentLoaded()
if (!mSynchronousDOMContentLoaded) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
NewRunnableMethod("nsDocument::DispatchContentLoadedEvents",
this,
&nsDocument::DispatchContentLoadedEvents);
Dispatch("nsDocument::DispatchContentLoadedEvents", TaskCategory::Other, ev.forget());
} else {
DispatchContentLoadedEvents();
@ -7019,7 +7025,9 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
MOZ_RELEASE_ASSERT(NS_IsMainThread());
RefPtr<nsRunnableMethod<nsDocument, void, false>> event =
NewNonOwningRunnableMethod(this, &nsDocument::DoNotifyPossibleTitleChange);
NewNonOwningRunnableMethod("nsDocument::DoNotifyPossibleTitleChange",
this,
&nsDocument::DoNotifyPossibleTitleChange);
nsresult rv = Dispatch("nsDocument::DoNotifyPossibleTitleChange",
TaskCategory::Other, do_AddRef(event));
if (NS_SUCCEEDED(rv)) {
@ -7169,7 +7177,9 @@ nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
mInitializableFrameLoaders.AppendElement(aLoader);
if (!mFrameLoaderRunner) {
mFrameLoaderRunner =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders",
this,
&nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
@ -7187,7 +7197,9 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader, nsIRunnable* aFinalizer)
mFrameLoaderFinalizers.AppendElement(aFinalizer);
if (!mFrameLoaderRunner) {
mFrameLoaderRunner =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders",
this,
&nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
@ -7211,7 +7223,9 @@ nsDocument::MaybeInitializeFinalizeFrameLoaders()
(mInitializableFrameLoaders.Length() ||
mFrameLoaderFinalizers.Length())) {
mFrameLoaderRunner =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders",
this,
&nsDocument::MaybeInitializeFinalizeFrameLoaders);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
return;
@ -8788,8 +8802,8 @@ nsDocument::BlockOnload()
// block onload only when there are no script blockers.
++mAsyncOnloadBlockCount;
if (mAsyncOnloadBlockCount == 1) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsDocument::AsyncBlockOnload));
nsContentUtils::AddScriptRunner(NewRunnableMethod(
"nsDocument::AsyncBlockOnload", this, &nsDocument::AsyncBlockOnload));
}
return;
}
@ -8846,7 +8860,11 @@ nsDocument::UnblockOnload(bool aFireSync)
class nsUnblockOnloadEvent : public Runnable {
public:
explicit nsUnblockOnloadEvent(nsDocument* aDoc) : mDoc(aDoc) {}
explicit nsUnblockOnloadEvent(nsDocument* aDoc)
: mozilla::Runnable("nsUnblockOnloadEvent")
, mDoc(aDoc)
{
}
NS_IMETHOD Run() override {
mDoc->DoUnblockOnload();
return NS_OK;
@ -9728,6 +9746,7 @@ class nsDelayedEventDispatcher : public Runnable
{
public:
explicit nsDelayedEventDispatcher(nsTArray<nsCOMPtr<nsIDocument>>& aDocuments)
: mozilla::Runnable("nsDelayedEventDispatcher")
{
mDocuments.SwapElements(aDocuments);
}
@ -9974,7 +9993,9 @@ nsIDocument::RegisterPendingLinkUpdate(Link* aLink)
if (!mHasLinksToUpdateRunnable) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &nsIDocument::FlushPendingLinkUpdatesFromRunnable);
NewRunnableMethod("nsIDocument::FlushPendingLinkUpdatesFromRunnable",
this,
&nsIDocument::FlushPendingLinkUpdatesFromRunnable);
// Do this work in a second in the worst case.
nsresult rv =
NS_IdleDispatchToCurrentThread(event.forget(), 1000);
@ -10896,7 +10917,10 @@ class nsCallExitFullscreen : public Runnable
{
public:
explicit nsCallExitFullscreen(nsIDocument* aDoc)
: mDoc(aDoc) {}
: mozilla::Runnable("nsCallExitFullscreen")
, mDoc(aDoc)
{
}
NS_IMETHOD Run() override final
{
@ -10976,7 +11000,10 @@ class ExitFullscreenScriptRunnable : public Runnable
{
public:
explicit ExitFullscreenScriptRunnable(nsCOMArray<nsIDocument>&& aDocuments)
: mDocuments(Move(aDocuments)) { }
: mozilla::Runnable("ExitFullscreenScriptRunnable")
, mDocuments(Move(aDocuments))
{
}
NS_IMETHOD Run() override
{
@ -11170,7 +11197,10 @@ class nsCallRequestFullScreen : public Runnable
{
public:
explicit nsCallRequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
: mRequest(Move(aRequest)) { }
: mozilla::Runnable("nsCallRequestFullScreen")
, mRequest(Move(aRequest))
{
}
NS_IMETHOD Run() override
{
@ -11900,7 +11930,8 @@ class PointerLockRequest final : public Runnable
{
public:
PointerLockRequest(Element* aElement, bool aUserInputOrChromeCaller)
: mElement(do_GetWeakReference(aElement))
: mozilla::Runnable("PointerLockRequest")
, mElement(do_GetWeakReference(aElement))
, mDocument(do_GetWeakReference(aElement->OwnerDoc()))
, mUserInputOrChromeCaller(aUserInputOrChromeCaller)
{}
@ -12251,7 +12282,9 @@ nsDocument::GetVisibilityState() const
nsDocument::PostVisibilityUpdateEvent()
{
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
NewRunnableMethod("nsDocument::UpdateVisibilityState",
this,
&nsDocument::UpdateVisibilityState);
Dispatch("nsDocument::UpdateVisibilityState", TaskCategory::Other, event.forget());
}
@ -12796,7 +12829,9 @@ nsDocument::ScheduleIntersectionObserverNotification()
}
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> notification =
NewRunnableMethod(this, &nsDocument::NotifyIntersectionObservers);
NewRunnableMethod("nsDocument::NotifyIntersectionObservers",
this,
&nsDocument::NotifyIntersectionObservers);
Dispatch("nsDocument::IntersectionObserverNotification", TaskCategory::Other,
notification.forget());
}
@ -13086,7 +13121,9 @@ nsIDocument::RebuildUserFontSet()
if (!mPostedFlushUserFontSet) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsIDocument::HandleRebuildUserFontSet);
NewRunnableMethod("nsIDocument::HandleRebuildUserFontSet",
this,
&nsIDocument::HandleRebuildUserFontSet);
if (NS_SUCCEEDED(Dispatch("nsIDocument::HandleRebuildUserFontSet",
TaskCategory::Other, ev.forget()))) {
mPostedFlushUserFontSet = true;

View File

@ -2021,10 +2021,14 @@ nsFocusManager::Focus(nsPIDOMWindowOuter* aWindow,
class FocusBlurEvent : public Runnable
{
public:
FocusBlurEvent(nsISupports* aTarget, EventMessage aEventMessage,
nsPresContext* aContext, bool aWindowRaised,
bool aIsRefocus, EventTarget* aRelatedTarget)
: mTarget(aTarget)
FocusBlurEvent(nsISupports* aTarget,
EventMessage aEventMessage,
nsPresContext* aContext,
bool aWindowRaised,
bool aIsRefocus,
EventTarget* aRelatedTarget)
: mozilla::Runnable("FocusBlurEvent")
, mTarget(aTarget)
, mContext(aContext)
, mEventMessage(aEventMessage)
, mWindowRaised(aWindowRaised)
@ -2055,12 +2059,14 @@ public:
class FocusInOutEvent : public Runnable
{
public:
FocusInOutEvent(nsISupports* aTarget, EventMessage aEventMessage,
nsPresContext* aContext,
nsPIDOMWindowOuter* aOriginalFocusedWindow,
nsIContent* aOriginalFocusedContent,
EventTarget* aRelatedTarget)
: mTarget(aTarget)
FocusInOutEvent(nsISupports* aTarget,
EventMessage aEventMessage,
nsPresContext* aContext,
nsPIDOMWindowOuter* aOriginalFocusedWindow,
nsIContent* aOriginalFocusedContent,
EventTarget* aRelatedTarget)
: mozilla::Runnable("FocusInOutEvent")
, mTarget(aTarget)
, mContext(aContext)
, mEventMessage(aEventMessage)
, mOriginalFocusedWindow(aOriginalFocusedWindow)
@ -2264,8 +2270,8 @@ nsFocusManager::RaiseWindow(nsPIDOMWindowOuter* aWindow)
nsCOMPtr<nsPIDOMWindowOuter> active(mActiveWindow);
nsCOMPtr<nsPIDOMWindowOuter> window(aWindow);
RefPtr<nsFocusManager> self(this);
NS_DispatchToCurrentThread(
NS_NewRunnableFunction([self, active, window] () -> void {
NS_DispatchToCurrentThread(NS_NewRunnableFunction(
"nsFocusManager::RaiseWindow", [self, active, window]() -> void {
if (active) {
self->WindowLowered(active);
}
@ -3623,6 +3629,7 @@ class PointerUnlocker : public Runnable
{
public:
PointerUnlocker()
: mozilla::Runnable("PointerUnlocker")
{
MOZ_ASSERT(!PointerUnlocker::sActiveUnlocker);
PointerUnlocker::sActiveUnlocker = this;

View File

@ -1985,7 +1985,11 @@ class nsFrameLoaderDestroyRunnable : public Runnable
public:
explicit nsFrameLoaderDestroyRunnable(nsFrameLoader* aFrameLoader)
: mFrameLoader(aFrameLoader), mPhase(eDestroyDocShell) {}
: mozilla::Runnable("nsFrameLoaderDestroyRunnable")
, mFrameLoader(aFrameLoader)
, mPhase(eDestroyDocShell)
{
}
NS_IMETHOD Run() override;
};
@ -2070,9 +2074,10 @@ nsFrameLoader::StartDestroy()
nsCOMPtr<nsIGroupedSHistory> groupedSHistory;
GetGroupedSHistory(getter_AddRefs(groupedSHistory));
if (groupedSHistory) {
NS_DispatchToCurrentThread(NS_NewRunnableFunction([groupedSHistory] () {
groupedSHistory->CloseInactiveFrameLoaderOwners();
}));
NS_DispatchToCurrentThread(NS_NewRunnableFunction(
"nsFrameLoader::StartDestroy", [groupedSHistory]() {
groupedSHistory->CloseInactiveFrameLoaderOwners();
}));
}
}
@ -3167,6 +3172,7 @@ public:
JS::Handle<JSObject*> aCpows,
nsFrameLoader* aFrameLoader)
: nsSameProcessAsyncMessageBase(aRootingCx, aCpows)
, mozilla::Runnable("nsAsyncMessageToChild")
, mFrameLoader(aFrameLoader)
{
}

View File

@ -1751,6 +1751,7 @@ public:
nsAsyncMessageToSameProcessChild(JS::RootingContext* aRootingCx,
JS::Handle<JSObject*> aCpows)
: nsSameProcessAsyncMessageBase(aRootingCx, aCpows)
, mozilla::Runnable("nsAsyncMessageToSameProcessChild")
{ }
NS_IMETHOD Run() override
{

View File

@ -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(this, &nsGlobalWindow::ClearStatus));
nsContentUtils::AddScriptRunner(NewRunnableMethod(
"nsGlobalWindow::ClearStatus", this, &nsGlobalWindow::ClearStatus));
// Sometimes, WouldReuseInnerWindow() returns true even if there's no inner
// window (see bug 776497). Be safe.
@ -3345,7 +3345,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
// up with the outer. See bug 969156.
if (createdInnerWindow) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(newInnerWindow,
NewRunnableMethod("nsGlobalWindow::FireOnNewGlobalObject",
newInnerWindow,
&nsGlobalWindow::FireOnNewGlobalObject));
}
@ -3359,7 +3360,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsContentUtils::IsSystemPrincipal(mDoc->NodePrincipal())) {
newInnerWindow->mHasNotifiedGlobalCreated = true;
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsGlobalWindow::DispatchDOMWindowCreated));
NewRunnableMethod("nsGlobalWindow::DispatchDOMWindowCreated",
this,
&nsGlobalWindow::DispatchDOMWindowCreated));
}
}
@ -6870,10 +6873,13 @@ 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)
: mWindow(aWindow)
: mozilla::Runnable("FullscreenTransitionTask")
, mWindow(aWindow)
, mWidget(aWidget)
, mScreen(aScreen)
, mTransitionData(aTransitionData)
@ -9209,8 +9215,9 @@ class nsCloseEvent : public Runnable {
RefPtr<nsGlobalWindow> mWindow;
bool mIndirect;
nsCloseEvent(nsGlobalWindow *aWindow, bool aIndirect)
: mWindow(aWindow)
nsCloseEvent(nsGlobalWindow* aWindow, bool aIndirect)
: mozilla::Runnable("nsCloseEvent")
, mWindow(aWindow)
, mIndirect(aIndirect)
{}
@ -9639,11 +9646,11 @@ struct BrowserCompartmentMatcher : public js::CompartmentFilter {
class WindowDestroyedEvent final : public Runnable
{
public:
WindowDestroyedEvent(nsIDOMWindow* aWindow, uint64_t aID,
const char* aTopic) :
mID(aID),
mPhase(Phase::Destroying),
mTopic(aTopic)
WindowDestroyedEvent(nsIDOMWindow* aWindow, uint64_t aID, const char* aTopic)
: mozilla::Runnable("WindowDestroyedEvent")
, mID(aID)
, mPhase(Phase::Destroying)
, mTopic(aTopic)
{
mWindow = do_GetWeakReference(aWindow);
}
@ -10133,7 +10140,12 @@ public:
ChildCommandDispatcher(nsGlobalWindow* aWindow,
nsITabChild* aTabChild,
const nsAString& aAction)
: mWindow(aWindow), mTabChild(aTabChild), mAction(aAction) {}
: mozilla::Runnable("ChildCommandDispatcher")
, mWindow(aWindow)
, mTabChild(aTabChild)
, mAction(aAction)
{
}
NS_IMETHOD Run() override
{
@ -10162,7 +10174,11 @@ class CommandDispatcher : public Runnable
public:
CommandDispatcher(nsIDOMXULCommandDispatcher* aDispatcher,
const nsAString& aAction)
: mDispatcher(aDispatcher), mAction(aAction) {}
: mozilla::Runnable("CommandDispatcher")
, mDispatcher(aDispatcher)
, mAction(aAction)
{
}
NS_IMETHOD Run() override
{
@ -10954,10 +10970,11 @@ nsGlobalWindow::PageHidden()
class HashchangeCallback : public Runnable
{
public:
HashchangeCallback(const nsAString &aOldURL,
const nsAString &aNewURL,
HashchangeCallback(const nsAString& aOldURL,
const nsAString& aNewURL,
nsGlobalWindow* aWindow)
: mWindow(aWindow)
: mozilla::Runnable("HashchangeCallback")
, mWindow(aWindow)
{
MOZ_ASSERT(mWindow);
MOZ_ASSERT(mWindow->IsInnerWindow());
@ -11570,8 +11587,11 @@ public:
uint32_t aTimeInS,
bool aCallOnidle,
nsGlobalWindow* aIdleWindow)
: mIdleObserver(aIdleObserver), mTimeInS(aTimeInS), mIdleWindow(aIdleWindow),
mCallOnidle(aCallOnidle)
: mozilla::Runnable("NotifyIdleObserverRunnable")
, mIdleObserver(aIdleObserver)
, mTimeInS(aTimeInS)
, mIdleWindow(aIdleWindow)
, mCallOnidle(aCallOnidle)
{ }
NS_IMETHOD Run() override
@ -11679,10 +11699,12 @@ nsGlobalWindow::ScheduleNextIdleObserverCallback()
}
mIdleTimer->Cancel();
rv = mIdleTimer->InitWithFuncCallback(IdleObserverTimerCallback,
this,
callbackTimeMS,
nsITimer::TYPE_ONE_SHOT);
rv = mIdleTimer->InitWithNamedFuncCallback(
IdleObserverTimerCallback,
this,
callbackTimeMS,
nsITimer::TYPE_ONE_SHOT,
"nsGlobalWindow::ScheduleNextIdleObserverCallback");
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -11724,10 +11746,12 @@ nsGlobalWindow::ScheduleActiveTimerCallback()
mIdleTimer->Cancel();
uint32_t fuzzFactorInMS = GetFuzzTimeMS();
nsresult rv = mIdleTimer->InitWithFuncCallback(IdleActiveTimerCallback,
this,
fuzzFactorInMS,
nsITimer::TYPE_ONE_SHOT);
nsresult rv = mIdleTimer->InitWithNamedFuncCallback(
IdleActiveTimerCallback,
this,
fuzzFactorInMS,
nsITimer::TYPE_ONE_SHOT,
"nsGlobalWindow::ScheduleActiveTimerCallback");
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
@ -12816,7 +12840,8 @@ public:
~AutoUnblockScriptClosing()
{
void (nsGlobalWindow::*run)() = &nsGlobalWindow::UnblockScriptedClosing;
nsCOMPtr<nsIRunnable> caller = NewRunnableMethod(mWin, run);
nsCOMPtr<nsIRunnable> caller = NewRunnableMethod(
"AutoUnblockScriptClosing::~AutoUnblockScriptClosing", mWin, run);
mWin->Dispatch("nsGlobalWindow::UnblockScriptedClosing",
TaskCategory::Other, caller.forget());
}

View File

@ -43,6 +43,7 @@ class UnlinkHostObjectURIsRunnable final : public mozilla::Runnable
{
public:
explicit UnlinkHostObjectURIsRunnable(nsTArray<nsCString>& aURIs)
: mozilla::Runnable("UnlinkHostObjectURIsRunnable")
{
mURIs.SwapElements(aURIs);
}

View File

@ -309,9 +309,15 @@ nsInProcessTabChildGlobal::InitTabChildGlobal()
class nsAsyncScriptLoad : public Runnable
{
public:
nsAsyncScriptLoad(nsInProcessTabChildGlobal* aTabChild, const nsAString& aURL,
bool aRunInGlobalScope)
: mTabChild(aTabChild), mURL(aURL), mRunInGlobalScope(aRunInGlobalScope) {}
nsAsyncScriptLoad(nsInProcessTabChildGlobal* aTabChild,
const nsAString& aURL,
bool aRunInGlobalScope)
: mozilla::Runnable("nsAsyncScriptLoad")
, mTabChild(aTabChild)
, mURL(aURL)
, mRunInGlobalScope(aRunInGlobalScope)
{
}
NS_IMETHOD Run() override
{

View File

@ -436,7 +436,8 @@ public:
JS::RootingContext* aRootingCx,
xpc::ErrorReport* aReport,
JS::Handle<JS::Value> aError)
: mWindow(aWindow)
: mozilla::Runnable("ScriptErrorEvent")
, mWindow(aWindow)
, mReport(aReport)
, mError(aRootingCx, aError)
{}
@ -2219,7 +2220,11 @@ class NotifyGCEndRunnable : public Runnable
nsString mMessage;
public:
explicit NotifyGCEndRunnable(const nsString& aMessage) : mMessage(aMessage) {}
explicit NotifyGCEndRunnable(const nsString& aMessage)
: mozilla::Runnable("NotifyGCEndRunnable")
, mMessage(aMessage)
{
}
NS_DECL_NSIRUNNABLE
};
@ -2545,7 +2550,8 @@ class AsyncTaskRunnable final : public Runnable
public:
explicit AsyncTaskRunnable(JS::AsyncTask* aTask)
: mTask(aTask)
: mozilla::Runnable("AsyncTaskRunnable")
, mTask(aTask)
{
MOZ_ASSERT(mTask);
}

View File

@ -179,7 +179,8 @@ 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)
: mReport(aReport)
: Runnable("dom::AsyncErrorReporter")
, mReport(aReport)
{}
NS_IMETHOD Run() override

View File

@ -279,7 +279,8 @@ public:
}
nsSimplePluginEvent(nsIDocument* aTarget, const nsAString& aEvent)
: mTarget(aTarget)
: mozilla::Runnable("nsSimplePluginEvent")
, mTarget(aTarget)
, mDocument(aTarget)
, mEvent(aEvent)
{
@ -289,7 +290,8 @@ public:
nsSimplePluginEvent(nsIContent* aTarget,
nsIDocument* aDocument,
const nsAString& aEvent)
: mTarget(aTarget)
: mozilla::Runnable("nsSimplePluginEvent")
, mTarget(aTarget)
, mDocument(aDocument)
, mEvent(aEvent)
{

View File

@ -129,8 +129,12 @@ private:
{
public:
ChangeNotification(nsReferencedElement* aTarget,
Element* aFrom, Element* aTo)
: Notification(aTarget), mFrom(aFrom), mTo(aTo)
Element* aFrom,
Element* aTo)
: mozilla::Runnable("nsReferencedElement::ChangeNotification")
, Notification(aTarget)
, mFrom(aFrom)
, mTo(aTo)
{}
NS_DECL_ISUPPORTS_INHERITED

View File

@ -273,7 +273,8 @@ 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(this, update));
nsContentUtils::AddScriptRunner(
NewRunnableMethod("nsAttributeTextNode::AttributeChanged", this, update));
}
}

13
dom/cache/Context.cpp vendored
View File

@ -736,8 +736,10 @@ Context::ThreadsafeHandle::AllowToClose()
// Dispatch is guaranteed to succeed here because we block shutdown until
// all Contexts have been destroyed.
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod(this, &ThreadsafeHandle::AllowToCloseOnOwningThread);
nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod(
"dom::cache::Context::ThreadsafeHandle::AllowToCloseOnOwningThread",
this,
&ThreadsafeHandle::AllowToCloseOnOwningThread);
MOZ_ALWAYS_SUCCEEDS(
mOwningEventTarget->Dispatch(runnable.forget(), nsIThread::DISPATCH_NORMAL));
}
@ -752,8 +754,11 @@ Context::ThreadsafeHandle::InvalidateAndAllowToClose()
// Dispatch is guaranteed to succeed here because we block shutdown until
// all Contexts have been destroyed.
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod(this, &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread);
nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod(
"dom::cache::Context::ThreadsafeHandle::"
"InvalidateAndAllowToCloseOnOwningThread",
this,
&ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread);
MOZ_ALWAYS_SUCCEEDS(
mOwningEventTarget->Dispatch(runnable.forget(), nsIThread::DISPATCH_NORMAL));
}

View File

@ -912,7 +912,10 @@ private:
// here since we are guaranteed the Action will survive until
// CompleteOnInitiatingThread is called.
nsCOMPtr<nsIRunnable> runnable = NewNonOwningRunnableMethod<nsresult>(
this, &CachePutAllAction::OnAsyncCopyComplete, aRv);
"dom::cache::Manager::CachePutAllAction::OnAsyncCopyComplete",
this,
&CachePutAllAction::OnAsyncCopyComplete,
aRv);
MOZ_ALWAYS_SUCCEEDS(
mTarget->Dispatch(runnable.forget(), nsIThread::DISPATCH_NORMAL));
}
@ -1766,7 +1769,8 @@ 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(ioThread, &nsIThread::Shutdown)));
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod("nsIThread::Shutdown",
ioThread, &nsIThread::Shutdown)));
}
void

View File

@ -65,7 +65,8 @@ PrincipalVerifier::RemoveListener(Listener* aListener)
PrincipalVerifier::PrincipalVerifier(Listener* aListener,
PBackgroundParent* aActor,
const PrincipalInfo& aPrincipalInfo)
: mActor(BackgroundParent::GetContentParent(aActor))
: Runnable("dom::cache::PrincipalVerifier")
, mActor(BackgroundParent::GetContentParent(aActor))
, mPrincipalInfo(aPrincipalInfo)
, mInitiatingEventTarget(GetCurrentThreadSerialEventTarget())
, mResult(NS_OK)

View File

@ -132,7 +132,8 @@ class ReadStream::Inner::NoteClosedRunnable final : public CancelableRunnable
{
public:
explicit NoteClosedRunnable(ReadStream::Inner* aStream)
: mStream(aStream)
: CancelableRunnable("dom::cache::ReadStream::Inner::NoteClosedRunnable")
, mStream(aStream)
{ }
NS_IMETHOD Run() override
@ -167,7 +168,8 @@ class ReadStream::Inner::ForgetRunnable final : public CancelableRunnable
{
public:
explicit ForgetRunnable(ReadStream::Inner* aStream)
: mStream(aStream)
: CancelableRunnable("dom::cache::ReadStream::Inner::ForgetRunnable")
, mStream(aStream)
{ }
NS_IMETHOD Run() override

View File

@ -1576,8 +1576,9 @@ CanvasRenderingContext2D::ScheduleStableStateCallback()
mHasPendingStableStateCallback = true;
nsContentUtils::RunInStableState(
NewRunnableMethod(this, &CanvasRenderingContext2D::OnStableState)
);
NewRunnableMethod("dom::CanvasRenderingContext2D::OnStableState",
this,
&CanvasRenderingContext2D::OnStableState));
}
void

View File

@ -1076,7 +1076,8 @@ class FulfillImageBitmapPromiseTask final : public Runnable,
{
public:
FulfillImageBitmapPromiseTask(Promise* aPromise, ImageBitmap* aImageBitmap)
: FulfillImageBitmapPromise(aPromise, aImageBitmap)
: Runnable("dom::FulfillImageBitmapPromiseTask")
, FulfillImageBitmapPromise(aPromise, aImageBitmap)
{
}
@ -1278,7 +1279,8 @@ public:
nsIGlobalObject* aGlobal,
Blob& aBlob,
const Maybe<IntRect>& aCropRect)
:CreateImageBitmapFromBlob(aPromise, aGlobal, aBlob, aCropRect)
: Runnable("dom::CreateImageBitmapFromBlobTask")
, CreateImageBitmapFromBlob(aPromise, aGlobal, aBlob, aCropRect)
{
}
@ -1732,12 +1734,18 @@ 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)
: MapDataIntoBufferSource<T>(aCx, aPromise, aImageBitmap, aBuffer, aOffset, aFormat)
: Runnable("dom::MapDataIntoBufferSourceTask")
, MapDataIntoBufferSource<T>(aCx,
aPromise,
aImageBitmap,
aBuffer,
aOffset,
aFormat)
{
}

View File

@ -1737,9 +1737,10 @@ class UpdateContextLossStatusTask : public CancelableRunnable
RefPtr<WebGLContext> mWebGL;
public:
explicit UpdateContextLossStatusTask(WebGLContext* webgl)
: mWebGL(webgl)
{
explicit UpdateContextLossStatusTask(WebGLContext* webgl)
: CancelableRunnable("UpdateContextLossStatusTask")
, mWebGL(webgl)
{
}
NS_IMETHOD Run() override {

View File

@ -18,13 +18,16 @@ class AvailableRunnable final : public Runnable
const RefPtr<WebGLQuery> mQuery;
public:
explicit AvailableRunnable(WebGLQuery* query)
: mQuery(query)
{ }
explicit AvailableRunnable(WebGLQuery* query)
: Runnable("AvailableRunnable")
, mQuery(query)
{
}
NS_IMETHOD Run() override {
mQuery->mCanBeAvailable = true;
return NS_OK;
NS_IMETHOD Run() override
{
mQuery->mCanBeAvailable = true;
return NS_OK;
}
};

View File

@ -22,8 +22,9 @@ using namespace dom;
AsyncEventDispatcher::AsyncEventDispatcher(EventTarget* aTarget,
WidgetEvent& aEvent)
: mTarget(aTarget),
mEventMessage(eUnidentifiedEvent)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventMessage(eUnidentifiedEvent)
{
MOZ_ASSERT(mTarget);
RefPtr<Event> event =

View File

@ -34,9 +34,12 @@ public:
* 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)
: mTarget(aTarget)
AsyncEventDispatcher(nsINode* aTarget,
const nsAString& aEventType,
bool aBubbles,
bool aOnlyChromeDispatch)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventType(aEventType)
, mEventMessage(eUnidentifiedEvent)
, mBubbles(aBubbles)
@ -53,7 +56,8 @@ public:
AsyncEventDispatcher(nsINode* aTarget,
mozilla::EventMessage aEventMessage,
bool aBubbles, bool aOnlyChromeDispatch)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventMessage(aEventMessage)
, mBubbles(aBubbles)
, mOnlyChromeDispatch(aOnlyChromeDispatch)
@ -64,7 +68,8 @@ public:
AsyncEventDispatcher(dom::EventTarget* aTarget, const nsAString& aEventType,
bool aBubbles)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventType(aEventType)
, mEventMessage(eUnidentifiedEvent)
, mBubbles(aBubbles)
@ -74,7 +79,8 @@ public:
AsyncEventDispatcher(dom::EventTarget* aTarget,
mozilla::EventMessage aEventMessage,
bool aBubbles)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventMessage(aEventMessage)
, mBubbles(aBubbles)
{
@ -83,7 +89,8 @@ public:
}
AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEvent(aEvent)
, mEventMessage(eUnidentifiedEvent)
{

View File

@ -446,9 +446,10 @@ DataTransferItem::GetAsString(FunctionStringCallback* aCallback,
class GASRunnable final : public Runnable
{
public:
GASRunnable(FunctionStringCallback* aCallback,
const nsAString& aStringData)
: mCallback(aCallback), mStringData(aStringData)
GASRunnable(FunctionStringCallback* aCallback, const nsAString& aStringData)
: mozilla::Runnable("GASRunnable")
, mCallback(aCallback)
, mStringData(aStringData)
{}
NS_IMETHOD Run() override

View File

@ -1412,9 +1412,12 @@ EventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext,
int32_t clickHoldDelay =
Preferences::GetInt("ui.click_hold_context_menus.delay", 500);
mClickHoldTimer->SetTarget(SystemGroup::EventTargetFor(TaskCategory::Other));
mClickHoldTimer->InitWithFuncCallback(sClickHoldCallback, this,
clickHoldDelay,
nsITimer::TYPE_ONE_SHOT);
mClickHoldTimer->InitWithNamedFuncCallback(
sClickHoldCallback,
this,
clickHoldDelay,
nsITimer::TYPE_ONE_SHOT,
"EventStateManager::CreateClickHoldTimer");
}
} // CreateClickHoldTimer

View File

@ -712,12 +712,13 @@ TextComposition::HasEditor() const
******************************************************************************/
TextComposition::CompositionEventDispatcher::CompositionEventDispatcher(
TextComposition* aComposition,
nsINode* aEventTarget,
EventMessage aEventMessage,
const nsAString& aData,
bool aIsSynthesizedEvent)
: mTextComposition(aComposition)
TextComposition* aComposition,
nsINode* aEventTarget,
EventMessage aEventMessage,
const nsAString& aData,
bool aIsSynthesizedEvent)
: Runnable("TextComposition::CompositionEventDispatcher")
, mTextComposition(aComposition)
, mEventTarget(aEventTarget)
, mData(aData)
, mEventMessage(aEventMessage)

View File

@ -433,7 +433,9 @@ private:
EventMessage mEventMessage;
bool mIsSynthesizedEvent;
CompositionEventDispatcher() : mIsSynthesizedEvent(false) {};
CompositionEventDispatcher()
: Runnable("TextComposition::CompositionEventDispatcher")
, mIsSynthesizedEvent(false){};
};
/**

View File

@ -332,8 +332,11 @@ WheelTransaction::SetTimeout()
}
sTimer->Cancel();
DebugOnly<nsresult> rv =
sTimer->InitWithFuncCallback(OnTimeout, nullptr, GetTimeoutTime(),
nsITimer::TYPE_ONE_SHOT);
sTimer->InitWithNamedFuncCallback(OnTimeout,
nullptr,
GetTimeoutTime(),
nsITimer::TYPE_ONE_SHOT,
"WheelTransaction::SetTimeout");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"nsITimer::InitWithFuncCallback failed");
}

View File

@ -75,7 +75,8 @@ class FetchSignalProxy final : public FetchSignal::Follower
public:
explicit FetchSignalProxyRunnable(FetchSignalProxy* aProxy)
: mProxy(aProxy)
: Runnable("dom::FetchSignalProxy::FetchSignalProxyRunnable")
, mProxy(aProxy)
{}
NS_IMETHOD
@ -264,7 +265,8 @@ class MainThreadFetchRunnable : public Runnable
public:
MainThreadFetchRunnable(WorkerFetchResolver* aResolver,
InternalRequest* aRequest)
: mResolver(aResolver)
: Runnable("dom::MainThreadFetchRunnable")
, mResolver(aResolver)
, mRequest(aRequest)
{
MOZ_ASSERT(mResolver);

View File

@ -58,7 +58,8 @@ class BeginConsumeBodyRunnable final : public Runnable
public:
explicit BeginConsumeBodyRunnable(FetchBodyConsumer<Derived>* aConsumer)
: mFetchBodyConsumer(aConsumer)
: Runnable("BeginConsumeBodyRunnable")
, mFetchBodyConsumer(aConsumer)
{ }
NS_IMETHOD

View File

@ -643,7 +643,8 @@ class DataAvailableRunnable final : public Runnable
public:
explicit DataAvailableRunnable(FetchDriverObserver* aObserver)
: mObserver(aObserver)
: Runnable("dom::DataAvailableRunnable")
, mObserver(aObserver)
{
MOZ_ASSERT(aObserver);
}

View File

@ -31,7 +31,8 @@ public:
MutableBlobStorageCallback* aCallback,
Blob* aBlob,
nsresult aRv)
: mBlobStorage(aBlobStorage)
: Runnable("dom::BlobCreationDoneRunnable")
, mBlobStorage(aBlobStorage)
, mCallback(aCallback)
, mBlob(aBlob)
, mRv(aRv)
@ -79,7 +80,8 @@ class FileCreatedRunnable final : public Runnable
{
public:
FileCreatedRunnable(MutableBlobStorage* aBlobStorage, PRFileDesc* aFD)
: mBlobStorage(aBlobStorage)
: Runnable("dom::FileCreatedRunnable")
, mBlobStorage(aBlobStorage)
, mFD(aFD)
{
MOZ_ASSERT(aBlobStorage);
@ -114,7 +116,8 @@ class CreateTemporaryFileRunnable final : public Runnable
{
public:
explicit CreateTemporaryFileRunnable(MutableBlobStorage* aBlobStorage)
: mBlobStorage(aBlobStorage)
: Runnable("dom::CreateTemporaryFileRunnable")
, mBlobStorage(aBlobStorage)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess());
@ -148,7 +151,8 @@ class ErrorPropagationRunnable final : public Runnable
{
public:
ErrorPropagationRunnable(MutableBlobStorage* aBlobStorage, nsresult aRv)
: mBlobStorage(aBlobStorage)
: Runnable("dom::ErrorPropagationRunnable")
, mBlobStorage(aBlobStorage)
, mRv(aRv)
{}
@ -217,9 +221,12 @@ public:
}
private:
WriteRunnable(MutableBlobStorage* aBlobStorage, PRFileDesc* aFD,
void* aData, uint32_t aLength)
: mBlobStorage(aBlobStorage)
WriteRunnable(MutableBlobStorage* aBlobStorage,
PRFileDesc* aFD,
void* aData,
uint32_t aLength)
: Runnable("dom::WriteRunnable")
, mBlobStorage(aBlobStorage)
, mFD(aFD)
, mData(aData)
, mLength(aLength)
@ -247,7 +254,8 @@ class CloseFileRunnable final : public Runnable
{
public:
explicit CloseFileRunnable(PRFileDesc* aFD)
: mFD(aFD)
: Runnable("dom::CloseFileRunnable")
, mFD(aFD)
{}
NS_IMETHOD
@ -279,7 +287,8 @@ public:
already_AddRefed<nsISupports> aParent,
const nsACString& aContentType,
already_AddRefed<MutableBlobStorageCallback> aCallback)
: mBlobStorage(aBlobStorage)
: Runnable("dom::CreateBlobRunnable")
, mBlobStorage(aBlobStorage)
, mParent(aParent)
, mContentType(aContentType)
, mCallback(aCallback)
@ -327,7 +336,8 @@ public:
nsISupports* aParent,
const nsACString& aContentType,
MutableBlobStorageCallback* aCallback)
: mBlobStorage(aBlobStorage)
: Runnable("dom::LastRunnable")
, mBlobStorage(aBlobStorage)
, mParent(aParent)
, mContentType(aContentType)
, mCallback(aCallback)

View File

@ -46,7 +46,8 @@ public:
private:
CallbackRunnable(nsIInputStreamCallback* aCallback,
IPCBlobInputStream* aStream)
: mCallback(aCallback)
: CancelableRunnable("dom::CallbackRunnable")
, mCallback(aCallback)
, mStream(aStream)
{
MOZ_ASSERT(mCallback);

View File

@ -25,7 +25,8 @@ class ShutdownRunnable final : public CancelableRunnable
{
public:
explicit ShutdownRunnable(IPCBlobInputStreamChild* aActor)
: mActor(aActor)
: CancelableRunnable("dom::ShutdownRunnable")
, mActor(aActor)
{}
NS_IMETHOD
@ -45,7 +46,8 @@ class StreamNeededRunnable final : public CancelableRunnable
{
public:
explicit StreamNeededRunnable(IPCBlobInputStreamChild* aActor)
: mActor(aActor)
: CancelableRunnable("dom::StreamNeededRunnable")
, mActor(aActor)
{}
NS_IMETHOD
@ -70,7 +72,8 @@ class StreamReadyRunnable final : public CancelableRunnable
public:
StreamReadyRunnable(IPCBlobInputStream* aDestinationStream,
nsIInputStream* aCreatedStream)
: mDestinationStream(aDestinationStream)
: CancelableRunnable("dom::StreamReadyRunnable")
, mDestinationStream(aDestinationStream)
, mCreatedStream(aCreatedStream)
{
MOZ_ASSERT(mDestinationStream);
@ -102,8 +105,10 @@ public:
class ReleaseWorkerHolderRunnable final : public CancelableRunnable
{
public:
explicit ReleaseWorkerHolderRunnable(UniquePtr<workers::WorkerHolder>&& aWorkerHolder)
: mWorkerHolder(Move(aWorkerHolder))
explicit ReleaseWorkerHolderRunnable(
UniquePtr<workers::WorkerHolder>&& aWorkerHolder)
: CancelableRunnable("dom::ReleaseWorkerHolderRunnable")
, mWorkerHolder(Move(aWorkerHolder))
{}
NS_IMETHOD

View File

@ -27,6 +27,8 @@ bool gShutdownHasStarted = false;
class ThreadInitializeRunnable final : public Runnable
{
public:
ThreadInitializeRunnable() : Runnable("dom::ThreadInitializeRunnable") {}
NS_IMETHOD
Run() override
{
@ -44,7 +46,8 @@ public:
NS_DECL_ISUPPORTS_INHERITED
explicit MigrateActorRunnable(IPCBlobInputStreamChild* aActor)
: mActor(aActor)
: Runnable("dom::MigrateActorRunnable")
, mActor(aActor)
{
MOZ_ASSERT(mActor);
}

View File

@ -588,7 +588,8 @@ public:
ProgressRunnable(CopyFileHandleOp* aCopyFileHandleOp,
uint64_t aProgress,
uint64_t aProgressMax)
: mCopyFileHandleOp(aCopyFileHandleOp)
: Runnable("dom::CopyFileHandleOp::ProgressRunnable")
, mCopyFileHandleOp(aCopyFileHandleOp)
, mProgress(aProgress)
, mProgressMax(aProgressMax)
{ }
@ -1081,10 +1082,11 @@ FileHandleThreadPool::MaybeFireCallback(StoragesCompleteCallback* aCallback)
return true;
}
FileHandleThreadPool::
FileHandleQueue::FileHandleQueue(FileHandleThreadPool* aFileHandleThreadPool,
FileHandle* aFileHandle)
: mOwningFileHandleThreadPool(aFileHandleThreadPool)
FileHandleThreadPool::FileHandleQueue::FileHandleQueue(
FileHandleThreadPool* aFileHandleThreadPool,
FileHandle* aFileHandle)
: Runnable("dom::FileHandleThreadPool::FileHandleQueue")
, mOwningFileHandleThreadPool(aFileHandleThreadPool)
, mFileHandle(aFileHandle)
, mShouldFinish(false)
{

View File

@ -82,7 +82,8 @@ public:
FileSystemRequestParent* aActor,
FileSystemTaskParentBase* aTask,
const nsAString& aPath)
: mContentParent(aParent)
: Runnable("dom::CheckPermissionRunnable")
, mContentParent(aParent)
, mActor(aActor)
, mTask(aTask)
, mPath(aPath)

View File

@ -231,10 +231,12 @@ FileSystemTaskChildBase::SetError(const nsresult& aErrorValue)
* FileSystemTaskParentBase class
*/
FileSystemTaskParentBase::FileSystemTaskParentBase(FileSystemBase* aFileSystem,
const FileSystemParams& aParam,
FileSystemRequestParent* aParent)
: mErrorValue(NS_OK)
FileSystemTaskParentBase::FileSystemTaskParentBase(
FileSystemBase* aFileSystem,
const FileSystemParams& aParam,
FileSystemRequestParent* aParent)
: Runnable("dom::FileSystemTaskParentBase")
, mErrorValue(NS_OK)
, mFileSystem(aFileSystem)
, mRequestParent(aParent)
, mBackgroundEventTarget(GetCurrentThreadEventTarget())

View File

@ -61,6 +61,7 @@ private:
nsTArray<RefPtr<GetFilesCallback>>& aCallbacks,
Sequence<RefPtr<File>>& aFiles,
already_AddRefed<nsIGlobalObject> aGlobal)
: Runnable("dom::ReleaseRunnable")
{
mPromises.SwapElements(aPromises);
mCallbacks.SwapElements(aCallbacks);

View File

@ -89,10 +89,9 @@ void
HttpServer::NotifyStarted(nsresult aStatus)
{
RefPtr<HttpServerListener> listener = mListener;
nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction([listener, aStatus] ()
{
listener->OnServerStarted(aStatus);
});
nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction(
"dom::HttpServer::NotifyStarted",
[listener, aStatus]() { listener->OnServerStarted(aStatus); });
NS_DispatchToCurrentThread(event);
}
@ -288,12 +287,12 @@ HttpServer::TransportProvider::MaybeNotify()
{
if (mTransport && mListener) {
RefPtr<TransportProvider> self = this;
nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction([self, this] ()
{
DebugOnly<nsresult> rv = mListener->OnTransportAvailable(mTransport,
mInput, mOutput);
MOZ_ASSERT(NS_SUCCEEDED(rv));
});
nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction(
"dom::HttpServer::TransportProvider::MaybeNotify", [self, this]() {
DebugOnly<nsresult> rv =
mListener->OnTransportAvailable(mTransport, mInput, mOutput);
MOZ_ASSERT(NS_SUCCEEDED(rv));
});
NS_DispatchToCurrentThread(event);
}
}
@ -633,11 +632,9 @@ HttpServer::Connection::ConsumeLine(const char* aBuffer,
RefPtr<HttpServerListener> listener = mServer->mListener;
RefPtr<InternalRequest> request = mPendingWebSocketRequest;
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableFunction([listener, request] ()
{
listener->OnWebSocket(request);
});
nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction(
"dom::HttpServer::Connection::ConsumeLine",
[listener, request]() { listener->OnWebSocket(request); });
NS_DispatchToCurrentThread(event);
return NS_OK;
@ -702,11 +699,9 @@ HttpServer::Connection::ConsumeLine(const char* aBuffer,
RefPtr<HttpServerListener> listener = mServer->mListener;
RefPtr<InternalRequest> request = mPendingReq.forget();
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableFunction([listener, request] ()
{
listener->OnRequest(request);
});
nsCOMPtr<nsIRunnable> event = NS_NewRunnableFunction(
"dom::HttpServer::Connection::ConsumeLine",
[listener, request]() { listener->OnRequest(request); });
NS_DispatchToCurrentThread(event);
mPendingReqVersion = 0;

View File

@ -235,7 +235,7 @@ class DarwinGamepadServiceStartupRunnable final : public Runnable
DarwinGamepadService MOZ_NON_OWNING_REF *mService;
public:
explicit DarwinGamepadServiceStartupRunnable(DarwinGamepadService *service)
: mService(service) {}
: Runnable("DarwinGamepadServiceStartupRunnable"), mService(service) {}
NS_IMETHOD Run() override
{
MOZ_ASSERT(mService);

View File

@ -12,15 +12,18 @@ namespace {
class GamepadUpdateRunnable final : public Runnable
{
public:
explicit GamepadUpdateRunnable(const GamepadChangeEvent& aGamepadEvent)
: mEvent(aGamepadEvent) {}
NS_IMETHOD Run() override
{
RefPtr<GamepadManager> svc(GamepadManager::GetService());
if (svc) {
svc->Update(mEvent);
}
return NS_OK;
explicit GamepadUpdateRunnable(const GamepadChangeEvent& aGamepadEvent)
: Runnable("dom::GamepadUpdateRunnable")
, mEvent(aGamepadEvent)
{
}
NS_IMETHOD Run() override
{
RefPtr<GamepadManager> svc(GamepadManager::GetService());
if (svc) {
svc->Update(mEvent);
}
return NS_OK;
}
protected:
GamepadChangeEvent mEvent;

View File

@ -20,12 +20,13 @@ class SendGamepadUpdateRunnable final : public Runnable
RefPtr<GamepadEventChannelParent> mParent;
GamepadChangeEvent mEvent;
public:
SendGamepadUpdateRunnable(GamepadEventChannelParent* aParent,
GamepadChangeEvent aEvent)
: mEvent(aEvent)
{
MOZ_ASSERT(aParent);
mParent = aParent;
SendGamepadUpdateRunnable(GamepadEventChannelParent* aParent,
GamepadChangeEvent aEvent)
: Runnable("dom::SendGamepadUpdateRunnable")
, mEvent(aEvent)
{
MOZ_ASSERT(aParent);
mParent = aParent;
}
NS_IMETHOD Run() override
{

View File

@ -1002,7 +1002,9 @@ GamepadWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
class StartWindowsGamepadServiceRunnable final : public Runnable
{
public:
StartWindowsGamepadServiceRunnable() {}
StartWindowsGamepadServiceRunnable()
: Runnable("StartWindowsGamepadServiceRunnable")
{}
NS_IMETHOD Run() override
{
@ -1040,7 +1042,9 @@ private:
class StopWindowsGamepadServiceRunnable final : public Runnable
{
public:
StopWindowsGamepadServiceRunnable() {}
StopWindowsGamepadServiceRunnable()
: Runnable("StopWindowsGamepadServiceRunnable")
{}
NS_IMETHOD Run() override
{

View File

@ -147,7 +147,8 @@ class RequestPromptEvent : public Runnable
{
public:
RequestPromptEvent(nsGeolocationRequest* aRequest, nsWeakPtr aWindow)
: mRequest(aRequest)
: mozilla::Runnable("RequestPromptEvent")
, mRequest(aRequest)
, mWindow(aWindow)
{
}
@ -168,8 +169,9 @@ class RequestAllowEvent : public Runnable
{
public:
RequestAllowEvent(int allow, nsGeolocationRequest* request)
: mAllow(allow),
mRequest(request)
: mozilla::Runnable("RequestAllowEvent")
, mAllow(allow)
, mRequest(request)
{
}
@ -192,8 +194,9 @@ class RequestSendLocationEvent : public Runnable
public:
RequestSendLocationEvent(nsIDOMGeoPosition* aPosition,
nsGeolocationRequest* aRequest)
: mPosition(aPosition),
mRequest(aRequest)
: mozilla::Runnable("RequestSendLocationEvent")
, mPosition(aPosition)
, mRequest(aRequest)
{
}

View File

@ -241,8 +241,10 @@ HTMLCanvasPrintState::Done()
if (mCanvas) {
mCanvas->InvalidateCanvas();
}
RefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
RefPtr<nsRunnableMethod<HTMLCanvasPrintState>> doneEvent =
NewRunnableMethod("dom::HTMLCanvasPrintState::NotifyDone",
this,
&HTMLCanvasPrintState::NotifyDone);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) {
mPendingNotify = true;
}
@ -521,8 +523,10 @@ HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
}
mPrintState = new HTMLCanvasPrintState(this, mCurrentContext, aCallback);
RefPtr<nsRunnableMethod<HTMLCanvasElement> > renderEvent =
NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
RefPtr<nsRunnableMethod<HTMLCanvasElement>> renderEvent =
NewRunnableMethod("dom::HTMLCanvasElement::CallPrintCallback",
this,
&HTMLCanvasElement::CallPrintCallback);
return OwnerDoc()->Dispatch("HTMLCanvasElement::CallPrintCallback",
TaskCategory::Other,
renderEvent.forget());
@ -844,13 +848,16 @@ 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<Blob*, const char*>(
&aCallback,
static_cast<void(BlobCallback::*)(
Blob*, const char*)>(&BlobCallback::Call),
nullptr, nullptr));
OwnerDoc()->Dispatch(
"FireNullBlobEvent",
TaskCategory::Other,
NewRunnableMethod<Blob*, const char*>(
"dom::HTMLCanvasElement::ToBlob",
&aCallback,
static_cast<void (BlobCallback::*)(Blob*, const char*)>(
&BlobCallback::Call),
nullptr,
nullptr));
return;
}
@ -1353,7 +1360,8 @@ HTMLCanvasElement::OnVisibilityChange()
{
public:
explicit Runnable(AsyncCanvasRenderer* aRenderer)
: mRenderer(aRenderer)
: mozilla::CancelableRunnable("Runnable")
, mRenderer(aRenderer)
{}
NS_IMETHOD Run() override
@ -1395,7 +1403,8 @@ HTMLCanvasElement::OnMemoryPressure()
{
public:
explicit Runnable(AsyncCanvasRenderer* aRenderer)
: mRenderer(aRenderer)
: mozilla::CancelableRunnable("Runnable")
, mRenderer(aRenderer)
{}
NS_IMETHOD Run() override

View File

@ -426,7 +426,8 @@ protected:
class RemoveElementRunnable : public Runnable {
public:
explicit RemoveElementRunnable(HTMLFormElement* aForm)
: mForm(aForm)
: Runnable("dom::HTMLFormElement::RemoveElementRunnable")
, mForm(aForm)
{}
NS_IMETHOD Run() override {

View File

@ -79,9 +79,11 @@ namespace dom {
class ImageLoadTask : public Runnable
{
public:
ImageLoadTask(HTMLImageElement *aElement, bool aAlwaysLoad,
ImageLoadTask(HTMLImageElement* aElement,
bool aAlwaysLoad,
bool aUseUrgentStartForChannel)
: mElement(aElement)
: Runnable("dom::ImageLoadTask")
, mElement(aElement)
, mAlwaysLoad(aAlwaysLoad)
, mUseUrgentStartForChannel(aUseUrgentStartForChannel)
{
@ -676,7 +678,10 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (LoadingEnabled() &&
OwnerDoc()->IsCurrentActiveDocument()) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod<bool>(this, &HTMLImageElement::MaybeLoadImage, false));
NewRunnableMethod<bool>("dom::HTMLImageElement::MaybeLoadImage",
this,
&HTMLImageElement::MaybeLoadImage,
false));
}
}
@ -769,9 +774,14 @@ HTMLImageElement::NodeInfoChanged(nsIDocument* aOldDoc)
// Bug 1076583 - We still behave synchronously in the non-responsive case
nsContentUtils::AddScriptRunner(
(InResponsiveMode())
? NewRunnableMethod<bool>(this, &HTMLImageElement::QueueImageLoadTask, true)
: NewRunnableMethod<bool>(this, &HTMLImageElement::MaybeLoadImage, true)
);
? NewRunnableMethod<bool>("dom::HTMLImageElement::QueueImageLoadTask",
this,
&HTMLImageElement::QueueImageLoadTask,
true)
: NewRunnableMethod<bool>("dom::HTMLImageElement::MaybeLoadImage",
this,
&HTMLImageElement::MaybeLoadImage,
true));
}
}
@ -894,7 +904,10 @@ HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
nsContentUtils::AddScriptRunner(
NewRunnableMethod<bool>(dest, &HTMLImageElement::MaybeLoadImage, false));
NewRunnableMethod<bool>("dom::HTMLImageElement::MaybeLoadImage",
dest,
&HTMLImageElement::MaybeLoadImage,
false));
}
}

View File

@ -4870,7 +4870,9 @@ HTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
ClearBrokenState();
RemoveStatesSilently(NS_EVENT_STATE_BROKEN);
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &HTMLInputElement::MaybeLoadImage));
NewRunnableMethod("dom::HTMLInputElement::MaybeLoadImage",
this,
&HTMLInputElement::MaybeLoadImage));
}
}

View File

@ -171,7 +171,8 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update));
nsContentUtils::AddScriptRunner(
NewRunnableMethod("dom::HTMLLinkElement::BindToTree", this, update));
CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded"));

View File

@ -232,10 +232,12 @@ RejectPromises(const nsTArray<RefPtr<Promise>>& aPromises, nsresult aError)
class nsMediaEvent : public Runnable
{
public:
explicit nsMediaEvent(HTMLMediaElement* aElement) :
mElement(aElement),
mLoadID(mElement->GetCurrentLoadID()) {}
explicit nsMediaEvent(HTMLMediaElement* aElement)
: Runnable("dom::nsMediaEvent")
, mElement(aElement)
, mLoadID(mElement->GetCurrentLoadID())
{
}
~nsMediaEvent() {}
NS_IMETHOD Run() = 0;
@ -405,9 +407,11 @@ public:
for (VideoSegment::ConstChunkIterator c(video); !c.IsEnded(); c.Next()) {
if (c->mFrame.GetIntrinsicSize() != gfx::IntSize(0,0)) {
mInitialSizeFound = true;
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod<gfx::IntSize>(this, &StreamSizeListener::ReceivedSize,
c->mFrame.GetIntrinsicSize());
nsCOMPtr<nsIRunnable> event = NewRunnableMethod<gfx::IntSize>(
"dom::HTMLMediaElement::StreamSizeListener::ReceivedSize",
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
@ -970,24 +974,26 @@ private:
}
uint64_t windowID = mAudioChannelAgent->WindowID();
NS_DispatchToMainThread(NS_NewRunnableFunction([windowID]() -> void {
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
return;
}
NS_DispatchToMainThread(NS_NewRunnableFunction(
"dom::HTMLMediaElement::AudioChannelAgentCallback::"
"MaybeNotifyMediaResumed",
[windowID]() -> void {
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
return;
}
nsCOMPtr<nsISupportsPRUint64> wrapper =
do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID);
if (NS_WARN_IF(!wrapper)) {
return;
}
nsCOMPtr<nsISupportsPRUint64> 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
@ -4090,8 +4096,12 @@ HTMLMediaElement::WakeLockBoolWrapper::UpdateWakeLock()
int timeout = Preferences::GetInt("media.wakelock_timeout", 2000);
mTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mTimer) {
mTimer->InitWithFuncCallback(TimerCallback, this, timeout,
nsITimer::TYPE_ONE_SHOT);
mTimer->InitWithNamedFuncCallback(
TimerCallback,
this,
timeout,
nsITimer::TYPE_ONE_SHOT,
"dom::HTMLMediaElement::WakeLockBoolWrapper::UpdateWakeLock");
}
}
}
@ -4531,11 +4541,12 @@ void HTMLMediaElement::UnbindFromTree(bool aDeep,
NotifyDecoderActivityChanges();
RefPtr<HTMLMediaElement> self(this);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([self] () {
if (self->mUnboundFromTree) {
self->Pause();
}
});
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableFunction("dom::HTMLMediaElement::UnbindFromTree", [self]() {
if (self->mUnboundFromTree) {
self->Pause();
}
});
RunInStableState(task);
}
@ -4844,9 +4855,15 @@ public:
{
nsCOMPtr<nsIRunnable> event;
if (aBlocked == BLOCKED) {
event = NewRunnableMethod(this, &StreamListener::DoNotifyBlocked);
event = NewRunnableMethod(
"dom::HTMLMediaElement::StreamListener::DoNotifyBlocked",
this,
&StreamListener::DoNotifyBlocked);
} else {
event = NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked);
event = NewRunnableMethod(
"dom::HTMLMediaElement::StreamListener::DoNotifyUnblocked",
this,
&StreamListener::DoNotifyUnblocked);
}
aGraph->DispatchToMainThreadAfterStreamStateUpdate(mAbstractMainThread,
event.forget());
@ -4856,7 +4873,10 @@ public:
MutexAutoLock lock(mMutex);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
mAbstractMainThread,
NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData));
NewRunnableMethod(
"dom::HTMLMediaElement::StreamListener::DoNotifyHaveCurrentData",
this,
&StreamListener::DoNotifyHaveCurrentData));
}
virtual void NotifyOutput(MediaStreamGraph* aGraph,
GraphTime aCurrentTime) override
@ -4867,7 +4887,9 @@ public:
mPendingNotifyOutput = true;
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
mAbstractMainThread,
NewRunnableMethod(this, &StreamListener::DoNotifyOutput));
NewRunnableMethod("dom::HTMLMediaElement::StreamListener::DoNotifyOutput",
this,
&StreamListener::DoNotifyOutput));
}
private:
@ -6296,7 +6318,9 @@ 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<nsIRunnable> event =
NewRunnableMethod(this, &HTMLMediaElement::DoRemoveSelfReference);
NewRunnableMethod("dom::HTMLMediaElement::DoRemoveSelfReference",
this,
&HTMLMediaElement::DoRemoveSelfReference);
NS_DispatchToMainThread(event);
}
}
@ -7493,9 +7517,9 @@ HTMLMediaElement::AsyncResolveSeekDOMPromiseIfExists()
MOZ_ASSERT(NS_IsMainThread());
if (mSeekDOMPromise) {
RefPtr<dom::Promise> promise = mSeekDOMPromise.forget();
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
promise->MaybeResolveWithUndefined();
});
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"dom::HTMLMediaElement::AsyncResolveSeekDOMPromiseIfExists",
[=]() { promise->MaybeResolveWithUndefined(); });
mAbstractMainThread->Dispatch(r.forget());
mSeekDOMPromise = nullptr;
}
@ -7507,9 +7531,9 @@ HTMLMediaElement::AsyncRejectSeekDOMPromiseIfExists()
MOZ_ASSERT(NS_IsMainThread());
if (mSeekDOMPromise) {
RefPtr<dom::Promise> promise = mSeekDOMPromise.forget();
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
});
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"dom::HTMLMediaElement::AsyncRejectSeekDOMPromiseIfExists",
[=]() { promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR); });
mAbstractMainThread->Dispatch(r.forget());
mSeekDOMPromise = nullptr;
}
@ -7527,29 +7551,32 @@ HTMLMediaElement::ReportCanPlayTelemetry()
}
thread->Dispatch(
NS_NewRunnableFunction([thread]() {
NS_NewRunnableFunction(
"dom::HTMLMediaElement::ReportCanPlayTelemetry",
[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([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(
"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();
}));
}),
NS_DISPATCH_NORMAL);
}

View File

@ -131,7 +131,9 @@ class PluginFocusSetter : public Runnable
{
public:
PluginFocusSetter(nsIWidget* aWidget, Element* aElement)
: mWidget(aWidget), mElement(aElement)
: Runnable("PluginFocusSetter")
, mWidget(aWidget)
, mElement(aElement)
{
}
@ -269,7 +271,8 @@ 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(this, start));
nsContentUtils::AddScriptRunner(
NewRunnableMethod("dom::HTMLObjectElement::BindToTree", this, start));
}
return NS_OK;

View File

@ -139,7 +139,8 @@ HTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
if (mIsDoneAddingChildren && !pluginDoc) {
void (HTMLSharedObjectElement::*start)() =
&HTMLSharedObjectElement::StartObjectLoad;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, start));
nsContentUtils::AddScriptRunner(NewRunnableMethod(
"dom::HTMLSharedObjectElement::BindToTree", this, start));
}
return NS_OK;

View File

@ -146,7 +146,8 @@ HTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NS_ENSURE_SUCCESS(rv, rv);
void (HTMLStyleElement::*update)() = &HTMLStyleElement::UpdateStyleSheetInternal;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update));
nsContentUtils::AddScriptRunner(
NewRunnableMethod("dom::HTMLStyleElement::BindToTree", this, update));
return rv;
}

View File

@ -265,7 +265,10 @@ void
HTMLTrackElement::DispatchLoadResource()
{
if (!mLoadResourceDispatched) {
RefPtr<Runnable> r = NewRunnableMethod(this, &HTMLTrackElement::LoadResource);
RefPtr<Runnable> r =
NewRunnableMethod("dom::HTMLTrackElement::LoadResource",
this,
&HTMLTrackElement::LoadResource);
nsContentUtils::RunInStableState(r.forget());
mLoadResourceDispatched = true;
}
@ -437,11 +440,11 @@ HTMLTrackElement::DispatchTrackRunnable(const nsString& aEventName)
if (!doc) {
return;
}
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod
<const nsString>(this,
&HTMLTrackElement::DispatchTrustedEvent,
aEventName);
nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod<const nsString>(
"dom::HTMLTrackElement::DispatchTrustedEvent",
this,
&HTMLTrackElement::DispatchTrustedEvent,
aEventName);
doc->Dispatch("HTMLTrackElement::DispatchTrackRunnable",
TaskCategory::Other, runnable.forget());
}

View File

@ -493,7 +493,9 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
// come during painting and this will trigger invalidation.
if (aType == imgINotificationObserver::HAS_TRANSPARENCY) {
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod(this, &ImageDocument::OnHasTransparency);
NewRunnableMethod("dom::ImageDocument::OnHasTransparency",
this,
&ImageDocument::OnHasTransparency);
nsContentUtils::AddScriptRunner(runnable);
}
@ -566,7 +568,9 @@ ImageDocument::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
}
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod(this, &ImageDocument::DefaultCheckOverflowing);
NewRunnableMethod("dom::ImageDocument::DefaultCheckOverflowing",
this,
&ImageDocument::DefaultCheckOverflowing);
nsContentUtils::AddScriptRunner(runnable);
UpdateTitleAndCharset();

View File

@ -170,8 +170,10 @@ TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
ReportTelemetryForTrack(track);
if (aTextTrackSource == TextTrackSource::Track) {
RefPtr<nsIRunnable> task =
NewRunnableMethod(this, &TextTrackManager::HonorUserPreferencesForTrackSelection);
RefPtr<nsIRunnable> task = NewRunnableMethod(
"dom::TextTrackManager::HonorUserPreferencesForTrackSelection",
this,
&TextTrackManager::HonorUserPreferencesForTrackSelection);
nsContentUtils::RunInStableState(task.forget());
}
@ -190,8 +192,10 @@ TextTrackManager::AddTextTrack(TextTrack* aTextTrack)
ReportTelemetryForTrack(aTextTrack);
if (aTextTrack->GetTextTrackSource() == TextTrackSource::Track) {
RefPtr<nsIRunnable> task =
NewRunnableMethod(this, &TextTrackManager::HonorUserPreferencesForTrackSelection);
RefPtr<nsIRunnable> task = NewRunnableMethod(
"dom::TextTrackManager::HonorUserPreferencesForTrackSelection",
this,
&TextTrackManager::HonorUserPreferencesForTrackSelection);
nsContentUtils::RunInStableState(task.forget());
}
}
@ -483,12 +487,15 @@ class SimpleTextTrackEvent : public Runnable
{
public:
friend class CompareSimpleTextTrackEvents;
SimpleTextTrackEvent(const nsAString& aEventName, double aTime,
TextTrack* aTrack, TextTrackCue* aCue)
: mName(aEventName),
mTime(aTime),
mTrack(aTrack),
mCue(aCue)
SimpleTextTrackEvent(const nsAString& aEventName,
double aTime,
TextTrack* aTrack,
TextTrackCue* aCue)
: Runnable("dom::SimpleTextTrackEvent")
, mName(aEventName)
, mTime(aTime)
, mTrack(aTrack)
, mCue(aCue)
{}
NS_IMETHOD Run() {
@ -624,8 +631,11 @@ TextTrackManager::DispatchUpdateCueDisplay()
nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
if (win) {
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackManager::UpdateCueDisplay", TaskCategory::Other,
NewRunnableMethod(this, &TextTrackManager::UpdateCueDisplay));
"TextTrackManager::UpdateCueDisplay",
TaskCategory::Other,
NewRunnableMethod("dom::TextTrackManager::UpdateCueDisplay",
this,
&TextTrackManager::UpdateCueDisplay));
mUpdateCueDisplayDispatched = true;
}
}
@ -644,8 +654,11 @@ TextTrackManager::DispatchTimeMarchesOn()
nsPIDOMWindowInner* win = mMediaElement->OwnerDoc()->GetInnerWindow();
if (win) {
nsGlobalWindow::Cast(win)->Dispatch(
"TextTrackManager::TimeMarchesOn", TaskCategory::Other,
NewRunnableMethod(this, &TextTrackManager::TimeMarchesOn));
"TextTrackManager::TimeMarchesOn",
TaskCategory::Other,
NewRunnableMethod("dom::TextTrackManager::TimeMarchesOn",
this,
&TextTrackManager::TimeMarchesOn));
mTimeMarchesOnDispatched = true;
}
}

View File

@ -120,7 +120,11 @@ using namespace mozilla::dom;
class nsAutoFocusEvent : public Runnable
{
public:
explicit nsAutoFocusEvent(nsGenericHTMLFormElement* aElement) : mElement(aElement) {}
explicit nsAutoFocusEvent(nsGenericHTMLFormElement* aElement)
: mozilla::Runnable("nsAutoFocusEvent")
, mElement(aElement)
{
}
NS_IMETHOD Run() override {
nsFocusManager* fm = nsFocusManager::GetFocusManager();

View File

@ -2505,7 +2505,9 @@ nsHTMLDocument::MaybeEditingStateChanged()
EditingStateChanged();
} else if (!mInDestructor) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsHTMLDocument::MaybeEditingStateChanged));
NewRunnableMethod("nsHTMLDocument::MaybeEditingStateChanged",
this,
&nsHTMLDocument::MaybeEditingStateChanged));
}
}
}
@ -2536,9 +2538,10 @@ nsHTMLDocument::SetMayStartLayout(bool aMayStartLayout)
class DeferredContentEditableCountChangeEvent : public Runnable
{
public:
DeferredContentEditableCountChangeEvent(nsHTMLDocument *aDoc,
nsIContent *aElement)
: mDoc(aDoc)
DeferredContentEditableCountChangeEvent(nsHTMLDocument* aDoc,
nsIContent* aElement)
: mozilla::Runnable("DeferredContentEditableCountChangeEvent")
, mDoc(aDoc)
, mElement(aElement)
{
}

View File

@ -86,9 +86,10 @@ private:
class RestoreSelectionState : public Runnable {
public:
RestoreSelectionState(nsTextEditorState *aState, nsTextControlFrame *aFrame)
: mFrame(aFrame),
mTextEditorState(aState)
RestoreSelectionState(nsTextEditorState* aState, nsTextControlFrame* aFrame)
: mozilla::Runnable("RestoreSelectionState")
, mFrame(aFrame)
, mTextEditorState(aState)
{
}
@ -1249,10 +1250,11 @@ nsTextEditorState::GetSelectionController() const
// Helper class, used below in BindToFrame().
class PrepareEditorEvent : public Runnable {
public:
PrepareEditorEvent(nsTextEditorState &aState,
nsIContent *aOwnerContent,
const nsAString &aCurrentValue)
: mState(&aState)
PrepareEditorEvent(nsTextEditorState& aState,
nsIContent* aOwnerContent,
const nsAString& aCurrentValue)
: mozilla::Runnable("PrepareEditorEvent")
, mState(&aState)
, mOwnerContent(aOwnerContent)
, mCurrentValue(aCurrentValue)
{

View File

@ -5994,7 +5994,8 @@ public:
protected:
DatabaseOperationBase(const nsID& aBackgroundChildLoggingId,
uint64_t aLoggingSerialNumber)
: mOwningEventTarget(GetCurrentThreadEventTarget())
: Runnable("dom::indexedDB::DatabaseOperationBase")
, mOwningEventTarget(GetCurrentThreadEventTarget())
, mBackgroundChildLoggingId(aBackgroundChildLoggingId)
, mLoggingSerialNumber(aLoggingSerialNumber)
, mResultCode(NS_OK)
@ -6350,7 +6351,8 @@ class WaitForTransactionsHelper final
public:
WaitForTransactionsHelper(const nsCString& aDatabaseId,
nsIRunnable* aCallback)
: mDatabaseId(aDatabaseId)
: Runnable("dom::indexedDB::WaitForTransactionsHelper")
, mDatabaseId(aDatabaseId)
, mCallback(aCallback)
, mState(State::Initial)
{
@ -8999,7 +9001,8 @@ public:
const nsACString& aOrigin,
const nsAString& aDatabaseName,
int64_t aFileId)
: mPersistenceType(aPersistenceType)
: Runnable("dom::indexedDB::GetFileReferencesHelper")
, mPersistenceType(aPersistenceType)
, mOrigin(aOrigin)
, mDatabaseName(aDatabaseName)
, mFileId(aFileId)
@ -9027,6 +9030,9 @@ private:
class FlushPendingFileDeletionsRunnable final
: public Runnable
{
public:
FlushPendingFileDeletionsRunnable() : Runnable("FlushPendingFileDeletionsRunnable") {}
private:
~FlushPendingFileDeletionsRunnable() override = default;
@ -9365,7 +9371,8 @@ class Maintenance final
public:
explicit Maintenance(QuotaClient* aQuotaClient)
: mQuotaClient(aQuotaClient)
: Runnable("dom::indexedDB::Maintenance")
, mQuotaClient(aQuotaClient)
, mStartTime(PR_Now())
, mResultCode(NS_OK)
, mAborted(false)
@ -9581,7 +9588,8 @@ public:
const nsCString& aGroup,
const nsCString& aOrigin,
const nsString& aDatabasePath)
: mMaintenance(aMaintenance)
: Runnable("dom::indexedDB::DatabaseMaintenance")
, mMaintenance(aMaintenance)
, mGroup(aGroup)
, mOrigin(aOrigin)
, mDatabasePath(aDatabasePath)
@ -12631,7 +12639,7 @@ ConnectionPool::ShutdownThread(ThreadInfo& aThreadInfo)
NS_DISPATCH_NORMAL));
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(
NewRunnableMethod(thread, &nsIThread::Shutdown)));
NewRunnableMethod("nsIThread::Shutdown", thread, &nsIThread::Shutdown)));
mTotalThreadCount--;
}
@ -12739,7 +12747,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<nsIRunnable> runnable = new Runnable();
nsCOMPtr<nsIRunnable> runnable = new Runnable("IndexedDBDummyRunnable");
for (uint32_t index = mDatabasesPerformingIdleMaintenance.Length();
index > 0;
@ -13183,7 +13191,8 @@ ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId)
ConnectionPool::
ConnectionRunnable::ConnectionRunnable(DatabaseInfo* aDatabaseInfo)
: mDatabaseInfo(aDatabaseInfo)
: Runnable("dom::indexedDB::ConnectionPool::ConnectionRunnable")
, mDatabaseInfo(aDatabaseInfo)
, mOwningEventTarget(GetCurrentThreadEventTarget())
{
AssertIsOnBackgroundThread();
@ -13345,11 +13354,12 @@ DatabasesCompleteCallback::~DatabasesCompleteCallback()
MOZ_COUNT_DTOR(ConnectionPool::DatabasesCompleteCallback);
}
ConnectionPool::
FinishCallbackWrapper::FinishCallbackWrapper(ConnectionPool* aConnectionPool,
uint64_t aTransactionId,
FinishCallback* aCallback)
: mConnectionPool(aConnectionPool)
ConnectionPool::FinishCallbackWrapper::FinishCallbackWrapper(
ConnectionPool* aConnectionPool,
uint64_t aTransactionId,
FinishCallback* aCallback)
: Runnable("dom::indexedDB::ConnectionPool::FinishCallbackWrapper")
, mConnectionPool(aConnectionPool)
, mCallback(aCallback)
, mOwningEventTarget(GetCurrentThreadEventTarget())
, mTransactionId(aTransactionId)
@ -13412,9 +13422,9 @@ FinishCallbackWrapper::Run()
uint32_t ConnectionPool::ThreadRunnable::sNextSerialNumber = 0;
ConnectionPool::
ThreadRunnable::ThreadRunnable()
: mSerialNumber(++sNextSerialNumber)
ConnectionPool::ThreadRunnable::ThreadRunnable()
: Runnable("dom::indexedDB::ConnectionPool::ThreadRunnable")
, mSerialNumber(++sNextSerialNumber)
, mFirstRun(true)
, mContinueRunning(true)
{
@ -14477,7 +14487,9 @@ Database::MaybeCloseConnection()
IsClosed() &&
mDirectoryLock) {
nsCOMPtr<nsIRunnable> callback =
NewRunnableMethod(this, &Database::ConnectionClosedCallback);
NewRunnableMethod("dom::indexedDB::Database::ConnectionClosedCallback",
this,
&Database::ConnectionClosedCallback);
RefPtr<WaitForTransactionsHelper> helper =
new WaitForTransactionsHelper(Id(), callback);
@ -22679,8 +22691,10 @@ OpenDatabaseOp::SendResults()
// Make sure to release the database on this thread.
mDatabase = nullptr;
} else if (mDirectoryLock) {
nsCOMPtr<nsIRunnable> callback =
NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback);
nsCOMPtr<nsIRunnable> callback = NewRunnableMethod(
"dom::indexedDB::OpenDatabaseOp::ConnectionClosedCallback",
this,
&OpenDatabaseOp::ConnectionClosedCallback);
RefPtr<WaitForTransactionsHelper> helper =
new WaitForTransactionsHelper(mDatabaseId, callback);

View File

@ -60,7 +60,8 @@ public:
DoCleanup(FileManager* aFileManager, int64_t aFileId);
CleanupFileRunnable(FileManager* aFileManager, int64_t aFileId)
: mFileManager(aFileManager)
: Runnable("dom::indexedDB::CleanupFileRunnable")
, mFileManager(aFileManager)
, mFileId(aFileId)
{
MOZ_ASSERT(aFileManager);

View File

@ -73,9 +73,9 @@ class CancelableRunnableWrapper final
nsCOMPtr<nsIRunnable> mRunnable;
public:
explicit
CancelableRunnableWrapper(nsIRunnable* aRunnable)
: mRunnable(aRunnable)
explicit CancelableRunnableWrapper(nsIRunnable* aRunnable)
: CancelableRunnable("dom::CancelableRunnableWrapper")
, mRunnable(aRunnable)
{
MOZ_ASSERT(aRunnable);
}

View File

@ -36,7 +36,8 @@ public:
uint32_t aSeverityFlag,
bool aIsChrome,
uint64_t aInnerWindowID)
: mMessage(aMessage)
: mozilla::Runnable("ScriptErrorRunnable")
, mMessage(aMessage)
, mFilename(aFilename)
, mLineNumber(aLineNumber)
, mColumnNumber(aColumnNumber)
@ -55,7 +56,8 @@ public:
uint32_t aSeverityFlag,
bool aIsChrome,
uint64_t aInnerWindowID)
: mMessageName(aMessageName)
: mozilla::Runnable("ScriptErrorRunnable")
, mMessageName(aMessageName)
, mFilename(aFilename)
, mLineNumber(aLineNumber)
, mColumnNumber(aColumnNumber)

View File

@ -32,7 +32,10 @@ ContentBridgeChild::~ContentBridgeChild()
void
ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
{
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy));
MessageLoop::current()->PostTask(
NewRunnableMethod("dom::ContentBridgeChild::DeferredDestroy",
this,
&ContentBridgeChild::DeferredDestroy));
}
/*static*/ void

View File

@ -36,7 +36,10 @@ ContentBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
if (os) {
os->RemoveObserver(this, "content-child-shutdown");
}
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy));
MessageLoop::current()->PostTask(
NewRunnableMethod("dom::ContentBridgeParent::DeferredDestroy",
this,
&ContentBridgeParent::DeferredDestroy));
}
/*static*/ ContentBridgeParent*
@ -173,7 +176,8 @@ ContentBridgeParent::NotifyTabDestroyed()
{
int32_t numLiveTabs = ManagedPBrowserParent().Count();
if (numLiveTabs == 1) {
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::Close));
MessageLoop::current()->PostTask(NewRunnableMethod(
"dom::ContentBridgeParent::Close", this, &ContentBridgeParent::Close));
}
}

View File

@ -2776,10 +2776,12 @@ ContentChild::StartForceKillTimer()
if (timeoutSecs > 0) {
mForceKillTimer = do_CreateInstance("@mozilla.org/timer;1");
MOZ_ASSERT(mForceKillTimer);
mForceKillTimer->InitWithFuncCallback(ContentChild::ForceKillTimerCallback,
mForceKillTimer->InitWithNamedFuncCallback(
ContentChild::ForceKillTimerCallback,
this,
timeoutSecs * 1000,
nsITimer::TYPE_ONE_SHOT);
nsITimer::TYPE_ONE_SHOT,
"dom::ContentChild::StartForceKillTimer");
}
}
@ -2809,7 +2811,9 @@ ContentChild::RecvShutdown()
// time (100ms) in the hopes that the event loop will have finished by
// then.
MessageLoop::current()->PostDelayedTask(
NewRunnableMethod(this, &ContentChild::RecvShutdown), 100);
NewRunnableMethod(
"dom::ContentChild::RecvShutdown", this, &ContentChild::RecvShutdown),
100);
return IPC_OK();
}
}

View File

@ -1711,7 +1711,11 @@ DelayedDeleteSubprocess(GeckoChildProcessHost* aSubprocess)
// system.
struct DelayedDeleteContentParentTask : public Runnable
{
explicit DelayedDeleteContentParentTask(ContentParent* aObj) : mObj(aObj) { }
explicit DelayedDeleteContentParentTask(ContentParent* aObj)
: Runnable("dom::DelayedDeleteContentParentTask")
, mObj(aObj)
{
}
// No-op
NS_IMETHOD Run() override { return NS_OK; }
@ -1843,10 +1847,11 @@ 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
<ShutDownMethod>(cp,
&ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
MessageLoop::current()->PostTask(
NewRunnableMethod<ShutDownMethod>("dom::ContentParent::ShutDownProcess",
cp,
&ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
}
cpm->RemoveContentProcess(this->ChildID());
@ -1972,10 +1977,12 @@ ContentParent::StartForceKillTimer()
if (timeoutSecs > 0) {
mForceKillTimer = do_CreateInstance("@mozilla.org/timer;1");
MOZ_ASSERT(mForceKillTimer);
mForceKillTimer->InitWithFuncCallback(ContentParent::ForceKillTimerCallback,
this,
timeoutSecs * 1000,
nsITimer::TYPE_ONE_SHOT);
mForceKillTimer->InitWithNamedFuncCallback(
ContentParent::ForceKillTimerCallback,
this,
timeoutSecs * 1000,
nsITimer::TYPE_ONE_SHOT,
"dom::ContentParent::StartForceKillTimer");
}
}
@ -2004,10 +2011,11 @@ 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
<ShutDownMethod>(this,
&ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
MessageLoop::current()->PostTask(
NewRunnableMethod<ShutDownMethod>("dom::ContentParent::ShutDownProcess",
this,
&ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
}
}
@ -4094,7 +4102,8 @@ class AnonymousTemporaryFileRequestor final : public Runnable
{
public:
AnonymousTemporaryFileRequestor(ContentParent* aCP, const uint64_t& aID)
: mCP(aCP)
: Runnable("dom::AnonymousTemporaryFileRequestor")
, mCP(aCP)
, mID(aID)
, mRv(NS_OK)
, mPRFD(nullptr)

View File

@ -49,11 +49,12 @@ 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<nsCOMPtr<nsIFile>>& aFiles,
bool aIsDirectory)
: mFilePickerParent(aFPParent)
, mIsDirectory(aIsDirectory)
: mozilla::Runnable("dom::FilePickerParent::IORunnable")
, mFilePickerParent(aFPParent)
, mIsDirectory(aIsDirectory)
{
mFiles.SwapElements(aFiles);
MOZ_ASSERT_IF(aIsDirectory, mFiles.Length() == 1);

View File

@ -206,7 +206,9 @@ 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(this, &PreallocatedProcessManagerImpl::AllocateNow),
NewRunnableMethod("PreallocatedProcessManagerImpl::AllocateNow",
this,
&PreallocatedProcessManagerImpl::AllocateNow),
Preferences::GetUint("dom.ipc.processPrelaunch.delayMs",
DEFAULT_ALLOCATE_DELAY));
}
@ -218,7 +220,10 @@ PreallocatedProcessManagerImpl::AllocateOnIdle()
return;
}
NS_IdleDispatchToCurrentThread(NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow));
NS_IdleDispatchToCurrentThread(
NewRunnableMethod("PreallocatedProcessManagerImpl::AllocateNow",
this,
&PreallocatedProcessManagerImpl::AllocateNow));
}
void

View File

@ -369,7 +369,9 @@ 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(this, &HangMonitorChild::ShutdownOnThread));
Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ShutdownOnThread",
this,
&HangMonitorChild::ShutdownOnThread));
}
mozilla::ipc::IPCResult
@ -480,10 +482,12 @@ HangMonitorChild::NotifySlowScript(nsITabChild* aTabChild,
}
nsAutoCString filename(aFileName);
Dispatch(NewNonOwningRunnableMethod
<TabId, nsCString>(this,
&HangMonitorChild::NotifySlowScriptAsync,
id, filename));
Dispatch(NewNonOwningRunnableMethod<TabId, nsCString>(
"HangMonitorChild::NotifySlowScriptAsync",
this,
&HangMonitorChild::NotifySlowScriptAsync,
id,
filename));
return SlowScriptAction::Continue;
}
@ -511,9 +515,11 @@ HangMonitorChild::NotifyPluginHang(uint32_t aPluginId)
mSentReport = true;
// bounce to background thread
Dispatch(NewNonOwningRunnableMethod<uint32_t>(this,
&HangMonitorChild::NotifyPluginHangAsync,
aPluginId));
Dispatch(NewNonOwningRunnableMethod<uint32_t>(
"HangMonitorChild::NotifyPluginHangAsync",
this,
&HangMonitorChild::NotifyPluginHangAsync,
aPluginId));
}
void
@ -535,7 +541,9 @@ HangMonitorChild::ClearHang()
if (mSentReport) {
// bounce to background thread
Dispatch(NewNonOwningRunnableMethod(this, &HangMonitorChild::ClearHangAsync));
Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ClearHangAsync",
this,
&HangMonitorChild::ClearHangAsync));
MonitorAutoLock lock(mMonitor);
mSentReport = false;
@ -603,7 +611,8 @@ HangMonitorParent::Shutdown()
mProcess = nullptr;
}
Dispatch(NewNonOwningRunnableMethod(this,
Dispatch(NewNonOwningRunnableMethod("HangMonitorParent::ShutdownOnThread",
this,
&HangMonitorParent::ShutdownOnThread));
while (!mShutdownDone) {
@ -634,8 +643,12 @@ HangMonitorParent::ForcePaint(dom::TabParent* aTab, uint64_t aLayerObserverEpoch
MOZ_RELEASE_ASSERT(NS_IsMainThread());
if (sShouldForcePaint) {
TabId id = aTab->GetTabId();
Dispatch(NewNonOwningRunnableMethod
<TabId, uint64_t>(this, &HangMonitorParent::ForcePaintOnThread, id, aLayerObserverEpoch));
Dispatch(NewNonOwningRunnableMethod<TabId, uint64_t>(
"HangMonitorParent::ForcePaintOnThread",
this,
&HangMonitorParent::ForcePaintOnThread,
id,
aLayerObserverEpoch));
}
}
@ -944,8 +957,10 @@ HangMonitoredProcess::TerminateScript()
return NS_ERROR_UNEXPECTED;
}
ProcessHangMonitor::Get()->Dispatch(NewNonOwningRunnableMethod(mActor,
&HangMonitorParent::TerminateScript));
ProcessHangMonitor::Get()->Dispatch(
NewNonOwningRunnableMethod("HangMonitorParent::TerminateScript",
mActor,
&HangMonitorParent::TerminateScript));
return NS_OK;
}
@ -961,8 +976,10 @@ HangMonitoredProcess::BeginStartingDebugger()
return NS_ERROR_UNEXPECTED;
}
ProcessHangMonitor::Get()->Dispatch(NewNonOwningRunnableMethod(mActor,
&HangMonitorParent::BeginStartingDebugger));
ProcessHangMonitor::Get()->Dispatch(
NewNonOwningRunnableMethod("HangMonitorParent::BeginStartingDebugger",
mActor,
&HangMonitorParent::BeginStartingDebugger));
return NS_OK;
}
@ -978,8 +995,10 @@ HangMonitoredProcess::EndStartingDebugger()
return NS_ERROR_UNEXPECTED;
}
ProcessHangMonitor::Get()->Dispatch(NewNonOwningRunnableMethod(mActor,
&HangMonitorParent::EndStartingDebugger));
ProcessHangMonitor::Get()->Dispatch(
NewNonOwningRunnableMethod("HangMonitorParent::EndStartingDebugger",
mActor,
&HangMonitorParent::EndStartingDebugger));
return NS_OK;
}
@ -1159,10 +1178,12 @@ CreateHangMonitorParent(ContentParent* aContentParent,
auto* process = new HangMonitoredProcess(parent, aContentParent);
parent->SetProcess(process);
monitor->Dispatch(NewNonOwningRunnableMethod
<Endpoint<PProcessHangMonitorParent>&&>(parent,
&HangMonitorParent::Bind,
Move(aEndpoint)));
monitor->Dispatch(
NewNonOwningRunnableMethod<Endpoint<PProcessHangMonitorParent>&&>(
"HangMonitorParent::Bind",
parent,
&HangMonitorParent::Bind,
Move(aEndpoint)));
return parent;
}
@ -1178,10 +1199,12 @@ mozilla::CreateHangMonitorChild(Endpoint<PProcessHangMonitorChild>&& aEndpoint)
ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
auto* child = new HangMonitorChild(monitor);
monitor->Dispatch(NewNonOwningRunnableMethod
<Endpoint<PProcessHangMonitorChild>&&>(child,
&HangMonitorChild::Bind,
Move(aEndpoint)));
monitor->Dispatch(
NewNonOwningRunnableMethod<Endpoint<PProcessHangMonitorChild>&&>(
"HangMonitorChild::Bind",
child,
&HangMonitorChild::Bind,
Move(aEndpoint)));
}
void

View File

@ -2781,8 +2781,13 @@ class LayerTreeUpdateRunnable final
bool mActive;
public:
explicit LayerTreeUpdateRunnable(uint64_t aLayersId, uint64_t aEpoch, bool aActive)
: mLayersId(aLayersId), mEpoch(aEpoch), mActive(aActive)
explicit LayerTreeUpdateRunnable(uint64_t aLayersId,
uint64_t aEpoch,
bool aActive)
: Runnable("dom::LayerTreeUpdateRunnable")
, mLayersId(aLayersId)
, mEpoch(aEpoch)
, mActive(aActive)
{
MOZ_ASSERT(!NS_IsMainThread());
}

View File

@ -663,7 +663,8 @@ 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);

Some files were not shown because too many files have changed in this diff Show More