merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2017-06-27 10:56:41 +02:00
Родитель 808a742e3b b9099ac2ed
Коммит 4e00eff077
680 изменённых файлов: 7080 добавлений и 3945 удалений

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

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

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

@ -649,9 +649,12 @@ DocAccessible::ScrollPositionDidChange(nscoord aX, nscoord aY)
mScrollWatchTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mScrollWatchTimer) {
NS_ADDREF_THIS(); // Kung fu death grip
mScrollWatchTimer->InitWithFuncCallback(ScrollTimerCallback, this,
kScrollPosCheckWait,
nsITimer::TYPE_REPEATING_SLACK);
mScrollWatchTimer->InitWithNamedFuncCallback(
ScrollTimerCallback,
this,
kScrollPosCheckWait,
nsITimer::TYPE_REPEATING_SLACK,
"a11y::DocAccessible::ScrollPositionDidChange");
}
}
mScrollPositionChangedTicks = 1;
@ -2100,12 +2103,12 @@ DocAccessible::DoARIAOwnsRelocation(Accessible* aOwner)
// Same child on same position, no change.
if (child->Parent() == aOwner &&
child->IndexInParent() == static_cast<int32_t>(insertIdx)) {
NS_ASSERTION(child == children->ElementAt(arrayIdx), "Not in sync!");
MOZ_ASSERT(child == children->ElementAt(arrayIdx), "Not in sync!");
insertIdx++; arrayIdx++;
continue;
}
NS_ASSERTION(children->SafeElementAt(arrayIdx) != child, "Already in place!");
MOZ_ASSERT(children->SafeElementAt(arrayIdx) != child, "Already in place!");
nsTArray<RefPtr<Accessible> >::index_type idx = children->IndexOf(child);
if (idx < arrayIdx) {
@ -2202,8 +2205,10 @@ DocAccessible::MoveChild(Accessible* aChild, Accessible* aNewParent,
"child", aChild, nullptr);
#endif
// If the child was taken from from an ARIA owns element.
// Forget aria-owns info in case of ARIA owned element. The caller is expected
// to update it if needed.
if (aChild->IsRelocated()) {
aChild->SetRelocated(false);
nsTArray<RefPtr<Accessible> >* owned = mARIAOwnsHash.Get(curParent);
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(aChild);
@ -2320,6 +2325,7 @@ DocAccessible::UncacheChildrenInSubtree(Accessible* aRoot)
owned->RemoveElement(child);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(aRoot);
owned = nullptr;
}
}

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

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

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

