Backed out changeset 85ce8cb0639a (bug 1268313)

--HG--
extra : rebase_source : 56d1cf41a2dc4959b67f834e07192a5c772176a8
This commit is contained in:
Carsten "Tomcat" Book 2016-04-29 14:21:16 +02:00
Родитель 2dc450ceba
Коммит ba3fe0975c
237 изменённых файлов: 1280 добавлений и 1046 удалений

Просмотреть файл

@ -1383,8 +1383,10 @@ nsSHistory::RemoveEntries(nsTArray<uint64_t>& aIDs, int32_t aStartIndex)
--index;
}
if (didRemove && mRootDocShell) {
NS_DispatchToCurrentThread(NewRunnableMethod(static_cast<nsDocShell*>(mRootDocShell),
&nsDocShell::FireDummyOnLocationChange));
nsCOMPtr<nsIRunnable> ev =
NS_NewRunnableMethod(static_cast<nsDocShell*>(mRootDocShell),
&nsDocShell::FireDummyOnLocationChange);
NS_DispatchToCurrentThread(ev);
}
}

Просмотреть файл

@ -1236,7 +1236,7 @@ Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag)
DoFinishNotificationImmediately();
} else if (!mFinishNotificationTask.IsPending()) {
RefPtr<nsRunnableMethod<Animation>> runnable =
NewRunnableMethod(this, &Animation::DoFinishNotificationImmediately);
NS_NewRunnableMethod(this, &Animation::DoFinishNotificationImmediately);
runtime->DispatchToMicroTask(runnable);
mFinishNotificationTask = runnable;
}

Просмотреть файл

@ -86,7 +86,8 @@ ArchiveReaderEvent::RunShare(nsresult aStatus)
{
mStatus = aStatus;
NS_DispatchToMainThread(NewRunnableMethod(this, &ArchiveReaderEvent::ShareMainThread));
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &ArchiveReaderEvent::ShareMainThread);
NS_DispatchToMainThread(event);
return NS_OK;
}

Просмотреть файл

@ -517,7 +517,7 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
}
else {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler));
NS_NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler));
}
}
}

Просмотреть файл

@ -364,7 +364,11 @@ EventSource::OnStartRequest(nsIRequest *aRequest,
return NS_ERROR_ABORT;
}
rv = NS_DispatchToMainThread(NewRunnableMethod(this, &EventSource::AnnounceConnection));
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &EventSource::AnnounceConnection);
NS_ENSURE_STATE(event);
rv = NS_DispatchToMainThread(event);
NS_ENSURE_SUCCESS(rv, rv);
mStatus = PARSE_STATE_BEGIN_OF_STREAM;
@ -470,7 +474,11 @@ EventSource::OnStopRequest(nsIRequest *aRequest,
ClearFields();
rv = NS_DispatchToMainThread(NewRunnableMethod(this, &EventSource::ReestablishConnection));
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &EventSource::ReestablishConnection);
NS_ENSURE_STATE(event);
rv = NS_DispatchToMainThread(event);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -899,8 +907,11 @@ EventSource::ConsoleError()
nsresult
EventSource::DispatchFailConnection()
{
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &EventSource::FailConnection);
NS_ENSURE_STATE(event);
return NS_DispatchToMainThread(NewRunnableMethod(this, &EventSource::FailConnection));
return NS_DispatchToMainThread(event);
}
void
@ -974,7 +985,7 @@ EventSource::Thaw()
nsresult rv;
if (!mGoingToDispatchAllMessages && mMessagesToDispatch.GetSize() > 0) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
NS_NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
NS_ENSURE_STATE(event);
mGoingToDispatchAllMessages = true;
@ -1034,7 +1045,7 @@ EventSource::DispatchCurrentMessageEvent()
if (!mGoingToDispatchAllMessages) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &EventSource::DispatchAllMessageEvents);
NS_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 = NewRunnableMethod(this,
nsCOMPtr<nsIRunnable> runnable = NS_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 = NewRunnableMethod(orientation,
nsCOMPtr<nsIRunnable> runnable = NS_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 =
NewNonOwningRunnableMethod(this,
NS_NewNonOwningRunnableMethod(this,
&nsContentSink::DoProcessLinkHeader);
rv = NS_DispatchToCurrentThread(mProcessLinkHeaderEvent.get());
if (NS_FAILED(rv)) {

Просмотреть файл

@ -5042,29 +5042,22 @@ nsContentUtils::WarnScriptWasIgnored(nsIDocument* aDocument)
/* static */
bool
nsContentUtils::AddScriptRunner(already_AddRefed<nsIRunnable> aRunnable)
nsContentUtils::AddScriptRunner(nsIRunnable* aRunnable)
{
nsCOMPtr<nsIRunnable> runnable = aRunnable;
if (!runnable) {
if (!aRunnable) {
return false;
}
if (sScriptBlockerCount) {
return sBlockedScriptRunners->AppendElement(runnable.forget()) != nullptr;
return sBlockedScriptRunners->AppendElement(aRunnable) != nullptr;
}
runnable->Run();
nsCOMPtr<nsIRunnable> run = aRunnable;
run->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,7 +1608,6 @@ 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(NewRunnableMethod
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<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(NewRunnableMethod
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<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(NewRunnableMethod
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<LayoutDeviceIntPoint, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeMouseMove,
LayoutDeviceIntPoint(aScreenX, aScreenY), aObserver));
@ -1072,7 +1072,7 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NewRunnableMethod
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<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(NewRunnableMethod
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<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(NewRunnableMethod
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<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(NewRunnableMethod<nsIObserver*>
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs<nsIObserver*>
(widget, &nsIWidget::ClearNativeTouchSequence, aObserver));
return NS_OK;
}

Просмотреть файл

@ -4352,7 +4352,7 @@ nsDocument::SetStyleSheetApplicableState(StyleSheetHandle aSheet,
}
if (!mSSApplicableStateNotificationPending) {
nsCOMPtr<nsIRunnable> notification = NewRunnableMethod(this,
nsCOMPtr<nsIRunnable> notification = NS_NewRunnableMethod(this,
&nsDocument::NotifyStyleSheetApplicableStateChanged);
mSSApplicableStateNotificationPending =
NS_SUCCEEDED(NS_DispatchToCurrentThread(notification));
@ -4961,7 +4961,7 @@ nsDocument::MaybeEndOutermostXBLUpdate()
BindingManager()->EndOutermostUpdate();
} else if (!mInDestructor) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate));
NS_NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate));
}
}
}
@ -5279,7 +5279,7 @@ nsDocument::UnblockDOMContentLoaded()
MOZ_ASSERT(mReadyState == READYSTATE_INTERACTIVE);
if (!mSynchronousDOMContentLoaded) {
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
NS_NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
NS_DispatchToCurrentThread(ev);
} else {
DispatchContentLoadedEvents();
@ -7262,7 +7262,7 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
return;
RefPtr<nsRunnableMethod<nsDocument, void, false> > event =
NewNonOwningRunnableMethod(this,
NS_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 =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_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 =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_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 =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
return;
@ -9064,7 +9064,7 @@ nsDocument::BlockOnload()
++mAsyncOnloadBlockCount;
if (mAsyncOnloadBlockCount == 1) {
bool success = nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsDocument::AsyncBlockOnload));
NS_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 =
NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
NS_NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
NS_DispatchToMainThread(event);
}
@ -13503,7 +13503,7 @@ nsIDocument::RebuildUserFontSet()
// change reflow).
if (!mPostedFlushUserFontSet) {
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsIDocument::HandleRebuildUserFontSet);
NS_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(
NewRunnableMethod(this, &nsGlobalWindow::ClearStatus));
NS_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(
NewRunnableMethod(newInnerWindow,
&nsGlobalWindow::FireOnNewGlobalObject));
NS_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(
NewRunnableMethod(this, &nsGlobalWindow::DispatchDOMWindowCreated));
NS_NewRunnableMethod(this, &nsGlobalWindow::DispatchDOMWindowCreated));
}
}
@ -11476,7 +11476,7 @@ public:
~AutoUnblockScriptClosing()
{
void (nsGlobalWindow::*run)() = &nsGlobalWindow::UnblockScriptedClosing;
NS_DispatchToCurrentThread(NewRunnableMethod(mWin, run));
NS_DispatchToCurrentThread(NS_NewRunnableMethod(mWin, run));
}
};

Просмотреть файл

@ -503,8 +503,8 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
if (!scriptURI) {
// Asynchronously report the failure to create a URI object
NS_DispatchToCurrentThread(
NewRunnableMethod(aElement,
&nsIScriptElement::FireErrorEvent));
NS_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(
NewRunnableMethod(aElement,
&nsIScriptElement::FireErrorEvent));
NS_NewRunnableMethod(aElement,
&nsIScriptElement::FireErrorEvent));
return false;
}
}
@ -1150,8 +1150,10 @@ void
nsScriptLoader::ProcessPendingRequestsAsync()
{
if (mParserBlockingRequest || !mPendingChildLoaders.IsEmpty()) {
NS_DispatchToCurrentThread(NewRunnableMethod(this,
&nsScriptLoader::ProcessPendingRequests));
nsCOMPtr<nsIRunnable> ev = NS_NewRunnableMethod(this,
&nsScriptLoader::ProcessPendingRequests);
NS_DispatchToCurrentThread(ev);
}
}

Просмотреть файл

@ -273,7 +273,8 @@ nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument,
// that if we get unbound while the event is up that's ok -- we'll just
// have no grandparent when it fires, and will do nothing.
void (nsAttributeTextNode::*update)() = &nsAttributeTextNode::UpdateText;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update));
nsCOMPtr<nsIRunnable> ev = NS_NewRunnableMethod(this, update);
nsContentUtils::AddScriptRunner(ev);
}
}

9
dom/cache/Context.cpp поставляемый
Просмотреть файл

@ -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 =
NewRunnableMethod(this, &ThreadsafeHandle::AllowToCloseOnOwningThread);
NS_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 =
NewRunnableMethod(this, &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread);
NS_NewRunnableMethod(this, &ThreadsafeHandle::InvalidateAndAllowToCloseOnOwningThread);
MOZ_ALWAYS_SUCCEEDS(
mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
}
@ -780,7 +780,10 @@ Context::ThreadsafeHandle::~ThreadsafeHandle()
// Dispatch is guaranteed to succeed here because we block shutdown until
// all Contexts have been destroyed.
NS_ProxyRelease(mOwningThread, mStrongRef.forget());
nsCOMPtr<nsIRunnable> runnable =
NS_NewNonOwningRunnableMethod(mStrongRef.forget().take(), &Context::Release);
MOZ_ALWAYS_SUCCEEDS(
mOwningThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
}
void

6
dom/cache/Manager.cpp поставляемый
Просмотреть файл

