Skip to content

Commit

Permalink
Backed out changeset 85ce8cb0639a (bug 1268313)
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Apr 29, 2016
1 parent b82e37d commit ef948a0
Show file tree
Hide file tree
Showing 237 changed files with 1,280 additions and 1,046 deletions.
6 changes: 4 additions & 2 deletions docshell/shistory/nsSHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dom/animation/Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion dom/archivereader/ArchiveEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion dom/base/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
}
else {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler));
NS_NewRunnableMethod(binding, &nsXBLBinding::ExecuteAttachedHandler));
}
}
}
Expand Down
21 changes: 16 additions & 5 deletions dom/base/EventSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dom/base/ScreenOrientation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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())) {
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsContentSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
17 changes: 5 additions & 12 deletions dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion dom/base/nsContentUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,6 @@ class nsContentUtils
* 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);

/**
Expand Down
14 changes: 7 additions & 7 deletions dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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,
Expand All @@ -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));
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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));
Expand All @@ -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;
}
Expand Down
20 changes: 10 additions & 10 deletions dom/base/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -4961,7 +4961,7 @@ nsDocument::MaybeEndOutermostXBLUpdate()
BindingManager()->EndOutermostUpdate();
} else if (!mInDestructor) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate));
NS_NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate));
}
}
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -7453,7 +7453,7 @@ nsDocument::MaybeInitializeFinalizeFrameLoaders()
(mInitializableFrameLoaders.Length() ||
mFrameLoaderFinalizers.Length())) {
mFrameLoaderRunner =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
return;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -12772,7 +12772,7 @@ nsDocument::GetVisibilityState() const
nsDocument::PostVisibilityUpdateEvent()
{
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
NS_NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
NS_DispatchToMainThread(event);
}

Expand Down Expand Up @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions dom/base/nsGlobalWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand All @@ -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));
}
}

Expand Down Expand Up @@ -11476,7 +11476,7 @@ class AutoUnblockScriptClosing
~AutoUnblockScriptClosing()
{
void (nsGlobalWindow::*run)() = &nsGlobalWindow::UnblockScriptedClosing;
NS_DispatchToCurrentThread(NewRunnableMethod(mWin, run));
NS_DispatchToCurrentThread(NS_NewRunnableMethod(mWin, run));
}
};

Expand Down
14 changes: 8 additions & 6 deletions dom/base/nsScriptLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
Loading

0 comments on commit ef948a0

Please sign in to comment.