@ -33,6 +33,7 @@
using namespace mozilla;
using namespace mozilla::a11y;
#define NSAccessibilityDOMIdentifierAttribute @"AXDOMIdentifier"
#define NSAccessibilityMathRootRadicandAttribute @"AXMathRootRadicand"
#define NSAccessibilityMathRootIndexAttribute @"AXMathRootIndex"
#define NSAccessibilityMathFractionNumeratorAttribute @"AXMathFractionNumerator"
@ -159,6 +160,7 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
- (NSArray*)additionalAccessibilityAttributeNames
{
NSMutableArray* additional = [NSMutableArray array];
[additional addObject:NSAccessibilityDOMIdentifierAttribute];
switch (mRole) {
case roles::MATHML_ROOT:
[additional addObject:NSAccessibilityMathRootIndexAttribute];
@ -321,6 +323,14 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
}
if ([attribute isEqualToString:NSAccessibilityHelpAttribute])
return [self help];
if ([attribute isEqualToString:NSAccessibilityDOMIdentifierAttribute]) {
nsAutoString id;
if (accWrap)
nsCoreUtils::GetID(accWrap->GetContent(), id);
else
proxy->DOMNodeID(id);
return nsCocoaUtils::ToNSString(id);
}
switch (mRole) {
case roles::MATHML_ROOT:
@ -886,9 +896,6 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
case roles::ALERT:
return @"AXApplicationAlert";
case roles::SEPARATOR:
return @"AXContentSeparator";
case roles::PROPERTYPAGE:
return @"AXTabPanel";
@ -910,6 +917,7 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
// macOS added an AXSubrole value to distinguish generic AXGroup objects
// from those which are AXGroups as a result of an explicit ARIA role,
// such as the non-landmark, non-listitem text containers in DPub ARIA.
case roles::FOOTNOTE:
case roles::SECTION:
if (roleAtom)
return @"AXApplicationGroup";
@ -948,6 +956,7 @@ static const RoleDescrMap sRoleDescrMap[] = {
{ @"AXLandmarkContentInfo", NS_LITERAL_STRING("content") },
{ @"AXLandmarkMain", NS_LITERAL_STRING("main") },
{ @"AXLandmarkNavigation", NS_LITERAL_STRING("navigation") },
{ @"AXLandmarkRegion", NS_LITERAL_STRING("region") },
{ @"AXLandmarkSearch", NS_LITERAL_STRING("search") },
{ @"AXSearchField", NS_LITERAL_STRING("searchTextField") },
{ @"AXTabPanel", NS_LITERAL_STRING("tabPanel") },
@ -969,6 +978,9 @@ struct RoleDescrComparator
if (mRole == roles::DOCUMENT)
return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
if (mRole == roles::HEADING)
return utils::LocalizedString(NS_LITERAL_STRING("heading"));
NSString* subrole = [self subrole];
if (subrole) {

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

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

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

@ -264,6 +264,7 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
// the executable file to retrieve version information.
nsCOMPtr<nsIRunnable> runnable(
NewRunnableMethod<nsCOMPtr<nsIFile>, RefPtr<AccumulateRunnable>>(
"LazyInstantiator::GatherTelemetry",
this,
&LazyInstantiator::GatherTelemetry,
clientExe,

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

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

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

@ -4,6 +4,7 @@ support-files =
file_dom_notifications.html
[browser_notification_close.js]
skip-if = os == 'win' # Bug 1227785
[browser_notification_do_not_disturb.js]
[browser_notification_open_settings.js]
[browser_notification_remove_permission.js]

4
browser/extensions/e10srollout/bootstrap.js поставляемый
Просмотреть файл

@ -10,6 +10,7 @@ Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/UpdateUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/TelemetryEnvironment.jsm");
// The amount of people to be part of e10s
const TEST_THRESHOLD = {
@ -239,6 +240,9 @@ function getUserSample(multi) {
function setCohort(cohortName) {
Preferences.set(PREF_COHORT_NAME, cohortName);
if (cohortName != "unsupportedChannel") {
TelemetryEnvironment.setExperimentActive("e10sCohort", cohortName);
}
try {
if (Ci.nsICrashReporter) {
Services.appinfo.QueryInterface(Ci.nsICrashReporter).annotateCrashReport("E10SCohort", cohortName);

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

@ -95,7 +95,7 @@ function setImageTooltip(tooltip, doc, imageUrl, options) {
min-height: 1px;">
<img class="${imageClass}"
style="height: ${imgHeight}px; max-height: 100%;"
src="${imageUrl}"/>
src="${encodeURI(imageUrl)}"/>
</div>`;
if (!hideDimensionLabel) {

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

@ -1161,7 +1161,11 @@ CssGridHighlighter.prototype = extend(AutoRefreshHighlighter.prototype, {
let fragment = this.gridData[i];
for (let area of fragment.areas) {
let { rowStart, rowEnd, columnStart, columnEnd } = area;
let { rowStart, rowEnd, columnStart, columnEnd, type } = area;
if (type === "implicit") {
continue;
}
// Draw the line edges for the grid area
const areaColStart = fragment.cols.lines[columnStart - 1];

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

@ -455,9 +455,12 @@ nsPingListener::StartTimeout(DocGroup* aDocGroup)
timer->SetTarget(aDocGroup->EventTargetFor(TaskCategory::Network));
if (timer) {
nsresult rv = timer->InitWithFuncCallback(OnPingTimeout, mLoadGroup,
PING_TIMEOUT,
nsITimer::TYPE_ONE_SHOT);
nsresult rv =
timer->InitWithNamedFuncCallback(OnPingTimeout,
mLoadGroup,
PING_TIMEOUT,
nsITimer::TYPE_ONE_SHOT,
"nsPingListener::StartTimeout");
if (NS_SUCCEEDED(rv)) {
mTimer = timer;
return NS_OK;
@ -1770,10 +1773,12 @@ nsDocShell::DispatchToTabGroup(const char* aName,
NS_IMETHODIMP
nsDocShell::DispatchLocationChangeEvent()
{
return DispatchToTabGroup("nsDocShell::FireDummyOnLocationChange",
TaskCategory::Other,
NewRunnableMethod(this,
&nsDocShell::FireDummyOnLocationChange));
return DispatchToTabGroup(
"nsDocShell::FireDummyOnLocationChange",
TaskCategory::Other,
NewRunnableMethod("nsDocShell::FireDummyOnLocationChange",
this,
&nsDocShell::FireDummyOnLocationChange));
}
bool
@ -9647,13 +9652,20 @@ public:
bool aLoadReplace,
nsIURI* aReferrer, uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit, uint32_t aFlags,
const char* aTypeHint, nsIInputStream* aPostData,
nsIInputStream* aHeadersData, uint32_t aLoadType,
nsISHEntry* aSHEntry, bool aFirstParty,
const nsAString& aSrcdoc, nsIDocShell* aSourceDocShell,
nsIURI* aBaseURI, bool aCheckForPrerender)
: mSrcdoc(aSrcdoc)
nsIPrincipal* aPrincipalToInherit,
uint32_t aFlags,
const char* aTypeHint,
nsIInputStream* aPostData,
nsIInputStream* aHeadersData,
uint32_t aLoadType,
nsISHEntry* aSHEntry,
bool aFirstParty,
const nsAString& aSrcdoc,
nsIDocShell* aSourceDocShell,
nsIURI* aBaseURI,
bool aCheckForPrerender)
: mozilla::Runnable("InternalLoadEvent")
, mSrcdoc(aSrcdoc)
, mDocShell(aDocShell)
, mURI(aURI)
, mOriginalURI(aOriginalURI)
@ -14046,7 +14058,8 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
bool aNoOpenerImplied,
bool aIsTrusted,
nsIPrincipal* aTriggeringPrincipal)
: mHandler(aHandler)
: mozilla::Runnable("OnLinkClickEvent")
, mHandler(aHandler)
, mURI(aURI)
, mTargetSpec(aTargetSpec)
, mFileName(aFileName)

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -454,8 +454,9 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType
// should be invoked prior to returning control back to script.
// Create a script runner to process the top of the processing
// stack as soon as it is safe to run script.
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableFunction(&CustomElementRegistry::ProcessTopElementQueue);
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
"dom::CustomElementRegistry::EnqueueLifecycleCallback",
&CustomElementRegistry::ProcessTopElementQueue);
nsContentUtils::AddScriptRunner(runnable);
}
}

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

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

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

@ -150,31 +150,31 @@ DOMIntersectionObserver::GetThresholds(nsTArray<double>& aRetVal)
void
DOMIntersectionObserver::Observe(Element& aTarget)
{
if (mObservationTargets.EnsureInserted(&aTarget)) {
// A new entry was created.
aTarget.RegisterIntersectionObserver(this);
Connect();
if (mObservationTargets.Contains(&aTarget)) {
return;
}
aTarget.RegisterIntersectionObserver(this);
mObservationTargets.AppendElement(&aTarget);
Connect();
}
void
DOMIntersectionObserver::Unobserve(Element& aTarget)
{
if (mObservationTargets.Count() == 1) {
if (mObservationTargets.Length() == 1) {
Disconnect();
return;
}
mObservationTargets.RemoveEntry(&aTarget);
mObservationTargets.RemoveElement(&aTarget);
aTarget.UnregisterIntersectionObserver(this);
}
void
DOMIntersectionObserver::UnlinkTarget(Element& aTarget)
{
if (mObservationTargets.EnsureRemoved(&aTarget) &&
mObservationTargets.Count() == 0) {
// We removed the last entry.
mObservationTargets.RemoveElement(&aTarget);
if (mObservationTargets.Length() == 0) {
Disconnect();
}
}
@ -200,8 +200,8 @@ DOMIntersectionObserver::Disconnect()
}
mConnected = false;
for (auto iter = mObservationTargets.Iter(); !iter.Done(); iter.Next()) {
Element* target = iter.Get()->GetKey();
for (size_t i = 0; i < mObservationTargets.Length(); ++i) {
Element* target = mObservationTargets.ElementAt(i);
target->UnregisterIntersectionObserver(this);
}
mObservationTargets.Clear();
@ -325,8 +325,8 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
rootMargin.Side(side) = nsLayoutUtils::ComputeCBDependentValue(basis, coord);
}
for (auto iter = mObservationTargets.Iter(); !iter.Done(); iter.Next()) {
Element* target = iter.Get()->GetKey();
for (size_t i = 0; i < mObservationTargets.Length(); ++i) {
Element* target = mObservationTargets.ElementAt(i);
nsIFrame* targetFrame = target->GetPrimaryFrame();
nsRect targetRect;
Maybe<nsRect> intersectionRect;
@ -501,7 +501,7 @@ DOMIntersectionObserver::Notify()
}
mozilla::dom::Sequence<mozilla::OwningNonNull<DOMIntersectionObserverEntry>> entries;
if (entries.SetCapacity(mQueuedEntries.Length(), mozilla::fallible)) {
for (uint32_t i = 0; i < mQueuedEntries.Length(); ++i) {
for (size_t i = 0; i < mQueuedEntries.Length(); ++i) {
RefPtr<DOMIntersectionObserverEntry> next = mQueuedEntries[i];
*entries.AppendElement(mozilla::fallible) = next;
}

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

@ -179,7 +179,10 @@ protected:
RefPtr<Element> mRoot;
nsCSSRect mRootMargin;
nsTArray<double> mThresholds;
nsTHashtable<nsPtrHashKey<Element>> mObservationTargets;
// Holds raw pointers which are explicitly cleared by UnlinkTarget().
nsTArray<Element*> mObservationTargets;
nsTArray<RefPtr<DOMIntersectionObserverEntry>> mQueuedEntries;
bool mConnected;
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -26,6 +26,8 @@ static StaticRefPtr<TabGroup> sChromeTabGroup;
TabGroup::TabGroup(bool aIsChrome)
: mLastWindowLeft(false)
, mThrottledQueuesInitialized(false)
, mNumOfIndexedDBTransactions(0)
, mNumOfIndexedDBDatabases(0)
, mIsChrome(aIsChrome)
, mForegroundCount(0)
{

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

@ -127,6 +127,18 @@ public:
// the background.
bool IsBackground() const override;
// Increase/Decrease the number of IndexedDB transactions/databases for the
// decision making of the preemption in the scheduler.
Atomic<uint32_t>& IndexedDBTransactionCounter()
{
return mNumOfIndexedDBTransactions;
}
Atomic<uint32_t>& IndexedDBDatabaseCounter()
{
return mNumOfIndexedDBDatabases;
}
private:
virtual AbstractThread*
AbstractMainThreadForImpl(TaskCategory aCategory) override;
@ -140,6 +152,8 @@ private:
// Thread-safe members
Atomic<bool> mLastWindowLeft;
Atomic<bool> mThrottledQueuesInitialized;
Atomic<uint32_t> mNumOfIndexedDBTransactions;
Atomic<uint32_t> mNumOfIndexedDBDatabases;
const bool mIsChrome;
// Main thread only

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

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

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

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

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

@ -301,6 +301,7 @@ bool nsContentUtils::sGetBoxQuadsEnabled = false;
bool nsContentUtils::sSkipCursorMoveForSameValueSet = false;
bool nsContentUtils::sRequestIdleCallbackEnabled = false;
bool nsContentUtils::sLowerNetworkPriority = false;
bool nsContentUtils::sShowInputPlaceholderOnFocus = true;
#ifndef RELEASE_OR_BETA
bool nsContentUtils::sBypassCSSOMOriginCheck = false;
#endif
@ -713,6 +714,9 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sLowerNetworkPriority,
"privacy.trackingprotection.lower_network_priority", false);
Preferences::AddBoolVarCache(&sShowInputPlaceholderOnFocus,
"dom.placeholder.show_on_focus", true);
Preferences::AddBoolVarCache(&sIsBytecodeCacheEnabled,
"dom.script_loader.bytecode_cache.enabled", false);
@ -5309,12 +5313,16 @@ nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode,
class AnonymousContentDestroyer : public Runnable {
public:
explicit AnonymousContentDestroyer(nsCOMPtr<nsIContent>* aContent) {
explicit AnonymousContentDestroyer(nsCOMPtr<nsIContent>* aContent)
: mozilla::Runnable("AnonymousContentDestroyer")
{
mContent.swap(*aContent);
mParent = mContent->GetParent();
mDoc = mContent->OwnerDoc();
}
explicit AnonymousContentDestroyer(nsCOMPtr<Element>* aElement) {
explicit AnonymousContentDestroyer(nsCOMPtr<Element>* aElement)
: mozilla::Runnable("AnonymousContentDestroyer")
{
mContent = aElement->forget();
mParent = mContent->GetParent();
mDoc = mContent->OwnerDoc();
@ -10547,9 +10555,9 @@ nsContentUtils::UserInteractionObserver::Init()
// started yet. It will have started by the time we have the chance to spin
// the event loop.
RefPtr<UserInteractionObserver> self = this;
NS_DispatchToMainThread(NS_NewRunnableFunction([=] () {
HangMonitor::RegisterAnnotator(*self);
}));
NS_DispatchToMainThread(
NS_NewRunnableFunction("nsContentUtils::UserInteractionObserver::Init",
[=]() { HangMonitor::RegisterAnnotator(*self); }));
}
void

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

@ -3038,6 +3038,11 @@ public:
// if we want to lower the priority of the channel.
static bool IsLowerNetworkPriority() { return sLowerNetworkPriority; }
// Check pref "dom.placeholder.show_on_focus" to see
// if we want to show the placeholder inside input elements
// when they have focus.
static bool ShowInputPlaceholderOnFocus() { return sShowInputPlaceholderOnFocus; }
// Check pref "dom.script_loader.bytecode_cache.enabled" to see
// if we want to cache JS bytecode on the cache entry.
static bool IsBytecodeCacheEnabled() { return sIsBytecodeCacheEnabled; }
@ -3197,6 +3202,7 @@ private:
static bool sSkipCursorMoveForSameValueSet;
static bool sRequestIdleCallbackEnabled;
static bool sLowerNetworkPriority;
static bool sShowInputPlaceholderOnFocus;
#ifndef RELEASE_OR_BETA
static bool sBypassCSSOMOriginCheck;
#endif

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

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

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

@ -1106,10 +1106,21 @@ nsDOMWindowUtils::SendNativeKeyEvent(int32_t aNativeKeyboardLayout,
if (!widget)
return NS_ERROR_FAILURE;
NS_DispatchToMainThread(NewRunnableMethod
<int32_t, int32_t, uint32_t, nsString, nsString, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeKeyEvent, aNativeKeyboardLayout,
aNativeKeyCode, aModifiers, aCharacters, aUnmodifiedCharacters, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<int32_t,
int32_t,
uint32_t,
nsString,
nsString,
nsIObserver*>("nsIWidget::SynthesizeNativeKeyEvent",
widget,
&nsIWidget::SynthesizeNativeKeyEvent,
aNativeKeyboardLayout,
aNativeKeyCode,
aModifiers,
aCharacters,
aUnmodifiedCharacters,
aObserver));
return NS_OK;
}
@ -1126,11 +1137,15 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX,
if (!widget)
return NS_ERROR_FAILURE;
NS_DispatchToMainThread(NewRunnableMethod
<LayoutDeviceIntPoint, int32_t, int32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeMouseEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aModifierFlags,
aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<LayoutDeviceIntPoint, int32_t, int32_t, nsIObserver*>(
"nsIWidget::SynthesizeNativeMouseEvent",
widget,
&nsIWidget::SynthesizeNativeMouseEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aNativeMessage,
aModifierFlags,
aObserver));
return NS_OK;
}
@ -1145,10 +1160,12 @@ nsDOMWindowUtils::SendNativeMouseMove(int32_t aScreenX,
if (!widget)
return NS_ERROR_FAILURE;
NS_DispatchToMainThread(NewRunnableMethod
<LayoutDeviceIntPoint, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeMouseMove,
LayoutDeviceIntPoint(aScreenX, aScreenY), aObserver));
NS_DispatchToMainThread(NewRunnableMethod<LayoutDeviceIntPoint, nsIObserver*>(
"nsIWidget::SynthesizeNativeMouseMove",
widget,
&nsIWidget::SynthesizeNativeMouseMove,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aObserver));
return NS_OK;
}
@ -1170,11 +1187,25 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NewRunnableMethod
<mozilla::LayoutDeviceIntPoint, uint32_t, double, double, double, uint32_t, uint32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeMouseScrollEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY), aNativeMessage, aDeltaX, aDeltaY,
aDeltaZ, aModifierFlags, aAdditionalFlags, aObserver));
NS_DispatchToMainThread(NewRunnableMethod<mozilla::LayoutDeviceIntPoint,
uint32_t,
double,
double,
double,
uint32_t,
uint32_t,
nsIObserver*>(
"nsIWidget::SynthesizeNativeMouseScrollEvent",
widget,
&nsIWidget::SynthesizeNativeMouseScrollEvent,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aNativeMessage,
aDeltaX,
aDeltaY,
aDeltaZ,
aModifierFlags,
aAdditionalFlags,
aObserver));
return NS_OK;
}
@ -1196,12 +1227,21 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
return NS_ERROR_INVALID_ARG;
}
NS_DispatchToMainThread(NewRunnableMethod
<uint32_t, nsIWidget::TouchPointerState, LayoutDeviceIntPoint, double, uint32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId,
(nsIWidget::TouchPointerState)aTouchState,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aPressure, aOrientation, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<uint32_t,
nsIWidget::TouchPointerState,
LayoutDeviceIntPoint,
double,
uint32_t,
nsIObserver*>("nsIWidget::SynthesizeNativeTouchPoint",
widget,
&nsIWidget::SynthesizeNativeTouchPoint,
aPointerId,
(nsIWidget::TouchPointerState)aTouchState,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aPressure,
aOrientation,
aObserver));
return NS_OK;
}
@ -1216,10 +1256,14 @@ nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NewRunnableMethod
<LayoutDeviceIntPoint, bool, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchTap,
LayoutDeviceIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<LayoutDeviceIntPoint, bool, nsIObserver*>(
"nsIWidget::SynthesizeNativeTouchTap",
widget,
&nsIWidget::SynthesizeNativeTouchTap,
LayoutDeviceIntPoint(aScreenX, aScreenY),
aLongTap,
aObserver));
return NS_OK;
}
@ -1231,8 +1275,11 @@ nsDOMWindowUtils::ClearNativeTouchSequence(nsIObserver* aObserver)
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NewRunnableMethod<nsIObserver*>
(widget, &nsIWidget::ClearNativeTouchSequence, aObserver));
NS_DispatchToMainThread(
NewRunnableMethod<nsIObserver*>("nsIWidget::ClearNativeTouchSequence",
widget,
&nsIWidget::ClearNativeTouchSequence,
aObserver));
return NS_OK;
}

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

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

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

@ -4443,8 +4443,10 @@ nsDocument::SetStyleSheetApplicableState(StyleSheet* aSheet,
if (!mSSApplicableStateNotificationPending) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> notification = NewRunnableMethod(this,
&nsDocument::NotifyStyleSheetApplicableStateChanged);
nsCOMPtr<nsIRunnable> notification =
NewRunnableMethod("nsDocument::NotifyStyleSheetApplicableStateChanged",
this,
&nsDocument::NotifyStyleSheetApplicableStateChanged);
mSSApplicableStateNotificationPending =
NS_SUCCEEDED(
Dispatch("nsDocument::NotifyStyleSheetApplicableStateChanged",
@ -5059,7 +5061,9 @@ nsDocument::MaybeEndOutermostXBLUpdate()
} else if (!mInDestructor) {
if (!mMaybeEndOutermostXBLUpdateRunner) {
mMaybeEndOutermostXBLUpdateRunner =
NewRunnableMethod(this, &nsDocument::MaybeEndOutermostXBLUpdate);
NewRunnableMethod("nsDocument::MaybeEndOutermostXBLUpdate",
this,
&nsDocument::MaybeEndOutermostXBLUpdate);
}
nsContentUtils::AddScriptRunner(mMaybeEndOutermostXBLUpdateRunner);
}
@ -5390,7 +5394,9 @@ nsDocument::UnblockDOMContentLoaded()
if (!mSynchronousDOMContentLoaded) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsDocument::DispatchContentLoadedEvents);
NewRunnableMethod("nsDocument::DispatchContentLoadedEvents",
this,
&nsDocument::DispatchContentLoadedEvents);
Dispatch("nsDocument::DispatchContentLoadedEvents", TaskCategory::Other, ev.forget());
} else {
DispatchContentLoadedEvents();
@ -7027,7 +7033,9 @@ nsDocument::NotifyPossibleTitleChange(bool aBoundTitleElement)
MOZ_RELEASE_ASSERT(NS_IsMainThread());
RefPtr<nsRunnableMethod<nsDocument, void, false>> event =
NewNonOwningRunnableMethod(this, &nsDocument::DoNotifyPossibleTitleChange);
NewNonOwningRunnableMethod("nsDocument::DoNotifyPossibleTitleChange",
this,
&nsDocument::DoNotifyPossibleTitleChange);
nsresult rv = Dispatch("nsDocument::DoNotifyPossibleTitleChange",
TaskCategory::Other, do_AddRef(event));
if (NS_SUCCEEDED(rv)) {
@ -7173,7 +7181,9 @@ nsDocument::InitializeFrameLoader(nsFrameLoader* aLoader)
mInitializableFrameLoaders.AppendElement(aLoader);
if (!mFrameLoaderRunner) {
mFrameLoaderRunner =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders",
this,
&nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
@ -7191,7 +7201,9 @@ nsDocument::FinalizeFrameLoader(nsFrameLoader* aLoader, nsIRunnable* aFinalizer)
mFrameLoaderFinalizers.AppendElement(aFinalizer);
if (!mFrameLoaderRunner) {
mFrameLoaderRunner =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders",
this,
&nsDocument::MaybeInitializeFinalizeFrameLoaders);
NS_ENSURE_TRUE(mFrameLoaderRunner, NS_ERROR_OUT_OF_MEMORY);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
@ -7215,7 +7227,9 @@ nsDocument::MaybeInitializeFinalizeFrameLoaders()
(mInitializableFrameLoaders.Length() ||
mFrameLoaderFinalizers.Length())) {
mFrameLoaderRunner =
NewRunnableMethod(this, &nsDocument::MaybeInitializeFinalizeFrameLoaders);
NewRunnableMethod("nsDocument::MaybeInitializeFinalizeFrameLoaders",
this,
&nsDocument::MaybeInitializeFinalizeFrameLoaders);
nsContentUtils::AddScriptRunner(mFrameLoaderRunner);
}
return;
@ -8792,8 +8806,8 @@ nsDocument::BlockOnload()
// block onload only when there are no script blockers.
++mAsyncOnloadBlockCount;
if (mAsyncOnloadBlockCount == 1) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsDocument::AsyncBlockOnload));
nsContentUtils::AddScriptRunner(NewRunnableMethod(
"nsDocument::AsyncBlockOnload", this, &nsDocument::AsyncBlockOnload));
}
return;
}
@ -8850,7 +8864,11 @@ nsDocument::UnblockOnload(bool aFireSync)
class nsUnblockOnloadEvent : public Runnable {
public:
explicit nsUnblockOnloadEvent(nsDocument* aDoc) : mDoc(aDoc) {}
explicit nsUnblockOnloadEvent(nsDocument* aDoc)
: mozilla::Runnable("nsUnblockOnloadEvent")
, mDoc(aDoc)
{
}
NS_IMETHOD Run() override {
mDoc->DoUnblockOnload();
return NS_OK;
@ -9732,6 +9750,7 @@ class nsDelayedEventDispatcher : public Runnable
{
public:
explicit nsDelayedEventDispatcher(nsTArray<nsCOMPtr<nsIDocument>>& aDocuments)
: mozilla::Runnable("nsDelayedEventDispatcher")
{
mDocuments.SwapElements(aDocuments);
}
@ -9977,7 +9996,9 @@ nsIDocument::RegisterPendingLinkUpdate(Link* aLink)
if (!mHasLinksToUpdateRunnable) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &nsIDocument::FlushPendingLinkUpdatesFromRunnable);
NewRunnableMethod("nsIDocument::FlushPendingLinkUpdatesFromRunnable",
this,
&nsIDocument::FlushPendingLinkUpdatesFromRunnable);
// Do this work in a second in the worst case.
nsresult rv =
NS_IdleDispatchToCurrentThread(event.forget(), 1000);
@ -10899,7 +10920,10 @@ class nsCallExitFullscreen : public Runnable
{
public:
explicit nsCallExitFullscreen(nsIDocument* aDoc)
: mDoc(aDoc) {}
: mozilla::Runnable("nsCallExitFullscreen")
, mDoc(aDoc)
{
}
NS_IMETHOD Run() override final
{
@ -10979,7 +11003,10 @@ class ExitFullscreenScriptRunnable : public Runnable
{
public:
explicit ExitFullscreenScriptRunnable(nsCOMArray<nsIDocument>&& aDocuments)
: mDocuments(Move(aDocuments)) { }
: mozilla::Runnable("ExitFullscreenScriptRunnable")
, mDocuments(Move(aDocuments))
{
}
NS_IMETHOD Run() override
{
@ -11173,7 +11200,10 @@ class nsCallRequestFullScreen : public Runnable
{
public:
explicit nsCallRequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
: mRequest(Move(aRequest)) { }
: mozilla::Runnable("nsCallRequestFullScreen")
, mRequest(Move(aRequest))
{
}
NS_IMETHOD Run() override
{
@ -11903,7 +11933,8 @@ class PointerLockRequest final : public Runnable
{
public:
PointerLockRequest(Element* aElement, bool aUserInputOrChromeCaller)
: mElement(do_GetWeakReference(aElement))
: mozilla::Runnable("PointerLockRequest")
, mElement(do_GetWeakReference(aElement))
, mDocument(do_GetWeakReference(aElement->OwnerDoc()))
, mUserInputOrChromeCaller(aUserInputOrChromeCaller)
{}
@ -12254,7 +12285,9 @@ nsDocument::GetVisibilityState() const
nsDocument::PostVisibilityUpdateEvent()
{
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &nsDocument::UpdateVisibilityState);
NewRunnableMethod("nsDocument::UpdateVisibilityState",
this,
&nsDocument::UpdateVisibilityState);
Dispatch("nsDocument::UpdateVisibilityState", TaskCategory::Other, event.forget());
}
@ -12799,7 +12832,9 @@ nsDocument::ScheduleIntersectionObserverNotification()
}
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> notification =
NewRunnableMethod(this, &nsDocument::NotifyIntersectionObservers);
NewRunnableMethod("nsDocument::NotifyIntersectionObservers",
this,
&nsDocument::NotifyIntersectionObservers);
Dispatch("nsDocument::IntersectionObserverNotification", TaskCategory::Other,
notification.forget());
}
@ -13089,7 +13124,9 @@ nsIDocument::RebuildUserFontSet()
if (!mPostedFlushUserFontSet) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIRunnable> ev =
NewRunnableMethod(this, &nsIDocument::HandleRebuildUserFontSet);
NewRunnableMethod("nsIDocument::HandleRebuildUserFontSet",
this,
&nsIDocument::HandleRebuildUserFontSet);
if (NS_SUCCEEDED(Dispatch("nsIDocument::HandleRebuildUserFontSet",
TaskCategory::Other, ev.forget()))) {
mPostedFlushUserFontSet = true;

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

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

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

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

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

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

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

@ -1013,7 +1013,9 @@ nsPIDOMWindow<T>::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow)
mWindowID(NextWindowID()), mHasNotifiedGlobalCreated(false),
mMarkedCCGeneration(0), mServiceWorkersTestingEnabled(false),
mLargeAllocStatus(LargeAllocStatus::NONE),
mShouldResumeOnFirstActiveMediaComponent(false)
mShouldResumeOnFirstActiveMediaComponent(false),
mHasTriedToCacheTopInnerWindow(false),
mNumOfIndexedDBDatabases(0)
{
if (aOuterWindow) {
mTimeoutManager =
@ -2297,6 +2299,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOuterWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTopInnerWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mListenerManager)
if (tmp->mTimeoutManager) {
@ -2387,6 +2391,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mListenerManager)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTopInnerWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocation)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mHistory)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCustomElements)
@ -3035,8 +3041,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
happens, setting status isn't a big requirement, so don't. (Doesn't happen
under normal circumstances, but bug 49615 describes a case.) */
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsGlobalWindow::ClearStatus));
nsContentUtils::AddScriptRunner(NewRunnableMethod(
"nsGlobalWindow::ClearStatus", this, &nsGlobalWindow::ClearStatus));
// Sometimes, WouldReuseInnerWindow() returns true even if there's no inner
// window (see bug 776497). Be safe.
@ -3185,6 +3191,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
}
mInnerWindow = newInnerWindow->AsInner();
MOZ_ASSERT(mInnerWindow);
mInnerWindow->TryToCacheTopInnerWindow();
if (!GetWrapperPreserveColor()) {
JS::Rooted<JSObject*> outer(cx,
@ -3346,7 +3354,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
// up with the outer. See bug 969156.
if (createdInnerWindow) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(newInnerWindow,
NewRunnableMethod("nsGlobalWindow::FireOnNewGlobalObject",
newInnerWindow,
&nsGlobalWindow::FireOnNewGlobalObject));
}
@ -3360,7 +3369,9 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsContentUtils::IsSystemPrincipal(mDoc->NodePrincipal())) {
newInnerWindow->mHasNotifiedGlobalCreated = true;
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &nsGlobalWindow::DispatchDOMWindowCreated));
NewRunnableMethod("nsGlobalWindow::DispatchDOMWindowCreated",
this,
&nsGlobalWindow::DispatchDOMWindowCreated));
}
}
@ -4421,6 +4432,67 @@ nsPIDOMWindowInner::IsRunningTimeout()
return TimeoutManager().IsRunningTimeout();
}
void
nsPIDOMWindowInner::TryToCacheTopInnerWindow()
{
if (mHasTriedToCacheTopInnerWindow) {
return;
}
MOZ_ASSERT(!mInnerObjectsFreed);
mHasTriedToCacheTopInnerWindow = true;
nsGlobalWindow* window = nsGlobalWindow::Cast(AsInner());
MOZ_ASSERT(window);
if (nsCOMPtr<nsPIDOMWindowOuter> topOutter = window->GetScriptableTop()) {
mTopInnerWindow = topOutter->GetCurrentInnerWindow();
}
}
void
nsPIDOMWindowInner::UpdateActiveIndexedDBTransactionCount(int32_t aDelta)
{
MOZ_ASSERT(NS_IsMainThread());
if (aDelta == 0) {
return;
}
TabGroup()->IndexedDBTransactionCounter() += aDelta;
}
void
nsPIDOMWindowInner::UpdateActiveIndexedDBDatabaseCount(int32_t aDelta)
{
MOZ_ASSERT(NS_IsMainThread());
if (aDelta == 0) {
return;
}
// We count databases but not transactions because only active databases
// could block throttling.
uint32_t& counter = mTopInnerWindow ?
mTopInnerWindow->mNumOfIndexedDBDatabases : mNumOfIndexedDBDatabases;
counter+= aDelta;
TabGroup()->IndexedDBDatabaseCounter() += aDelta;
}
bool
nsPIDOMWindowInner::HasActiveIndexedDBDatabases()
{
MOZ_ASSERT(NS_IsMainThread());
return mTopInnerWindow ?
mTopInnerWindow->mNumOfIndexedDBDatabases > 0 :
mNumOfIndexedDBDatabases > 0;
}
void
nsPIDOMWindowOuter::NotifyCreatedNewMediaComponent()
{
@ -6871,10 +6943,13 @@ class FullscreenTransitionTask : public Runnable
{
public:
FullscreenTransitionTask(const FullscreenTransitionDuration& aDuration,
nsGlobalWindow* aWindow, bool aFullscreen,
nsIWidget* aWidget, nsIScreen* aScreen,
nsGlobalWindow* aWindow,
bool aFullscreen,
nsIWidget* aWidget,
nsIScreen* aScreen,
nsISupports* aTransitionData)
: mWindow(aWindow)
: mozilla::Runnable("FullscreenTransitionTask")
, mWindow(aWindow)
, mWidget(aWidget)
, mScreen(aScreen)
, mTransitionData(aTransitionData)
@ -9210,8 +9285,9 @@ class nsCloseEvent : public Runnable {
RefPtr<nsGlobalWindow> mWindow;
bool mIndirect;
nsCloseEvent(nsGlobalWindow *aWindow, bool aIndirect)
: mWindow(aWindow)
nsCloseEvent(nsGlobalWindow* aWindow, bool aIndirect)
: mozilla::Runnable("nsCloseEvent")
, mWindow(aWindow)
, mIndirect(aIndirect)
{}
@ -9640,11 +9716,11 @@ struct BrowserCompartmentMatcher : public js::CompartmentFilter {
class WindowDestroyedEvent final : public Runnable
{
public:
WindowDestroyedEvent(nsIDOMWindow* aWindow, uint64_t aID,
const char* aTopic) :
mID(aID),
mPhase(Phase::Destroying),
mTopic(aTopic)
WindowDestroyedEvent(nsIDOMWindow* aWindow, uint64_t aID, const char* aTopic)
: mozilla::Runnable("WindowDestroyedEvent")
, mID(aID)
, mPhase(Phase::Destroying)
, mTopic(aTopic)
{
mWindow = do_GetWeakReference(aWindow);
}
@ -10137,7 +10213,12 @@ public:
ChildCommandDispatcher(nsGlobalWindow* aWindow,
nsITabChild* aTabChild,
const nsAString& aAction)
: mWindow(aWindow), mTabChild(aTabChild), mAction(aAction) {}
: mozilla::Runnable("ChildCommandDispatcher")
, mWindow(aWindow)
, mTabChild(aTabChild)
, mAction(aAction)
{
}
NS_IMETHOD Run() override
{
@ -10166,7 +10247,11 @@ class CommandDispatcher : public Runnable
public:
CommandDispatcher(nsIDOMXULCommandDispatcher* aDispatcher,
const nsAString& aAction)
: mDispatcher(aDispatcher), mAction(aAction) {}
: mozilla::Runnable("CommandDispatcher")
, mDispatcher(aDispatcher)
, mAction(aAction)
{
}
NS_IMETHOD Run() override
{
@ -10958,10 +11043,11 @@ nsGlobalWindow::PageHidden()
class HashchangeCallback : public Runnable
{
public:
HashchangeCallback(const nsAString &aOldURL,
const nsAString &aNewURL,
HashchangeCallback(const nsAString& aOldURL,
const nsAString& aNewURL,
nsGlobalWindow* aWindow)
: mWindow(aWindow)
: mozilla::Runnable("HashchangeCallback")
, mWindow(aWindow)
{
MOZ_ASSERT(mWindow);
MOZ_ASSERT(mWindow->IsInnerWindow());
@ -11574,8 +11660,11 @@ public:
uint32_t aTimeInS,
bool aCallOnidle,
nsGlobalWindow* aIdleWindow)
: mIdleObserver(aIdleObserver), mTimeInS(aTimeInS), mIdleWindow(aIdleWindow),
mCallOnidle(aCallOnidle)
: mozilla::Runnable("NotifyIdleObserverRunnable")
, mIdleObserver(aIdleObserver)
, mTimeInS(aTimeInS)
, mIdleWindow(aIdleWindow)
, mCallOnidle(aCallOnidle)
{ }
NS_IMETHOD Run() override
@ -11683,10 +11772,12 @@ nsGlobalWindow::ScheduleNextIdleObserverCallback()
}
mIdleTimer->Cancel();
rv = mIdleTimer->InitWithFuncCallback(IdleObserverTimerCallback,
this,
callbackTimeMS,
nsITimer::TYPE_ONE_SHOT);
rv = mIdleTimer->InitWithNamedFuncCallback(
IdleObserverTimerCallback,
this,
callbackTimeMS,
nsITimer::TYPE_ONE_SHOT,
"nsGlobalWindow::ScheduleNextIdleObserverCallback");
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -11728,10 +11819,12 @@ nsGlobalWindow::ScheduleActiveTimerCallback()
mIdleTimer->Cancel();
uint32_t fuzzFactorInMS = GetFuzzTimeMS();
nsresult rv = mIdleTimer->InitWithFuncCallback(IdleActiveTimerCallback,
this,
fuzzFactorInMS,
nsITimer::TYPE_ONE_SHOT);
nsresult rv = mIdleTimer->InitWithNamedFuncCallback(
IdleActiveTimerCallback,
this,
fuzzFactorInMS,
nsITimer::TYPE_ONE_SHOT,
"nsGlobalWindow::ScheduleActiveTimerCallback");
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
@ -12820,7 +12913,8 @@ public:
~AutoUnblockScriptClosing()
{
void (nsGlobalWindow::*run)() = &nsGlobalWindow::UnblockScriptedClosing;
nsCOMPtr<nsIRunnable> caller = NewRunnableMethod(mWin, run);
nsCOMPtr<nsIRunnable> caller = NewRunnableMethod(
"AutoUnblockScriptClosing::~AutoUnblockScriptClosing", mWin, run);
mWin->Dispatch("nsGlobalWindow::UnblockScriptedClosing",
TaskCategory::Other, caller.forget());
}

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

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

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

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

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

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

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

@ -179,7 +179,8 @@ class AsyncErrorReporter final : public mozilla::Runnable
public:
// aWindow may be null if this error report is not associated with a window
explicit AsyncErrorReporter(xpc::ErrorReport* aReport)
: mReport(aReport)
: Runnable("dom::AsyncErrorReporter")
, mReport(aReport)
{}
NS_IMETHOD Run() override

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

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

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

@ -764,6 +764,18 @@ protected:
// When there is any created alive media component, we can consider to resume
// the media content in the window.
bool mShouldResumeOnFirstActiveMediaComponent;
// mTopInnerWindow is only used on inner windows for tab-wise check by timeout
// throttling. It could be null.
nsCOMPtr<nsPIDOMWindowInner> mTopInnerWindow;
// The evidence that we have tried to cache mTopInnerWindow only once from
// SetNewDocument(). Note: We need this extra flag because mTopInnerWindow
// could be null and we don't want it to be set multiple times.
bool mHasTriedToCacheTopInnerWindow;
// The number of active IndexedDB databases. Inner window only.
uint32_t mNumOfIndexedDBDatabases;
};
#define NS_PIDOMWINDOWINNER_IID \
@ -914,6 +926,19 @@ public:
bool IsRunningTimeout();
// To cache top inner-window if available after constructed for tab-wised
// indexedDB counters.
void TryToCacheTopInnerWindow();
// Increase/Decrease the number of active IndexedDB transactions/databases for
// the decision making of TabGroup scheduling and timeout-throttling.
void UpdateActiveIndexedDBTransactionCount(int32_t aDelta);
void UpdateActiveIndexedDBDatabaseCount(int32_t aDelta);
// Return true if there is any active IndexedDB databases which could block
// timeout-throttling.
bool HasActiveIndexedDBDatabases();
protected:
void CreatePerformanceObjectIfNeeded();
};

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

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

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

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

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

@ -45,7 +45,7 @@ public:
inline void TraceSelf(JSTracer* trc)
{
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mTypedObj");
JS::UnsafeTraceRoot(trc, &mTypedObj, "TypedArray.mWrappedObj");
JS::UnsafeTraceRoot(trc, &mWrappedObj, "TypedArray.mWrappedObj");
}
private:

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

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

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

@ -912,7 +912,10 @@ private:
// here since we are guaranteed the Action will survive until
// CompleteOnInitiatingThread is called.
nsCOMPtr<nsIRunnable> runnable = NewNonOwningRunnableMethod<nsresult>(
this, &CachePutAllAction::OnAsyncCopyComplete, aRv);
"dom::cache::Manager::CachePutAllAction::OnAsyncCopyComplete",
this,
&CachePutAllAction::OnAsyncCopyComplete,
aRv);
MOZ_ALWAYS_SUCCEEDS(
mTarget->Dispatch(runnable.forget(), nsIThread::DISPATCH_NORMAL));
}
@ -1766,7 +1769,8 @@ Manager::~Manager()
// Don't spin the event loop in the destructor waiting for the thread to
// shutdown. Defer this to the main thread, instead.
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod(ioThread, &nsIThread::Shutdown)));
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod("nsIThread::Shutdown",
ioThread, &nsIThread::Shutdown)));
}
void

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -34,9 +34,12 @@ public:
* the event is dispatched to it, otherwise the dispatch path starts
* at the first chrome ancestor of that target.
*/
AsyncEventDispatcher(nsINode* aTarget, const nsAString& aEventType,
bool aBubbles, bool aOnlyChromeDispatch)
: mTarget(aTarget)
AsyncEventDispatcher(nsINode* aTarget,
const nsAString& aEventType,
bool aBubbles,
bool aOnlyChromeDispatch)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventType(aEventType)
, mEventMessage(eUnidentifiedEvent)
, mBubbles(aBubbles)
@ -53,7 +56,8 @@ public:
AsyncEventDispatcher(nsINode* aTarget,
mozilla::EventMessage aEventMessage,
bool aBubbles, bool aOnlyChromeDispatch)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventMessage(aEventMessage)
, mBubbles(aBubbles)
, mOnlyChromeDispatch(aOnlyChromeDispatch)
@ -64,7 +68,8 @@ public:
AsyncEventDispatcher(dom::EventTarget* aTarget, const nsAString& aEventType,
bool aBubbles)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventType(aEventType)
, mEventMessage(eUnidentifiedEvent)
, mBubbles(aBubbles)
@ -74,7 +79,8 @@ public:
AsyncEventDispatcher(dom::EventTarget* aTarget,
mozilla::EventMessage aEventMessage,
bool aBubbles)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEventMessage(aEventMessage)
, mBubbles(aBubbles)
{
@ -83,7 +89,8 @@ public:
}
AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent)
: mTarget(aTarget)
: CancelableRunnable("AsyncEventDispatcher")
, mTarget(aTarget)
, mEvent(aEvent)
, mEventMessage(eUnidentifiedEvent)
{

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -244,8 +244,10 @@ HTMLCanvasPrintState::Done()
if (mCanvas) {
mCanvas->InvalidateCanvas();
}
RefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
RefPtr<nsRunnableMethod<HTMLCanvasPrintState>> doneEvent =
NewRunnableMethod("dom::HTMLCanvasPrintState::NotifyDone",
this,
&HTMLCanvasPrintState::NotifyDone);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) {
mPendingNotify = true;
}
@ -524,8 +526,10 @@ HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
}
mPrintState = new HTMLCanvasPrintState(this, mCurrentContext, aCallback);
RefPtr<nsRunnableMethod<HTMLCanvasElement> > renderEvent =
NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
RefPtr<nsRunnableMethod<HTMLCanvasElement>> renderEvent =
NewRunnableMethod("dom::HTMLCanvasElement::CallPrintCallback",
this,
&HTMLCanvasElement::CallPrintCallback);
return OwnerDoc()->Dispatch("HTMLCanvasElement::CallPrintCallback",
TaskCategory::Other,
renderEvent.forget());
@ -847,13 +851,16 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
// According to spec, blob should return null if either its horizontal
// dimension or its vertical dimension is zero. See link below.
// https://html.spec.whatwg.org/multipage/scripting.html#dom-canvas-toblob
OwnerDoc()->Dispatch("FireNullBlobEvent",
TaskCategory::Other,
NewRunnableMethod<Blob*, const char*>(
&aCallback,
static_cast<void(BlobCallback::*)(
Blob*, const char*)>(&BlobCallback::Call),
nullptr, nullptr));
OwnerDoc()->Dispatch(
"FireNullBlobEvent",
TaskCategory::Other,
NewRunnableMethod<Blob*, const char*>(
"dom::HTMLCanvasElement::ToBlob",
&aCallback,
static_cast<void (BlobCallback::*)(Blob*, const char*)>(
&BlobCallback::Call),
nullptr,
nullptr));
return;
}
@ -1356,7 +1363,8 @@ HTMLCanvasElement::OnVisibilityChange()
{
public:
explicit Runnable(AsyncCanvasRenderer* aRenderer)
: mRenderer(aRenderer)
: mozilla::CancelableRunnable("Runnable")
, mRenderer(aRenderer)
{}
NS_IMETHOD Run() override
@ -1393,7 +1401,8 @@ HTMLCanvasElement::OnMemoryPressure()
{
public:
explicit Runnable(AsyncCanvasRenderer* aRenderer)
: mRenderer(aRenderer)
: mozilla::CancelableRunnable("Runnable")
, mRenderer(aRenderer)
{}
NS_IMETHOD Run() override

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

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

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

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

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

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

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

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

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

@ -232,10 +232,12 @@ RejectPromises(const nsTArray<RefPtr<Promise>>& aPromises, nsresult aError)
class nsMediaEvent : public Runnable
{
public:
explicit nsMediaEvent(HTMLMediaElement* aElement) :
mElement(aElement),
mLoadID(mElement->GetCurrentLoadID()) {}
explicit nsMediaEvent(HTMLMediaElement* aElement)
: Runnable("dom::nsMediaEvent")
, mElement(aElement)
, mLoadID(mElement->GetCurrentLoadID())
{
}
~nsMediaEvent() {}
NS_IMETHOD Run() = 0;
@ -405,9 +407,11 @@ public:
for (VideoSegment::ConstChunkIterator c(video); !c.IsEnded(); c.Next()) {
if (c->mFrame.GetIntrinsicSize() != gfx::IntSize(0,0)) {
mInitialSizeFound = true;
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod<gfx::IntSize>(this, &StreamSizeListener::ReceivedSize,
c->mFrame.GetIntrinsicSize());
nsCOMPtr<nsIRunnable> event = NewRunnableMethod<gfx::IntSize>(
"dom::HTMLMediaElement::StreamSizeListener::ReceivedSize",
this,
&StreamSizeListener::ReceivedSize,
c->mFrame.GetIntrinsicSize());
// This is fine to dispatch straight to main thread (instead of via
// ...AfterStreamUpdate()) since it reflects state of the element,
// not the stream. Events reflecting stream or track state should be
@ -970,24 +974,26 @@ private:
}
uint64_t windowID = mAudioChannelAgent->WindowID();
NS_DispatchToMainThread(NS_NewRunnableFunction([windowID]() -> void {
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
return;
}
NS_DispatchToMainThread(NS_NewRunnableFunction(
"dom::HTMLMediaElement::AudioChannelAgentCallback::"
"MaybeNotifyMediaResumed",
[windowID]() -> void {
nsCOMPtr<nsIObserverService> observerService =
services::GetObserverService();
if (NS_WARN_IF(!observerService)) {
return;
}
nsCOMPtr<nsISupportsPRUint64> wrapper =
do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID);
if (NS_WARN_IF(!wrapper)) {
return;
}
nsCOMPtr<nsISupportsPRUint64> wrapper =
do_CreateInstance(NS_SUPPORTS_PRUINT64_CONTRACTID);
if (NS_WARN_IF(!wrapper)) {
return;
}
wrapper->SetData(windowID);
observerService->NotifyObservers(wrapper,
"media-playback-resumed",
u"active");
}));
wrapper->SetData(windowID);
observerService->NotifyObservers(
wrapper, "media-playback-resumed", u"active");
}));
}
bool
@ -4123,8 +4129,12 @@ HTMLMediaElement::WakeLockBoolWrapper::UpdateWakeLock()
int timeout = Preferences::GetInt("media.wakelock_timeout", 2000);
mTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mTimer) {
mTimer->InitWithFuncCallback(TimerCallback, this, timeout,
nsITimer::TYPE_ONE_SHOT);
mTimer->InitWithNamedFuncCallback(
TimerCallback,
this,
timeout,
nsITimer::TYPE_ONE_SHOT,
"dom::HTMLMediaElement::WakeLockBoolWrapper::UpdateWakeLock");
}
}
}
@ -4564,11 +4574,12 @@ void HTMLMediaElement::UnbindFromTree(bool aDeep,
NotifyDecoderActivityChanges();
RefPtr<HTMLMediaElement> self(this);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([self] () {
if (self->mUnboundFromTree) {
self->Pause();
}
});
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableFunction("dom::HTMLMediaElement::UnbindFromTree", [self]() {
if (self->mUnboundFromTree) {
self->Pause();
}
});
RunInStableState(task);
}
@ -4869,9 +4880,15 @@ public:
{
nsCOMPtr<nsIRunnable> event;
if (aBlocked == BLOCKED) {
event = NewRunnableMethod(this, &StreamListener::DoNotifyBlocked);
event = NewRunnableMethod(
"dom::HTMLMediaElement::StreamListener::DoNotifyBlocked",
this,
&StreamListener::DoNotifyBlocked);
} else {
event = NewRunnableMethod(this, &StreamListener::DoNotifyUnblocked);
event = NewRunnableMethod(
"dom::HTMLMediaElement::StreamListener::DoNotifyUnblocked",
this,
&StreamListener::DoNotifyUnblocked);
}
aGraph->DispatchToMainThreadAfterStreamStateUpdate(mAbstractMainThread,
event.forget());
@ -4881,7 +4898,10 @@ public:
MutexAutoLock lock(mMutex);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
mAbstractMainThread,
NewRunnableMethod(this, &StreamListener::DoNotifyHaveCurrentData));
NewRunnableMethod(
"dom::HTMLMediaElement::StreamListener::DoNotifyHaveCurrentData",
this,
&StreamListener::DoNotifyHaveCurrentData));
}
virtual void NotifyOutput(MediaStreamGraph* aGraph,
GraphTime aCurrentTime) override
@ -4892,7 +4912,9 @@ public:
mPendingNotifyOutput = true;
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
mAbstractMainThread,
NewRunnableMethod(this, &StreamListener::DoNotifyOutput));
NewRunnableMethod("dom::HTMLMediaElement::StreamListener::DoNotifyOutput",
this,
&StreamListener::DoNotifyOutput));
}
private:
@ -6321,7 +6343,9 @@ void HTMLMediaElement::AddRemoveSelfReference()
// Dispatch Release asynchronously so that we don't destroy this object
// inside a call stack of method calls on this object
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod(this, &HTMLMediaElement::DoRemoveSelfReference);
NewRunnableMethod("dom::HTMLMediaElement::DoRemoveSelfReference",
this,
&HTMLMediaElement::DoRemoveSelfReference);
NS_DispatchToMainThread(event);
}
}
@ -7488,9 +7512,9 @@ HTMLMediaElement::AsyncResolveSeekDOMPromiseIfExists()
MOZ_ASSERT(NS_IsMainThread());
if (mSeekDOMPromise) {
RefPtr<dom::Promise> promise = mSeekDOMPromise.forget();
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
promise->MaybeResolveWithUndefined();
});
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"dom::HTMLMediaElement::AsyncResolveSeekDOMPromiseIfExists",
[=]() { promise->MaybeResolveWithUndefined(); });
mAbstractMainThread->Dispatch(r.forget());
mSeekDOMPromise = nullptr;
}
@ -7502,9 +7526,9 @@ HTMLMediaElement::AsyncRejectSeekDOMPromiseIfExists()
MOZ_ASSERT(NS_IsMainThread());
if (mSeekDOMPromise) {
RefPtr<dom::Promise> promise = mSeekDOMPromise.forget();
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
});
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"dom::HTMLMediaElement::AsyncRejectSeekDOMPromiseIfExists",
[=]() { promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR); });
mAbstractMainThread->Dispatch(r.forget());
mSeekDOMPromise = nullptr;
}
@ -7522,29 +7546,32 @@ HTMLMediaElement::ReportCanPlayTelemetry()
}
thread->Dispatch(
NS_NewRunnableFunction([thread]() {
NS_NewRunnableFunction(
"dom::HTMLMediaElement::ReportCanPlayTelemetry",
[thread]() {
#if XP_WIN
// Windows Media Foundation requires MSCOM to be inited.
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
MOZ_ASSERT(hr == S_OK);
// Windows Media Foundation requires MSCOM to be inited.
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
MOZ_ASSERT(hr == S_OK);
#endif
bool aac = MP4Decoder::IsSupportedType(
MediaContainerType(MEDIAMIMETYPE("audio/mp4")), nullptr);
bool h264 = MP4Decoder::IsSupportedType(
MediaContainerType(MEDIAMIMETYPE("video/mp4")), nullptr);
bool aac = MP4Decoder::IsSupportedType(
MediaContainerType(MEDIAMIMETYPE("audio/mp4")), nullptr);
bool h264 = MP4Decoder::IsSupportedType(
MediaContainerType(MEDIAMIMETYPE("video/mp4")), nullptr);
#if XP_WIN
CoUninitialize();
CoUninitialize();
#endif
AbstractThread::MainThread()->Dispatch(
NS_NewRunnableFunction([thread, aac, h264]() {
LOG(LogLevel::Debug, ("MediaTelemetry aac=%d h264=%d", aac, h264));
Telemetry::Accumulate(
Telemetry::HistogramID::VIDEO_CAN_CREATE_AAC_DECODER, aac);
Telemetry::Accumulate(
Telemetry::HistogramID::VIDEO_CAN_CREATE_H264_DECODER, h264);
thread->AsyncShutdown();
}));
}),
AbstractThread::MainThread()->Dispatch(NS_NewRunnableFunction(
"dom::HTMLMediaElement::ReportCanPlayTelemetry",
[thread, aac, h264]() {
LOG(LogLevel::Debug, ("MediaTelemetry aac=%d h264=%d", aac, h264));
Telemetry::Accumulate(
Telemetry::HistogramID::VIDEO_CAN_CREATE_AAC_DECODER, aac);
Telemetry::Accumulate(
Telemetry::HistogramID::VIDEO_CAN_CREATE_H264_DECODER, h264);
thread->AsyncShutdown();
}));
}),
NS_DISPATCH_NORMAL);
}

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

@ -131,7 +131,9 @@ class PluginFocusSetter : public Runnable
{
public:
PluginFocusSetter(nsIWidget* aWidget, Element* aElement)
: mWidget(aWidget), mElement(aElement)
: Runnable("PluginFocusSetter")
, mWidget(aWidget)
, mElement(aElement)
{
}
@ -269,7 +271,8 @@ HTMLObjectElement::BindToTree(nsIDocument *aDocument,
// If we already have all the children, start the load.
if (mIsDoneAddingChildren && !pluginDoc) {
void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad;
nsContentUtils::AddScriptRunner(NewRunnableMethod(this, start));
nsContentUtils::AddScriptRunner(
NewRunnableMethod("dom::HTMLObjectElement::BindToTree", this, start));
}
return NS_OK;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -83,9 +83,10 @@ private:
class RestoreSelectionState : public Runnable {
public:
RestoreSelectionState(nsTextEditorState *aState, nsTextControlFrame *aFrame)
: mFrame(aFrame),
mTextEditorState(aState)
RestoreSelectionState(nsTextEditorState* aState, nsTextControlFrame* aFrame)
: mozilla::Runnable("RestoreSelectionState")
, mFrame(aFrame)
, mTextEditorState(aState)
{
}
@ -1238,10 +1239,11 @@ nsTextEditorState::GetSelectionController() const
// Helper class, used below in BindToFrame().
class PrepareEditorEvent : public Runnable {
public:
PrepareEditorEvent(nsTextEditorState &aState,
nsIContent *aOwnerContent,
const nsAString &aCurrentValue)
: mState(&aState)
PrepareEditorEvent(nsTextEditorState& aState,
nsIContent* aOwnerContent,
const nsAString& aCurrentValue)
: mozilla::Runnable("PrepareEditorEvent")
, mState(&aState)
, mOwnerContent(aOwnerContent)
, mCurrentValue(aCurrentValue)
{
@ -2854,15 +2856,8 @@ nsTextEditorState::UpdateOverlayTextVisibility(bool aNotify)
mPreviewVisibility = valueIsEmpty && !previewValue.IsEmpty();
mPlaceholderVisibility = valueIsEmpty && previewValue.IsEmpty();
static bool sPrefCached = false;
static bool sPrefShowOnFocus = true;
if (!sPrefCached) {
sPrefCached = true;
Preferences::AddBoolVarCache(&sPrefShowOnFocus,
"dom.placeholder.show_on_focus", true);
}
if (mPlaceholderVisibility && !sPrefShowOnFocus) {
if (mPlaceholderVisibility &&
!nsContentUtils::ShowInputPlaceholderOnFocus()) {
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
mPlaceholderVisibility = !nsContentUtils::IsFocusedContent(content);
}

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

@ -2223,17 +2223,7 @@ BackgroundDatabaseChild::RecvPBackgroundIDBVersionChangeTransactionConstructor(
request,
aNextObjectStoreId,
aNextIndexId);
if (NS_WARN_IF(!transaction)) {
// This can happen if we receive events after a worker has begun its
// shutdown process.
MOZ_ASSERT(!NS_IsMainThread());
// Report this to the console.
IDB_REPORT_INTERNAL_ERR();
MOZ_ALWAYS_TRUE(aActor->SendDeleteMe());
return IPC_OK();
}
MOZ_ASSERT(transaction);
transaction->AssertIsOnOwningThread();

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