@ -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 = NewNonOwningRunnableMethod<nsresult>(
nsCOMPtr<nsIRunnable> runnable = NS_NewNonOwningRunnableMethodWithArgs<nsresult>(
this, &CachePutAllAction::OnAsyncCopyComplete, aRv);
MOZ_ALWAYS_SUCCEEDS(
mTargetThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL));
@ -1761,7 +1761,9 @@ Manager::~Manager()
// Don't spin the event loop in the destructor waiting for the thread to
// shutdown. Defer this to the main thread, instead.
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod(ioThread, &nsIThread::Shutdown)));
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(ioThread, &nsIThread::Shutdown);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(runnable));
}
void

Просмотреть файл

@ -171,7 +171,9 @@ CameraPreviewMediaStream::SetCurrentFrame(const gfx::IntSize& aIntrinsicSize, Im
++mInvalidatePending;
}
NS_DispatchToMainThread(NewRunnableMethod(this, &CameraPreviewMediaStream::Invalidate));
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &CameraPreviewMediaStream::Invalidate);
NS_DispatchToMainThread(event);
}
void
@ -182,7 +184,9 @@ CameraPreviewMediaStream::ClearCurrentFrame()
for (nsTArray<RefPtr<VideoFrameContainer> >::size_type i = 0; i < mVideoOutputs.Length(); ++i) {
VideoFrameContainer* output = mVideoOutputs[i];
output->ClearCurrentFrame();
NS_DispatchToMainThread(NewRunnableMethod(output, &VideoFrameContainer::Invalidate));
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
NS_DispatchToMainThread(event);
}
}

Просмотреть файл

@ -73,8 +73,10 @@ public:
TrackID aInputTrackID) override
{
if (aTrackEvents & TRACK_EVENT_CREATED) {
aGraph->DispatchToMainThreadAfterStreamStateUpdate(NewRunnableMethod<TrackID>(
this, &TrackCreatedListener::DoNotifyTrackCreated, aID));
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethodWithArgs<TrackID>(
this, &TrackCreatedListener::DoNotifyTrackCreated, aID);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
}
}

Просмотреть файл

@ -233,11 +233,11 @@ CameraPermissionRequest::DispatchCallback(uint32_t aPermission)
{
nsCOMPtr<nsIRunnable> callbackRunnable;
if (aPermission == nsIPermissionManager::ALLOW_ACTION) {
callbackRunnable = NewRunnableMethod(this, &CameraPermissionRequest::CallAllow);
callbackRunnable = NS_NewRunnableMethod(this, &CameraPermissionRequest::CallAllow);
} else {
callbackRunnable = NewRunnableMethod(this, &CameraPermissionRequest::CallCancel);
callbackRunnable = NS_NewRunnableMethod(this, &CameraPermissionRequest::CallCancel);
}
return NS_DispatchToMainThread(callbackRunnable.forget());
return NS_DispatchToMainThread(callbackRunnable);
}
void

Просмотреть файл

@ -488,7 +488,7 @@ DeviceStorageStatics::AddListener(nsDOMDeviceStorage* aListener)
MOZ_ASSERT(sInstance->mInitialized);
if (sInstance->mListeners.IsEmpty()) {
NS_DispatchToMainThread(
NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Register));
NS_NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Register));
}
RefPtr<ListenerWrapper> wrapper =
@ -519,7 +519,7 @@ DeviceStorageStatics::RemoveListener(nsDOMDeviceStorage* aListener)
if (removed && sInstance->mListeners.IsEmpty()) {
NS_DispatchToMainThread(
NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Deregister));
NS_NewRunnableMethod(sInstance.get(), &DeviceStorageStatics::Deregister));
}
}

Просмотреть файл

@ -371,8 +371,9 @@ EventListenerService::NotifyAboutMainThreadListenerChangeInternal(dom::EventTarg
if (!mPendingListenerChanges) {
mPendingListenerChanges = nsArrayBase::Create();
NS_DispatchToCurrentThread(NewRunnableMethod(this,
&EventListenerService::NotifyPendingChanges));
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableMethod(this,
&EventListenerService::NotifyPendingChanges);
NS_DispatchToCurrentThread(runnable);
}
RefPtr<EventListenerChange> changes = mPendingListenerChangesSet.Get(aTarget);

Просмотреть файл

@ -83,7 +83,9 @@ FetchDriver::Fetch(FetchDriverObserver* aObserver)
MOZ_RELEASE_ASSERT(!mRequest->IsSynchronous(),
"Synchronous fetch not supported");
return NS_DispatchToCurrentThread(NewRunnableMethod(this, &FetchDriver::ContinueFetch));
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethod(this, &FetchDriver::ContinueFetch);
return NS_DispatchToCurrentThread(r);
}
nsresult

Просмотреть файл

@ -223,7 +223,7 @@ HTMLCanvasPrintState::Done()
mCanvas->InvalidateCanvas();
}
RefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
NS_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 =
NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
NS_NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
return NS_DispatchToCurrentThread(renderEvent);
}

Просмотреть файл

@ -618,7 +618,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// loading.
if (LoadingEnabled()) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage));
NS_NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage));
}
}
@ -825,7 +825,7 @@ HTMLImageElement::CopyInnerTo(Element* aDest)
if (!dest->InResponsiveMode() &&
dest->HasAttr(kNameSpaceID_None, nsGkAtoms::src)) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage));
NS_NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage));
}
}

Просмотреть файл

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

Просмотреть файл

@ -184,10 +184,10 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, update));
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, update));
void (HTMLLinkElement::*updateImport)() = &HTMLLinkElement::UpdateImport;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, updateImport));
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, updateImport));
CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded"));

Просмотреть файл

@ -842,8 +842,8 @@ void HTMLMediaElement::QueueLoadFromSourceTask()
{
ChangeDelayLoadStatus(true);
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_LOADING);
RefPtr<Runnable> r = NewRunnableMethod(this, &HTMLMediaElement::LoadFromSourceChildren);
RunInStableState(r);
RunInStableState(
NS_NewRunnableMethod(this, &HTMLMediaElement::LoadFromSourceChildren));
}
void HTMLMediaElement::QueueSelectResourceTask()
@ -853,8 +853,8 @@ void HTMLMediaElement::QueueSelectResourceTask()
return;
mHaveQueuedSelectResource = true;
ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE);
RefPtr<Runnable> r = NewRunnableMethod(this, &HTMLMediaElement::SelectResourceWrapper);
RunInStableState(r);
RunInStableState(
NS_NewRunnableMethod(this, &HTMLMediaElement::SelectResourceWrapper));
}
NS_IMETHODIMP HTMLMediaElement::Load()
@ -3186,9 +3186,9 @@ public:
{
nsCOMPtr<nsIRunnable> event;
if (aBlocked == BLOCKED) {
event = NewRunnableMethod(this, &StreamListener::DoNotifyBlocked);
event = NS_NewRunnableMethod(this, &StreamListener::DoNotifyBlocked);
} else {
event = NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked);
event = NS_NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked);
}
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
}
@ -3197,7 +3197,7 @@ public:
{
if (event == EVENT_FINISHED) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &StreamListener::DoNotifyFinished);
NS_NewRunnableMethod(this, &StreamListener::DoNotifyFinished);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
}
}
@ -3205,7 +3205,7 @@ public:
{
MutexAutoLock lock(mMutex);
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData);
NS_NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
}
virtual void NotifyOutput(MediaStreamGraph* aGraph,
@ -3216,7 +3216,7 @@ public:
return;
mPendingNotifyOutput = true;
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &StreamListener::DoNotifyOutput);
NS_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 =
NewRunnableMethod<gfx::IntSize>(
NS_NewRunnableMethodWithArgs<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 =
NewRunnableMethod(this, &HTMLMediaElement::DoRemoveSelfReference);
NS_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(NewRunnableMethod(this, start));
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, start));
}
return NS_OK;

Просмотреть файл

@ -153,7 +153,7 @@ HTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
if (mIsDoneAddingChildren && !pluginDoc) {
void (HTMLSharedObjectElement::*start)() =
&HTMLSharedObjectElement::StartObjectLoad;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, start));
nsContentUtils::AddScriptRunner(NS_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(NewRunnableMethod(this, update));
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, update));
return rv;
}

Просмотреть файл

@ -260,8 +260,8 @@ HTMLTrackElement::BindToTree(nsIDocument* aDocument,
media->NotifyAddedSource();
LOG(LogLevel::Debug, ("Track element sent notification to parent."));
RefPtr<Runnable> r = NewRunnableMethod(this, &HTMLTrackElement::LoadResource);
mMediaParent->RunInStableState(r);
mMediaParent->RunInStableState(
NS_NewRunnableMethod(this, &HTMLTrackElement::LoadResource));
}
return NS_OK;
@ -314,7 +314,7 @@ void
HTMLTrackElement::DispatchTrackRunnable(const nsString& aEventName)
{
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod
NS_NewRunnableMethodWithArg
<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 =
NewRunnableMethod(this, &ImageDocument::OnHasTransparency);
NS_NewRunnableMethod(this, &ImageDocument::OnHasTransparency);
nsContentUtils::AddScriptRunner(runnable);
}
@ -554,7 +554,7 @@ ImageDocument::OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage)
aImage->GetHeight(&mImageHeight);
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod(this, &ImageDocument::DefaultCheckOverflowing);
NS_NewRunnableMethod(this, &ImageDocument::DefaultCheckOverflowing);
nsContentUtils::AddScriptRunner(runnable);
UpdateTitleAndCharset();

Просмотреть файл

@ -2505,7 +2505,7 @@ nsHTMLDocument::MaybeEditingStateChanged()
EditingStateChanged();
} else if (!mInDestructor) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsHTMLDocument::MaybeEditingStateChanged));
NS_NewRunnableMethod(this, &nsHTMLDocument::MaybeEditingStateChanged));
}
}
}

Просмотреть файл

@ -11823,7 +11823,7 @@ ConnectionPool::ShutdownThread(ThreadInfo& aThreadInfo)
MOZ_ALWAYS_SUCCEEDS(thread->Dispatch(runnable, NS_DISPATCH_NORMAL));
nsCOMPtr<nsIRunnable> shutdownRunnable =
NewRunnableMethod(thread, &nsIThread::Shutdown);
NS_NewRunnableMethod(thread, &nsIThread::Shutdown);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(shutdownRunnable));
mTotalThreadCount--;
@ -13668,7 +13668,7 @@ Database::MaybeCloseConnection()
IsClosed() &&
mDirectoryLock) {
nsCOMPtr<nsIRunnable> callback =
NewRunnableMethod(this, &Database::ConnectionClosedCallback);
NS_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 =
NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback);
NS_NewRunnableMethod(this, &OpenDatabaseOp::ConnectionClosedCallback);
RefPtr<WaitForTransactionsHelper> helper =
new WaitForTransactionsHelper(mDatabaseId, callback);

