mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1268313: Part 7 - Move NS_NewRunnableMethod and friends to mozilla::NewRunnableMethod. r=froydnj
This commit is contained in:
parent
12d497cb39
commit
48a594a09e
@ -1383,10 +1383,8 @@ nsSHistory::RemoveEntries(nsTArray<uint64_t>& aIDs, int32_t aStartIndex)
|
||||
--index;
|
||||
}
|
||||
if (didRemove && mRootDocShell) {
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
NS_NewRunnableMethod(static_cast<nsDocShell*>(mRootDocShell),
|
||||
&nsDocShell::FireDummyOnLocationChange);
|
||||
NS_DispatchToCurrentThread(ev);
|
||||
NS_DispatchToCurrentThread(NewRunnableMethod(static_cast<nsDocShell*>(mRootDocShell),
|
||||
&nsDocShell::FireDummyOnLocationChange));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1236,7 +1236,7 @@ Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag)
|
||||
DoFinishNotificationImmediately();
|
||||
} else if (!mFinishNotificationTask.IsPending()) {
|
||||
RefPtr<nsRunnableMethod<Animation>> runnable =
|
||||
NS_NewRunnableMethod(this, &Animation::DoFinishNotificationImmediately);
|
||||
NewRunnableMethod(this, &Animation::DoFinishNotificationImmediately);
|
||||
runtime->DispatchToMicroTask(runnable);
|
||||
mFinishNotificationTask = runnable;
|
||||
}
|
||||
|
@ -86,8 +86,7 @@ ArchiveReaderEvent::RunShare(nsresult aStatus)
|
||||
{
|
||||
mStatus = aStatus;
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &ArchiveReaderEvent::ShareMainThread);
|
||||
NS_DispatchToMainThread(event);
|
||||
NS_DispatchToMainThread(NewRunnableMethod(this, &ArchiveReaderEvent::ShareMainThread));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
}
|
||||
else {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler));
|
||||
NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,11 +364,7 @@ EventSource::OnStartRequest(nsIRequest *aRequest,
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &EventSource::AnnounceConnection);
|
||||
NS_ENSURE_STATE(event);
|
||||
|
||||
rv = NS_DispatchToMainThread(event);
|
||||
rv = NS_DispatchToMainThread(NewRunnableMethod(this, &EventSource::AnnounceConnection));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mStatus = PARSE_STATE_BEGIN_OF_STREAM;
|
||||
@ -474,11 +470,7 @@ EventSource::OnStopRequest(nsIRequest *aRequest,
|
||||
|
||||
ClearFields();
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &EventSource::ReestablishConnection);
|
||||
NS_ENSURE_STATE(event);
|
||||
|
||||
rv = NS_DispatchToMainThread(event);
|
||||
rv = NS_DispatchToMainThread(NewRunnableMethod(this, &EventSource::ReestablishConnection));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
@ -907,11 +899,8 @@ EventSource::ConsoleError()
|
||||
nsresult
|
||||
EventSource::DispatchFailConnection()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &EventSource::FailConnection);
|
||||
NS_ENSURE_STATE(event);
|
||||
|
||||
return NS_DispatchToMainThread(event);
|
||||
return NS_DispatchToMainThread(NewRunnableMethod(this, &EventSource::FailConnection));
|
||||
}
|
||||
|
||||
void
|
||||
@ -985,7 +974,7 @@ EventSource::Thaw()
|
||||
nsresult rv;
|
||||
if (!mGoingToDispatchAllMessages && mMessagesToDispatch.GetSize() > 0) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
|
||||
NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
|
||||
NS_ENSURE_STATE(event);
|
||||
|
||||
mGoingToDispatchAllMessages = true;
|
||||
@ -1045,7 +1034,7 @@ EventSource::DispatchCurrentMessageEvent()
|
||||
|
||||
if (!mGoingToDispatchAllMessages) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
|
||||
NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
|
||||
NS_ENSURE_STATE(event);
|
||||
|
||||
mGoingToDispatchAllMessages = true;
|
||||
|
@ -540,7 +540,7 @@ ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration)
|
||||
doc->SetOrientationPendingPromise(nullptr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableMethod(this,
|
||||
nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod(this,
|
||||
&ScreenOrientation::DispatchChangeEvent);
|
||||
rv = NS_DispatchToMainThread(runnable);
|
||||
NS_WARN_IF(NS_FAILED(rv));
|
||||
@ -615,7 +615,7 @@ ScreenOrientation::VisibleEventListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
doc->SetOrientationPendingPromise(nullptr);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableMethod(orientation,
|
||||
nsCOMPtr<nsIRunnable> runnable = NewRunnableMethod(orientation,
|
||||
&ScreenOrientation::DispatchChangeEvent);
|
||||
rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
|
@ -271,7 +271,7 @@ nsContentSink::ProcessHTTPHeaders(nsIChannel* aChannel)
|
||||
"Already dispatched an event?");
|
||||
|
||||
mProcessLinkHeaderEvent =
|
||||
NS_NewNonOwningRunnableMethod(this,
|
||||
NewNonOwningRunnableMethod(this,
|
||||
&nsContentSink::DoProcessLinkHeader);
|
||||
rv = NS_DispatchToCurrentThread(mProcessLinkHeaderEvent.get());
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -5042,22 +5042,29 @@ nsContentUtils::WarnScriptWasIgnored(nsIDocument* aDocument)
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::AddScriptRunner(nsIRunnable* aRunnable)
|
||||
nsContentUtils::AddScriptRunner(already_AddRefed<nsIRunnable> aRunnable)
|
||||
{
|
||||
if (!aRunnable) {
|
||||
nsCOMPtr<nsIRunnable> runnable = aRunnable;
|
||||
if (!runnable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sScriptBlockerCount) {
|
||||
return sBlockedScriptRunners->AppendElement(aRunnable) != nullptr;
|
||||
return sBlockedScriptRunners->AppendElement(runnable.forget()) != nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> run = aRunnable;
|
||||
run->Run();
|
||||
runnable->Run();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::AddScriptRunner(nsIRunnable* aRunnable) {
|
||||
nsCOMPtr<nsIRunnable> runnable = aRunnable;
|
||||
return AddScriptRunner(runnable.forget());
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::RunInStableState(already_AddRefed<nsIRunnable> aRunnable)
|
||||
|
@ -1608,6 +1608,7 @@ public:
|
||||
* has not yet been AddRefed.
|
||||
* @return false on out of memory, true otherwise.
|
||||
*/
|
||||
static bool AddScriptRunner(already_AddRefed<nsIRunnable> aRunnable);
|
||||
static bool AddScriptRunner(nsIRunnable* aRunnable);
|
||||
|
||||
/**
|
||||
|
@ -1008,7 +1008,7 @@ nsDOMWindowUtils::SendNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
NS_DispatchToMainThread(NewRunnableMethod
|
||||
<int32_t, int32_t, uint32_t, nsString, nsString, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeKeyEvent, aNativeKeyboardLayout,
|
||||
aNativeKeyCode, aModifiers, aCharacters, aUnmodifiedCharacters, aObserver));
|
||||
@ -1028,7 +1028,7 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
NS_DispatchToMainThread(NewRunnableMethod
|
||||
<LayoutDeviceIntPoint, int32_t, int32_t, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeMouseEvent,
|
||||
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aModifierFlags,
|
||||
@ -1047,7 +1047,7 @@ nsDOMWindowUtils::SendNativeMouseMove(int32_t aScreenX,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
NS_DispatchToMainThread(NewRunnableMethod
|
||||
<LayoutDeviceIntPoint, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeMouseMove,
|
||||
LayoutDeviceIntPoint(aScreenX, aScreenY), aObserver));
|
||||
@ -1072,7 +1072,7 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
NS_DispatchToMainThread(NewRunnableMethod
|
||||
<mozilla::LayoutDeviceIntPoint, uint32_t, double, double, double, uint32_t, uint32_t, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeMouseScrollEvent,
|
||||
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aDeltaX, aDeltaY,
|
||||
@ -1098,7 +1098,7 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
NS_DispatchToMainThread(NewRunnableMethod
|
||||
<uint32_t, nsIWidget::TouchPointerState, LayoutDeviceIntPoint, double, uint32_t, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId,
|
||||
(nsIWidget::TouchPointerState)aTouchState,
|
||||
@ -1118,7 +1118,7 @@ nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
|
||||
NS_DispatchToMainThread(NewRunnableMethod
|
||||
<LayoutDeviceIntPoint, bool, nsIObserver*>
|
||||
(widget, &nsIWidget::SynthesizeNativeTouchTap,
|
||||
LayoutDeviceIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
|
||||
@ -1133,7 +1133,7 @@ nsDOMWindowUtils::ClearNativeTouchSequence(nsIObserver* aObserver)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs<nsIObserver*>
|
||||
NS_DispatchToMainThread(NewRunnableMethod<nsIObserver*>
|
||||
(widget, &nsIWidget::ClearNativeTouchSequence, aObserver));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4352,7 +4352,7 @@ nsDocument::SetStyleSheetApplicableState(StyleSheetHandle aSheet,
|
||||
}
|
||||
|
||||
if (!mSSApplicableStateNotificationPending) {
|
||||
nsCOMPtr<nsIRunnable> notification = NS_NewRunnableMethod(this,
|
||||
nsCOMPtr<nsIRunnable> notification = NewRunnableMethod(this,
|
||||
&nsDocument::NotifyStyleSheetApplicableStateChanged);
|
||||
mSSApplicableStateNotificationPending =
|
||||
NS_SUCCEEDED(NS_DispatchToCurrentThread(notification));
|
||||
@ -4961,7 +4961,7 @@ nsDocument::MaybeEndOutermostXBLUpdate()
|
||||
BindingManager()->EndOutermostUpdate();
|
||||
} else if (!mInDestructor) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate));
|
||||
NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5279,7 +5279,7 @@ nsDocument::UnblockDOMContentLoaded()
|
||||
MOZ_ASSERT(mReadyState == READYSTATE_INTERACTIVE);
|
||||
if (!mSynchronousDOMContentLoaded) {
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
NS_NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
|
||||
NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
|
||||
NS_DispatchToCurrentThread(ev);
|
||||
} else {
|
||||
DispatchContentLoadedEvents();
|
||||
@ -7262,7 +7262,7 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
|
||||
return;
|
||||
|
||||
RefPtr<nsRunnableMethod<nsDocument, void, false> > event =
|
||||
NS_NewNonOwningRunnableMethod(this,
|
||||
NewNonOwningRunnableMethod(this,
|
||||
&nsDocument::DoNotifyPossibleTitleChange);
|
||||
nsresult rv = NS_DispatchToCurrentThread(event);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
@ -7411,7 +7411,7 @@ nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
|
||||
mInitializableFrameLoaders.AppendElement(aLoader);
|
||||
if (!mFrameLoaderRunner) {
|
||||
mFrameLoaderRunner =
|
||||
NS_NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
|
||||
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
|
||||
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
|
||||
}
|
||||
@ -7429,7 +7429,7 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader, nsIRunnable* aFinalizer)
|
||||
mFrameLoaderFinalizers.AppendElement(aFinalizer);
|
||||
if (!mFrameLoaderRunner) {
|
||||
mFrameLoaderRunner =
|
||||
NS_NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
|
||||
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
|
||||
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
|
||||
}
|
||||
@ -7453,7 +7453,7 @@ nsDocument::MaybeInitializeFinalizeFrameLoaders()
|
||||
(mInitializableFrameLoaders.Length() ||
|
||||
mFrameLoaderFinalizers.Length())) {
|
||||
mFrameLoaderRunner =
|
||||
NS_NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
|
||||
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
|
||||
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
|
||||
}
|
||||
return;
|
||||
@ -9064,7 +9064,7 @@ nsDocument::BlockOnload()
|
||||
++mAsyncOnloadBlockCount;
|
||||
if (mAsyncOnloadBlockCount == 1) {
|
||||
bool success = nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &nsDocument::AsyncBlockOnload));
|
||||
NewRunnableMethod(this, &nsDocument::AsyncBlockOnload));
|
||||
|
||||
// The script runner shouldn't fail to add. But if somebody broke
|
||||
// something and it does, we'll thrash at 100% cpu forever. The best
|
||||
@ -12772,7 +12772,7 @@ nsDocument::GetVisibilityState() const
|
||||
nsDocument::PostVisibilityUpdateEvent()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
|
||||
NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
||||
@ -13503,7 +13503,7 @@ nsIDocument::RebuildUserFontSet()
|
||||
// change reflow).
|
||||
if (!mPostedFlushUserFontSet) {
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
NS_NewRunnableMethod(this, &nsIDocument::HandleRebuildUserFontSet);
|
||||
NewRunnableMethod(this, &nsIDocument::HandleRebuildUserFontSet);
|
||||
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) {
|
||||
mPostedFlushUserFontSet = true;
|
||||
}
|
||||
|
@ -2494,7 +2494,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
under normal circumstances, but bug 49615 describes a case.) */
|
||||
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &nsGlobalWindow::ClearStatus));
|
||||
NewRunnableMethod(this, &nsGlobalWindow::ClearStatus));
|
||||
|
||||
// Sometimes, WouldReuseInnerWindow() returns true even if there's no inner
|
||||
// window (see bug 776497). Be safe.
|
||||
@ -2799,8 +2799,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
// up with the outer. See bug 969156.
|
||||
if (createdInnerWindow) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(newInnerWindow,
|
||||
&nsGlobalWindow::FireOnNewGlobalObject));
|
||||
NewRunnableMethod(newInnerWindow,
|
||||
&nsGlobalWindow::FireOnNewGlobalObject));
|
||||
}
|
||||
|
||||
if (newInnerWindow && !newInnerWindow->mHasNotifiedGlobalCreated && mDoc) {
|
||||
@ -2813,7 +2813,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
nsContentUtils::IsSystemPrincipal(mDoc->NodePrincipal())) {
|
||||
newInnerWindow->mHasNotifiedGlobalCreated = true;
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &nsGlobalWindow::DispatchDOMWindowCreated));
|
||||
NewRunnableMethod(this, &nsGlobalWindow::DispatchDOMWindowCreated));
|
||||
}
|
||||
}
|
||||
|
||||
@ -11476,7 +11476,7 @@ public:
|
||||
~AutoUnblockScriptClosing()
|
||||
{
|
||||
void (nsGlobalWindow::*run)() = &nsGlobalWindow::UnblockScriptedClosing;
|
||||
NS_DispatchToCurrentThread(NS_NewRunnableMethod(mWin, run));
|
||||
NS_DispatchToCurrentThread(NewRunnableMethod(mWin, run));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -503,8 +503,8 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||
if (!scriptURI) {
|
||||
// Asynchronously report the failure to create a URI object
|
||||
NS_DispatchToCurrentThread(
|
||||
NS_NewRunnableMethod(aElement,
|
||||
&nsIScriptElement::FireErrorEvent));
|
||||
NewRunnableMethod(aElement,
|
||||
&nsIScriptElement::FireErrorEvent));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -570,8 +570,8 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||
if (NS_FAILED(rv)) {
|
||||
// Asynchronously report the load failure
|
||||
NS_DispatchToCurrentThread(
|
||||
NS_NewRunnableMethod(aElement,
|
||||
&nsIScriptElement::FireErrorEvent));
|
||||
NewRunnableMethod(aElement,
|
||||
&nsIScriptElement::FireErrorEvent));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1150,10 +1150,8 @@ void
|
||||
nsScriptLoader::ProcessPendingRequestsAsync()
|
||||
{
|
||||
if (mParserBlockingRequest || !mPendingChildLoaders.IsEmpty()) {
|
||||
nsCOMPtr<nsIRunnable> ev = NS_NewRunnableMethod(this,
|
||||
&nsScriptLoader::ProcessPendingRequests);
|
||||
|
||||
NS_DispatchToCurrentThread(ev);
|
||||
NS_DispatchToCurrentThread(NewRunnableMethod(this,
|
||||
&nsScriptLoader::ProcessPendingRequests));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,8 +273,7 @@ nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument,
|
||||
// that if we get unbound while the event is up that's ok -- we'll just
|
||||
// have no grandparent when it fires, and will do nothing.
|
||||
void (nsAttributeTextNode::*update)() = &nsAttributeTextNode::UpdateText;
|
||||
nsCOMPtr<nsIRunnable> ev = NS_NewRunnableMethod(this, update);
|
||||
nsContentUtils::AddScriptRunner(ev);
|
||||
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update));
|
||||
}
|
||||
}
|
||||
|
||||
|
9
dom/cache/Context.cpp
vendored
9
dom/cache/Context.cpp
vendored
@ -740,7 +740,7 @@ Context::ThreadsafeHandle::AllowToClose()
|
||||
// Dispatch is guaranteed to succeed here because we block shutdown until
|
||||
// all Contexts have been destroyed.
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &ThreadsafeHandle::AllowToCloseOnOwningThread);
|
||||
NewRunnableMethod(this, &ThreadsafeHandle::AllowToCloseOnOwningThread);
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
|
||||
}
|
||||
@ -756,7 +756,7 @@ Context::ThreadsafeHandle::InvalidateAndAllowToClose()
|
||||
// Dispatch is guaranteed to succeed here because we block shutdown until
|
||||
// all Contexts have been destroyed.
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread);
|
||||
NewRunnableMethod(this, &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread);
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
|
||||
}
|
||||
@ -780,10 +780,7 @@ Context::ThreadsafeHandle::~ThreadsafeHandle()
|
||||
|
||||
// Dispatch is guaranteed to succeed here because we block shutdown until
|
||||
// all Contexts have been destroyed.
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewNonOwningRunnableMethod(mStrongRef.forget().take(), &Context::Release);
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
|
||||
NS_ProxyRelease(mOwningThread, mStrongRef.forget());
|
||||
}
|
||||
|
||||
void
|
||||
|
6
dom/cache/Manager.cpp
vendored
6
dom/cache/Manager.cpp
vendored
@ -912,7 +912,7 @@ private:
|
||||
// May be on any thread, including STS event target. Non-owning runnable
|
||||
// here since we are guaranteed the Action will survive until
|
||||
// CompleteOnInitiatingThread is called.
|
||||
nsCOMPtr<nsIRunnable> runnable = NS_NewNonOwningRunnableMethodWithArgs<nsresult>(
|
||||
nsCOMPtr<nsIRunnable> runnable = NewNonOwningRunnableMethod<nsresult>(
|
||||
this, &CachePutAllAction::OnAsyncCopyComplete, aRv);
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mTargetThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
|
||||
@ -1761,9 +1761,7 @@ Manager::~Manager()
|
||||
|
||||
// Don't spin the event loop in the destructor waiting for the thread to
|
||||
// shutdown. Defer this to the main thread, instead.
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(ioThread, &nsIThread::Shutdown);
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod(ioThread, &nsIThread::Shutdown)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -171,9 +171,7 @@ CameraPreviewMediaStream::SetCurrentFrame(const gfx::IntSize& aIntrinsicSize, Im
|
||||
++mInvalidatePending;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &CameraPreviewMediaStream::Invalidate);
|
||||
NS_DispatchToMainThread(event);
|
||||
NS_DispatchToMainThread(NewRunnableMethod(this, &CameraPreviewMediaStream::Invalidate));
|
||||
}
|
||||
|
||||
void
|
||||
@ -184,9 +182,7 @@ CameraPreviewMediaStream::ClearCurrentFrame()
|
||||
for (nsTArray<RefPtr<VideoFrameContainer> >::size_type i = 0; i < mVideoOutputs.Length(); ++i) {
|
||||
VideoFrameContainer* output = mVideoOutputs[i];
|
||||
output->ClearCurrentFrame();
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
|
||||
NS_DispatchToMainThread(event);
|
||||
NS_DispatchToMainThread(NewRunnableMethod(output, &VideoFrameContainer::Invalidate));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,8 @@ public:
|
||||
TrackID aInputTrackID) override
|
||||
{
|
||||
if (aTrackEvents & TRACK_EVENT_CREATED) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<TrackID>(
|
||||
this, &TrackCreatedListener::DoNotifyTrackCreated, aID);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(NewRunnableMethod<TrackID>(
|
||||
this, &TrackCreatedListener::DoNotifyTrackCreated, aID));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,11 +233,11 @@ CameraPermissionRequest::DispatchCallback(uint32_t aPermission)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> callbackRunnable;
|
||||
if (aPermission == nsIPermissionManager::ALLOW_ACTION) {
|
||||
callbackRunnable = NS_NewRunnableMethod(this, &CameraPermissionRequest::CallAllow);
|
||||
callbackRunnable = NewRunnableMethod(this, &CameraPermissionRequest::CallAllow);
|
||||
} else {
|
||||
callbackRunnable = NS_NewRunnableMethod(this, &CameraPermissionRequest::CallCancel);
|
||||
callbackRunnable = NewRunnableMethod(this, &CameraPermissionRequest::CallCancel);
|
||||
}
|
||||
return NS_DispatchToMainThread(callbackRunnable);
|
||||
return NS_DispatchToMainThread(callbackRunnable.forget());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -488,7 +488,7 @@ DeviceStorageStatics::AddListener(nsDOMDeviceStorage* aListener)
|
||||
MOZ_ASSERT(sInstance->mInitialized);
|
||||
if (sInstance->mListeners.IsEmpty()) {
|
||||
NS_DispatchToMainThread(
|
||||
NS_NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Register));
|
||||
NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Register));
|
||||
}
|
||||
|
||||
RefPtr<ListenerWrapper> wrapper =
|
||||
@ -519,7 +519,7 @@ DeviceStorageStatics::RemoveListener(nsDOMDeviceStorage* aListener)
|
||||
|
||||
if (removed && sInstance->mListeners.IsEmpty()) {
|
||||
NS_DispatchToMainThread(
|
||||
NS_NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Deregister));
|
||||
NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Deregister));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,9 +371,8 @@ EventListenerService::NotifyAboutMainThreadListenerChangeInternal(dom::EventTarg
|
||||
|
||||
if (!mPendingListenerChanges) {
|
||||
mPendingListenerChanges = nsArrayBase::Create();
|
||||
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableMethod(this,
|
||||
&EventListenerService::NotifyPendingChanges);
|
||||
NS_DispatchToCurrentThread(runnable);
|
||||
NS_DispatchToCurrentThread(NewRunnableMethod(this,
|
||||
&EventListenerService::NotifyPendingChanges));
|
||||
}
|
||||
|
||||
RefPtr<EventListenerChange> changes = mPendingListenerChangesSet.Get(aTarget);
|
||||
|
@ -83,9 +83,7 @@ FetchDriver::Fetch(FetchDriverObserver* aObserver)
|
||||
MOZ_RELEASE_ASSERT(!mRequest->IsSynchronous(),
|
||||
"Synchronous fetch not supported");
|
||||
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(this, &FetchDriver::ContinueFetch);
|
||||
return NS_DispatchToCurrentThread(r);
|
||||
return NS_DispatchToCurrentThread(NewRunnableMethod(this, &FetchDriver::ContinueFetch));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -223,7 +223,7 @@ HTMLCanvasPrintState::Done()
|
||||
mCanvas->InvalidateCanvas();
|
||||
}
|
||||
RefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
|
||||
NS_NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
|
||||
NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
|
||||
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) {
|
||||
mPendingNotify = true;
|
||||
}
|
||||
@ -503,7 +503,7 @@ HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
|
||||
mPrintState = new HTMLCanvasPrintState(this, mCurrentContext, aCallback);
|
||||
|
||||
RefPtr<nsRunnableMethod<HTMLCanvasElement> > renderEvent =
|
||||
NS_NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
|
||||
NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
|
||||
return NS_DispatchToCurrentThread(renderEvent);
|
||||
}
|
||||
|
||||
|
@ -618,7 +618,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
// loading.
|
||||
if (LoadingEnabled()) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage));
|
||||
NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage));
|
||||
}
|
||||
}
|
||||
|
||||
@ -825,7 +825,7 @@ HTMLImageElement::CopyInnerTo(Element* aDest)
|
||||
if (!dest->InResponsiveMode() &&
|
||||
dest->HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage));
|
||||
NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4354,7 +4354,7 @@ HTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
ClearBrokenState();
|
||||
RemoveStatesSilently(NS_EVENT_STATE_BROKEN);
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &HTMLInputElement::MaybeLoadImage));
|
||||
NewRunnableMethod(this, &HTMLInputElement::MaybeLoadImage));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,10 +184,10 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
}
|
||||
|
||||
void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal;
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, update));
|
||||
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update));
|
||||
|
||||
void (HTMLLinkElement::*updateImport)() = &HTMLLinkElement::UpdateImport;
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, updateImport));
|
||||
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, updateImport));
|
||||
|
||||
CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded"));
|
||||
|
||||
|
@ -842,8 +842,8 @@ void HTMLMediaElement::QueueLoadFromSourceTask()
|
||||
{
|
||||
ChangeDelayLoadStatus(true);
|
||||
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_LOADING);
|
||||
RunInStableState(
|
||||
NS_NewRunnableMethod(this, &HTMLMediaElement::LoadFromSourceChildren));
|
||||
RefPtr<Runnable> r = NewRunnableMethod(this, &HTMLMediaElement::LoadFromSourceChildren);
|
||||
RunInStableState(r);
|
||||
}
|
||||
|
||||
void HTMLMediaElement::QueueSelectResourceTask()
|
||||
@ -853,8 +853,8 @@ void HTMLMediaElement::QueueSelectResourceTask()
|
||||
return;
|
||||
mHaveQueuedSelectResource = true;
|
||||
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE);
|
||||
RunInStableState(
|
||||
NS_NewRunnableMethod(this, &HTMLMediaElement::SelectResourceWrapper));
|
||||
RefPtr<Runnable> r = NewRunnableMethod(this, &HTMLMediaElement::SelectResourceWrapper);
|
||||
RunInStableState(r);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::Load()
|
||||
@ -3186,9 +3186,9 @@ public:
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> event;
|
||||
if (aBlocked == BLOCKED) {
|
||||
event = NS_NewRunnableMethod(this, &StreamListener::DoNotifyBlocked);
|
||||
event = NewRunnableMethod(this, &StreamListener::DoNotifyBlocked);
|
||||
} else {
|
||||
event = NS_NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked);
|
||||
event = NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked);
|
||||
}
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
@ -3197,7 +3197,7 @@ public:
|
||||
{
|
||||
if (event == EVENT_FINISHED) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &StreamListener::DoNotifyFinished);
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyFinished);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
}
|
||||
@ -3205,7 +3205,7 @@ public:
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData);
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
virtual void NotifyOutput(MediaStreamGraph* aGraph,
|
||||
@ -3216,7 +3216,7 @@ public:
|
||||
return;
|
||||
mPendingNotifyOutput = true;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &StreamListener::DoNotifyOutput);
|
||||
NewRunnableMethod(this, &StreamListener::DoNotifyOutput);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
|
||||
@ -3268,7 +3268,7 @@ public:
|
||||
if (c->mFrame.GetIntrinsicSize() != gfx::IntSize(0,0)) {
|
||||
mInitialSizeFound = true;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethodWithArgs<gfx::IntSize>(
|
||||
NewRunnableMethod<gfx::IntSize>(
|
||||
this, &StreamSizeListener::ReceivedSize,
|
||||
c->mFrame.GetIntrinsicSize());
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
@ -4622,7 +4622,7 @@ void HTMLMediaElement::AddRemoveSelfReference()
|
||||
// Dispatch Release asynchronously so that we don't destroy this object
|
||||
// inside a call stack of method calls on this object
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &HTMLMediaElement::DoRemoveSelfReference);
|
||||
NewRunnableMethod(this, &HTMLMediaElement::DoRemoveSelfReference);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ HTMLObjectElement::BindToTree(nsIDocument *aDocument,
|
||||
// If we already have all the children, start the load.
|
||||
if (mIsDoneAddingChildren && !pluginDoc) {
|
||||
void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad;
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, start));
|
||||
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, start));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -153,7 +153,7 @@ HTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
|
||||
if (mIsDoneAddingChildren && !pluginDoc) {
|
||||
void (HTMLSharedObjectElement::*start)() =
|
||||
&HTMLSharedObjectElement::StartObjectLoad;
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, start));
|
||||
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, start));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -147,7 +147,7 @@ HTMLStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
void (HTMLStyleElement::*update)() = &HTMLStyleElement::UpdateStyleSheetInternal;
|
||||
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, update));
|
||||
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update));
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -260,8 +260,8 @@ HTMLTrackElement::BindToTree(nsIDocument* aDocument,
|
||||
media->NotifyAddedSource();
|
||||
LOG(LogLevel::Debug, ("Track element sent notification to parent."));
|
||||
|
||||
mMediaParent->RunInStableState(
|
||||
NS_NewRunnableMethod(this, &HTMLTrackElement::LoadResource));
|
||||
RefPtr<Runnable> r = NewRunnableMethod(this, &HTMLTrackElement::LoadResource);
|
||||
mMediaParent->RunInStableState(r);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -314,7 +314,7 @@ void
|
||||
HTMLTrackElement::DispatchTrackRunnable(const nsString& aEventName)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg
|
||||
NewRunnableMethod
|
||||
<const nsString>(this,
|
||||
&HTMLTrackElement::DispatchTrustedEvent,
|
||||
aEventName);
|
||||
|
@ -491,7 +491,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
|
||||
// come during painting and this will trigger invalidation.
|
||||
if (aType == imgINotificationObserver::HAS_TRANSPARENCY) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &ImageDocument::OnHasTransparency);
|
||||
NewRunnableMethod(this, &ImageDocument::OnHasTransparency);
|
||||
nsContentUtils::AddScriptRunner(runnable);
|
||||
}
|
||||
|
||||
@ -554,7 +554,7 @@ ImageDocument::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
|
||||
aImage->GetHeight(&mImageHeight);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &ImageDocument::DefaultCheckOverflowing);
|
||||
NewRunnableMethod(this, &ImageDocument::DefaultCheckOverflowing);
|
||||
nsContentUtils::AddScriptRunner(runnable);
|
||||
UpdateTitleAndCharset();
|
||||
|
||||
|
@ -2505,7 +2505,7 @@ nsHTMLDocument::MaybeEditingStateChanged()
|
||||
EditingStateChanged();
|
||||
} else if (!mInDestructor) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
NS_NewRunnableMethod(this, &nsHTMLDocument::MaybeEditingStateChanged));
|
||||
NewRunnableMethod(this, &nsHTMLDocument::MaybeEditingStateChanged));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11823,7 +11823,7 @@ ConnectionPool::ShutdownThread(ThreadInfo& aThreadInfo)
|
||||
MOZ_ALWAYS_SUCCEEDS(thread->Dispatch(runnable, NS_DISPATCH_NORMAL));
|
||||
|
||||
nsCOMPtr<nsIRunnable> shutdownRunnable =
|
||||
NS_NewRunnableMethod(thread, &nsIThread::Shutdown);
|
||||
NewRunnableMethod(thread, &nsIThread::Shutdown);
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(shutdownRunnable));
|
||||
|
||||
mTotalThreadCount--;
|
||||
@ -13668,7 +13668,7 @@ Database::MaybeCloseConnection()
|
||||
IsClosed() &&
|
||||
mDirectoryLock) {
|
||||
nsCOMPtr<nsIRunnable> callback =
|
||||
NS_NewRunnableMethod(this, &Database::ConnectionClosedCallback);
|
||||
NewRunnableMethod(this, &Database::ConnectionClosedCallback);
|
||||
|
||||
RefPtr<WaitForTransactionsHelper> helper =
|
||||
new WaitForTransactionsHelper(Id(), callback);
|
||||
@ -21414,7 +21414,7 @@ OpenDatabaseOp::SendResults()
|
||||
mDatabase = nullptr;
|
||||
} else if (mDirectoryLock) {
|
||||
nsCOMPtr<nsIRunnable> callback =
|
||||
NS_NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback);
|
||||
NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback);
|
||||
|
||||
RefPtr<WaitForTransactionsHelper> helper =
|
||||
new WaitForTransactionsHelper(mDatabaseId, callback);
|
||||
|
@ -87,7 +87,7 @@ private:
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> destroyRunnable =
|
||||
NS_NewNonOwningRunnableMethod(this, &StreamWrapper::Destroy);
|
||||
NewNonOwningRunnableMethod(this, &StreamWrapper::Destroy);
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(destroyRunnable,
|
||||
NS_DISPATCH_NORMAL));
|
||||
|
@ -1036,9 +1036,9 @@ IDBDatabase::DelayedMaybeExpireFileActors()
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<bool>(this,
|
||||
&IDBDatabase::ExpireFileActors,
|
||||
/* aExpireAll */ false);
|
||||
NewRunnableMethod<bool>(this,
|
||||
&IDBDatabase::ExpireFileActors,
|
||||
/* aExpireAll */ false);
|
||||
MOZ_ASSERT(runnable);
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
|
@ -293,7 +293,7 @@ ReleaseOnTarget(SmartPtr<T>& aDoomed, nsIEventTarget* aTarget)
|
||||
auto* doomedSupports = static_cast<nsISupports*>(doomedRaw);
|
||||
|
||||
nsCOMPtr<nsIRunnable> releaseRunnable =
|
||||
NS_NewNonOwningRunnableMethod(doomedSupports, &nsISupports::Release);
|
||||
NewNonOwningRunnableMethod(doomedSupports, &nsISupports::Release);
|
||||
MOZ_ASSERT(releaseRunnable);
|
||||
|
||||
if (aTarget) {
|
||||
@ -1600,11 +1600,7 @@ private:
|
||||
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(stream->Close()), "Failed to close stream!");
|
||||
|
||||
nsCOMPtr<nsIRunnable> shutdownRunnable =
|
||||
NS_NewRunnableMethod(ioTarget, &nsIThread::Shutdown);
|
||||
MOZ_ASSERT(shutdownRunnable);
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(shutdownRunnable));
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod(ioTarget, &nsIThread::Shutdown)));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2138,7 +2134,7 @@ RemoteBlobImpl::Destroy()
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> destroyRunnable =
|
||||
NS_NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
|
||||
NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
|
||||
|
||||
if (mActorTarget) {
|
||||
destroyRunnable =
|
||||
@ -2566,7 +2562,7 @@ RemoteBlobImpl::Destroy()
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> destroyRunnable =
|
||||
NS_NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
|
||||
NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
|
||||
|
||||
if (mActorTarget) {
|
||||
destroyRunnable =
|
||||
@ -3422,7 +3418,7 @@ BlobChild::NoteDyingRemoteBlobImpl()
|
||||
// on the owning thread, so we proxy here if necessary.
|
||||
if (!IsOnOwningThread()) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewNonOwningRunnableMethod(this, &BlobChild::NoteDyingRemoteBlobImpl);
|
||||
NewNonOwningRunnableMethod(this, &BlobChild::NoteDyingRemoteBlobImpl);
|
||||
|
||||
if (mEventTarget) {
|
||||
runnable = new CancelableRunnableWrapper(runnable, mEventTarget);
|
||||
@ -4001,7 +3997,7 @@ BlobParent::NoteDyingRemoteBlobImpl()
|
||||
// on the main thread, so we proxy here if necessary.
|
||||
if (!IsOnOwningThread()) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewNonOwningRunnableMethod(this, &BlobParent::NoteDyingRemoteBlobImpl);
|
||||
NewNonOwningRunnableMethod(this, &BlobParent::NoteDyingRemoteBlobImpl);
|
||||
|
||||
if (mEventTarget) {
|
||||
runnable = new CancelableRunnableWrapper(runnable, mEventTarget);
|
||||
|
@ -34,8 +34,7 @@ ContentBridgeChild::~ContentBridgeChild()
|
||||
void
|
||||
ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy);
|
||||
MessageLoop::current()->PostTask(runnable.forget());
|
||||
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy));
|
||||
}
|
||||
|
||||
/*static*/ ContentBridgeChild*
|
||||
|
@ -37,8 +37,7 @@ ContentBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
if (os) {
|
||||
os->RemoveObserver(this, "content-child-shutdown");
|
||||
}
|
||||
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy);
|
||||
MessageLoop::current()->PostTask(runnable.forget());
|
||||
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy));
|
||||
}
|
||||
|
||||
/*static*/ ContentBridgeParent*
|
||||
@ -168,8 +167,7 @@ ContentBridgeParent::NotifyTabDestroyed()
|
||||
{
|
||||
int32_t numLiveTabs = ManagedPBrowserParent().Count();
|
||||
if (numLiveTabs == 1) {
|
||||
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeParent::Close);
|
||||
MessageLoop::current()->PostTask(runnable.forget());
|
||||
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::Close));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ protected:
|
||||
|
||||
void Close()
|
||||
{
|
||||
// Trick NS_NewRunnableMethod
|
||||
// Trick NewRunnableMethod
|
||||
PContentBridgeParent::Close();
|
||||
}
|
||||
|
||||
|
@ -2178,10 +2178,10 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||
// Destroy any processes created by this ContentParent
|
||||
for(uint32_t i = 0; i < childIDArray.Length(); i++) {
|
||||
ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]);
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<ShutDownMethod>(cp, &ContentParent::ShutDownProcess,
|
||||
SEND_SHUTDOWN_MESSAGE);
|
||||
MessageLoop::current()->PostTask(runnable.forget());
|
||||
MessageLoop::current()->PostTask(NewRunnableMethod
|
||||
<ShutDownMethod>(cp,
|
||||
&ContentParent::ShutDownProcess,
|
||||
SEND_SHUTDOWN_MESSAGE));
|
||||
}
|
||||
cpm->RemoveContentProcess(this->ChildID());
|
||||
|
||||
@ -2262,10 +2262,10 @@ ContentParent::NotifyTabDestroyed(const TabId& aTabId,
|
||||
if (tabIds.Length() == 1) {
|
||||
// In the case of normal shutdown, send a shutdown message to child to
|
||||
// allow it to perform shutdown tasks.
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<ShutDownMethod>(this, &ContentParent::ShutDownProcess,
|
||||
SEND_SHUTDOWN_MESSAGE);
|
||||
MessageLoop::current()->PostTask(runnable.forget());
|
||||
MessageLoop::current()->PostTask(NewRunnableMethod
|
||||
<ShutDownMethod>(this,
|
||||
&ContentParent::ShutDownProcess,
|
||||
SEND_SHUTDOWN_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,9 +204,8 @@ PreallocatedProcessManagerImpl::AllocateAfterDelay()
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateOnIdle);
|
||||
MessageLoop::current()->PostDelayedTask(
|
||||
runnable.forget(),
|
||||
NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateOnIdle),
|
||||
Preferences::GetUint("dom.ipc.processPrelaunch.delayMs",
|
||||
DEFAULT_ALLOCATE_DELAY));
|
||||
}
|
||||
@ -218,8 +217,7 @@ PreallocatedProcessManagerImpl::AllocateOnIdle()
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow);
|
||||
MessageLoop::current()->PostIdleTask(runnable.forget());
|
||||
MessageLoop::current()->PostIdleTask(NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -287,8 +287,7 @@ HangMonitorChild::ActorDestroy(ActorDestroyReason aWhy)
|
||||
|
||||
// We use a task here to ensure that IPDL is finished with this
|
||||
// HangMonitorChild before it gets deleted on the main thread.
|
||||
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &HangMonitorChild::ShutdownOnThread);
|
||||
MonitorLoop()->PostTask(runnable.forget());
|
||||
MonitorLoop()->PostTask(NewNonOwningRunnableMethod(this, &HangMonitorChild::ShutdownOnThread));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -374,14 +373,10 @@ HangMonitorChild::NotifySlowScript(nsITabChild* aTabChild,
|
||||
}
|
||||
nsAutoCString filename(aFileName);
|
||||
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewNonOwningRunnableMethodWithArgs<TabId,
|
||||
nsCString,
|
||||
unsigned>(this,
|
||||
&HangMonitorChild::NotifySlowScriptAsync,
|
||||
id, filename, aLineNo);
|
||||
MonitorLoop()->PostTask(runnable.forget());
|
||||
|
||||
MonitorLoop()->PostTask(NewNonOwningRunnableMethod
|
||||
<TabId, nsCString, unsigned>(this,
|
||||
&HangMonitorChild::NotifySlowScriptAsync,
|
||||
id, filename, aLineNo));
|
||||
return SlowScriptAction::Continue;
|
||||
}
|
||||
|
||||
@ -409,11 +404,9 @@ HangMonitorChild::NotifyPluginHang(uint32_t aPluginId)
|
||||
mSentReport = true;
|
||||
|
||||
// bounce to background thread
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewNonOwningRunnableMethodWithArgs<uint32_t>(this,
|
||||
&HangMonitorChild::NotifyPluginHangAsync,
|
||||
aPluginId);
|
||||
MonitorLoop()->PostTask(runnable.forget());
|
||||
MonitorLoop()->PostTask(NewNonOwningRunnableMethod<uint32_t>(this,
|
||||
&HangMonitorChild::NotifyPluginHangAsync,
|
||||
aPluginId));
|
||||
}
|
||||
|
||||
void
|
||||
@ -435,8 +428,7 @@ HangMonitorChild::ClearHang()
|
||||
|
||||
if (mSentReport) {
|
||||
// bounce to background thread
|
||||
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &HangMonitorChild::ClearHangAsync);
|
||||
MonitorLoop()->PostTask(runnable.forget());
|
||||
MonitorLoop()->PostTask(NewNonOwningRunnableMethod(this, &HangMonitorChild::ClearHangAsync));
|
||||
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
mSentReport = false;
|
||||
@ -501,8 +493,8 @@ HangMonitorParent::Shutdown()
|
||||
mProcess = nullptr;
|
||||
}
|
||||
|
||||
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &HangMonitorParent::ShutdownOnThread);
|
||||
MonitorLoop()->PostTask(runnable.forget());
|
||||
MonitorLoop()->PostTask(NewNonOwningRunnableMethod(this,
|
||||
&HangMonitorParent::ShutdownOnThread));
|
||||
|
||||
while (!mShutdownDone) {
|
||||
mMonitor.Wait();
|
||||
@ -822,8 +814,8 @@ HangMonitoredProcess::TerminateScript()
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(mActor, &HangMonitorParent::TerminateScript);
|
||||
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(runnable.forget());
|
||||
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(NewNonOwningRunnableMethod(mActor,
|
||||
&HangMonitorParent::TerminateScript));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -839,8 +831,8 @@ HangMonitoredProcess::BeginStartingDebugger()
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(mActor, &HangMonitorParent::BeginStartingDebugger);
|
||||
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(runnable.forget());
|
||||
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(NewNonOwningRunnableMethod(mActor,
|
||||
&HangMonitorParent::BeginStartingDebugger));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -856,8 +848,8 @@ HangMonitoredProcess::EndStartingDebugger()
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(mActor, &HangMonitorParent::EndStartingDebugger);
|
||||
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(runnable.forget());
|
||||
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(NewNonOwningRunnableMethod(mActor,
|
||||
&HangMonitorParent::EndStartingDebugger));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1035,14 +1027,13 @@ mozilla::CreateHangMonitorParent(ContentParent* aContentParent,
|
||||
HangMonitoredProcess* process = new HangMonitoredProcess(parent, aContentParent);
|
||||
parent->SetProcess(process);
|
||||
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewNonOwningRunnableMethodWithArgs<mozilla::ipc::Transport*,
|
||||
base::ProcessId,
|
||||
MessageLoop*>(parent,
|
||||
&HangMonitorParent::Open,
|
||||
aTransport, aOtherPid,
|
||||
XRE_GetIOMessageLoop());
|
||||
monitor->MonitorLoop()->PostTask(runnable.forget());
|
||||
monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
|
||||
<mozilla::ipc::Transport*,
|
||||
base::ProcessId,
|
||||
MessageLoop*>(parent,
|
||||
&HangMonitorParent::Open,
|
||||
aTransport, aOtherPid,
|
||||
XRE_GetIOMessageLoop()));
|
||||
|
||||
return parent;
|
||||
}
|
||||
@ -1056,14 +1047,13 @@ mozilla::CreateHangMonitorChild(mozilla::ipc::Transport* aTransport,
|
||||
ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
|
||||
HangMonitorChild* child = new HangMonitorChild(monitor);
|
||||
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewNonOwningRunnableMethodWithArgs<mozilla::ipc::Transport*,
|
||||
base::ProcessId,
|
||||
MessageLoop*>(child,
|
||||
&HangMonitorChild::Open,
|
||||
aTransport, aOtherPid,
|
||||
XRE_GetIOMessageLoop());
|
||||
monitor->MonitorLoop()->PostTask(runnable.forget());
|
||||
monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
|
||||
<mozilla::ipc::Transport*,
|
||||
base::ProcessId,
|
||||
MessageLoop*>(child,
|
||||
&HangMonitorChild::Open,
|
||||
aTransport, aOtherPid,
|
||||
XRE_GetIOMessageLoop()));
|
||||
|
||||
return child;
|
||||
}
|
||||
|
@ -659,8 +659,7 @@ nsJSChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
|
||||
method = &nsJSChannel::NotifyListener;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> ev = NS_NewRunnableMethod(this, method);
|
||||
nsresult rv = NS_DispatchToCurrentThread(ev);
|
||||
nsresult rv = NS_DispatchToCurrentThread(mozilla::NewRunnableMethod(this, method));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
loadGroup->RemoveRequest(this, nullptr, rv);
|
||||
|
@ -74,10 +74,9 @@ protected:
|
||||
public:
|
||||
void DispatchUpdateEstimatedMediaDuration(int64_t aDuration)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethodWithArg<int64_t>(this, &AbstractMediaDecoder::UpdateEstimatedMediaDuration,
|
||||
aDuration);
|
||||
NS_DispatchToMainThread(r);
|
||||
NS_DispatchToMainThread(NewRunnableMethod<int64_t>(this,
|
||||
&AbstractMediaDecoder::UpdateEstimatedMediaDuration,
|
||||
aDuration));
|
||||
}
|
||||
|
||||
virtual VideoFrameContainer* GetVideoFrameContainer() = 0;
|
||||
|
@ -191,13 +191,13 @@ public:
|
||||
{
|
||||
if (aTrackEvents & TRACK_EVENT_CREATED) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<TrackID, MediaSegment::Type, MediaStream*, TrackID>(
|
||||
NewRunnableMethod<TrackID, MediaSegment::Type, MediaStream*, TrackID>(
|
||||
this, &OwnedStreamListener::DoNotifyTrackCreated,
|
||||
aID, aQueuedMedia.GetType(), aInputStream, aInputTrackID);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
|
||||
} else if (aTrackEvents & TRACK_EVENT_ENDED) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<MediaStream*, TrackID>(
|
||||
NewRunnableMethod<MediaStream*, TrackID>(
|
||||
this, &OwnedStreamListener::DoNotifyTrackEnded,
|
||||
aInputStream, aInputTrackID);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
|
||||
@ -281,7 +281,7 @@ public:
|
||||
{
|
||||
if (aTrackEvents & TRACK_EVENT_ENDED) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<MediaStream>, TrackID>(
|
||||
NewRunnableMethod<StorensRefPtrPassByPtr<MediaStream>, TrackID>(
|
||||
this, &PlaybackStreamListener::DoNotifyTrackEnded, aInputStream, aInputTrackID);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
|
||||
}
|
||||
@ -290,7 +290,7 @@ public:
|
||||
void NotifyFinishedTrackCreation(MediaStreamGraph* aGraph) override
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &PlaybackStreamListener::DoNotifyFinishedTrackCreation);
|
||||
NewRunnableMethod(this, &PlaybackStreamListener::DoNotifyFinishedTrackCreation);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,7 @@ MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
|
||||
}
|
||||
|
||||
// Dispatch initialization that needs to happen on that task queue.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(this, &MediaDecoderReader::InitializationTask);
|
||||
mTaskQueue->Dispatch(r.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &MediaDecoderReader::InitializationTask));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -260,7 +260,7 @@ MediaDecoderReaderWrapper::ReleaseMediaResources()
|
||||
{
|
||||
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(mReader, &MediaDecoderReader::ReleaseMediaResources);
|
||||
NewRunnableMethod(mReader, &MediaDecoderReader::ReleaseMediaResources);
|
||||
mReader->OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ MediaDecoderReaderWrapper::SetIdle()
|
||||
{
|
||||
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(mReader, &MediaDecoderReader::SetIdle);
|
||||
NewRunnableMethod(mReader, &MediaDecoderReader::SetIdle);
|
||||
mReader->OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ MediaDecoderReaderWrapper::ResetDecode()
|
||||
{
|
||||
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(mReader, &MediaDecoderReader::ResetDecode);
|
||||
NewRunnableMethod(mReader, &MediaDecoderReader::ResetDecode);
|
||||
mReader->OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
|
||||
|
@ -898,7 +898,7 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Dispatch initialization that needs to happen on that task queue.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<RefPtr<MediaDecoder>>(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<RefPtr<MediaDecoder>>(
|
||||
this, &MediaDecoderStateMachine::InitializationTask, aDecoder);
|
||||
mTaskQueue->Dispatch(r.forget());
|
||||
|
||||
@ -921,8 +921,7 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
|
||||
nsresult rv = mReader->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
r = NS_NewRunnableMethod(this, &MediaDecoderStateMachine::ReadMetadata);
|
||||
OwnerThread()->Dispatch(r.forget());
|
||||
OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaDecoderStateMachine::ReadMetadata));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1096,7 +1095,7 @@ void MediaDecoderStateMachine::RecomputeDuration()
|
||||
void
|
||||
MediaDecoderStateMachine::DispatchSetDormant(bool aDormant)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<bool>(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
|
||||
this, &MediaDecoderStateMachine::SetDormant, aDormant);
|
||||
OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
@ -2422,9 +2421,7 @@ MediaDecoderStateMachine::ScheduleStateMachine()
|
||||
}
|
||||
mDispatchedStateMachine = true;
|
||||
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::RunStateMachine);
|
||||
OwnerThread()->Dispatch(task.forget());
|
||||
OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaDecoderStateMachine::RunStateMachine));
|
||||
}
|
||||
|
||||
void
|
||||
@ -2683,7 +2680,7 @@ void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream,
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
DECODER_LOG("AddOutputStream aStream=%p!", aStream);
|
||||
mOutputStreamManager->Add(aStream, aFinishWhenEnded);
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<bool>(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
|
||||
this, &MediaDecoderStateMachine::SetAudioCaptured, true);
|
||||
OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
@ -2694,7 +2691,7 @@ void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream)
|
||||
DECODER_LOG("RemoveOutputStream=%p!", aStream);
|
||||
mOutputStreamManager->Remove(aStream);
|
||||
if (mOutputStreamManager->IsEmpty()) {
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<bool>(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
|
||||
this, &MediaDecoderStateMachine::SetAudioCaptured, false);
|
||||
OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ MediaFormatReader::ScheduleUpdate(TrackType aTrack)
|
||||
LOGV("SchedulingUpdate(%s)", TrackTypeToStr(aTrack));
|
||||
decoder.mUpdateScheduled = true;
|
||||
RefPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<TrackType>(this, &MediaFormatReader::Update, aTrack));
|
||||
NewRunnableMethod<TrackType>(this, &MediaFormatReader::Update, aTrack));
|
||||
OwnerThread()->Dispatch(task.forget());
|
||||
}
|
||||
|
||||
@ -1288,7 +1288,7 @@ MediaFormatReader::Output(TrackType aTrack, MediaData* aSample)
|
||||
}
|
||||
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArgs<TrackType, MediaData*>(
|
||||
NewRunnableMethod<TrackType, MediaData*>(
|
||||
this, &MediaFormatReader::NotifyNewOutput, aTrack, aSample);
|
||||
OwnerThread()->Dispatch(task.forget());
|
||||
}
|
||||
@ -1297,7 +1297,7 @@ void
|
||||
MediaFormatReader::DrainComplete(TrackType aTrack)
|
||||
{
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackType>(
|
||||
NewRunnableMethod<TrackType>(
|
||||
this, &MediaFormatReader::NotifyDrainComplete, aTrack);
|
||||
OwnerThread()->Dispatch(task.forget());
|
||||
}
|
||||
@ -1306,7 +1306,7 @@ void
|
||||
MediaFormatReader::InputExhausted(TrackType aTrack)
|
||||
{
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackType>(
|
||||
NewRunnableMethod<TrackType>(
|
||||
this, &MediaFormatReader::NotifyInputExhausted, aTrack);
|
||||
OwnerThread()->Dispatch(task.forget());
|
||||
}
|
||||
@ -1315,7 +1315,7 @@ void
|
||||
MediaFormatReader::Error(TrackType aTrack)
|
||||
{
|
||||
RefPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackType>(
|
||||
NewRunnableMethod<TrackType>(
|
||||
this, &MediaFormatReader::NotifyError, aTrack);
|
||||
OwnerThread()->Dispatch(task.forget());
|
||||
}
|
||||
@ -1435,9 +1435,7 @@ MediaFormatReader::Seek(SeekTarget aTarget, int64_t aUnused)
|
||||
|
||||
RefPtr<SeekPromise> p = mSeekPromise.Ensure(__func__);
|
||||
|
||||
RefPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethod(this, &MediaFormatReader::AttemptSeek));
|
||||
OwnerThread()->Dispatch(task.forget());
|
||||
OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaFormatReader::AttemptSeek));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
mDemuxOnly = aDemuxedOnly;
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<bool>(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
|
||||
this, &MediaDecoderReader::SetDemuxOnly, aDemuxedOnly);
|
||||
OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
|
@ -277,11 +277,11 @@ public:
|
||||
switch (aEvent) {
|
||||
case EVENT_FINISHED:
|
||||
NS_DispatchToMainThread(
|
||||
NS_NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyFinished));
|
||||
NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyFinished));
|
||||
break;
|
||||
case EVENT_REMOVED:
|
||||
NS_DispatchToMainThread(
|
||||
NS_NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyRemoved));
|
||||
NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyRemoved));
|
||||
break;
|
||||
case EVENT_HAS_DIRECT_LISTENERS:
|
||||
NotifyDirectListeners(aGraph, true);
|
||||
|
@ -819,10 +819,8 @@ private:
|
||||
new DispatchStartEventRunnable(this, NS_LITERAL_STRING("start")));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<nsresult>(mRecorder,
|
||||
&MediaRecorder::NotifyError, rv);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
NS_DispatchToMainThread(NewRunnableMethod<nsresult>(mRecorder,
|
||||
&MediaRecorder::NotifyError, rv));
|
||||
}
|
||||
if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this)))) {
|
||||
MOZ_ASSERT(false, "NS_DispatchToMainThread EncoderErrorNotifierRunnable failed");
|
||||
|
@ -56,9 +56,8 @@ MediaResource::Destroy()
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> destroyRunnable =
|
||||
NS_NewNonOwningRunnableMethod(this, &MediaResource::Destroy);
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(destroyRunnable));
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
NS_DispatchToMainThread(NewNonOwningRunnableMethod(this, &MediaResource::Destroy)));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(MediaResource)
|
||||
@ -871,7 +870,7 @@ ChannelMediaResource::CacheClientNotifyDataReceived()
|
||||
return;
|
||||
|
||||
mDataReceivedEvent =
|
||||
NS_NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
|
||||
NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
|
||||
NS_DispatchToMainThread(mDataReceivedEvent.get());
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
const PrincipalHandle& aNewPrincipalHandle) override
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<PrincipalHandle>>(
|
||||
NewRunnableMethod<StoreCopyPassByConstLRef<PrincipalHandle>>(
|
||||
this, &PrincipalHandleListener::DoNotifyPrincipalHandleChanged, aNewPrincipalHandle);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
|
||||
}
|
||||
|
@ -38,12 +38,12 @@ MediaTimer::MediaTimer()
|
||||
void
|
||||
MediaTimer::DispatchDestroy()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> task = NS_NewNonOwningRunnableMethod(this, &MediaTimer::Destroy);
|
||||
// Hold a strong reference to the thread so that it doesn't get deleted in
|
||||
// Destroy(), which may run completely before the stack if Dispatch() begins
|
||||
// to unwind.
|
||||
nsCOMPtr<nsIEventTarget> thread = mThread;
|
||||
nsresult rv = thread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
nsresult rv = thread->Dispatch(NewNonOwningRunnableMethod(this, &MediaTimer::Destroy),
|
||||
NS_DISPATCH_NORMAL);
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
|
||||
(void) rv;
|
||||
}
|
||||
@ -97,8 +97,8 @@ MediaTimer::ScheduleUpdate()
|
||||
}
|
||||
mUpdateScheduled = true;
|
||||
|
||||
nsCOMPtr<nsIRunnable> task = NS_NewRunnableMethod(this, &MediaTimer::Update);
|
||||
nsresult rv = mThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
nsresult rv = mThread->Dispatch(NewRunnableMethod(this, &MediaTimer::Update),
|
||||
NS_DISPATCH_NORMAL);
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
|
||||
(void) rv;
|
||||
}
|
||||
|
@ -525,8 +525,8 @@ void RtspMediaResource::SetSuspend(bool aIsSuspend)
|
||||
RTSPMLOG("SetSuspend %d",aIsSuspend);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<bool>(this, &RtspMediaResource::NotifySuspend,
|
||||
aIsSuspend);
|
||||
NewRunnableMethod<bool>(this, &RtspMediaResource::NotifySuspend,
|
||||
aIsSuspend);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
|
||||
|
@ -222,16 +222,16 @@ CDMCallbackProxy::SessionClosed(const nsCString& aSessionId)
|
||||
}
|
||||
if (keyStatusesChange) {
|
||||
nsCOMPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethodWithArg<nsString>(mProxy,
|
||||
task = NewRunnableMethod<nsString>(mProxy,
|
||||
&CDMProxy::OnKeyStatusesChange,
|
||||
NS_ConvertUTF8toUTF16(aSessionId));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethodWithArg<nsString>(mProxy,
|
||||
&CDMProxy::OnSessionClosed,
|
||||
NS_ConvertUTF8toUTF16(aSessionId));
|
||||
task = NewRunnableMethod<nsString>(mProxy,
|
||||
&CDMProxy::OnSessionClosed,
|
||||
NS_ConvertUTF8toUTF16(aSessionId));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
@ -295,9 +295,9 @@ CDMCallbackProxy::KeyStatusChanged(const nsCString& aSessionId,
|
||||
}
|
||||
if (keyStatusesChange) {
|
||||
nsCOMPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethodWithArg<nsString>(mProxy,
|
||||
&CDMProxy::OnKeyStatusesChange,
|
||||
NS_ConvertUTF8toUTF16(aSessionId));
|
||||
task = NewRunnableMethod<nsString>(mProxy,
|
||||
&CDMProxy::OnKeyStatusesChange,
|
||||
NS_ConvertUTF8toUTF16(aSessionId));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
}
|
||||
@ -325,7 +325,7 @@ void
|
||||
CDMCallbackProxy::Terminated()
|
||||
{
|
||||
MOZ_ASSERT(mProxy->IsOnGMPThread());
|
||||
nsCOMPtr<nsIRunnable> task = NS_NewRunnableMethod(mProxy, &CDMProxy::Terminated);
|
||||
nsCOMPtr<nsIRunnable> task = NewRunnableMethod(mProxy, &CDMProxy::Terminated);
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,9 @@ CDMProxy::Init(PromiseId aPromiseId,
|
||||
data->mGMPName = aGMPName;
|
||||
data->mInPrivateBrowsing = aInPrivateBrowsing;
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<nsAutoPtr<InitData>>(this,
|
||||
&CDMProxy::gmp_Init,
|
||||
Move(data)));
|
||||
NewRunnableMethod<nsAutoPtr<InitData>>(this,
|
||||
&CDMProxy::gmp_Init,
|
||||
Move(data)));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -119,9 +119,9 @@ CDMProxy::gmp_InitDone(GMPDecryptorProxy* aCDM, nsAutoPtr<InitData>&& aData)
|
||||
mCallback = new CDMCallbackProxy(this);
|
||||
mCDM->Init(mCallback);
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<uint32_t>(this,
|
||||
&CDMProxy::OnCDMCreated,
|
||||
aData->mPromiseId));
|
||||
NewRunnableMethod<uint32_t>(this,
|
||||
&CDMProxy::OnCDMCreated,
|
||||
aData->mPromiseId));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ CDMProxy::CreateSession(uint32_t aCreateSessionToken,
|
||||
data->mInitData = Move(aInitData);
|
||||
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<nsAutoPtr<CreateSessionData>>(this, &CDMProxy::gmp_CreateSession, data));
|
||||
NewRunnableMethod<nsAutoPtr<CreateSessionData>>(this, &CDMProxy::gmp_CreateSession, data));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ CDMProxy::LoadSession(PromiseId aPromiseId,
|
||||
data->mPromiseId = aPromiseId;
|
||||
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_LoadSession, data));
|
||||
NewRunnableMethod<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_LoadSession, data));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ CDMProxy::SetServerCertificate(PromiseId aPromiseId,
|
||||
data->mPromiseId = aPromiseId;
|
||||
data->mCert = Move(aCert);
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<nsAutoPtr<SetServerCertificateData>>(this, &CDMProxy::gmp_SetServerCertificate, data));
|
||||
NewRunnableMethod<nsAutoPtr<SetServerCertificateData>>(this, &CDMProxy::gmp_SetServerCertificate, data));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ CDMProxy::UpdateSession(const nsAString& aSessionId,
|
||||
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
||||
data->mResponse = Move(aResponse);
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<nsAutoPtr<UpdateSessionData>>(this, &CDMProxy::gmp_UpdateSession, data));
|
||||
NewRunnableMethod<nsAutoPtr<UpdateSessionData>>(this, &CDMProxy::gmp_UpdateSession, data));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ CDMProxy::CloseSession(const nsAString& aSessionId,
|
||||
data->mPromiseId = aPromiseId;
|
||||
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_CloseSession, data));
|
||||
NewRunnableMethod<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_CloseSession, data));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -424,7 +424,7 @@ CDMProxy::RemoveSession(const nsAString& aSessionId,
|
||||
data->mPromiseId = aPromiseId;
|
||||
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_RemoveSession, data));
|
||||
NewRunnableMethod<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_RemoveSession, data));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ CDMProxy::Shutdown()
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mKeys.Clear();
|
||||
// Note: This may end up being the last owning reference to the CDMProxy.
|
||||
nsCOMPtr<nsIRunnable> task(NS_NewRunnableMethod(this, &CDMProxy::gmp_Shutdown));
|
||||
nsCOMPtr<nsIRunnable> task(NewRunnableMethod(this, &CDMProxy::gmp_Shutdown));
|
||||
if (mGMPThread) {
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
@ -498,9 +498,9 @@ CDMProxy::ResolvePromise(PromiseId aId)
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethodWithArg<PromiseId>(this,
|
||||
&CDMProxy::ResolvePromise,
|
||||
aId);
|
||||
task = NewRunnableMethod<PromiseId>(this,
|
||||
&CDMProxy::ResolvePromise,
|
||||
aId);
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
}
|
||||
@ -659,7 +659,7 @@ CDMProxy::Decrypt(MediaRawData* aSample)
|
||||
RefPtr<DecryptPromise> promise(job->Ensure());
|
||||
|
||||
nsCOMPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethodWithArg<RefPtr<DecryptJob>>(this, &CDMProxy::gmp_Decrypt, job));
|
||||
NewRunnableMethod<RefPtr<DecryptJob>>(this, &CDMProxy::gmp_Decrypt, job));
|
||||
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
|
||||
return promise;
|
||||
}
|
||||
|
@ -134,8 +134,8 @@ GMPContentParent::CloseIfUnused()
|
||||
GeckoMediaPluginServiceChild::GetSingleton());
|
||||
gmp->RemoveGMPContentParent(toClose);
|
||||
}
|
||||
NS_DispatchToCurrentThread(NS_NewRunnableMethod(toClose,
|
||||
&GMPContentParent::Close));
|
||||
NS_DispatchToCurrentThread(NewRunnableMethod(toClose,
|
||||
&GMPContentParent::Close));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ private:
|
||||
bool DeallocPGMPAudioDecoderParent(PGMPAudioDecoderParent* aActor) override;
|
||||
|
||||
void CloseIfUnused();
|
||||
// Needed because NS_NewRunnableMethod tried to use the class that the method
|
||||
// Needed because NewRunnableMethod tried to use the class that the method
|
||||
// lives on to store the receiver, but PGMPContentParent isn't refcounted.
|
||||
void Close()
|
||||
{
|
||||
|
@ -171,12 +171,10 @@ GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult)
|
||||
if (!ON_GMP_THREAD()) {
|
||||
// We should run this whole method on the GMP thread since the buffer needs
|
||||
// to be deleted after the SendDecrypted call.
|
||||
RefPtr<Runnable> t =
|
||||
NS_NewRunnableMethodWithArgs<GMPBuffer*,
|
||||
GMPErr>(this,
|
||||
&GMPDecryptorChild::Decrypted,
|
||||
aBuffer, aResult);
|
||||
mPlugin->GMPMessageLoop()->PostTask(t.forget());
|
||||
mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod
|
||||
<GMPBuffer*, GMPErr>(this,
|
||||
&GMPDecryptorChild::Decrypted,
|
||||
aBuffer, aResult));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ GMPParent::ChildTerminated()
|
||||
// removed so there is no harm in not trying to remove it again.
|
||||
LOGD("%s::%s: GMPThread() returned nullptr.", __CLASS__, __FUNCTION__);
|
||||
} else {
|
||||
gmpThread->Dispatch(NS_NewRunnableMethodWithArg<RefPtr<GMPParent>>(
|
||||
gmpThread->Dispatch(NewRunnableMethod<RefPtr<GMPParent>>(
|
||||
mService,
|
||||
&GeckoMediaPluginServiceParent::PluginTerminated,
|
||||
self),
|
||||
@ -522,7 +522,7 @@ GMPParent::DeleteProcess()
|
||||
mState = GMPStateClosing;
|
||||
Close();
|
||||
}
|
||||
mProcess->Delete(NS_NewRunnableMethod(this, &GMPParent::ChildTerminated));
|
||||
mProcess->Delete(NewRunnableMethod(this, &GMPParent::ChildTerminated));
|
||||
LOGD("%s: Shut down process", __FUNCTION__);
|
||||
mProcess = nullptr;
|
||||
mState = GMPStateNotLoaded;
|
||||
|
@ -73,8 +73,7 @@ public:
|
||||
// main thread tries to do a sync call back to the calling thread.
|
||||
MOZ_ASSERT(!IsOnChildMainThread());
|
||||
|
||||
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(this, &SyncRunnable::Run);
|
||||
mMessageLoop->PostTask(runnable.forget());
|
||||
mMessageLoop->PostTask(NewRunnableMethod(this, &SyncRunnable::Run));
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
while (!mDone) {
|
||||
lock.Wait();
|
||||
@ -122,8 +121,7 @@ RunOnMainThread(GMPTask* aTask)
|
||||
}
|
||||
|
||||
RefPtr<Runnable> r = new Runnable(aTask);
|
||||
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(r, &Runnable::Run);
|
||||
sMainLoop->PostTask(runnable.forget());
|
||||
sMainLoop->PostTask(NewRunnableMethod(r, &Runnable::Run));
|
||||
|
||||
return GMPNoErr;
|
||||
}
|
||||
@ -255,8 +253,7 @@ GMPThreadImpl::Post(GMPTask* aTask)
|
||||
}
|
||||
|
||||
RefPtr<Runnable> r = new Runnable(aTask);
|
||||
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(r, &Runnable::Run);
|
||||
mThread.message_loop()->PostTask(runnable.forget());
|
||||
mThread.message_loop()->PostTask(NewRunnableMethod(r, &Runnable::Run));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -78,8 +78,7 @@ void
|
||||
GMPProcessParent::Delete(nsCOMPtr<nsIRunnable> aCallback)
|
||||
{
|
||||
mDeletedCallback = aCallback;
|
||||
RefPtr<mozilla::Runnable> task = NS_NewNonOwningRunnableMethod(this, &GMPProcessParent::DoDelete);
|
||||
XRE_GetIOMessageLoop()->PostTask(task.forget());
|
||||
XRE_GetIOMessageLoop()->PostTask(NewNonOwningRunnableMethod(this, &GMPProcessParent::DoDelete));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -326,7 +326,16 @@ GeckoMediaPluginService::ShutdownGMPThread()
|
||||
}
|
||||
|
||||
nsresult
|
||||
GeckoMediaPluginService::GMPDispatch(nsIRunnable* event, uint32_t flags)
|
||||
GeckoMediaPluginService::GMPDispatch(nsIRunnable* event,
|
||||
uint32_t flags)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> r(event);
|
||||
return GMPDispatch(r.forget());
|
||||
}
|
||||
|
||||
nsresult
|
||||
GeckoMediaPluginService::GMPDispatch(already_AddRefed<nsIRunnable> event,
|
||||
uint32_t flags)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> r(event);
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
|
@ -90,6 +90,7 @@ protected:
|
||||
UniquePtr<GetGMPContentParentCallback>&& aCallback) = 0;
|
||||
|
||||
nsresult GMPDispatch(nsIRunnable* event, uint32_t flags = NS_DISPATCH_NORMAL);
|
||||
nsresult GMPDispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = NS_DISPATCH_NORMAL);
|
||||
void ShutdownGMPThread();
|
||||
|
||||
Mutex mMutex; // Protects mGMPThread and mGMPThreadShutdown and some members
|
||||
|
@ -419,8 +419,8 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
|
||||
NS_LITERAL_CSTRING("Dispatching UnloadPlugins"));
|
||||
#endif
|
||||
gmpThread->Dispatch(
|
||||
NS_NewRunnableMethod(this,
|
||||
&GeckoMediaPluginServiceParent::UnloadPlugins),
|
||||
NewRunnableMethod(this,
|
||||
&GeckoMediaPluginServiceParent::UnloadPlugins),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
@ -493,7 +493,7 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
|
||||
} else if (!strcmp("browser:purge-session-history", aTopic)) {
|
||||
// Clear everything!
|
||||
if (!aSomeData || nsDependentString(aSomeData).IsEmpty()) {
|
||||
return GMPDispatch(NS_NewRunnableMethod(
|
||||
return GMPDispatch(NewRunnableMethod(
|
||||
this, &GeckoMediaPluginServiceParent::ClearStorage));
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return GMPDispatch(NS_NewRunnableMethodWithArg<PRTime>(
|
||||
return GMPDispatch(NewRunnableMethod<PRTime>(
|
||||
this, &GeckoMediaPluginServiceParent::ClearRecentHistoryOnGMPThread,
|
||||
t));
|
||||
}
|
||||
@ -605,7 +605,7 @@ GeckoMediaPluginServiceParent::AsyncShutdownComplete(GMPParent* aParent)
|
||||
if (mShuttingDownOnGMPThread) {
|
||||
// The main thread may be waiting for async shutdown of plugins,
|
||||
// one of which has completed. Wake up the main thread by sending a task.
|
||||
nsCOMPtr<nsIRunnable> task(NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> task(NewRunnableMethod(
|
||||
this, &GeckoMediaPluginServiceParent::NotifyAsyncShutdownComplete));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
@ -737,7 +737,7 @@ GeckoMediaPluginServiceParent::UnloadPlugins()
|
||||
SetAsyncShutdownPluginState(nullptr, '3',
|
||||
NS_LITERAL_CSTRING("Dispatching sync-shutdown-complete"));
|
||||
#endif
|
||||
nsCOMPtr<nsIRunnable> task(NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> task(NewRunnableMethod(
|
||||
this, &GeckoMediaPluginServiceParent::NotifySyncShutdownComplete));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
@ -1749,7 +1749,7 @@ NS_IMETHODIMP
|
||||
GeckoMediaPluginServiceParent::ForgetThisSite(const nsAString& aSite)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return GMPDispatch(NS_NewRunnableMethodWithArg<nsCString>(
|
||||
return GMPDispatch(NewRunnableMethod<nsCString>(
|
||||
this, &GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread,
|
||||
NS_ConvertUTF16toUTF8(aSite)));
|
||||
}
|
||||
|
@ -226,8 +226,8 @@ GMPVideoDecoderChild::Alloc(size_t aSize,
|
||||
rv = CallNeedShmem(aSize, aMem);
|
||||
--mNeedShmemIntrCount;
|
||||
if (mPendingDecodeComplete) {
|
||||
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete);
|
||||
mPlugin->GMPMessageLoop()->PostTask(runnable.forget());
|
||||
mPlugin->GMPMessageLoop()->PostTask(
|
||||
NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete));
|
||||
}
|
||||
#else
|
||||
#ifdef GMP_SAFE_SHMEM
|
||||
|
@ -207,8 +207,8 @@ GMPVideoEncoderChild::Alloc(size_t aSize,
|
||||
rv = CallNeedShmem(aSize, aMem);
|
||||
--mNeedShmemIntrCount;
|
||||
if (mPendingEncodeComplete) {
|
||||
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete);
|
||||
mPlugin->GMPMessageLoop()->PostTask(runnable.forget());
|
||||
mPlugin->GMPMessageLoop()->PostTask(
|
||||
NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete));
|
||||
}
|
||||
#else
|
||||
#ifdef GMP_SAFE_SHMEM
|
||||
|
@ -36,8 +36,8 @@ private:
|
||||
public:
|
||||
void SetFinished()
|
||||
{
|
||||
NS_DispatchToMainThread(NS_NewNonOwningRunnableMethod(this,
|
||||
&GMPTestMonitor::MarkFinished));
|
||||
NS_DispatchToMainThread(mozilla::NewNonOwningRunnableMethod(this,
|
||||
&GMPTestMonitor::MarkFinished));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -304,8 +304,8 @@ EnumerateGMPStorageDir(const nsACString& aDir, T&& aDirIter)
|
||||
class GMPShutdownObserver : public nsIRunnable
|
||||
, public nsIObserver {
|
||||
public:
|
||||
GMPShutdownObserver(nsIRunnable* aShutdownTask,
|
||||
nsIRunnable* Continuation,
|
||||
GMPShutdownObserver(already_AddRefed<nsIRunnable> aShutdownTask,
|
||||
already_AddRefed<nsIRunnable> Continuation,
|
||||
const nsACString& aNodeId)
|
||||
: mShutdownTask(aShutdownTask)
|
||||
, mContinuation(Continuation)
|
||||
@ -371,7 +371,7 @@ public:
|
||||
class ClearGMPStorageTask : public nsIRunnable
|
||||
, public nsIObserver {
|
||||
public:
|
||||
ClearGMPStorageTask(nsIRunnable* Continuation,
|
||||
ClearGMPStorageTask(already_AddRefed<nsIRunnable> Continuation,
|
||||
nsIThread* aTarget, PRTime aSince)
|
||||
: mContinuation(Continuation)
|
||||
, mTarget(aTarget)
|
||||
@ -421,11 +421,11 @@ private:
|
||||
NS_IMPL_ISUPPORTS(ClearGMPStorageTask, nsIRunnable, nsIObserver)
|
||||
|
||||
static void
|
||||
ClearGMPStorage(nsIRunnable* aContinuation,
|
||||
ClearGMPStorage(already_AddRefed<nsIRunnable> aContinuation,
|
||||
nsIThread* aTarget, PRTime aSince = -1)
|
||||
{
|
||||
RefPtr<ClearGMPStorageTask> task(
|
||||
new ClearGMPStorageTask(aContinuation, aTarget, aSince));
|
||||
new ClearGMPStorageTask(Move(aContinuation), aTarget, aSince));
|
||||
NS_DispatchToMainThread(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
void DoTest(void (GMPStorageTest::*aTestMethod)()) {
|
||||
EnsureNSSInitializedChromeOrContent();
|
||||
nsCOMPtr<nsIThread> thread(GetGMPThread());
|
||||
ClearGMPStorage(NS_NewRunnableMethod(this, aTestMethod), thread);
|
||||
ClearGMPStorage(NewRunnableMethod(this, aTestMethod), thread);
|
||||
AwaitFinished();
|
||||
}
|
||||
|
||||
@ -569,7 +569,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
EXPECT_TRUE(!PBnodeId2.Equals(nodeId2));
|
||||
|
||||
nsCOMPtr<nsIThread> thread(GetGMPThread());
|
||||
ClearGMPStorage(NS_NewRunnableMethodWithArg<nsCString>(
|
||||
ClearGMPStorage(NewRunnableMethod<nsCString>(
|
||||
this, &GMPStorageTest::TestGetNodeId_Continuation, nodeId1), thread);
|
||||
}
|
||||
|
||||
@ -681,7 +681,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
// It sends us a "test-storage complete" message when its passed, or
|
||||
// some other message if its tests fail.
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"),
|
||||
NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example1.com"),
|
||||
NS_LITERAL_STRING("http://example2.com"),
|
||||
@ -700,9 +700,9 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
EXPECT_TRUE(IsGMPStorageIsEmpty());
|
||||
|
||||
// Generate storage data for some site.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestForgetThisSite_AnotherSite);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example1.com"),
|
||||
NS_LITERAL_STRING("http://example2.com"),
|
||||
@ -714,9 +714,9 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
Shutdown();
|
||||
|
||||
// Generate storage data for another site.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestForgetThisSite_CollectSiteInfo);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example3.com"),
|
||||
NS_LITERAL_STRING("http://example4.com"),
|
||||
@ -751,7 +751,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
// Collect nodeIds that are expected to remain for later comparison.
|
||||
EnumerateGMPStorageDir(NS_LITERAL_CSTRING("id"), NodeIdCollector(siteInfo));
|
||||
// Invoke "Forget this site" on the main thread.
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArg<nsAutoPtr<NodeInfo>>(
|
||||
NS_DispatchToMainThread(NewRunnableMethod<nsAutoPtr<NodeInfo>>(
|
||||
this, &GMPStorageTest::TestForgetThisSite_Forget, siteInfo));
|
||||
}
|
||||
|
||||
@ -763,11 +763,11 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
service->GetThread(getter_AddRefs(thread));
|
||||
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<nsAutoPtr<NodeInfo>>(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<nsAutoPtr<NodeInfo>>(
|
||||
this, &GMPStorageTest::TestForgetThisSite_Verify, aSiteInfo);
|
||||
thread->Dispatch(r, NS_DISPATCH_NORMAL);
|
||||
|
||||
nsCOMPtr<nsIRunnable> f = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> f = NewRunnableMethod(
|
||||
this, &GMPStorageTest::SetFinished);
|
||||
thread->Dispatch(f, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
@ -833,9 +833,9 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
EXPECT_TRUE(IsGMPStorageIsEmpty());
|
||||
|
||||
// Generate storage data for some site.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestClearRecentHistory1_Clear);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example1.com"),
|
||||
NS_LITERAL_STRING("http://example2.com"),
|
||||
@ -855,9 +855,9 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
EXPECT_TRUE(IsGMPStorageIsEmpty());
|
||||
|
||||
// Generate storage data for some site.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestClearRecentHistory2_Clear);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example1.com"),
|
||||
NS_LITERAL_STRING("http://example2.com"),
|
||||
@ -877,9 +877,9 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
EXPECT_TRUE(IsGMPStorageIsEmpty());
|
||||
|
||||
// Generate storage data for some site.
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestClearRecentHistory3_Clear);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
|
||||
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example1.com"),
|
||||
NS_LITERAL_STRING("http://example2.com"),
|
||||
@ -908,10 +908,10 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
nsresult rv = EnumerateGMPStorageDir(NS_LITERAL_CSTRING("id"), f);
|
||||
EXPECT_TRUE(NS_SUCCEEDED(rv));
|
||||
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestClearRecentHistory_CheckEmpty);
|
||||
nsCOMPtr<nsIThread> t(GetGMPThread());
|
||||
ClearGMPStorage(r, t, f.GetResult());
|
||||
ClearGMPStorage(r.forget(), t, f.GetResult());
|
||||
}
|
||||
|
||||
void TestClearRecentHistory2_Clear() {
|
||||
@ -919,10 +919,10 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
nsresult rv = EnumerateGMPStorageDir(NS_LITERAL_CSTRING("storage"), f);
|
||||
EXPECT_TRUE(NS_SUCCEEDED(rv));
|
||||
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestClearRecentHistory_CheckEmpty);
|
||||
nsCOMPtr<nsIThread> t(GetGMPThread());
|
||||
ClearGMPStorage(r, t, f.GetResult());
|
||||
ClearGMPStorage(r.forget(), t, f.GetResult());
|
||||
}
|
||||
|
||||
void TestClearRecentHistory3_Clear() {
|
||||
@ -930,10 +930,10 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
nsresult rv = EnumerateGMPStorageDir(NS_LITERAL_CSTRING("storage"), f);
|
||||
EXPECT_TRUE(NS_SUCCEEDED(rv));
|
||||
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
|
||||
this, &GMPStorageTest::TestClearRecentHistory_CheckNonEmpty);
|
||||
nsCOMPtr<nsIThread> t(GetGMPThread());
|
||||
ClearGMPStorage(r, t, f.GetResult() + 1);
|
||||
ClearGMPStorage(r.forget(), t, f.GetResult() + 1);
|
||||
}
|
||||
|
||||
class FileCounter {
|
||||
@ -987,7 +987,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
auto t = time(0);
|
||||
nsCString response("stored crossOriginTestRecordId ");
|
||||
response.AppendInt((int64_t)t);
|
||||
Expect(response, NS_NewRunnableMethod(this,
|
||||
Expect(response, NewRunnableMethod(this,
|
||||
&GMPStorageTest::TestCrossOriginStorage_RecordStoredContinuation));
|
||||
|
||||
nsCString update("store crossOriginTestRecordId ");
|
||||
@ -1007,7 +1007,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
Shutdown();
|
||||
|
||||
Expect(NS_LITERAL_CSTRING("retrieve crossOriginTestRecordId succeeded (length 0 bytes)"),
|
||||
NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example5.com"),
|
||||
NS_LITERAL_STRING("http://example6.com"),
|
||||
@ -1019,7 +1019,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
// Send the decryptor the message "store recordid $time"
|
||||
// Wait for the decrytor to send us "stored recordid $time"
|
||||
nsCString response("stored pbdata test-pb-data");
|
||||
Expect(response, NS_NewRunnableMethod(this,
|
||||
Expect(response, NewRunnableMethod(this,
|
||||
&GMPStorageTest::TestPBStorage_RecordStoredContinuation));
|
||||
|
||||
// Open decryptor on one, origin, write a record, close decryptor,
|
||||
@ -1036,7 +1036,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
Shutdown();
|
||||
|
||||
Expect(NS_LITERAL_CSTRING("retrieve pbdata succeeded (length 12 bytes)"),
|
||||
NS_NewRunnableMethod(this,
|
||||
NewRunnableMethod(this,
|
||||
&GMPStorageTest::TestPBStorage_RecordRetrievedContinuation));
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://pb1.com"),
|
||||
@ -1050,7 +1050,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
SimulatePBModeExit();
|
||||
|
||||
Expect(NS_LITERAL_CSTRING("retrieve pbdata succeeded (length 0 bytes)"),
|
||||
NS_NewRunnableMethod(this,
|
||||
NewRunnableMethod(this,
|
||||
&GMPStorageTest::SetFinished));
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://pb1.com"),
|
||||
@ -1073,10 +1073,10 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
const nsAString& aOrigin2,
|
||||
void (GMPStorageTest::*aCallback)()) {
|
||||
nsCOMPtr<nsIRunnable> continuation(
|
||||
NS_NewRunnableMethodWithArg<nsCOMPtr<nsIRunnable>>(
|
||||
NewRunnableMethod<nsCOMPtr<nsIRunnable>>(
|
||||
this,
|
||||
&GMPStorageTest::NextAsyncShutdownTimeoutTest,
|
||||
NS_NewRunnableMethod(this, aCallback)));
|
||||
NewRunnableMethod(this, aCallback)));
|
||||
|
||||
CreateDecryptor(aOrigin1, aOrigin2, false, continuation);
|
||||
}
|
||||
@ -1115,7 +1115,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
// the token.
|
||||
nsCString response("shutdown-token received ");
|
||||
response.Append(token);
|
||||
Expect(response, NS_NewRunnableMethodWithArg<nsCString>(this,
|
||||
Expect(response, NewRunnableMethod<nsCString>(this,
|
||||
&GMPStorageTest::TestAsyncShutdownStorage_ReceivedShutdownToken, token));
|
||||
|
||||
// Test that a GMP can write to storage during shutdown, and retrieve
|
||||
@ -1127,7 +1127,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
}
|
||||
|
||||
void TestAsyncShutdownStorage_ReceivedShutdownToken(const nsCString& aToken) {
|
||||
ShutdownThen(NS_NewRunnableMethodWithArg<nsCString>(this,
|
||||
ShutdownThen(NewRunnableMethod<nsCString>(this,
|
||||
&GMPStorageTest::TestAsyncShutdownStorage_AsyncShutdownComplete, aToken));
|
||||
}
|
||||
|
||||
@ -1137,7 +1137,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
nsCString response("retrieved shutdown-token ");
|
||||
response.Append(aToken);
|
||||
Expect(response,
|
||||
NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example13.com"),
|
||||
NS_LITERAL_STRING("http://example14.com"),
|
||||
@ -1150,7 +1150,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
Shutdown();
|
||||
|
||||
Expect(NS_LITERAL_CSTRING("OP tests completed"),
|
||||
NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example15.com"),
|
||||
NS_LITERAL_STRING("http://example16.com"),
|
||||
@ -1161,7 +1161,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
|
||||
void TestPluginVoucher() {
|
||||
Expect(NS_LITERAL_CSTRING("retrieved plugin-voucher: gmp-fake placeholder voucher"),
|
||||
NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://example17.com"),
|
||||
NS_LITERAL_STRING("http://example18.com"),
|
||||
@ -1205,12 +1205,12 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
update.AppendLiteral(" test-data");
|
||||
AppendIntPadded(update, i);
|
||||
|
||||
nsIRunnable* continuation = nullptr;
|
||||
nsCOMPtr<nsIRunnable> continuation;
|
||||
if (i + 1 == num) {
|
||||
continuation =
|
||||
NS_NewRunnableMethod(this, &GMPStorageTest::TestGetRecordNames_QueryNames);
|
||||
NewRunnableMethod(this, &GMPStorageTest::TestGetRecordNames_QueryNames);
|
||||
}
|
||||
Expect(response, continuation);
|
||||
Expect(response, continuation.forget());
|
||||
}
|
||||
|
||||
CreateDecryptor(NS_LITERAL_STRING("http://foo.com"),
|
||||
@ -1223,7 +1223,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
nsCString response("record-names ");
|
||||
response.Append(mRecordNames);
|
||||
Expect(response,
|
||||
NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
Update(NS_LITERAL_CSTRING("retrieve-record-names"));
|
||||
}
|
||||
|
||||
@ -1260,7 +1260,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
response.Append(longRecordName);
|
||||
response.AppendLiteral(" ");
|
||||
response.Append(data);
|
||||
Expect(response, NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
Expect(response, NewRunnableMethod(this, &GMPStorageTest::SetFinished));
|
||||
|
||||
nsCString update("store ");
|
||||
update.Append(longRecordName);
|
||||
@ -1272,8 +1272,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
update);
|
||||
}
|
||||
|
||||
void Expect(const nsCString& aMessage, nsIRunnable* aContinuation) {
|
||||
mExpected.AppendElement(ExpectedMessage(aMessage, aContinuation));
|
||||
void Expect(const nsCString& aMessage, already_AddRefed<nsIRunnable> aContinuation) {
|
||||
mExpected.AppendElement(ExpectedMessage(aMessage, Move(aContinuation)));
|
||||
}
|
||||
|
||||
void AwaitFinished() {
|
||||
@ -1283,15 +1283,15 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
mFinished = false;
|
||||
}
|
||||
|
||||
void ShutdownThen(nsIRunnable* aContinuation) {
|
||||
void ShutdownThen(already_AddRefed<nsIRunnable> aContinuation) {
|
||||
EXPECT_TRUE(!!mDecryptor);
|
||||
if (!mDecryptor) {
|
||||
return;
|
||||
}
|
||||
EXPECT_FALSE(mNodeId.IsEmpty());
|
||||
RefPtr<GMPShutdownObserver> task(
|
||||
new GMPShutdownObserver(NS_NewRunnableMethod(this, &GMPStorageTest::Shutdown),
|
||||
aContinuation, mNodeId));
|
||||
new GMPShutdownObserver(NewRunnableMethod(this, &GMPStorageTest::Shutdown),
|
||||
Move(aContinuation), mNodeId));
|
||||
NS_DispatchToMainThread(task, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -1309,7 +1309,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
|
||||
void SetFinished() {
|
||||
mFinished = true;
|
||||
Shutdown();
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethod(this, &GMPStorageTest::Dummy));
|
||||
NS_DispatchToMainThread(NewRunnableMethod(this, &GMPStorageTest::Dummy));
|
||||
}
|
||||
|
||||
void SessionMessage(const nsCString& aSessionId,
|
||||
@ -1364,7 +1364,7 @@ private:
|
||||
~GMPStorageTest() { }
|
||||
|
||||
struct ExpectedMessage {
|
||||
ExpectedMessage(const nsCString& aMessage, nsIRunnable* aContinuation)
|
||||
ExpectedMessage(const nsCString& aMessage, already_AddRefed<nsIRunnable> aContinuation)
|
||||
: mMessage(aMessage)
|
||||
, mContinuation(aContinuation)
|
||||
{}
|
||||
@ -1386,9 +1386,9 @@ GMPTestRunner::DoTest(void (GMPTestRunner::*aTestMethod)(GMPTestMonitor&))
|
||||
nsCOMPtr<nsIThread> thread(GetGMPThread());
|
||||
|
||||
GMPTestMonitor monitor;
|
||||
thread->Dispatch(NS_NewRunnableMethodWithArg<GMPTestMonitor&>(this,
|
||||
aTestMethod,
|
||||
monitor),
|
||||
thread->Dispatch(NewRunnableMethod<GMPTestMonitor&>(this,
|
||||
aTestMethod,
|
||||
monitor),
|
||||
NS_DISPATCH_NORMAL);
|
||||
monitor.AwaitFinished();
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ GMPRemoveTest::CreateVideoDecoder(nsCString aNodeId)
|
||||
GMPVideoDecoderProxy* decoder = nullptr;
|
||||
|
||||
mGMPThread->Dispatch(
|
||||
NS_NewNonOwningRunnableMethodWithArgs<nsCString, GMPVideoDecoderProxy**, GMPVideoHost**>(
|
||||
NewNonOwningRunnableMethod<nsCString, GMPVideoDecoderProxy**, GMPVideoHost**>(
|
||||
this, &GMPRemoveTest::gmp_GetVideoDecoder, aNodeId, &decoder, &host),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
||||
@ -276,7 +276,7 @@ GMPRemoveTest::CreateVideoDecoder(nsCString aNodeId)
|
||||
|
||||
nsTArray<uint8_t> empty;
|
||||
mGMPThread->Dispatch(
|
||||
NS_NewNonOwningRunnableMethodWithArgs<const GMPVideoCodec&, const nsTArray<uint8_t>&, GMPVideoDecoderCallbackProxy*, int32_t>(
|
||||
NewNonOwningRunnableMethod<const GMPVideoCodec&, const nsTArray<uint8_t>&, GMPVideoDecoderCallbackProxy*, int32_t>(
|
||||
decoder, &GMPVideoDecoderProxy::InitDecode,
|
||||
codec, empty, this, 1 /* core count */),
|
||||
NS_DISPATCH_SYNC);
|
||||
@ -328,7 +328,7 @@ void
|
||||
GMPRemoveTest::CloseVideoDecoder()
|
||||
{
|
||||
mGMPThread->Dispatch(
|
||||
NS_NewNonOwningRunnableMethod(mDecoder, &GMPVideoDecoderProxy::Close),
|
||||
NewNonOwningRunnableMethod(mDecoder, &GMPVideoDecoderProxy::Close),
|
||||
NS_DISPATCH_SYNC);
|
||||
|
||||
mDecoder = nullptr;
|
||||
@ -345,7 +345,7 @@ GMPErr
|
||||
GMPRemoveTest::Decode()
|
||||
{
|
||||
mGMPThread->Dispatch(
|
||||
NS_NewNonOwningRunnableMethod(this, &GMPRemoveTest::gmp_Decode),
|
||||
NewNonOwningRunnableMethod(this, &GMPRemoveTest::gmp_Decode),
|
||||
NS_DISPATCH_NORMAL);
|
||||
|
||||
mTestMonitor.AwaitFinished();
|
||||
|
@ -43,8 +43,8 @@ public:
|
||||
|
||||
void Init() {
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(thread),
|
||||
NS_NewRunnableMethod(this, &TestBinding::ReadMetadata));
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &TestBinding::ReadMetadata);
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(thread), r);
|
||||
EXPECT_EQ(NS_OK, rv);
|
||||
thread->Shutdown();
|
||||
}
|
||||
@ -54,7 +54,7 @@ private:
|
||||
{
|
||||
{
|
||||
RefPtr<TaskQueue> queue = reader->OwnerThread();
|
||||
nsCOMPtr<nsIRunnable> task = NS_NewRunnableMethod(reader, &MP4Reader::Shutdown);
|
||||
nsCOMPtr<nsIRunnable> task = NewRunnableMethod(reader, &MP4Reader::Shutdown);
|
||||
// Hackily bypass the tail dispatcher so that we can AwaitShutdownAndIdle.
|
||||
// In production code we'd use BeginShutdown + promises.
|
||||
queue->Dispatch(task.forget(), AbstractThread::AssertDispatchSuccess,
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
{
|
||||
if (event == EVENT_FINISHED) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &DecodedStreamGraphListener::DoNotifyFinished);
|
||||
NewRunnableMethod(this, &DecodedStreamGraphListener::DoNotifyFinished);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
}
|
||||
@ -99,9 +99,9 @@ UpdateStreamSuspended(MediaStream* aStream, bool aBlocking)
|
||||
} else {
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
if (aBlocking) {
|
||||
r = NS_NewRunnableMethod(aStream, &MediaStream::Suspend);
|
||||
r = NewRunnableMethod(aStream, &MediaStream::Suspend);
|
||||
} else {
|
||||
r = NS_NewRunnableMethod(aStream, &MediaStream::Resume);
|
||||
r = NewRunnableMethod(aStream, &MediaStream::Resume);
|
||||
}
|
||||
AbstractThread::MainThread()->Dispatch(r.forget());
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ void
|
||||
MediaSourceDemuxer::AttachSourceBuffer(TrackBuffersManager* aSourceBuffer)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackBuffersManager*>(
|
||||
NewRunnableMethod<TrackBuffersManager*>(
|
||||
this, &MediaSourceDemuxer::DoAttachSourceBuffer,
|
||||
aSourceBuffer);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
@ -195,7 +195,7 @@ void
|
||||
MediaSourceDemuxer::DetachSourceBuffer(TrackBuffersManager* aSourceBuffer)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<TrackBuffersManager*>(
|
||||
NewRunnableMethod<TrackBuffersManager*>(
|
||||
this, &MediaSourceDemuxer::DoDetachSourceBuffer,
|
||||
aSourceBuffer);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
|
@ -201,9 +201,7 @@ TrackBuffersManager::ProcessTasks()
|
||||
NS_WARNING("Invalid Task");
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &TrackBuffersManager::ProcessTasks);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
GetTaskQueue()->Dispatch(NewRunnableMethod(this, &TrackBuffersManager::ProcessTasks));
|
||||
}
|
||||
|
||||
// A PromiseHolder will assert upon destruction if it has a pending promise
|
||||
@ -793,9 +791,7 @@ TrackBuffersManager::ScheduleSegmentParserLoop()
|
||||
if (mDetached) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &TrackBuffersManager::SegmentParserLoop);
|
||||
GetTaskQueue()->Dispatch(task.forget());
|
||||
GetTaskQueue()->Dispatch(NewRunnableMethod(this, &TrackBuffersManager::SegmentParserLoop));
|
||||
}
|
||||
|
||||
void
|
||||
@ -971,11 +967,10 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
|
||||
int64_t duration = std::max(videoDuration, audioDuration);
|
||||
// 1. Update the duration attribute if it currently equals NaN.
|
||||
// Those steps are performed by the MediaSourceDecoder::SetInitialDuration
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<int64_t>(mParentDecoder,
|
||||
&MediaSourceDecoder::SetInitialDuration,
|
||||
duration ? duration : -1);
|
||||
AbstractThread::MainThread()->Dispatch(task.forget());
|
||||
AbstractThread::MainThread()->Dispatch(NewRunnableMethod<int64_t>
|
||||
(mParentDecoder,
|
||||
&MediaSourceDecoder::SetInitialDuration,
|
||||
duration ? duration : -1));
|
||||
|
||||
// 2. If the initialization segment has no audio, video, or text tracks, then
|
||||
// run the append error algorithm with the decode error parameter set to true
|
||||
|
@ -354,7 +354,7 @@ status_t AudioOffloadPlayer::DoSeek()
|
||||
|
||||
if (!mSeekPromise.IsEmpty()) {
|
||||
nsCOMPtr<nsIRunnable> nsEvent =
|
||||
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
|
||||
NewRunnableMethod<MediaDecoderEventVisibility>(
|
||||
mObserver,
|
||||
&MediaDecoder::SeekingStarted,
|
||||
mSeekTarget.mEventVisibility);
|
||||
@ -425,16 +425,14 @@ void AudioOffloadPlayer::NotifyAudioEOS()
|
||||
MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility);
|
||||
mSeekPromise.Resolve(val, __func__);
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
|
||||
&MediaDecoder::PlaybackEnded);
|
||||
NS_DispatchToMainThread(nsEvent);
|
||||
NS_DispatchToMainThread(NewRunnableMethod(mObserver,
|
||||
&MediaDecoder::PlaybackEnded));
|
||||
}
|
||||
|
||||
void AudioOffloadPlayer::NotifyPositionChanged()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> nsEvent =
|
||||
NS_NewRunnableMethod(mObserver, &MediaOmxCommonDecoder::NotifyOffloadPlayerPositionChanged);
|
||||
NS_DispatchToMainThread(nsEvent);
|
||||
NS_DispatchToMainThread(NewRunnableMethod(mObserver,
|
||||
&MediaOmxCommonDecoder::NotifyOffloadPlayerPositionChanged));
|
||||
}
|
||||
|
||||
void AudioOffloadPlayer::NotifyAudioTearDown()
|
||||
@ -448,9 +446,8 @@ void AudioOffloadPlayer::NotifyAudioTearDown()
|
||||
MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility);
|
||||
mSeekPromise.Resolve(val, __func__);
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
|
||||
&MediaOmxCommonDecoder::AudioOffloadTearDown);
|
||||
NS_DispatchToMainThread(nsEvent);
|
||||
NS_DispatchToMainThread(NewRunnableMethod(mObserver,
|
||||
&MediaOmxCommonDecoder::AudioOffloadTearDown));
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -132,11 +132,9 @@ OpusDataDecoder::DecodeHeader(const unsigned char* aData, size_t aLength)
|
||||
nsresult
|
||||
OpusDataDecoder::Input(MediaRawData* aSample)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
this, &OpusDataDecoder::Decode,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this, &OpusDataDecoder::Decode,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -309,9 +307,7 @@ OpusDataDecoder::DoDrain()
|
||||
nsresult
|
||||
OpusDataDecoder::Drain()
|
||||
{
|
||||
RefPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethod(this, &OpusDataDecoder::DoDrain));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &OpusDataDecoder::DoDrain));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -186,11 +186,9 @@ VPXDecoder::DecodeFrame(MediaRawData* aSample)
|
||||
nsresult
|
||||
VPXDecoder::Input(MediaRawData* aSample)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
this, &VPXDecoder::DecodeFrame,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this, &VPXDecoder::DecodeFrame,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -204,9 +202,7 @@ VPXDecoder::DoDrain()
|
||||
nsresult
|
||||
VPXDecoder::Drain()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethod(this, &VPXDecoder::DoDrain));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &VPXDecoder::DoDrain));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -129,11 +129,9 @@ VorbisDataDecoder::DecodeHeader(const unsigned char* aData, size_t aLength)
|
||||
nsresult
|
||||
VorbisDataDecoder::Input(MediaRawData* aSample)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
this, &VorbisDataDecoder::Decode,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this, &VorbisDataDecoder::Decode,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -265,9 +263,7 @@ VorbisDataDecoder::DoDrain()
|
||||
nsresult
|
||||
VorbisDataDecoder::Drain()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethod(this, &VorbisDataDecoder::DoDrain));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &VorbisDataDecoder::DoDrain));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -70,11 +70,9 @@ WaveDataDecoder::Init()
|
||||
nsresult
|
||||
WaveDataDecoder::Input(MediaRawData* aSample)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
this, &WaveDataDecoder::Decode,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this, &WaveDataDecoder::Decode,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -158,9 +156,7 @@ WaveDataDecoder::DoDrain()
|
||||
nsresult
|
||||
WaveDataDecoder::Drain()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethod(this, &WaveDataDecoder::DoDrain));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &WaveDataDecoder::DoDrain));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -186,4 +182,4 @@ WaveDataDecoder::IsWave(const nsACString& aMimeType)
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
#undef LOG
|
||||
#undef LOG
|
||||
|
@ -52,7 +52,7 @@ SamplesWaitingForKey::NotifyUsable(const CencKeyId& aKeyId)
|
||||
while (i < mSamples.Length()) {
|
||||
if (aKeyId == mSamples[i]->mCrypto.mKeyId) {
|
||||
RefPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(mDecoder,
|
||||
task = NewRunnableMethod<RefPtr<MediaRawData>>(mDecoder,
|
||||
&MediaDataDecoder::Input,
|
||||
RefPtr<MediaRawData>(mSamples[i]));
|
||||
mSamples.RemoveElementAt(i);
|
||||
|
@ -58,9 +58,7 @@ MediaDataDecoderProxy::Flush()
|
||||
|
||||
mFlushComplete.Set(false);
|
||||
|
||||
nsCOMPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Flush);
|
||||
mProxyThread->Dispatch(task.forget());
|
||||
mProxyThread->Dispatch(NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Flush));
|
||||
|
||||
mFlushComplete.WaitUntil(true);
|
||||
|
||||
@ -73,9 +71,7 @@ MediaDataDecoderProxy::Drain()
|
||||
MOZ_ASSERT(!IsOnProxyThread());
|
||||
MOZ_ASSERT(!mIsShutdown);
|
||||
|
||||
nsCOMPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Drain);
|
||||
mProxyThread->Dispatch(task.forget());
|
||||
mProxyThread->Dispatch(NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Drain));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -87,9 +83,9 @@ MediaDataDecoderProxy::Shutdown()
|
||||
#if defined(DEBUG)
|
||||
mIsShutdown = true;
|
||||
#endif
|
||||
nsCOMPtr<nsIRunnable> task;
|
||||
task = NS_NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Shutdown);
|
||||
nsresult rv = mProxyThread->AsXPCOMThread()->Dispatch(task, NS_DISPATCH_SYNC);
|
||||
nsresult rv = mProxyThread->AsXPCOMThread()->Dispatch(NewRunnableMethod(mProxyDecoder,
|
||||
&MediaDataDecoder::Shutdown),
|
||||
NS_DISPATCH_SYNC);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -389,9 +389,8 @@ MediaCodecDataDecoder::InitDecoder(Surface::Param aSurface)
|
||||
NS_ENSURE_SUCCESS(rv = ResetInputBuffers(), rv);
|
||||
NS_ENSURE_SUCCESS(rv = ResetOutputBuffers(), rv);
|
||||
|
||||
rv = NS_NewNamedThread(
|
||||
"MC Decoder", getter_AddRefs(mThread),
|
||||
NS_NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop));
|
||||
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop);
|
||||
rv = NS_NewNamedThread("MC Decoder", getter_AddRefs(mThread), r);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ AppleATDecoder::Input(MediaRawData* aSample)
|
||||
|
||||
// Queue a task to perform the actual decoding on a separate thread.
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this,
|
||||
&AppleATDecoder::SubmitSample,
|
||||
RefPtr<MediaRawData>(aSample));
|
||||
|
@ -100,7 +100,7 @@ AppleVDADecoder::Shutdown()
|
||||
mIsShutDown = true;
|
||||
if (mTaskQueue) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &AppleVDADecoder::ProcessShutdown);
|
||||
NewRunnableMethod(this, &AppleVDADecoder::ProcessShutdown);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
} else {
|
||||
ProcessShutdown();
|
||||
@ -133,7 +133,7 @@ AppleVDADecoder::Input(MediaRawData* aSample)
|
||||
mInputIncoming++;
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this,
|
||||
&AppleVDADecoder::SubmitFrame,
|
||||
RefPtr<MediaRawData>(aSample));
|
||||
@ -148,7 +148,7 @@ AppleVDADecoder::Flush()
|
||||
mIsFlushing = true;
|
||||
mTaskQueue->Flush();
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &AppleVDADecoder::ProcessFlush);
|
||||
NewRunnableMethod(this, &AppleVDADecoder::ProcessFlush);
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
while (mIsFlushing) {
|
||||
@ -163,7 +163,7 @@ AppleVDADecoder::Drain()
|
||||
{
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &AppleVDADecoder::ProcessDrain);
|
||||
NewRunnableMethod(this, &AppleVDADecoder::ProcessDrain);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ AppleVTDecoder::Input(MediaRawData* aSample)
|
||||
mInputIncoming++;
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this, &AppleVTDecoder::SubmitFrame, aSample);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
return NS_OK;
|
||||
|
@ -175,7 +175,7 @@ FFmpegAudioDecoder<LIBAV_VER>::DecodePacket(MediaRawData* aSample)
|
||||
nsresult
|
||||
FFmpegAudioDecoder<LIBAV_VER>::Input(MediaRawData* aSample)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
nsCOMPtr<nsIRunnable> runnable(NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this, &FFmpegAudioDecoder::DecodePacket, RefPtr<MediaRawData>(aSample)));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
return NS_OK;
|
||||
|
@ -104,7 +104,7 @@ FFmpegDataDecoder<LIBAV_VER>::Shutdown()
|
||||
{
|
||||
if (mTaskQueue) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessShutdown);
|
||||
NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessShutdown);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
} else {
|
||||
ProcessShutdown();
|
||||
@ -119,7 +119,7 @@ FFmpegDataDecoder<LIBAV_VER>::Flush()
|
||||
mIsFlushing = true;
|
||||
mTaskQueue->Flush();
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessFlush);
|
||||
NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessFlush);
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
while (mIsFlushing) {
|
||||
@ -133,7 +133,7 @@ FFmpegDataDecoder<LIBAV_VER>::Drain()
|
||||
{
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessDrain);
|
||||
NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessDrain);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ nsresult
|
||||
FFmpegVideoDecoder<LIBAV_VER>::Input(MediaRawData* aSample)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> runnable(
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this, &FFmpegVideoDecoder<LIBAV_VER>::DecodeFrame,
|
||||
RefPtr<MediaRawData>(aSample)));
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
|
@ -114,9 +114,7 @@ OmxDataDecoder::OmxDataDecoder(const TrackInfo& aTrackInfo,
|
||||
LOG("");
|
||||
mOmxLayer = new OmxPromiseLayer(mOmxTaskQueue, this, aImageContainer);
|
||||
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(this, &OmxDataDecoder::InitializationTask);
|
||||
mOmxTaskQueue->Dispatch(r.forget());
|
||||
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::InitializationTask));
|
||||
}
|
||||
|
||||
OmxDataDecoder::~OmxDataDecoder()
|
||||
@ -209,9 +207,7 @@ OmxDataDecoder::Flush()
|
||||
|
||||
mFlushing = true;
|
||||
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(this, &OmxDataDecoder::DoFlush);
|
||||
mOmxTaskQueue->Dispatch(r.forget());
|
||||
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::DoFlush));
|
||||
|
||||
// According to the definition of Flush() in PDM:
|
||||
// "the decoder must be ready to accept new input for decoding".
|
||||
@ -229,9 +225,7 @@ OmxDataDecoder::Drain()
|
||||
{
|
||||
LOG("");
|
||||
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(this, &OmxDataDecoder::SendEosBuffer);
|
||||
mOmxTaskQueue->Dispatch(r.forget());
|
||||
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::SendEosBuffer));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -243,9 +237,7 @@ OmxDataDecoder::Shutdown()
|
||||
|
||||
mShuttingDown = true;
|
||||
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
NS_NewRunnableMethod(this, &OmxDataDecoder::DoAsyncShutdown);
|
||||
mOmxTaskQueue->Dispatch(r.forget());
|
||||
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::DoAsyncShutdown));
|
||||
|
||||
{
|
||||
// DoAsyncShutdown() will be running for a while, it could be still running
|
||||
|
@ -79,9 +79,7 @@ WMFMediaDataDecoder::Shutdown()
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
if (mTaskQueue) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown));
|
||||
} else {
|
||||
ProcessShutdown();
|
||||
}
|
||||
@ -109,7 +107,7 @@ WMFMediaDataDecoder::Input(MediaRawData* aSample)
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
|
||||
NewRunnableMethod<RefPtr<MediaRawData>>(
|
||||
this,
|
||||
&WMFMediaDataDecoder::ProcessDecode,
|
||||
RefPtr<MediaRawData>(aSample));
|
||||
@ -185,11 +183,9 @@ WMFMediaDataDecoder::Flush()
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessFlush);
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mIsFlushing = true;
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessFlush));
|
||||
while (mIsFlushing) {
|
||||
mon.Wait();
|
||||
}
|
||||
@ -219,9 +215,7 @@ WMFMediaDataDecoder::Drain()
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessDrain);
|
||||
mTaskQueue->Dispatch(runnable.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessDrain));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -238,7 +232,7 @@ WMFMediaDataDecoder::ConfigurationChanged(const TrackInfo& aConfig)
|
||||
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<UniquePtr<TrackInfo>&&>(
|
||||
NewRunnableMethod<UniquePtr<TrackInfo>&&>(
|
||||
this,
|
||||
&WMFMediaDataDecoder::ProcessConfigurationChanged,
|
||||
aConfig.Clone());
|
||||
|
@ -136,7 +136,7 @@ DecoderCallbackFuzzingWrapper::Output(MediaData* aData)
|
||||
{
|
||||
if (!mTaskQueue->IsCurrentThreadIn()) {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethodWithArg<StorensRefPtrPassByPtr<MediaData>>(
|
||||
NewRunnableMethod<StorensRefPtrPassByPtr<MediaData>>(
|
||||
this, &DecoderCallbackFuzzingWrapper::Output, aData);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
return;
|
||||
@ -176,9 +176,7 @@ void
|
||||
DecoderCallbackFuzzingWrapper::Error()
|
||||
{
|
||||
if (!mTaskQueue->IsCurrentThreadIn()) {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::Error);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::Error));
|
||||
return;
|
||||
}
|
||||
CFW_LOGV("");
|
||||
@ -191,9 +189,7 @@ void
|
||||
DecoderCallbackFuzzingWrapper::InputExhausted()
|
||||
{
|
||||
if (!mTaskQueue->IsCurrentThreadIn()) {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::InputExhausted);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::InputExhausted));
|
||||
return;
|
||||
}
|
||||
if (!mDontDelayInputExhausted && !mDelayedOutput.empty()) {
|
||||
@ -212,9 +208,7 @@ void
|
||||
DecoderCallbackFuzzingWrapper::DrainComplete()
|
||||
{
|
||||
if (!mTaskQueue->IsCurrentThreadIn()) {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::DrainComplete);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::DrainComplete));
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(mCallback);
|
||||
@ -233,9 +227,7 @@ void
|
||||
DecoderCallbackFuzzingWrapper::ReleaseMediaResources()
|
||||
{
|
||||
if (!mTaskQueue->IsCurrentThreadIn()) {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ReleaseMediaResources);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ReleaseMediaResources));
|
||||
return;
|
||||
}
|
||||
CFW_LOGV("");
|
||||
@ -317,9 +309,7 @@ DecoderCallbackFuzzingWrapper::ClearDelayedOutput()
|
||||
{
|
||||
if (!mTaskQueue->IsCurrentThreadIn()) {
|
||||
DFW_LOGV("(dispatching self)");
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ClearDelayedOutput);
|
||||
mTaskQueue->Dispatch(task.forget());
|
||||
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ClearDelayedOutput));
|
||||
return;
|
||||
}
|
||||
DFW_LOGV("");
|
||||
|
@ -198,12 +198,11 @@ MediaSystemResourceManager::Acquire(MediaSystemResourceClient* aClient)
|
||||
return;
|
||||
}
|
||||
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_WAITING;
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<uint32_t>(
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
|
||||
NewRunnableMethod<uint32_t>(
|
||||
this,
|
||||
&MediaSystemResourceManager::DoAcquire,
|
||||
aClient->mId);
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
|
||||
aClient->mId));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -242,12 +241,11 @@ MediaSystemResourceManager::AcquireSyncNoWait(MediaSystemResourceClient* aClient
|
||||
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_WAITING;
|
||||
}
|
||||
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<uint32_t>(
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
|
||||
NewRunnableMethod<uint32_t>(
|
||||
this,
|
||||
&MediaSystemResourceManager::DoAcquire,
|
||||
aClient->mId);
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
|
||||
aClient->mId));
|
||||
|
||||
// should stop the thread until done.
|
||||
while (!done) {
|
||||
@ -310,12 +308,11 @@ MediaSystemResourceManager::ReleaseResource(MediaSystemResourceClient* aClient)
|
||||
|
||||
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_END;
|
||||
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<uint32_t>(
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
|
||||
NewRunnableMethod<uint32_t>(
|
||||
this,
|
||||
&MediaSystemResourceManager::DoRelease,
|
||||
aClient->mId);
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
|
||||
aClient->mId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,13 +336,12 @@ void
|
||||
MediaSystemResourceManager::HandleAcquireResult(uint32_t aId, bool aSuccess)
|
||||
{
|
||||
if (!InImageBridgeChildThread()) {
|
||||
RefPtr<Runnable> runnable =
|
||||
NS_NewRunnableMethodWithArgs<uint32_t, bool>(
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
|
||||
NewRunnableMethod<uint32_t, bool>(
|
||||
this,
|
||||
&MediaSystemResourceManager::HandleAcquireResult,
|
||||
aId,
|
||||
aSuccess);
|
||||
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
|
||||
aSuccess));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -412,9 +412,8 @@ AudioDestinationNode::NotifyMainThreadStreamFinished()
|
||||
MOZ_ASSERT(mStream->IsFinished());
|
||||
|
||||
if (mIsOffline) {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &AudioDestinationNode::FireOfflineCompletionEvent);
|
||||
NS_DispatchToCurrentThread(runnable);
|
||||
NS_DispatchToCurrentThread(NewRunnableMethod(this,
|
||||
&AudioDestinationNode::FireOfflineCompletionEvent));
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,11 +657,10 @@ AudioDestinationNode::NotifyStableState()
|
||||
void
|
||||
AudioDestinationNode::ScheduleStableStateNotification()
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &AudioDestinationNode::NotifyStableState);
|
||||
// Dispatch will fail if this is called on AudioNode destruction during
|
||||
// shutdown, in which case failure can be ignored.
|
||||
nsContentUtils::RunInStableState(event.forget());
|
||||
nsContentUtils::RunInStableState(NewRunnableMethod(this,
|
||||
&AudioDestinationNode::NotifyStableState));
|
||||
}
|
||||
|
||||
StreamTime
|
||||
|
@ -122,7 +122,7 @@ private:
|
||||
mDecodeJob.OnFailure(aErrorCode);
|
||||
} else {
|
||||
// Take extra care to cleanup on the main thread
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethod(this, &MediaDecodeTask::Cleanup));
|
||||
NS_DispatchToMainThread(NewRunnableMethod(this, &MediaDecodeTask::Cleanup));
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new ReportResultTask(mDecodeJob, &WebAudioDecodeJob::OnFailure, aErrorCode);
|
||||
|
@ -151,8 +151,8 @@ ReverbConvolver::ReverbConvolver(const float* impulseResponseData,
|
||||
NS_WARNING("Cannot start convolver thread.");
|
||||
return;
|
||||
}
|
||||
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &ReverbConvolver::backgroundThreadEntry);
|
||||
m_backgroundThread.message_loop()->PostTask(runnable.forget());
|
||||
m_backgroundThread.message_loop()->PostTask(NewNonOwningRunnableMethod(this,
|
||||
&ReverbConvolver::backgroundThreadEntry));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ public:
|
||||
if (!mStarted) {
|
||||
mStarted = true;
|
||||
nsCOMPtr<nsIRunnable> startRunnable =
|
||||
NS_NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
|
||||
NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(startRunnable.forget());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> endRunnable =
|
||||
NS_NewRunnableMethod(this, &SynthStreamListener::DoNotifyFinished);
|
||||
NewRunnableMethod(this, &SynthStreamListener::DoNotifyFinished);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(endRunnable.forget());
|
||||
}
|
||||
break;
|
||||
@ -85,7 +85,7 @@ public:
|
||||
if (aBlocked == MediaStreamListener::UNBLOCKED && !mStarted) {
|
||||
mStarted = true;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
|
||||
NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
|
||||
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
|
||||
}
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ nsPicoService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
DebugOnly<nsresult> rv = NS_NewNamedThread("Pico Worker", getter_AddRefs(mThread));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
return mThread->Dispatch(
|
||||
NS_NewRunnableMethod(this, &nsPicoService::Init), NS_DISPATCH_NORMAL);
|
||||
NewRunnableMethod(this, &nsPicoService::Init), NS_DISPATCH_NORMAL);
|
||||
}
|
||||
// nsISpeechService
|
||||
|
||||
@ -579,7 +579,7 @@ nsPicoService::Init()
|
||||
rv = dirIterator->HasMoreElements(&hasMoreElements);
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethod(this, &nsPicoService::RegisterVoices));
|
||||
NS_DispatchToMainThread(NewRunnableMethod(this, &nsPicoService::RegisterVoices));
|
||||
}
|
||||
|
||||
void
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user