mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1171785 use nsContentUtils::RunInStableState() r=bholley
This commit is contained in:
parent
171d831ed9
commit
dfec676114
@ -3441,16 +3441,14 @@ nsDOMWindowUtils::DispatchEventToChromeOnly(nsIDOMEventTarget* aTarget,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::RunInStableState(nsIRunnable *runnable)
|
||||
nsDOMWindowUtils::RunInStableState(nsIRunnable *aRunnable)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
|
||||
nsCOMPtr<nsIAppShell> appShell(do_GetService(kAppShellCID));
|
||||
if (!appShell) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> runnable = aRunnable;
|
||||
nsContentUtils::RunInStableState(runnable.forget());
|
||||
|
||||
return appShell->RunInStableState(runnable);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include "nsIURL.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsContainerFrame.h"
|
||||
@ -53,8 +51,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
static const char *kPrefSrcsetEnabled = "dom.image.srcset.enabled";
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Image)
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -882,15 +878,11 @@ HTMLImageElement::QueueImageLoadTask()
|
||||
return;
|
||||
}
|
||||
|
||||
// The task checks this to determine if it was the last queued event, so this
|
||||
// implicitly cancels earlier tasks
|
||||
mPendingImageLoadTask = new ImageLoadTask(this);
|
||||
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
|
||||
if (appShell) {
|
||||
appShell->RunInStableState(mPendingImageLoadTask);
|
||||
} else {
|
||||
MOZ_ASSERT(false, "expect appshell for HTMLImageElement");
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> task = new ImageLoadTask(this);
|
||||
// The task checks this to determine if it was the last
|
||||
// queued event, and so earlier tasks are implicitly canceled.
|
||||
mPendingImageLoadTask = task;
|
||||
nsContentUtils::RunInStableState(task.forget());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -61,8 +61,6 @@
|
||||
#include "Layers.h"
|
||||
#include <limits>
|
||||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsMediaFragmentURIParser.h"
|
||||
#include "nsURIHashKey.h"
|
||||
#include "nsJSUtils.h"
|
||||
@ -758,13 +756,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
void HTMLMediaElement::RunInStableState(nsIRunnable* aRunnable)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> event = new nsSyncSection(this, aRunnable);
|
||||
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
|
||||
appShell->RunInStableState(event);
|
||||
nsContentUtils::RunInStableState(event.forget());
|
||||
}
|
||||
|
||||
void HTMLMediaElement::QueueLoadFromSourceTask()
|
||||
|
@ -1704,9 +1704,11 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
attribute boolean paintFlashing;
|
||||
|
||||
/**
|
||||
* Allows running of a "synchronous section", in the form of an nsIRunnable
|
||||
* once the event loop has reached a "stable state". We've reached a stable
|
||||
* state when the currently executing task/event has finished, see:
|
||||
* Add a "synchronous section", in the form of an nsIRunnable run once the
|
||||
* event loop has reached a "stable state". |runnable| must not cause any
|
||||
* queued events to be processed (i.e. must not spin the event loop).
|
||||
* We've reached a stable state when the currently executing task/event has
|
||||
* finished, see:
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#synchronous-section
|
||||
* In practice this runs aRunnable once the currently executing event
|
||||
* finishes. If called multiple times per task/event, all the runnables will
|
||||
|
@ -10,8 +10,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "TaskDispatcher.h"
|
||||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
@ -24,8 +23,6 @@ namespace mozilla {
|
||||
StaticRefPtr<AbstractThread> sMainThread;
|
||||
ThreadLocal<AbstractThread*> AbstractThread::sCurrentThreadTLS;
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
class XPCOMThreadWrapper : public AbstractThread
|
||||
{
|
||||
public:
|
||||
@ -87,8 +84,7 @@ public:
|
||||
mTailDispatcher.emplace(/* aIsTailDispatcher = */ true);
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &XPCOMThreadWrapper::FireTailDispatcher);
|
||||
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
|
||||
appShell->RunInStableState(event);
|
||||
nsContentUtils::RunInStableState(event.forget());
|
||||
}
|
||||
|
||||
return mTailDispatcher.ref();
|
||||
|
@ -11,10 +11,7 @@
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/dom/CanvasCaptureMediaStreamBinding.h"
|
||||
#include "mozilla/dom/HTMLCanvasElement.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::gfx;
|
||||
@ -113,8 +110,7 @@ OutputStreamDriver::Start()
|
||||
// Run StartInternal() in stable state to allow it to directly capture a frame
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &OutputStreamDriver::StartInternal);
|
||||
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
|
||||
appShell->RunInStableState(runnable);
|
||||
nsContentUtils::RunInStableState(runnable.forget());
|
||||
|
||||
mStarted = true;
|
||||
return NS_OK;
|
||||
|
@ -10,11 +10,9 @@
|
||||
#include "AudioSegment.h"
|
||||
#include "VideoSegment.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "prerror.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -1839,8 +1837,6 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
|
||||
}
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
void
|
||||
MediaStreamGraphImpl::EnsureRunInStableState()
|
||||
{
|
||||
@ -1850,12 +1846,7 @@ MediaStreamGraphImpl::EnsureRunInStableState()
|
||||
return;
|
||||
mPostedRunInStableState = true;
|
||||
nsCOMPtr<nsIRunnable> event = new MediaStreamGraphStableStateRunnable(this, false);
|
||||
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
|
||||
if (appShell) {
|
||||
appShell->RunInStableState(event);
|
||||
} else {
|
||||
NS_ERROR("Appshell already destroyed?");
|
||||
}
|
||||
nsContentUtils::RunInStableState(event.forget());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -16,13 +16,12 @@
|
||||
#include "AudioNodeStream.h"
|
||||
#include "MediaStreamGraph.h"
|
||||
#include "OfflineAudioCompletionEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -684,17 +683,16 @@ AudioDestinationNode::NotifyStableState()
|
||||
mExtraCurrentTimeUpdatedSinceLastStableState = false;
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
void
|
||||
AudioDestinationNode::ScheduleStableStateNotification()
|
||||
{
|
||||
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
|
||||
if (appShell) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &AudioDestinationNode::NotifyStableState);
|
||||
appShell->RunInStableState(event);
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &AudioDestinationNode::NotifyStableState);
|
||||
// Dispatch will fail if this is called on AudioNode destruction during
|
||||
// shutdown, in which case failure can be ignored.
|
||||
nsContentUtils::RunInStableState(event.forget(),
|
||||
nsContentUtils::
|
||||
DispatchFailureHandling::IgnoreFailure);
|
||||
}
|
||||
|
||||
double
|
||||
|
Loading…
Reference in New Issue
Block a user