Просмотреть файл

@ -87,7 +87,7 @@ private:
}
nsCOMPtr<nsIRunnable> destroyRunnable =
NewNonOwningRunnableMethod(this, &StreamWrapper::Destroy);
NS_NewNonOwningRunnableMethod(this, &StreamWrapper::Destroy);
MOZ_ALWAYS_SUCCEEDS(mOwningThread->Dispatch(destroyRunnable,
NS_DISPATCH_NORMAL));

Просмотреть файл

@ -1036,9 +1036,9 @@ IDBDatabase::DelayedMaybeExpireFileActors()
}
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<bool>(this,
&IDBDatabase::ExpireFileActors,
/* aExpireAll */ false);
NS_NewRunnableMethodWithArg<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 =
NewNonOwningRunnableMethod(doomedSupports, &nsISupports::Release);
NS_NewNonOwningRunnableMethod(doomedSupports, &nsISupports::Release);
MOZ_ASSERT(releaseRunnable);
if (aTarget) {
@ -1600,7 +1600,11 @@ private:
NS_WARN_IF_FALSE(NS_SUCCEEDED(stream->Close()), "Failed to close stream!");
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod(ioTarget, &nsIThread::Shutdown)));
nsCOMPtr<nsIRunnable> shutdownRunnable =
NS_NewRunnableMethod(ioTarget, &nsIThread::Shutdown);
MOZ_ASSERT(shutdownRunnable);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(shutdownRunnable));
return NS_OK;
}
@ -2134,7 +2138,7 @@ RemoteBlobImpl::Destroy()
}
nsCOMPtr<nsIRunnable> destroyRunnable =
NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
NS_NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
if (mActorTarget) {
destroyRunnable =
@ -2562,7 +2566,7 @@ RemoteBlobImpl::Destroy()
}
nsCOMPtr<nsIRunnable> destroyRunnable =
NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
NS_NewNonOwningRunnableMethod(this, &RemoteBlobImpl::Destroy);
if (mActorTarget) {
destroyRunnable =
@ -3418,7 +3422,7 @@ BlobChild::NoteDyingRemoteBlobImpl()
// on the owning thread, so we proxy here if necessary.
if (!IsOnOwningThread()) {
nsCOMPtr<nsIRunnable> runnable =
NewNonOwningRunnableMethod(this, &BlobChild::NoteDyingRemoteBlobImpl);
NS_NewNonOwningRunnableMethod(this, &BlobChild::NoteDyingRemoteBlobImpl);
if (mEventTarget) {
runnable = new CancelableRunnableWrapper(runnable, mEventTarget);
@ -3997,7 +4001,7 @@ BlobParent::NoteDyingRemoteBlobImpl()
// on the main thread, so we proxy here if necessary.
if (!IsOnOwningThread()) {
nsCOMPtr<nsIRunnable> runnable =
NewNonOwningRunnableMethod(this, &BlobParent::NoteDyingRemoteBlobImpl);
NS_NewNonOwningRunnableMethod(this, &BlobParent::NoteDyingRemoteBlobImpl);
if (mEventTarget) {
runnable = new CancelableRunnableWrapper(runnable, mEventTarget);

Просмотреть файл

@ -34,7 +34,8 @@ ContentBridgeChild::~ContentBridgeChild()
void
ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
{
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy));
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeChild::DeferredDestroy);
MessageLoop::current()->PostTask(runnable.forget());
}
/*static*/ ContentBridgeChild*

Просмотреть файл

@ -37,7 +37,8 @@ ContentBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
if (os) {
os->RemoveObserver(this, "content-child-shutdown");
}
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy));
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeParent::DeferredDestroy);
MessageLoop::current()->PostTask(runnable.forget());
}
/*static*/ ContentBridgeParent*
@ -167,7 +168,8 @@ ContentBridgeParent::NotifyTabDestroyed()
{
int32_t numLiveTabs = ManagedPBrowserParent().Count();
if (numLiveTabs == 1) {
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ContentBridgeParent::Close));
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &ContentBridgeParent::Close);
MessageLoop::current()->PostTask(runnable.forget());
}
}

Просмотреть файл

@ -81,7 +81,7 @@ protected:
void Close()
{
// Trick NewRunnableMethod
// Trick NS_NewRunnableMethod
PContentBridgeParent::Close();
}

Просмотреть файл

@ -2177,10 +2177,10 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
// Destroy any processes created by this ContentParent
for(uint32_t i = 0; i < childIDArray.Length(); i++) {
ContentParent* cp = cpm->GetContentProcessById(childIDArray[i]);
MessageLoop::current()->PostTask(NewRunnableMethod
<ShutDownMethod>(cp,
&ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ShutDownMethod>(cp, &ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE);
MessageLoop::current()->PostTask(runnable.forget());
}
cpm->RemoveContentProcess(this->ChildID());
@ -2261,10 +2261,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.
MessageLoop::current()->PostTask(NewRunnableMethod
<ShutDownMethod>(this,
&ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE));
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<ShutDownMethod>(this, &ContentParent::ShutDownProcess,
SEND_SHUTDOWN_MESSAGE);
MessageLoop::current()->PostTask(runnable.forget());
}
}

Просмотреть файл

@ -204,8 +204,9 @@ PreallocatedProcessManagerImpl::AllocateAfterDelay()
return;
}
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateOnIdle);
MessageLoop::current()->PostDelayedTask(
NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateOnIdle),
runnable.forget(),
Preferences::GetUint("dom.ipc.processPrelaunch.delayMs",
DEFAULT_ALLOCATE_DELAY));
}
@ -217,7 +218,8 @@ PreallocatedProcessManagerImpl::AllocateOnIdle()
return;
}
MessageLoop::current()->PostIdleTask(NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow));
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow);
MessageLoop::current()->PostIdleTask(runnable.forget());
}
void

Просмотреть файл

@ -287,7 +287,8 @@ 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.
MonitorLoop()->PostTask(NewNonOwningRunnableMethod(this, &HangMonitorChild::ShutdownOnThread));
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &HangMonitorChild::ShutdownOnThread);
MonitorLoop()->PostTask(runnable.forget());
}
bool
@ -373,10 +374,14 @@ HangMonitorChild::NotifySlowScript(nsITabChild* aTabChild,
}
nsAutoCString filename(aFileName);
MonitorLoop()->PostTask(NewNonOwningRunnableMethod
<TabId, nsCString, unsigned>(this,
&HangMonitorChild::NotifySlowScriptAsync,
id, filename, aLineNo));
RefPtr<Runnable> runnable =
NS_NewNonOwningRunnableMethodWithArgs<TabId,
nsCString,
unsigned>(this,
&HangMonitorChild::NotifySlowScriptAsync,
id, filename, aLineNo);
MonitorLoop()->PostTask(runnable.forget());
return SlowScriptAction::Continue;
}
@ -404,9 +409,11 @@ HangMonitorChild::NotifyPluginHang(uint32_t aPluginId)
mSentReport = true;
// bounce to background thread
MonitorLoop()->PostTask(NewNonOwningRunnableMethod<uint32_t>(this,
&HangMonitorChild::NotifyPluginHangAsync,
aPluginId));
RefPtr<Runnable> runnable =
NS_NewNonOwningRunnableMethodWithArgs<uint32_t>(this,
&HangMonitorChild::NotifyPluginHangAsync,
aPluginId);
MonitorLoop()->PostTask(runnable.forget());
}
void
@ -428,7 +435,8 @@ HangMonitorChild::ClearHang()
if (mSentReport) {
// bounce to background thread
MonitorLoop()->PostTask(NewNonOwningRunnableMethod(this, &HangMonitorChild::ClearHangAsync));
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &HangMonitorChild::ClearHangAsync);
MonitorLoop()->PostTask(runnable.forget());
MonitorAutoLock lock(mMonitor);
mSentReport = false;
@ -493,8 +501,8 @@ HangMonitorParent::Shutdown()
mProcess = nullptr;
}
MonitorLoop()->PostTask(NewNonOwningRunnableMethod(this,
&HangMonitorParent::ShutdownOnThread));
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &HangMonitorParent::ShutdownOnThread);
MonitorLoop()->PostTask(runnable.forget());
while (!mShutdownDone) {
mMonitor.Wait();
@ -814,8 +822,8 @@ HangMonitoredProcess::TerminateScript()
return NS_ERROR_UNEXPECTED;
}
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(NewNonOwningRunnableMethod(mActor,
&HangMonitorParent::TerminateScript));
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(mActor, &HangMonitorParent::TerminateScript);
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(runnable.forget());
return NS_OK;
}
@ -831,8 +839,8 @@ HangMonitoredProcess::BeginStartingDebugger()
return NS_ERROR_UNEXPECTED;
}
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(NewNonOwningRunnableMethod(mActor,
&HangMonitorParent::BeginStartingDebugger));
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(mActor, &HangMonitorParent::BeginStartingDebugger);
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(runnable.forget());
return NS_OK;
}
@ -848,8 +856,8 @@ HangMonitoredProcess::EndStartingDebugger()
return NS_ERROR_UNEXPECTED;
}
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(NewNonOwningRunnableMethod(mActor,
&HangMonitorParent::EndStartingDebugger));
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(mActor, &HangMonitorParent::EndStartingDebugger);
ProcessHangMonitor::Get()->MonitorLoop()->PostTask(runnable.forget());
return NS_OK;
}
@ -1027,13 +1035,14 @@ mozilla::CreateHangMonitorParent(ContentParent* aContentParent,
HangMonitoredProcess* process = new HangMonitoredProcess(parent, aContentParent);
parent->SetProcess(process);
monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
<mozilla::ipc::Transport*,
base::ProcessId,
MessageLoop*>(parent,
&HangMonitorParent::Open,
aTransport, aOtherPid,
XRE_GetIOMessageLoop()));
RefPtr<Runnable> runnable =
NS_NewNonOwningRunnableMethodWithArgs<mozilla::ipc::Transport*,
base::ProcessId,
MessageLoop*>(parent,
&HangMonitorParent::Open,
aTransport, aOtherPid,
XRE_GetIOMessageLoop());
monitor->MonitorLoop()->PostTask(runnable.forget());
return parent;
}
@ -1047,13 +1056,14 @@ mozilla::CreateHangMonitorChild(mozilla::ipc::Transport* aTransport,
ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
HangMonitorChild* child = new HangMonitorChild(monitor);
monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
<mozilla::ipc::Transport*,
base::ProcessId,
MessageLoop*>(child,
&HangMonitorChild::Open,
aTransport, aOtherPid,
XRE_GetIOMessageLoop()));
RefPtr<Runnable> runnable =
NS_NewNonOwningRunnableMethodWithArgs<mozilla::ipc::Transport*,
base::ProcessId,
MessageLoop*>(child,
&HangMonitorChild::Open,
aTransport, aOtherPid,
XRE_GetIOMessageLoop());
monitor->MonitorLoop()->PostTask(runnable.forget());
return child;
}

Просмотреть файл

@ -659,7 +659,8 @@ nsJSChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
method = &nsJSChannel::NotifyListener;
}
nsresult rv = NS_DispatchToCurrentThread(mozilla::NewRunnableMethod(this, method));
nsCOMPtr<nsIRunnable> ev = NS_NewRunnableMethod(this, method);
nsresult rv = NS_DispatchToCurrentThread(ev);
if (NS_FAILED(rv)) {
loadGroup->RemoveRequest(this, nullptr, rv);

Просмотреть файл

@ -74,9 +74,10 @@ protected:
public:
void DispatchUpdateEstimatedMediaDuration(int64_t aDuration)
{
NS_DispatchToMainThread(NewRunnableMethod<int64_t>(this,
&AbstractMediaDecoder::UpdateEstimatedMediaDuration,
aDuration));
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethodWithArg<int64_t>(this, &AbstractMediaDecoder::UpdateEstimatedMediaDuration,
aDuration);
NS_DispatchToMainThread(r);
}
virtual VideoFrameContainer* GetVideoFrameContainer() = 0;

Просмотреть файл

@ -191,13 +191,13 @@ public:
{
if (aTrackEvents & TRACK_EVENT_CREATED) {
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<TrackID, MediaSegment::Type, MediaStream*, TrackID>(
NS_NewRunnableMethodWithArgs<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 =
NewRunnableMethod<MediaStream*, TrackID>(
NS_NewRunnableMethodWithArgs<MediaStream*, TrackID>(
this, &OwnedStreamListener::DoNotifyTrackEnded,
aInputStream, aInputTrackID);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
@ -281,7 +281,7 @@ public:
{
if (aTrackEvents & TRACK_EVENT_ENDED) {
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<StorensRefPtrPassByPtr<MediaStream>, TrackID>(
NS_NewRunnableMethodWithArgs<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 =
NewRunnableMethod(this, &PlaybackStreamListener::DoNotifyFinishedTrackCreation);
NS_NewRunnableMethod(this, &PlaybackStreamListener::DoNotifyFinishedTrackCreation);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
}

Просмотреть файл

@ -85,7 +85,8 @@ MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
}
// Dispatch initialization that needs to happen on that task queue.
mTaskQueue->Dispatch(NewRunnableMethod(this, &MediaDecoderReader::InitializationTask));
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(this, &MediaDecoderReader::InitializationTask);
mTaskQueue->Dispatch(r.forget());
}
void

Просмотреть файл

@ -260,7 +260,7 @@ MediaDecoderReaderWrapper::ReleaseMediaResources()
{
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
nsCOMPtr<nsIRunnable> r =
NewRunnableMethod(mReader, &MediaDecoderReader::ReleaseMediaResources);
NS_NewRunnableMethod(mReader, &MediaDecoderReader::ReleaseMediaResources);
mReader->OwnerThread()->Dispatch(r.forget());
}
@ -269,7 +269,7 @@ MediaDecoderReaderWrapper::SetIdle()
{
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
nsCOMPtr<nsIRunnable> r =
NewRunnableMethod(mReader, &MediaDecoderReader::SetIdle);
NS_NewRunnableMethod(mReader, &MediaDecoderReader::SetIdle);
mReader->OwnerThread()->Dispatch(r.forget());
}
@ -278,7 +278,7 @@ MediaDecoderReaderWrapper::ResetDecode()
{
MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn());
nsCOMPtr<nsIRunnable> r =
NewRunnableMethod(mReader, &MediaDecoderReader::ResetDecode);
NS_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 = NewRunnableMethod<RefPtr<MediaDecoder>>(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<RefPtr<MediaDecoder>>(
this, &MediaDecoderStateMachine::InitializationTask, aDecoder);
mTaskQueue->Dispatch(r.forget());
@ -921,7 +921,8 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
nsresult rv = mReader->Init();
NS_ENSURE_SUCCESS(rv, rv);
OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaDecoderStateMachine::ReadMetadata));
r = NS_NewRunnableMethod(this, &MediaDecoderStateMachine::ReadMetadata);
OwnerThread()->Dispatch(r.forget());
return NS_OK;
}
@ -1095,7 +1096,7 @@ void MediaDecoderStateMachine::RecomputeDuration()
void
MediaDecoderStateMachine::DispatchSetDormant(bool aDormant)
{
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<bool>(
this, &MediaDecoderStateMachine::SetDormant, aDormant);
OwnerThread()->Dispatch(r.forget());
}
@ -2421,7 +2422,9 @@ MediaDecoderStateMachine::ScheduleStateMachine()
}
mDispatchedStateMachine = true;
OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaDecoderStateMachine::RunStateMachine));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::RunStateMachine);
OwnerThread()->Dispatch(task.forget());
}
void
@ -2680,7 +2683,7 @@ void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream,
MOZ_ASSERT(NS_IsMainThread());
DECODER_LOG("AddOutputStream aStream=%p!", aStream);
mOutputStreamManager->Add(aStream, aFinishWhenEnded);
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<bool>(
this, &MediaDecoderStateMachine::SetAudioCaptured, true);
OwnerThread()->Dispatch(r.forget());
}
@ -2691,7 +2694,7 @@ void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream)
DECODER_LOG("RemoveOutputStream=%p!", aStream);
mOutputStreamManager->Remove(aStream);
if (mOutputStreamManager->IsEmpty()) {
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<TrackType>(this, &MediaFormatReader::Update, aTrack));
NS_NewRunnableMethodWithArg<TrackType>(this, &MediaFormatReader::Update, aTrack));
OwnerThread()->Dispatch(task.forget());
}
@ -1288,7 +1288,7 @@ MediaFormatReader::Output(TrackType aTrack, MediaData* aSample)
}
RefPtr<nsIRunnable> task =
NewRunnableMethod<TrackType, MediaData*>(
NS_NewRunnableMethodWithArgs<TrackType, MediaData*>(
this, &MediaFormatReader::NotifyNewOutput, aTrack, aSample);
OwnerThread()->Dispatch(task.forget());
}
@ -1297,7 +1297,7 @@ void
MediaFormatReader::DrainComplete(TrackType aTrack)
{
RefPtr<nsIRunnable> task =
NewRunnableMethod<TrackType>(
NS_NewRunnableMethodWithArg<TrackType>(
this, &MediaFormatReader::NotifyDrainComplete, aTrack);
OwnerThread()->Dispatch(task.forget());
}
@ -1306,7 +1306,7 @@ void
MediaFormatReader::InputExhausted(TrackType aTrack)
{
RefPtr<nsIRunnable> task =
NewRunnableMethod<TrackType>(
NS_NewRunnableMethodWithArg<TrackType>(
this, &MediaFormatReader::NotifyInputExhausted, aTrack);
OwnerThread()->Dispatch(task.forget());
}
@ -1315,7 +1315,7 @@ void
MediaFormatReader::Error(TrackType aTrack)
{
RefPtr<nsIRunnable> task =
NewRunnableMethod<TrackType>(
NS_NewRunnableMethodWithArg<TrackType>(
this, &MediaFormatReader::NotifyError, aTrack);
OwnerThread()->Dispatch(task.forget());
}
@ -1435,7 +1435,9 @@ MediaFormatReader::Seek(SeekTarget aTarget, int64_t aUnused)
RefPtr<SeekPromise> p = mSeekPromise.Ensure(__func__);
OwnerThread()->Dispatch(NewRunnableMethod(this, &MediaFormatReader::AttemptSeek));
RefPtr<nsIRunnable> task(
NS_NewRunnableMethod(this, &MediaFormatReader::AttemptSeek));
OwnerThread()->Dispatch(task.forget());
return p;
}

Просмотреть файл

@ -82,7 +82,7 @@ public:
mDemuxOnly = aDemuxedOnly;
return;
}
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<bool>(
this, &MediaDecoderReader::SetDemuxOnly, aDemuxedOnly);
OwnerThread()->Dispatch(r.forget());
}

Просмотреть файл

@ -277,11 +277,11 @@ public:
switch (aEvent) {
case EVENT_FINISHED:
NS_DispatchToMainThread(
NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyFinished));
NS_NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyFinished));
break;
case EVENT_REMOVED:
NS_DispatchToMainThread(
NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyRemoved));
NS_NewRunnableMethod(this, &GetUserMediaCallbackMediaStreamListener::NotifyRemoved));
break;
case EVENT_HAS_DIRECT_LISTENERS:
NotifyDirectListeners(aGraph, true);

Просмотреть файл

@ -819,8 +819,10 @@ private:
new DispatchStartEventRunnable(this, NS_LITERAL_STRING("start")));
if (NS_FAILED(rv)) {
NS_DispatchToMainThread(NewRunnableMethod<nsresult>(mRecorder,
&MediaRecorder::NotifyError, rv));
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethodWithArg<nsresult>(mRecorder,
&MediaRecorder::NotifyError, rv);
NS_DispatchToMainThread(runnable);
}
if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this)))) {
MOZ_ASSERT(false, "NS_DispatchToMainThread EncoderErrorNotifierRunnable failed");

Просмотреть файл

@ -56,8 +56,9 @@ MediaResource::Destroy()
delete this;
return;
}
MOZ_ALWAYS_SUCCEEDS(
NS_DispatchToMainThread(NewNonOwningRunnableMethod(this, &MediaResource::Destroy)));
nsCOMPtr<nsIRunnable> destroyRunnable =
NS_NewNonOwningRunnableMethod(this, &MediaResource::Destroy);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(destroyRunnable));
}
NS_IMPL_ADDREF(MediaResource)
@ -870,7 +871,7 @@ ChannelMediaResource::CacheClientNotifyDataReceived()
return;
mDataReceivedEvent =
NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
NS_NewNonOwningRunnableMethod(this, &ChannelMediaResource::DoNotifyDataReceived);
NS_DispatchToMainThread(mDataReceivedEvent.get());
}

Просмотреть файл

@ -89,7 +89,7 @@ public:
const PrincipalHandle& aNewPrincipalHandle) override
{
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<StoreCopyPassByConstLRef<PrincipalHandle>>(
NS_NewRunnableMethodWithArgs<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(NewNonOwningRunnableMethod(this, &MediaTimer::Destroy),
NS_DISPATCH_NORMAL);
nsresult rv = thread->Dispatch(task, NS_DISPATCH_NORMAL);
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
(void) rv;
}
@ -97,8 +97,8 @@ MediaTimer::ScheduleUpdate()
}
mUpdateScheduled = true;
nsresult rv = mThread->Dispatch(NewRunnableMethod(this, &MediaTimer::Update),
NS_DISPATCH_NORMAL);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableMethod(this, &MediaTimer::Update);
nsresult rv = mThread->Dispatch(task, 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 =
NewRunnableMethod<bool>(this, &RtspMediaResource::NotifySuspend,
aIsSuspend);
NS_NewRunnableMethodWithArg<bool>(this, &RtspMediaResource::NotifySuspend,
aIsSuspend);
NS_DispatchToMainThread(runnable);
}

Просмотреть файл

@ -222,16 +222,16 @@ CDMCallbackProxy::SessionClosed(const nsCString& aSessionId)
}
if (keyStatusesChange) {
nsCOMPtr<nsIRunnable> task;
task = NewRunnableMethod<nsString>(mProxy,
task = NS_NewRunnableMethodWithArg<nsString>(mProxy,
&CDMProxy::OnKeyStatusesChange,
NS_ConvertUTF8toUTF16(aSessionId));
NS_DispatchToMainThread(task);
}
nsCOMPtr<nsIRunnable> task;
task = NewRunnableMethod<nsString>(mProxy,
&CDMProxy::OnSessionClosed,
NS_ConvertUTF8toUTF16(aSessionId));
task = NS_NewRunnableMethodWithArg<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 = NewRunnableMethod<nsString>(mProxy,
&CDMProxy::OnKeyStatusesChange,
NS_ConvertUTF8toUTF16(aSessionId));
task = NS_NewRunnableMethodWithArg<nsString>(mProxy,
&CDMProxy::OnKeyStatusesChange,
NS_ConvertUTF8toUTF16(aSessionId));
NS_DispatchToMainThread(task);
}
}
@ -325,7 +325,7 @@ void
CDMCallbackProxy::Terminated()
{
MOZ_ASSERT(mProxy->IsOnGMPThread());
nsCOMPtr<nsIRunnable> task = NewRunnableMethod(mProxy, &CDMProxy::Terminated);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableMethod(mProxy, &CDMProxy::Terminated);
NS_DispatchToMainThread(task);
}

Просмотреть файл

@ -83,9 +83,9 @@ CDMProxy::Init(PromiseId aPromiseId,
data->mGMPName = aGMPName;
data->mInPrivateBrowsing = aInPrivateBrowsing;
nsCOMPtr<nsIRunnable> task(
NewRunnableMethod<nsAutoPtr<InitData>>(this,
&CDMProxy::gmp_Init,
Move(data)));
NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<uint32_t>(this,
&CDMProxy::OnCDMCreated,
aData->mPromiseId));
NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<nsAutoPtr<CreateSessionData>>(this, &CDMProxy::gmp_CreateSession, data));
NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_LoadSession, data));
NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<nsAutoPtr<SetServerCertificateData>>(this, &CDMProxy::gmp_SetServerCertificate, data));
NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<nsAutoPtr<UpdateSessionData>>(this, &CDMProxy::gmp_UpdateSession, data));
NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_CloseSession, data));
NS_NewRunnableMethodWithArg<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(
NewRunnableMethod<nsAutoPtr<SessionOpData>>(this, &CDMProxy::gmp_RemoveSession, data));
NS_NewRunnableMethodWithArg<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(NewRunnableMethod(this, &CDMProxy::gmp_Shutdown));
nsCOMPtr<nsIRunnable> task(NS_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 = NewRunnableMethod<PromiseId>(this,
&CDMProxy::ResolvePromise,
aId);
task = NS_NewRunnableMethodWithArg<PromiseId>(this,
&CDMProxy::ResolvePromise,
aId);
NS_DispatchToMainThread(task);
}
}
@ -659,7 +659,7 @@ CDMProxy::Decrypt(MediaRawData* aSample)
RefPtr<DecryptPromise> promise(job->Ensure());
nsCOMPtr<nsIRunnable> task(
NewRunnableMethod<RefPtr<DecryptJob>>(this, &CDMProxy::gmp_Decrypt, job));
NS_NewRunnableMethodWithArg<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(NewRunnableMethod(toClose,
&GMPContentParent::Close));
NS_DispatchToCurrentThread(NS_NewRunnableMethod(toClose,
&GMPContentParent::Close));
}
}

Просмотреть файл

@ -79,7 +79,7 @@ private:
bool DeallocPGMPAudioDecoderParent(PGMPAudioDecoderParent* aActor) override;
void CloseIfUnused();
// Needed because NewRunnableMethod tried to use the class that the method
// Needed because NS_NewRunnableMethod tried to use the class that the method
// lives on to store the receiver, but PGMPContentParent isn't refcounted.
void Close()
{

Просмотреть файл

@ -171,10 +171,12 @@ GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult)
if (!ON_GMP_THREAD()) {
// We should run this whole method on the GMP thread since the buffer needs
// to be deleted after the SendDecrypted call.
mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod
<GMPBuffer*, GMPErr>(this,
&GMPDecryptorChild::Decrypted,
aBuffer, aResult));
RefPtr<Runnable> t =
NS_NewRunnableMethodWithArgs<GMPBuffer*,
GMPErr>(this,
&GMPDecryptorChild::Decrypted,
aBuffer, aResult);
mPlugin->GMPMessageLoop()->PostTask(t.forget());
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(NewRunnableMethod<RefPtr<GMPParent>>(
gmpThread->Dispatch(NS_NewRunnableMethodWithArg<RefPtr<GMPParent>>(
mService,
&GeckoMediaPluginServiceParent::PluginTerminated,
self),
@ -522,7 +522,7 @@ GMPParent::DeleteProcess()
mState = GMPStateClosing;
Close();
}
mProcess->Delete(NewRunnableMethod(this, &GMPParent::ChildTerminated));
mProcess->Delete(NS_NewRunnableMethod(this, &GMPParent::ChildTerminated));
LOGD("%s: Shut down process", __FUNCTION__);
mProcess = nullptr;
mState = GMPStateNotLoaded;

Просмотреть файл

@ -73,7 +73,8 @@ public:
// main thread tries to do a sync call back to the calling thread.
MOZ_ASSERT(!IsOnChildMainThread());
mMessageLoop->PostTask(NewRunnableMethod(this, &SyncRunnable::Run));
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(this, &SyncRunnable::Run);
mMessageLoop->PostTask(runnable.forget());
MonitorAutoLock lock(mMonitor);
while (!mDone) {
lock.Wait();
@ -121,7 +122,8 @@ RunOnMainThread(GMPTask* aTask)
}
RefPtr<Runnable> r = new Runnable(aTask);
sMainLoop->PostTask(NewRunnableMethod(r, &Runnable::Run));
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(r, &Runnable::Run);
sMainLoop->PostTask(runnable.forget());
return GMPNoErr;
}
@ -253,7 +255,8 @@ GMPThreadImpl::Post(GMPTask* aTask)
}
RefPtr<Runnable> r = new Runnable(aTask);
mThread.message_loop()->PostTask(NewRunnableMethod(r, &Runnable::Run));
RefPtr<mozilla::Runnable> runnable = NS_NewRunnableMethod(r, &Runnable::Run);
mThread.message_loop()->PostTask(runnable.forget());
}
void

Просмотреть файл

@ -78,7 +78,8 @@ void
GMPProcessParent::Delete(nsCOMPtr<nsIRunnable> aCallback)
{
mDeletedCallback = aCallback;
XRE_GetIOMessageLoop()->PostTask(NewNonOwningRunnableMethod(this, &GMPProcessParent::DoDelete));
RefPtr<mozilla::Runnable> task = NS_NewNonOwningRunnableMethod(this, &GMPProcessParent::DoDelete);
XRE_GetIOMessageLoop()->PostTask(task.forget());
}
void

Просмотреть файл

@ -326,16 +326,7 @@ GeckoMediaPluginService::ShutdownGMPThread()
}
nsresult
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)
GeckoMediaPluginService::GMPDispatch(nsIRunnable* event, uint32_t flags)
{
nsCOMPtr<nsIRunnable> r(event);
nsCOMPtr<nsIThread> thread;

Просмотреть файл

@ -90,7 +90,6 @@ 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(
NewRunnableMethod(this,
&GeckoMediaPluginServiceParent::UnloadPlugins),
NS_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(NewRunnableMethod(
return GMPDispatch(NS_NewRunnableMethod(
this, &GeckoMediaPluginServiceParent::ClearStorage));
}
@ -503,7 +503,7 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
if (NS_FAILED(rv)) {
return rv;
}
return GMPDispatch(NewRunnableMethod<PRTime>(
return GMPDispatch(NS_NewRunnableMethodWithArg<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(NewRunnableMethod(
nsCOMPtr<nsIRunnable> task(NS_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(NewRunnableMethod(
nsCOMPtr<nsIRunnable> task(NS_NewRunnableMethod(
this, &GeckoMediaPluginServiceParent::NotifySyncShutdownComplete));
NS_DispatchToMainThread(task);
}
@ -1749,7 +1749,7 @@ NS_IMETHODIMP
GeckoMediaPluginServiceParent::ForgetThisSite(const nsAString& aSite)
{
MOZ_ASSERT(NS_IsMainThread());
return GMPDispatch(NewRunnableMethod<nsCString>(
return GMPDispatch(NS_NewRunnableMethodWithArg<nsCString>(
this, &GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread,
NS_ConvertUTF16toUTF8(aSite)));
}

Просмотреть файл

@ -226,8 +226,8 @@ GMPVideoDecoderChild::Alloc(size_t aSize,
rv = CallNeedShmem(aSize, aMem);
--mNeedShmemIntrCount;
if (mPendingDecodeComplete) {
mPlugin->GMPMessageLoop()->PostTask(
NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete));
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &GMPVideoDecoderChild::RecvDecodingComplete);
mPlugin->GMPMessageLoop()->PostTask(runnable.forget());
}
#else
#ifdef GMP_SAFE_SHMEM

Просмотреть файл

@ -207,8 +207,8 @@ GMPVideoEncoderChild::Alloc(size_t aSize,
rv = CallNeedShmem(aSize, aMem);
--mNeedShmemIntrCount;
if (mPendingEncodeComplete) {
mPlugin->GMPMessageLoop()->PostTask(
NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete));
RefPtr<Runnable> runnable = NS_NewRunnableMethod(this, &GMPVideoEncoderChild::RecvEncodingComplete);
mPlugin->GMPMessageLoop()->PostTask(runnable.forget());
}
#else
#ifdef GMP_SAFE_SHMEM

Просмотреть файл

@ -36,8 +36,8 @@ private:
public:
void SetFinished()
{
NS_DispatchToMainThread(mozilla::NewNonOwningRunnableMethod(this,
&GMPTestMonitor::MarkFinished));
NS_DispatchToMainThread(NS_NewNonOwningRunnableMethod(this,
&GMPTestMonitor::MarkFinished));
}
private:

Просмотреть файл

@ -304,8 +304,8 @@ EnumerateGMPStorageDir(const nsACString& aDir, T&& aDirIter)
class GMPShutdownObserver : public nsIRunnable
, public nsIObserver {
public:
GMPShutdownObserver(already_AddRefed<nsIRunnable> aShutdownTask,
already_AddRefed<nsIRunnable> Continuation,
GMPShutdownObserver(nsIRunnable* aShutdownTask,
nsIRunnable* Continuation,
const nsACString& aNodeId)
: mShutdownTask(aShutdownTask)
, mContinuation(Continuation)
@ -371,7 +371,7 @@ public:
class ClearGMPStorageTask : public nsIRunnable
, public nsIObserver {
public:
ClearGMPStorageTask(already_AddRefed<nsIRunnable> Continuation,
ClearGMPStorageTask(nsIRunnable* Continuation,
nsIThread* aTarget, PRTime aSince)
: mContinuation(Continuation)
, mTarget(aTarget)
@ -421,11 +421,11 @@ private:
NS_IMPL_ISUPPORTS(ClearGMPStorageTask, nsIRunnable, nsIObserver)
static void
ClearGMPStorage(already_AddRefed<nsIRunnable> aContinuation,
ClearGMPStorage(nsIRunnable* aContinuation,
nsIThread* aTarget, PRTime aSince = -1)
{
RefPtr<ClearGMPStorageTask> task(
new ClearGMPStorageTask(Move(aContinuation), aTarget, aSince));
new ClearGMPStorageTask(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(NewRunnableMethod(this, aTestMethod), thread);
ClearGMPStorage(NS_NewRunnableMethod(this, aTestMethod), thread);
AwaitFinished();
}
@ -569,7 +569,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
EXPECT_TRUE(!PBnodeId2.Equals(nodeId2));
nsCOMPtr<nsIThread> thread(GetGMPThread());
ClearGMPStorage(NewRunnableMethod<nsCString>(
ClearGMPStorage(NS_NewRunnableMethodWithArg<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"),
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
NS_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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestForgetThisSite_AnotherSite);
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestForgetThisSite_CollectSiteInfo);
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
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(NewRunnableMethod<nsAutoPtr<NodeInfo>>(
NS_DispatchToMainThread(NS_NewRunnableMethodWithArg<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 = NewRunnableMethod<nsAutoPtr<NodeInfo>>(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethodWithArg<nsAutoPtr<NodeInfo>>(
this, &GMPStorageTest::TestForgetThisSite_Verify, aSiteInfo);
thread->Dispatch(r, NS_DISPATCH_NORMAL);
nsCOMPtr<nsIRunnable> f = NewRunnableMethod(
nsCOMPtr<nsIRunnable> f = NS_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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestClearRecentHistory1_Clear);
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestClearRecentHistory2_Clear);
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestClearRecentHistory3_Clear);
Expect(NS_LITERAL_CSTRING("test-storage complete"), r.forget());
Expect(NS_LITERAL_CSTRING("test-storage complete"), r);
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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestClearRecentHistory_CheckEmpty);
nsCOMPtr<nsIThread> t(GetGMPThread());
ClearGMPStorage(r.forget(), t, f.GetResult());
ClearGMPStorage(r, 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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestClearRecentHistory_CheckEmpty);
nsCOMPtr<nsIThread> t(GetGMPThread());
ClearGMPStorage(r.forget(), t, f.GetResult());
ClearGMPStorage(r, 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 = NewRunnableMethod(
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(
this, &GMPStorageTest::TestClearRecentHistory_CheckNonEmpty);
nsCOMPtr<nsIThread> t(GetGMPThread());
ClearGMPStorage(r.forget(), t, f.GetResult() + 1);
ClearGMPStorage(r, 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, NewRunnableMethod(this,
Expect(response, NS_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)"),
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
NS_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, NewRunnableMethod(this,
Expect(response, NS_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)"),
NewRunnableMethod(this,
NS_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)"),
NewRunnableMethod(this,
NS_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(
NewRunnableMethod<nsCOMPtr<nsIRunnable>>(
NS_NewRunnableMethodWithArg<nsCOMPtr<nsIRunnable>>(
this,
&GMPStorageTest::NextAsyncShutdownTimeoutTest,
NewRunnableMethod(this, aCallback)));
NS_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, NewRunnableMethod<nsCString>(this,
Expect(response, NS_NewRunnableMethodWithArg<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(NewRunnableMethod<nsCString>(this,
ShutdownThen(NS_NewRunnableMethodWithArg<nsCString>(this,
&GMPStorageTest::TestAsyncShutdownStorage_AsyncShutdownComplete, aToken));
}
@ -1137,7 +1137,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
nsCString response("retrieved shutdown-token ");
response.Append(aToken);
Expect(response,
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
NS_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"),
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
NS_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"),
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
NS_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);
nsCOMPtr<nsIRunnable> continuation;
nsIRunnable* continuation = nullptr;
if (i + 1 == num) {
continuation =
NewRunnableMethod(this, &GMPStorageTest::TestGetRecordNames_QueryNames);
NS_NewRunnableMethod(this, &GMPStorageTest::TestGetRecordNames_QueryNames);
}
Expect(response, continuation.forget());
Expect(response, continuation);
}
CreateDecryptor(NS_LITERAL_STRING("http://foo.com"),
@ -1223,7 +1223,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
nsCString response("record-names ");
response.Append(mRecordNames);
Expect(response,
NewRunnableMethod(this, &GMPStorageTest::SetFinished));
NS_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, NewRunnableMethod(this, &GMPStorageTest::SetFinished));
Expect(response, NS_NewRunnableMethod(this, &GMPStorageTest::SetFinished));
nsCString update("store ");
update.Append(longRecordName);
@ -1272,8 +1272,8 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
update);
}
void Expect(const nsCString& aMessage, already_AddRefed<nsIRunnable> aContinuation) {
mExpected.AppendElement(ExpectedMessage(aMessage, Move(aContinuation)));
void Expect(const nsCString& aMessage, nsIRunnable* aContinuation) {
mExpected.AppendElement(ExpectedMessage(aMessage, aContinuation));
}
void AwaitFinished() {
@ -1283,15 +1283,15 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
mFinished = false;
}
void ShutdownThen(already_AddRefed<nsIRunnable> aContinuation) {
void ShutdownThen(nsIRunnable* aContinuation) {
EXPECT_TRUE(!!mDecryptor);
if (!mDecryptor) {
return;
}
EXPECT_FALSE(mNodeId.IsEmpty());
RefPtr<GMPShutdownObserver> task(
new GMPShutdownObserver(NewRunnableMethod(this, &GMPStorageTest::Shutdown),
Move(aContinuation), mNodeId));
new GMPShutdownObserver(NS_NewRunnableMethod(this, &GMPStorageTest::Shutdown),
aContinuation, mNodeId));
NS_DispatchToMainThread(task, NS_DISPATCH_NORMAL);
}
@ -1309,7 +1309,7 @@ class GMPStorageTest : public GMPDecryptorProxyCallback
void SetFinished() {
mFinished = true;
Shutdown();
NS_DispatchToMainThread(NewRunnableMethod(this, &GMPStorageTest::Dummy));
NS_DispatchToMainThread(NS_NewRunnableMethod(this, &GMPStorageTest::Dummy));
}
void SessionMessage(const nsCString& aSessionId,
@ -1364,7 +1364,7 @@ private:
~GMPStorageTest() { }
struct ExpectedMessage {
ExpectedMessage(const nsCString& aMessage, already_AddRefed<nsIRunnable> aContinuation)
ExpectedMessage(const nsCString& aMessage, nsIRunnable* aContinuation)
: mMessage(aMessage)
, mContinuation(aContinuation)
{}
@ -1386,9 +1386,9 @@ GMPTestRunner::DoTest(void (GMPTestRunner::*aTestMethod)(GMPTestMonitor&))
nsCOMPtr<nsIThread> thread(GetGMPThread());
GMPTestMonitor monitor;
thread->Dispatch(NewRunnableMethod<GMPTestMonitor&>(this,
aTestMethod,
monitor),
thread->Dispatch(NS_NewRunnableMethodWithArg<GMPTestMonitor&>(this,
aTestMethod,
monitor),
NS_DISPATCH_NORMAL);
monitor.AwaitFinished();
}

Просмотреть файл

@ -260,7 +260,7 @@ GMPRemoveTest::CreateVideoDecoder(nsCString aNodeId)
GMPVideoDecoderProxy* decoder = nullptr;
mGMPThread->Dispatch(
NewNonOwningRunnableMethod<nsCString, GMPVideoDecoderProxy**, GMPVideoHost**>(
NS_NewNonOwningRunnableMethodWithArgs<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(
NewNonOwningRunnableMethod<const GMPVideoCodec&, const nsTArray<uint8_t>&, GMPVideoDecoderCallbackProxy*, int32_t>(
NS_NewNonOwningRunnableMethodWithArgs<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(
NewNonOwningRunnableMethod(mDecoder, &GMPVideoDecoderProxy::Close),
NS_NewNonOwningRunnableMethod(mDecoder, &GMPVideoDecoderProxy::Close),
NS_DISPATCH_SYNC);
mDecoder = nullptr;
@ -345,7 +345,7 @@ GMPErr
GMPRemoveTest::Decode()
{
mGMPThread->Dispatch(
NewNonOwningRunnableMethod(this, &GMPRemoveTest::gmp_Decode),
NS_NewNonOwningRunnableMethod(this, &GMPRemoveTest::gmp_Decode),
NS_DISPATCH_NORMAL);
mTestMonitor.AwaitFinished();

Просмотреть файл

@ -43,8 +43,8 @@ public:
void Init() {
nsCOMPtr<nsIThread> thread;
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &TestBinding::ReadMetadata);
nsresult rv = NS_NewThread(getter_AddRefs(thread), r);
nsresult rv = NS_NewThread(getter_AddRefs(thread),
NS_NewRunnableMethod(this, &TestBinding::ReadMetadata));
EXPECT_EQ(NS_OK, rv);
thread->Shutdown();
}
@ -54,7 +54,7 @@ private:
{
{
RefPtr<TaskQueue> queue = reader->OwnerThread();
nsCOMPtr<nsIRunnable> task = NewRunnableMethod(reader, &MP4Reader::Shutdown);
nsCOMPtr<nsIRunnable> task = NS_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 =
NewRunnableMethod(this, &DecodedStreamGraphListener::DoNotifyFinished);
NS_NewRunnableMethod(this, &DecodedStreamGraphListener::DoNotifyFinished);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
}
}
@ -99,9 +99,9 @@ UpdateStreamSuspended(MediaStream* aStream, bool aBlocking)
} else {
nsCOMPtr<nsIRunnable> r;
if (aBlocking) {
r = NewRunnableMethod(aStream, &MediaStream::Suspend);
r = NS_NewRunnableMethod(aStream, &MediaStream::Suspend);
} else {
r = NewRunnableMethod(aStream, &MediaStream::Resume);
r = NS_NewRunnableMethod(aStream, &MediaStream::Resume);
}
AbstractThread::MainThread()->Dispatch(r.forget());
}

Просмотреть файл

@ -177,7 +177,7 @@ void
MediaSourceDemuxer::AttachSourceBuffer(TrackBuffersManager* aSourceBuffer)
{
nsCOMPtr<nsIRunnable> task =
NewRunnableMethod<TrackBuffersManager*>(
NS_NewRunnableMethodWithArg<TrackBuffersManager*>(
this, &MediaSourceDemuxer::DoAttachSourceBuffer,
aSourceBuffer);
GetTaskQueue()->Dispatch(task.forget());
@ -195,7 +195,7 @@ void
MediaSourceDemuxer::DetachSourceBuffer(TrackBuffersManager* aSourceBuffer)
{
nsCOMPtr<nsIRunnable> task =
NewRunnableMethod<TrackBuffersManager*>(
NS_NewRunnableMethodWithArg<TrackBuffersManager*>(
this, &MediaSourceDemuxer::DoDetachSourceBuffer,
aSourceBuffer);
GetTaskQueue()->Dispatch(task.forget());

Просмотреть файл

@ -201,7 +201,9 @@ TrackBuffersManager::ProcessTasks()
NS_WARNING("Invalid Task");
}
}
GetTaskQueue()->Dispatch(NewRunnableMethod(this, &TrackBuffersManager::ProcessTasks));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &TrackBuffersManager::ProcessTasks);
GetTaskQueue()->Dispatch(task.forget());
}
// A PromiseHolder will assert upon destruction if it has a pending promise
@ -791,7 +793,9 @@ TrackBuffersManager::ScheduleSegmentParserLoop()
if (mDetached) {
return;
}
GetTaskQueue()->Dispatch(NewRunnableMethod(this, &TrackBuffersManager::SegmentParserLoop));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &TrackBuffersManager::SegmentParserLoop);
GetTaskQueue()->Dispatch(task.forget());
}
void
@ -967,10 +971,11 @@ 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
AbstractThread::MainThread()->Dispatch(NewRunnableMethod<int64_t>
(mParentDecoder,
&MediaSourceDecoder::SetInitialDuration,
duration ? duration : -1));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethodWithArg<int64_t>(mParentDecoder,
&MediaSourceDecoder::SetInitialDuration,
duration ? duration : -1);
AbstractThread::MainThread()->Dispatch(task.forget());
// 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 =
NewRunnableMethod<MediaDecoderEventVisibility>(
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
mObserver,
&MediaDecoder::SeekingStarted,
mSeekTarget.mEventVisibility);
@ -425,14 +425,16 @@ void AudioOffloadPlayer::NotifyAudioEOS()
MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility);
mSeekPromise.Resolve(val, __func__);
}
NS_DispatchToMainThread(NewRunnableMethod(mObserver,
&MediaDecoder::PlaybackEnded));
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
&MediaDecoder::PlaybackEnded);
NS_DispatchToMainThread(nsEvent);
}
void AudioOffloadPlayer::NotifyPositionChanged()
{
NS_DispatchToMainThread(NewRunnableMethod(mObserver,
&MediaOmxCommonDecoder::NotifyOffloadPlayerPositionChanged));
nsCOMPtr<nsIRunnable> nsEvent =
NS_NewRunnableMethod(mObserver, &MediaOmxCommonDecoder::NotifyOffloadPlayerPositionChanged);
NS_DispatchToMainThread(nsEvent);
}
void AudioOffloadPlayer::NotifyAudioTearDown()
@ -446,8 +448,9 @@ void AudioOffloadPlayer::NotifyAudioTearDown()
MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility);
mSeekPromise.Resolve(val, __func__);
}
NS_DispatchToMainThread(NewRunnableMethod(mObserver,
&MediaOmxCommonDecoder::AudioOffloadTearDown));
nsCOMPtr<nsIRunnable> nsEvent = NS_NewRunnableMethod(mObserver,
&MediaOmxCommonDecoder::AudioOffloadTearDown);
NS_DispatchToMainThread(nsEvent);
}
// static

Просмотреть файл

@ -132,9 +132,11 @@ OpusDataDecoder::DecodeHeader(const unsigned char* aData, size_t aLength)
nsresult
OpusDataDecoder::Input(MediaRawData* aSample)
{
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
this, &OpusDataDecoder::Decode,
RefPtr<MediaRawData>(aSample)));
nsCOMPtr<nsIRunnable> runnable(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this, &OpusDataDecoder::Decode,
RefPtr<MediaRawData>(aSample)));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}
@ -307,7 +309,9 @@ OpusDataDecoder::DoDrain()
nsresult
OpusDataDecoder::Drain()
{
mTaskQueue->Dispatch(NewRunnableMethod(this, &OpusDataDecoder::DoDrain));
RefPtr<nsIRunnable> runnable(
NS_NewRunnableMethod(this, &OpusDataDecoder::DoDrain));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}

Просмотреть файл

@ -186,9 +186,11 @@ VPXDecoder::DecodeFrame(MediaRawData* aSample)
nsresult
VPXDecoder::Input(MediaRawData* aSample)
{
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
this, &VPXDecoder::DecodeFrame,
RefPtr<MediaRawData>(aSample)));
nsCOMPtr<nsIRunnable> runnable(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this, &VPXDecoder::DecodeFrame,
RefPtr<MediaRawData>(aSample)));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}
@ -202,7 +204,9 @@ VPXDecoder::DoDrain()
nsresult
VPXDecoder::Drain()
{
mTaskQueue->Dispatch(NewRunnableMethod(this, &VPXDecoder::DoDrain));
nsCOMPtr<nsIRunnable> runnable(
NS_NewRunnableMethod(this, &VPXDecoder::DoDrain));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}

Просмотреть файл

@ -129,9 +129,11 @@ VorbisDataDecoder::DecodeHeader(const unsigned char* aData, size_t aLength)
nsresult
VorbisDataDecoder::Input(MediaRawData* aSample)
{
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
this, &VorbisDataDecoder::Decode,
RefPtr<MediaRawData>(aSample)));
nsCOMPtr<nsIRunnable> runnable(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this, &VorbisDataDecoder::Decode,
RefPtr<MediaRawData>(aSample)));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}
@ -263,7 +265,9 @@ VorbisDataDecoder::DoDrain()
nsresult
VorbisDataDecoder::Drain()
{
mTaskQueue->Dispatch(NewRunnableMethod(this, &VorbisDataDecoder::DoDrain));
nsCOMPtr<nsIRunnable> runnable(
NS_NewRunnableMethod(this, &VorbisDataDecoder::DoDrain));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}

Просмотреть файл

@ -70,9 +70,11 @@ WaveDataDecoder::Init()
nsresult
WaveDataDecoder::Input(MediaRawData* aSample)
{
mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
this, &WaveDataDecoder::Decode,
RefPtr<MediaRawData>(aSample)));
nsCOMPtr<nsIRunnable> runnable(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this, &WaveDataDecoder::Decode,
RefPtr<MediaRawData>(aSample)));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}
@ -156,7 +158,9 @@ WaveDataDecoder::DoDrain()
nsresult
WaveDataDecoder::Drain()
{
mTaskQueue->Dispatch(NewRunnableMethod(this, &WaveDataDecoder::DoDrain));
nsCOMPtr<nsIRunnable> runnable(
NS_NewRunnableMethod(this, &WaveDataDecoder::DoDrain));
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}
@ -182,4 +186,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 = NewRunnableMethod<RefPtr<MediaRawData>>(mDecoder,
task = NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(mDecoder,
&MediaDataDecoder::Input,
RefPtr<MediaRawData>(mSamples[i]));
mSamples.RemoveElementAt(i);

Просмотреть файл

@ -58,7 +58,9 @@ MediaDataDecoderProxy::Flush()
mFlushComplete.Set(false);
mProxyThread->Dispatch(NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Flush));
nsCOMPtr<nsIRunnable> task;
task = NS_NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Flush);
mProxyThread->Dispatch(task.forget());
mFlushComplete.WaitUntil(true);
@ -71,7 +73,9 @@ MediaDataDecoderProxy::Drain()
MOZ_ASSERT(!IsOnProxyThread());
MOZ_ASSERT(!mIsShutdown);
mProxyThread->Dispatch(NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Drain));
nsCOMPtr<nsIRunnable> task;
task = NS_NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Drain);
mProxyThread->Dispatch(task.forget());
return NS_OK;
}
@ -83,9 +87,9 @@ MediaDataDecoderProxy::Shutdown()
#if defined(DEBUG)
mIsShutdown = true;
#endif
nsresult rv = mProxyThread->AsXPCOMThread()->Dispatch(NewRunnableMethod(mProxyDecoder,
&MediaDataDecoder::Shutdown),
NS_DISPATCH_SYNC);
nsCOMPtr<nsIRunnable> task;
task = NS_NewRunnableMethod(mProxyDecoder, &MediaDataDecoder::Shutdown);
nsresult rv = mProxyThread->AsXPCOMThread()->Dispatch(task, NS_DISPATCH_SYNC);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}

Просмотреть файл

@ -389,8 +389,9 @@ MediaCodecDataDecoder::InitDecoder(Surface::Param aSurface)
NS_ENSURE_SUCCESS(rv = ResetInputBuffers(), rv);
NS_ENSURE_SUCCESS(rv = ResetOutputBuffers(), rv);
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop);
rv = NS_NewNamedThread("MC Decoder", getter_AddRefs(mThread), r);
rv = NS_NewNamedThread(
"MC Decoder", getter_AddRefs(mThread),
NS_NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop));
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 =
NewRunnableMethod<RefPtr<MediaRawData>>(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this,
&AppleATDecoder::SubmitSample,
RefPtr<MediaRawData>(aSample));

Просмотреть файл

@ -100,7 +100,7 @@ AppleVDADecoder::Shutdown()
mIsShutDown = true;
if (mTaskQueue) {
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod(this, &AppleVDADecoder::ProcessShutdown);
NS_NewRunnableMethod(this, &AppleVDADecoder::ProcessShutdown);
mTaskQueue->Dispatch(runnable.forget());
} else {
ProcessShutdown();
@ -133,7 +133,7 @@ AppleVDADecoder::Input(MediaRawData* aSample)
mInputIncoming++;
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<RefPtr<MediaRawData>>(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this,
&AppleVDADecoder::SubmitFrame,
RefPtr<MediaRawData>(aSample));
@ -148,7 +148,7 @@ AppleVDADecoder::Flush()
mIsFlushing = true;
mTaskQueue->Flush();
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod(this, &AppleVDADecoder::ProcessFlush);
NS_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 =
NewRunnableMethod(this, &AppleVDADecoder::ProcessDrain);
NS_NewRunnableMethod(this, &AppleVDADecoder::ProcessDrain);
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}

Просмотреть файл

@ -107,7 +107,7 @@ AppleVTDecoder::Input(MediaRawData* aSample)
mInputIncoming++;
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<RefPtr<MediaRawData>>(
NS_NewRunnableMethodWithArg<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(NewRunnableMethod<RefPtr<MediaRawData>>(
nsCOMPtr<nsIRunnable> runnable(NS_NewRunnableMethodWithArg<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 =
NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessShutdown);
NS_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 =
NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessFlush);
NS_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 =
NewRunnableMethod(this, &FFmpegDataDecoder<LIBAV_VER>::ProcessDrain);
NS_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(
NewRunnableMethod<RefPtr<MediaRawData>>(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this, &FFmpegVideoDecoder<LIBAV_VER>::DecodeFrame,
RefPtr<MediaRawData>(aSample)));
mTaskQueue->Dispatch(runnable.forget());

Просмотреть файл

@ -114,7 +114,9 @@ OmxDataDecoder::OmxDataDecoder(const TrackInfo& aTrackInfo,
LOG("");
mOmxLayer = new OmxPromiseLayer(mOmxTaskQueue, this, aImageContainer);
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::InitializationTask));
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethod(this, &OmxDataDecoder::InitializationTask);
mOmxTaskQueue->Dispatch(r.forget());
}
OmxDataDecoder::~OmxDataDecoder()
@ -207,7 +209,9 @@ OmxDataDecoder::Flush()
mFlushing = true;
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::DoFlush));
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethod(this, &OmxDataDecoder::DoFlush);
mOmxTaskQueue->Dispatch(r.forget());
// According to the definition of Flush() in PDM:
// "the decoder must be ready to accept new input for decoding".
@ -225,7 +229,9 @@ OmxDataDecoder::Drain()
{
LOG("");
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::SendEosBuffer));
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethod(this, &OmxDataDecoder::SendEosBuffer);
mOmxTaskQueue->Dispatch(r.forget());
return NS_OK;
}
@ -237,7 +243,9 @@ OmxDataDecoder::Shutdown()
mShuttingDown = true;
mOmxTaskQueue->Dispatch(NewRunnableMethod(this, &OmxDataDecoder::DoAsyncShutdown));
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableMethod(this, &OmxDataDecoder::DoAsyncShutdown);
mOmxTaskQueue->Dispatch(r.forget());
{
// DoAsyncShutdown() will be running for a while, it could be still running

Просмотреть файл

@ -79,7 +79,9 @@ WMFMediaDataDecoder::Shutdown()
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
if (mTaskQueue) {
mTaskQueue->Dispatch(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown));
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessShutdown);
mTaskQueue->Dispatch(runnable.forget());
} else {
ProcessShutdown();
}
@ -107,7 +109,7 @@ WMFMediaDataDecoder::Input(MediaRawData* aSample)
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<RefPtr<MediaRawData>>(
NS_NewRunnableMethodWithArg<RefPtr<MediaRawData>>(
this,
&WMFMediaDataDecoder::ProcessDecode,
RefPtr<MediaRawData>(aSample));
@ -183,9 +185,11 @@ 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(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessFlush));
mTaskQueue->Dispatch(runnable.forget());
while (mIsFlushing) {
mon.Wait();
}
@ -215,7 +219,9 @@ WMFMediaDataDecoder::Drain()
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
MOZ_DIAGNOSTIC_ASSERT(!mIsShutDown);
mTaskQueue->Dispatch(NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessDrain));
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(this, &WMFMediaDataDecoder::ProcessDrain);
mTaskQueue->Dispatch(runnable.forget());
return NS_OK;
}
@ -232,7 +238,7 @@ WMFMediaDataDecoder::ConfigurationChanged(const TrackInfo& aConfig)
MOZ_ASSERT(mCallback->OnReaderTaskQueue());
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod<UniquePtr<TrackInfo>&&>(
NS_NewRunnableMethodWithArg<UniquePtr<TrackInfo>&&>(
this,
&WMFMediaDataDecoder::ProcessConfigurationChanged,
aConfig.Clone());

Просмотреть файл

@ -136,7 +136,7 @@ DecoderCallbackFuzzingWrapper::Output(MediaData* aData)
{
if (!mTaskQueue->IsCurrentThreadIn()) {
nsCOMPtr<nsIRunnable> task =
NewRunnableMethod<StorensRefPtrPassByPtr<MediaData>>(
NS_NewRunnableMethodWithArg<StorensRefPtrPassByPtr<MediaData>>(
this, &DecoderCallbackFuzzingWrapper::Output, aData);
mTaskQueue->Dispatch(task.forget());
return;
@ -176,7 +176,9 @@ void
DecoderCallbackFuzzingWrapper::Error()
{
if (!mTaskQueue->IsCurrentThreadIn()) {
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::Error));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::Error);
mTaskQueue->Dispatch(task.forget());
return;
}
CFW_LOGV("");
@ -189,7 +191,9 @@ void
DecoderCallbackFuzzingWrapper::InputExhausted()
{
if (!mTaskQueue->IsCurrentThreadIn()) {
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::InputExhausted));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::InputExhausted);
mTaskQueue->Dispatch(task.forget());
return;
}
if (!mDontDelayInputExhausted && !mDelayedOutput.empty()) {
@ -208,7 +212,9 @@ void
DecoderCallbackFuzzingWrapper::DrainComplete()
{
if (!mTaskQueue->IsCurrentThreadIn()) {
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::DrainComplete));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::DrainComplete);
mTaskQueue->Dispatch(task.forget());
return;
}
MOZ_ASSERT(mCallback);
@ -227,7 +233,9 @@ void
DecoderCallbackFuzzingWrapper::ReleaseMediaResources()
{
if (!mTaskQueue->IsCurrentThreadIn()) {
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ReleaseMediaResources));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ReleaseMediaResources);
mTaskQueue->Dispatch(task.forget());
return;
}
CFW_LOGV("");
@ -309,7 +317,9 @@ DecoderCallbackFuzzingWrapper::ClearDelayedOutput()
{
if (!mTaskQueue->IsCurrentThreadIn()) {
DFW_LOGV("(dispatching self)");
mTaskQueue->Dispatch(NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ClearDelayedOutput));
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableMethod(this, &DecoderCallbackFuzzingWrapper::ClearDelayedOutput);
mTaskQueue->Dispatch(task.forget());
return;
}
DFW_LOGV("");

Просмотреть файл

@ -198,11 +198,12 @@ MediaSystemResourceManager::Acquire(MediaSystemResourceClient* aClient)
return;
}
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_WAITING;
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod<uint32_t>(
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t>(
this,
&MediaSystemResourceManager::DoAcquire,
aClient->mId));
aClient->mId);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
}
bool
@ -241,11 +242,12 @@ MediaSystemResourceManager::AcquireSyncNoWait(MediaSystemResourceClient* aClient
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_WAITING;
}
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod<uint32_t>(
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t>(
this,
&MediaSystemResourceManager::DoAcquire,
aClient->mId));
aClient->mId);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
// should stop the thread until done.
while (!done) {
@ -308,11 +310,12 @@ MediaSystemResourceManager::ReleaseResource(MediaSystemResourceClient* aClient)
aClient->mResourceState = MediaSystemResourceClient::RESOURCE_STATE_END;
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod<uint32_t>(
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t>(
this,
&MediaSystemResourceManager::DoRelease,
aClient->mId));
aClient->mId);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
}
}
@ -336,12 +339,13 @@ void
MediaSystemResourceManager::HandleAcquireResult(uint32_t aId, bool aSuccess)
{
if (!InImageBridgeChildThread()) {
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(
NewRunnableMethod<uint32_t, bool>(
RefPtr<Runnable> runnable =
NS_NewRunnableMethodWithArgs<uint32_t, bool>(
this,
&MediaSystemResourceManager::HandleAcquireResult,
aId,
aSuccess));
aSuccess);
ImageBridgeChild::GetSingleton()->GetMessageLoop()->PostTask(runnable.forget());
return;
}

Просмотреть файл

@ -412,8 +412,9 @@ AudioDestinationNode::NotifyMainThreadStreamFinished()
MOZ_ASSERT(mStream->IsFinished());
if (mIsOffline) {
NS_DispatchToCurrentThread(NewRunnableMethod(this,
&AudioDestinationNode::FireOfflineCompletionEvent));
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(this, &AudioDestinationNode::FireOfflineCompletionEvent);
NS_DispatchToCurrentThread(runnable);
}
}
@ -657,10 +658,11 @@ 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(NewRunnableMethod(this,
&AudioDestinationNode::NotifyStableState));
nsContentUtils::RunInStableState(event.forget());
}
StreamTime

Просмотреть файл

@ -122,7 +122,7 @@ private:
mDecodeJob.OnFailure(aErrorCode);
} else {
// Take extra care to cleanup on the main thread
NS_DispatchToMainThread(NewRunnableMethod(this, &MediaDecodeTask::Cleanup));
NS_DispatchToMainThread(NS_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;
}
m_backgroundThread.message_loop()->PostTask(NewNonOwningRunnableMethod(this,
&ReverbConvolver::backgroundThreadEntry));
RefPtr<Runnable> runnable = NS_NewNonOwningRunnableMethod(this, &ReverbConvolver::backgroundThreadEntry);
m_backgroundThread.message_loop()->PostTask(runnable.forget());
}
}

Просмотреть файл

@ -61,12 +61,12 @@ public:
if (!mStarted) {
mStarted = true;
nsCOMPtr<nsIRunnable> startRunnable =
NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
NS_NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(startRunnable.forget());
}
nsCOMPtr<nsIRunnable> endRunnable =
NewRunnableMethod(this, &SynthStreamListener::DoNotifyFinished);
NS_NewRunnableMethod(this, &SynthStreamListener::DoNotifyFinished);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(endRunnable.forget());
}
break;
@ -85,7 +85,7 @@ public:
if (aBlocked == MediaStreamListener::UNBLOCKED && !mStarted) {
mStarted = true;
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &SynthStreamListener::DoNotifyStarted);
NS_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(
NewRunnableMethod(this, &nsPicoService::Init), NS_DISPATCH_NORMAL);
NS_NewRunnableMethod(this, &nsPicoService::Init), NS_DISPATCH_NORMAL);
}
// nsISpeechService
@ -579,7 +579,7 @@ nsPicoService::Init()
rv = dirIterator->HasMoreElements(&hasMoreElements);
}
NS_DispatchToMainThread(NewRunnableMethod(this, &nsPicoService::RegisterVoices));
NS_DispatchToMainThread(NS_NewRunnableMethod(this, &nsPicoService::RegisterVoices));
}
void

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше