зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1350436 - Rename ValidatingDispatcher to SchedulerGroup (r=froydnj)
MozReview-Commit-ID: 1gWB9ZLPQfY
This commit is contained in:
Родитель
21e75fbf2a
Коммит
2bb4eb39bf
|
@ -7,7 +7,7 @@
|
||||||
#include "mozilla/dom/DispatcherTrait.h"
|
#include "mozilla/dom/DispatcherTrait.h"
|
||||||
|
|
||||||
#include "mozilla/AbstractThread.h"
|
#include "mozilla/AbstractThread.h"
|
||||||
#include "mozilla/Dispatcher.h"
|
#include "mozilla/SchedulerGroup.h"
|
||||||
#include "nsINamed.h"
|
#include "nsINamed.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
@ -18,7 +18,7 @@ DispatcherTrait::Dispatch(const char* aName,
|
||||||
TaskCategory aCategory,
|
TaskCategory aCategory,
|
||||||
already_AddRefed<nsIRunnable>&& aRunnable)
|
already_AddRefed<nsIRunnable>&& aRunnable)
|
||||||
{
|
{
|
||||||
return ValidatingDispatcher::UnlabeledDispatch(aName, aCategory, Move(aRunnable));
|
return SchedulerGroup::UnlabeledDispatch(aName, aCategory, Move(aRunnable));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIEventTarget*
|
nsIEventTarget*
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
#include "mozilla/dom/TabGroup.h"
|
#include "mozilla/dom/TabGroup.h"
|
||||||
#include "mozilla/Dispatcher.h"
|
|
||||||
#include "mozilla/RefPtr.h"
|
#include "mozilla/RefPtr.h"
|
||||||
#include "mozilla/dom/CustomElementRegistry.h"
|
#include "mozilla/dom/CustomElementRegistry.h"
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,10 @@ TabGroup::GetFromWindowActor(mozIDOMWindowProxy* aWindow)
|
||||||
|
|
||||||
// We have an event target. We assume the IPC code created it via
|
// We have an event target. We assume the IPC code created it via
|
||||||
// TabGroup::CreateEventTarget.
|
// TabGroup::CreateEventTarget.
|
||||||
RefPtr<ValidatingDispatcher> dispatcher =
|
RefPtr<SchedulerGroup> group =
|
||||||
ValidatingDispatcher::FromEventTarget(target);
|
SchedulerGroup::FromEventTarget(target);
|
||||||
MOZ_RELEASE_ASSERT(dispatcher);
|
MOZ_RELEASE_ASSERT(group);
|
||||||
auto tabGroup = dispatcher->AsTabGroup();
|
auto tabGroup = group->AsTabGroup();
|
||||||
MOZ_RELEASE_ASSERT(tabGroup);
|
MOZ_RELEASE_ASSERT(tabGroup);
|
||||||
|
|
||||||
// We delay creating the event targets until now since the TabGroup
|
// We delay creating the event targets until now since the TabGroup
|
||||||
|
@ -241,7 +241,7 @@ TabGroup::EventTargetFor(TaskCategory aCategory) const
|
||||||
if (aCategory == TaskCategory::Worker || aCategory == TaskCategory::Timer) {
|
if (aCategory == TaskCategory::Worker || aCategory == TaskCategory::Timer) {
|
||||||
MOZ_RELEASE_ASSERT(mThrottledQueuesInitialized || mIsChrome);
|
MOZ_RELEASE_ASSERT(mThrottledQueuesInitialized || mIsChrome);
|
||||||
}
|
}
|
||||||
return ValidatingDispatcher::EventTargetFor(aCategory);
|
return SchedulerGroup::EventTargetFor(aCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractThread*
|
AbstractThread*
|
||||||
|
@ -255,7 +255,7 @@ TabGroup::AbstractMainThreadForImpl(TaskCategory aCategory)
|
||||||
return AbstractThread::MainThread();
|
return AbstractThread::MainThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ValidatingDispatcher::AbstractMainThreadForImpl(aCategory);
|
return SchedulerGroup::AbstractMainThreadForImpl(aCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
#include "mozilla/Atomics.h"
|
#include "mozilla/Atomics.h"
|
||||||
#include "mozilla/Dispatcher.h"
|
#include "mozilla/SchedulerGroup.h"
|
||||||
#include "mozilla/RefPtr.h"
|
#include "mozilla/RefPtr.h"
|
||||||
|
|
||||||
class mozIDOMWindowProxy;
|
class mozIDOMWindowProxy;
|
||||||
|
@ -43,7 +43,7 @@ namespace dom {
|
||||||
|
|
||||||
class DocGroup;
|
class DocGroup;
|
||||||
|
|
||||||
class TabGroup final : public ValidatingDispatcher
|
class TabGroup final : public SchedulerGroup
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
class HashEntry : public nsCStringHashKey
|
class HashEntry : public nsCStringHashKey
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/Dispatcher.h"
|
#include "mozilla/SchedulerGroup.h"
|
||||||
|
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "mozilla/AbstractThread.h"
|
#include "mozilla/AbstractThread.h"
|
||||||
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
class ValidatingDispatcher::Runnable final : public mozilla::Runnable
|
class SchedulerGroup::Runnable final : public mozilla::Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Runnable(already_AddRefed<nsIRunnable>&& aRunnable,
|
Runnable(already_AddRefed<nsIRunnable>&& aRunnable,
|
||||||
ValidatingDispatcher* aDispatcher);
|
SchedulerGroup* aDispatcher);
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
GetName(nsACString& aName) override
|
GetName(nsACString& aName) override
|
||||||
|
@ -41,10 +41,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsIRunnable> mRunnable;
|
nsCOMPtr<nsIRunnable> mRunnable;
|
||||||
RefPtr<ValidatingDispatcher> mDispatcher;
|
RefPtr<SchedulerGroup> mDispatcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* DispatcherEventTarget */
|
/* SchedulerEventTarget */
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -52,15 +52,15 @@ namespace {
|
||||||
{ 0xbf4e36c8, 0x7d04, 0x4ef4, \
|
{ 0xbf4e36c8, 0x7d04, 0x4ef4, \
|
||||||
{ 0xbb, 0xd8, 0x11, 0x09, 0x0a, 0xdb, 0x4d, 0xf7 } }
|
{ 0xbb, 0xd8, 0x11, 0x09, 0x0a, 0xdb, 0x4d, 0xf7 } }
|
||||||
|
|
||||||
class DispatcherEventTarget final : public nsIEventTarget
|
class SchedulerEventTarget final : public nsIEventTarget
|
||||||
{
|
{
|
||||||
RefPtr<ValidatingDispatcher> mDispatcher;
|
RefPtr<SchedulerGroup> mDispatcher;
|
||||||
TaskCategory mCategory;
|
TaskCategory mCategory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DISPATCHEREVENTTARGET_IID)
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DISPATCHEREVENTTARGET_IID)
|
||||||
|
|
||||||
DispatcherEventTarget(ValidatingDispatcher* aDispatcher, TaskCategory aCategory)
|
SchedulerEventTarget(SchedulerGroup* aDispatcher, TaskCategory aCategory)
|
||||||
: mDispatcher(aDispatcher)
|
: mDispatcher(aDispatcher)
|
||||||
, mCategory(aCategory)
|
, mCategory(aCategory)
|
||||||
{}
|
{}
|
||||||
|
@ -68,26 +68,26 @@ public:
|
||||||
NS_DECL_THREADSAFE_ISUPPORTS
|
NS_DECL_THREADSAFE_ISUPPORTS
|
||||||
NS_DECL_NSIEVENTTARGET
|
NS_DECL_NSIEVENTTARGET
|
||||||
|
|
||||||
ValidatingDispatcher* Dispatcher() const { return mDispatcher; }
|
SchedulerGroup* Dispatcher() const { return mDispatcher; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~DispatcherEventTarget() {}
|
~SchedulerEventTarget() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(DispatcherEventTarget, NS_DISPATCHEREVENTTARGET_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(SchedulerEventTarget, NS_DISPATCHEREVENTTARGET_IID)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(DispatcherEventTarget, DispatcherEventTarget, nsIEventTarget)
|
NS_IMPL_ISUPPORTS(SchedulerEventTarget, SchedulerEventTarget, nsIEventTarget)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DispatcherEventTarget::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags)
|
SchedulerEventTarget::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags)
|
||||||
{
|
{
|
||||||
return Dispatch(do_AddRef(aRunnable), aFlags);
|
return Dispatch(do_AddRef(aRunnable), aFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DispatcherEventTarget::Dispatch(already_AddRefed<nsIRunnable> aRunnable, uint32_t aFlags)
|
SchedulerEventTarget::Dispatch(already_AddRefed<nsIRunnable> aRunnable, uint32_t aFlags)
|
||||||
{
|
{
|
||||||
if (NS_WARN_IF(aFlags != NS_DISPATCH_NORMAL)) {
|
if (NS_WARN_IF(aFlags != NS_DISPATCH_NORMAL)) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
@ -96,22 +96,22 @@ DispatcherEventTarget::Dispatch(already_AddRefed<nsIRunnable> aRunnable, uint32_
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DispatcherEventTarget::DelayedDispatch(already_AddRefed<nsIRunnable>, uint32_t)
|
SchedulerEventTarget::DelayedDispatch(already_AddRefed<nsIRunnable>, uint32_t)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DispatcherEventTarget::IsOnCurrentThread(bool* aIsOnCurrentThread)
|
SchedulerEventTarget::IsOnCurrentThread(bool* aIsOnCurrentThread)
|
||||||
{
|
{
|
||||||
*aIsOnCurrentThread = NS_IsMainThread();
|
*aIsOnCurrentThread = NS_IsMainThread();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ nsresult
|
/* static */ nsresult
|
||||||
ValidatingDispatcher::UnlabeledDispatch(const char* aName,
|
SchedulerGroup::UnlabeledDispatch(const char* aName,
|
||||||
TaskCategory aCategory,
|
TaskCategory aCategory,
|
||||||
already_AddRefed<nsIRunnable>&& aRunnable)
|
already_AddRefed<nsIRunnable>&& aRunnable)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIRunnable> runnable(aRunnable);
|
nsCOMPtr<nsIRunnable> runnable(aRunnable);
|
||||||
if (aName) {
|
if (aName) {
|
||||||
|
@ -126,23 +126,23 @@ ValidatingDispatcher::UnlabeledDispatch(const char* aName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidatingDispatcher* ValidatingDispatcher::sRunningDispatcher;
|
SchedulerGroup* SchedulerGroup::sRunningDispatcher;
|
||||||
|
|
||||||
ValidatingDispatcher::ValidatingDispatcher()
|
SchedulerGroup::SchedulerGroup()
|
||||||
: mAccessValid(false)
|
: mAccessValid(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ValidatingDispatcher::Dispatch(const char* aName,
|
SchedulerGroup::Dispatch(const char* aName,
|
||||||
TaskCategory aCategory,
|
TaskCategory aCategory,
|
||||||
already_AddRefed<nsIRunnable>&& aRunnable)
|
already_AddRefed<nsIRunnable>&& aRunnable)
|
||||||
{
|
{
|
||||||
return LabeledDispatch(aName, aCategory, Move(aRunnable));
|
return LabeledDispatch(aName, aCategory, Move(aRunnable));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIEventTarget*
|
nsIEventTarget*
|
||||||
ValidatingDispatcher::EventTargetFor(TaskCategory aCategory) const
|
SchedulerGroup::EventTargetFor(TaskCategory aCategory) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aCategory != TaskCategory::Count);
|
MOZ_ASSERT(aCategory != TaskCategory::Count);
|
||||||
MOZ_ASSERT(mEventTargets[size_t(aCategory)]);
|
MOZ_ASSERT(mEventTargets[size_t(aCategory)]);
|
||||||
|
@ -150,14 +150,14 @@ ValidatingDispatcher::EventTargetFor(TaskCategory aCategory) const
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractThread*
|
AbstractThread*
|
||||||
ValidatingDispatcher::AbstractMainThreadFor(TaskCategory aCategory)
|
SchedulerGroup::AbstractMainThreadFor(TaskCategory aCategory)
|
||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||||
return AbstractMainThreadForImpl(aCategory);
|
return AbstractMainThreadForImpl(aCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractThread*
|
AbstractThread*
|
||||||
ValidatingDispatcher::AbstractMainThreadForImpl(TaskCategory aCategory)
|
SchedulerGroup::AbstractMainThreadForImpl(TaskCategory aCategory)
|
||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aCategory != TaskCategory::Count);
|
MOZ_ASSERT(aCategory != TaskCategory::Count);
|
||||||
|
@ -173,7 +173,7 @@ ValidatingDispatcher::AbstractMainThreadForImpl(TaskCategory aCategory)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ValidatingDispatcher::CreateEventTargets(bool aNeedValidation)
|
SchedulerGroup::CreateEventTargets(bool aNeedValidation)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < size_t(TaskCategory::Count); i++) {
|
for (size_t i = 0; i < size_t(TaskCategory::Count); i++) {
|
||||||
TaskCategory category = static_cast<TaskCategory>(i);
|
TaskCategory category = static_cast<TaskCategory>(i);
|
||||||
|
@ -189,9 +189,9 @@ ValidatingDispatcher::CreateEventTargets(bool aNeedValidation)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ValidatingDispatcher::Shutdown(bool aXPCOMShutdown)
|
SchedulerGroup::Shutdown(bool aXPCOMShutdown)
|
||||||
{
|
{
|
||||||
// There is a RefPtr cycle TabGroup -> DispatcherEventTarget -> TabGroup. To
|
// There is a RefPtr cycle TabGroup -> SchedulerEventTarget -> TabGroup. To
|
||||||
// avoid leaks, we need to break the chain somewhere. We shouldn't be using
|
// avoid leaks, we need to break the chain somewhere. We shouldn't be using
|
||||||
// the ThrottledEventQueue for this TabGroup when no windows belong to it,
|
// the ThrottledEventQueue for this TabGroup when no windows belong to it,
|
||||||
// so it's safe to null out the queue here.
|
// so it's safe to null out the queue here.
|
||||||
|
@ -202,17 +202,17 @@ ValidatingDispatcher::Shutdown(bool aXPCOMShutdown)
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIEventTarget>
|
already_AddRefed<nsIEventTarget>
|
||||||
ValidatingDispatcher::CreateEventTargetFor(TaskCategory aCategory)
|
SchedulerGroup::CreateEventTargetFor(TaskCategory aCategory)
|
||||||
{
|
{
|
||||||
RefPtr<DispatcherEventTarget> target =
|
RefPtr<SchedulerEventTarget> target =
|
||||||
new DispatcherEventTarget(this, aCategory);
|
new SchedulerEventTarget(this, aCategory);
|
||||||
return target.forget();
|
return target.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ ValidatingDispatcher*
|
/* static */ SchedulerGroup*
|
||||||
ValidatingDispatcher::FromEventTarget(nsIEventTarget* aEventTarget)
|
SchedulerGroup::FromEventTarget(nsIEventTarget* aEventTarget)
|
||||||
{
|
{
|
||||||
RefPtr<DispatcherEventTarget> target = do_QueryObject(aEventTarget);
|
RefPtr<SchedulerEventTarget> target = do_QueryObject(aEventTarget);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -220,9 +220,9 @@ ValidatingDispatcher::FromEventTarget(nsIEventTarget* aEventTarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ValidatingDispatcher::LabeledDispatch(const char* aName,
|
SchedulerGroup::LabeledDispatch(const char* aName,
|
||||||
TaskCategory aCategory,
|
TaskCategory aCategory,
|
||||||
already_AddRefed<nsIRunnable>&& aRunnable)
|
already_AddRefed<nsIRunnable>&& aRunnable)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIRunnable> runnable(aRunnable);
|
nsCOMPtr<nsIRunnable> runnable(aRunnable);
|
||||||
if (XRE_IsContentProcess()) {
|
if (XRE_IsContentProcess()) {
|
||||||
|
@ -232,7 +232,7 @@ ValidatingDispatcher::LabeledDispatch(const char* aName,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ValidatingDispatcher::SetValidatingAccess(ValidationType aType)
|
SchedulerGroup::SetValidatingAccess(ValidationType aType)
|
||||||
{
|
{
|
||||||
sRunningDispatcher = aType == StartValidation ? this : nullptr;
|
sRunningDispatcher = aType == StartValidation ? this : nullptr;
|
||||||
mAccessValid = aType == StartValidation;
|
mAccessValid = aType == StartValidation;
|
||||||
|
@ -242,15 +242,15 @@ ValidatingDispatcher::SetValidatingAccess(ValidationType aType)
|
||||||
js::EnableAccessValidation(jsapi.cx(), !!sRunningDispatcher);
|
js::EnableAccessValidation(jsapi.cx(), !!sRunningDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidatingDispatcher::Runnable::Runnable(already_AddRefed<nsIRunnable>&& aRunnable,
|
SchedulerGroup::Runnable::Runnable(already_AddRefed<nsIRunnable>&& aRunnable,
|
||||||
ValidatingDispatcher* aDispatcher)
|
SchedulerGroup* aDispatcher)
|
||||||
: mRunnable(Move(aRunnable)),
|
: mRunnable(Move(aRunnable)),
|
||||||
mDispatcher(aDispatcher)
|
mDispatcher(aDispatcher)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ValidatingDispatcher::Runnable::Run()
|
SchedulerGroup::Runnable::Run()
|
||||||
{
|
{
|
||||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
@ -266,21 +266,21 @@ ValidatingDispatcher::Runnable::Run()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidatingDispatcher::AutoProcessEvent::AutoProcessEvent()
|
SchedulerGroup::AutoProcessEvent::AutoProcessEvent()
|
||||||
: mPrevRunningDispatcher(ValidatingDispatcher::sRunningDispatcher)
|
: mPrevRunningDispatcher(SchedulerGroup::sRunningDispatcher)
|
||||||
{
|
{
|
||||||
ValidatingDispatcher* prev = sRunningDispatcher;
|
SchedulerGroup* prev = sRunningDispatcher;
|
||||||
if (prev) {
|
if (prev) {
|
||||||
MOZ_ASSERT(prev->mAccessValid);
|
MOZ_ASSERT(prev->mAccessValid);
|
||||||
prev->SetValidatingAccess(EndValidation);
|
prev->SetValidatingAccess(EndValidation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidatingDispatcher::AutoProcessEvent::~AutoProcessEvent()
|
SchedulerGroup::AutoProcessEvent::~AutoProcessEvent()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!sRunningDispatcher);
|
MOZ_ASSERT(!sRunningDispatcher);
|
||||||
|
|
||||||
ValidatingDispatcher* prev = mPrevRunningDispatcher;
|
SchedulerGroup* prev = mPrevRunningDispatcher;
|
||||||
if (prev) {
|
if (prev) {
|
||||||
prev->SetValidatingAccess(StartValidation);
|
prev->SetValidatingAccess(StartValidation);
|
||||||
}
|
}
|
|
@ -4,8 +4,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_Dispatcher_h
|
#ifndef mozilla_SchedulerGroup_h
|
||||||
#define mozilla_Dispatcher_h
|
#define mozilla_SchedulerGroup_h
|
||||||
|
|
||||||
#include "mozilla/AlreadyAddRefed.h"
|
#include "mozilla/AlreadyAddRefed.h"
|
||||||
#include "mozilla/TaskCategory.h"
|
#include "mozilla/TaskCategory.h"
|
||||||
|
@ -31,10 +31,10 @@ class TabGroup;
|
||||||
// only functionality offered by a Dispatcher is the ability to dispatch
|
// only functionality offered by a Dispatcher is the ability to dispatch
|
||||||
// runnables to the group. TabGroup, DocGroup, and SystemGroup are the concrete
|
// runnables to the group. TabGroup, DocGroup, and SystemGroup are the concrete
|
||||||
// implementations of Dispatcher.
|
// implementations of Dispatcher.
|
||||||
class ValidatingDispatcher
|
class SchedulerGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ValidatingDispatcher();
|
SchedulerGroup();
|
||||||
|
|
||||||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
~AutoProcessEvent();
|
~AutoProcessEvent();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ValidatingDispatcher* mPrevRunningDispatcher;
|
SchedulerGroup* mPrevRunningDispatcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ensure that it's valid to access the TabGroup at this time.
|
// Ensure that it's valid to access the TabGroup at this time.
|
||||||
|
@ -87,7 +87,7 @@ protected:
|
||||||
|
|
||||||
// Given an event target returned by |dispatcher->CreateEventTargetFor|, this
|
// Given an event target returned by |dispatcher->CreateEventTargetFor|, this
|
||||||
// function returns |dispatcher|.
|
// function returns |dispatcher|.
|
||||||
static ValidatingDispatcher* FromEventTarget(nsIEventTarget* aEventTarget);
|
static SchedulerGroup* FromEventTarget(nsIEventTarget* aEventTarget);
|
||||||
|
|
||||||
nsresult LabeledDispatch(const char* aName,
|
nsresult LabeledDispatch(const char* aName,
|
||||||
TaskCategory aCategory,
|
TaskCategory aCategory,
|
||||||
|
@ -105,7 +105,7 @@ protected:
|
||||||
};
|
};
|
||||||
void SetValidatingAccess(ValidationType aType);
|
void SetValidatingAccess(ValidationType aType);
|
||||||
|
|
||||||
static ValidatingDispatcher* sRunningDispatcher;
|
static SchedulerGroup* sRunningDispatcher;
|
||||||
bool mAccessValid;
|
bool mAccessValid;
|
||||||
|
|
||||||
nsCOMPtr<nsIEventTarget> mEventTargets[size_t(TaskCategory::Count)];
|
nsCOMPtr<nsIEventTarget> mEventTargets[size_t(TaskCategory::Count)];
|
||||||
|
@ -114,4 +114,4 @@ protected:
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_dom_Dispatcher_h
|
#endif // mozilla_SchedulerGroup_h
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
class SystemGroupImpl final : public ValidatingDispatcher
|
class SystemGroupImpl final : public SchedulerGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SystemGroupImpl();
|
SystemGroupImpl();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#define mozilla_SystemGroup_h
|
#define mozilla_SystemGroup_h
|
||||||
|
|
||||||
#include "mozilla/TaskCategory.h"
|
#include "mozilla/TaskCategory.h"
|
||||||
#include "mozilla/Dispatcher.h"
|
#include "mozilla/SchedulerGroup.h"
|
||||||
|
|
||||||
// The SystemGroup should be used for dispatching runnables that don't need to
|
// The SystemGroup should be used for dispatching runnables that don't need to
|
||||||
// touch web content. Runnables dispatched to the SystemGroup are run in order
|
// touch web content. Runnables dispatched to the SystemGroup are run in order
|
||||||
|
|
|
@ -39,7 +39,6 @@ EXPORTS.mozilla += [
|
||||||
'BlockingResourceBase.h',
|
'BlockingResourceBase.h',
|
||||||
'CondVar.h',
|
'CondVar.h',
|
||||||
'DeadlockDetector.h',
|
'DeadlockDetector.h',
|
||||||
'Dispatcher.h',
|
|
||||||
'HangAnnotations.h',
|
'HangAnnotations.h',
|
||||||
'HangMonitor.h',
|
'HangMonitor.h',
|
||||||
'LazyIdleThread.h',
|
'LazyIdleThread.h',
|
||||||
|
@ -48,6 +47,7 @@ EXPORTS.mozilla += [
|
||||||
'MozPromise.h',
|
'MozPromise.h',
|
||||||
'Mutex.h',
|
'Mutex.h',
|
||||||
'ReentrantMonitor.h',
|
'ReentrantMonitor.h',
|
||||||
|
'SchedulerGroup.h',
|
||||||
'SharedThreadPool.h',
|
'SharedThreadPool.h',
|
||||||
'StateMirroring.h',
|
'StateMirroring.h',
|
||||||
'StateWatching.h',
|
'StateWatching.h',
|
||||||
|
@ -63,7 +63,6 @@ UNIFIED_SOURCES += [
|
||||||
'AbstractThread.cpp',
|
'AbstractThread.cpp',
|
||||||
'BackgroundHangMonitor.cpp',
|
'BackgroundHangMonitor.cpp',
|
||||||
'BlockingResourceBase.cpp',
|
'BlockingResourceBase.cpp',
|
||||||
'Dispatcher.cpp',
|
|
||||||
'HangAnnotations.cpp',
|
'HangAnnotations.cpp',
|
||||||
'HangMonitor.cpp',
|
'HangMonitor.cpp',
|
||||||
'LazyIdleThread.cpp',
|
'LazyIdleThread.cpp',
|
||||||
|
@ -78,6 +77,7 @@ UNIFIED_SOURCES += [
|
||||||
'nsThreadPool.cpp',
|
'nsThreadPool.cpp',
|
||||||
'nsThreadUtils.cpp',
|
'nsThreadUtils.cpp',
|
||||||
'nsTimerImpl.cpp',
|
'nsTimerImpl.cpp',
|
||||||
|
'SchedulerGroup.cpp',
|
||||||
'SharedThreadPool.cpp',
|
'SharedThreadPool.cpp',
|
||||||
'SystemGroup.cpp',
|
'SystemGroup.cpp',
|
||||||
'TaskQueue.cpp',
|
'TaskQueue.cpp',
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
#include "nsQueryObject.h"
|
#include "nsQueryObject.h"
|
||||||
#include "pratom.h"
|
#include "pratom.h"
|
||||||
#include "mozilla/CycleCollectedJSContext.h"
|
#include "mozilla/CycleCollectedJSContext.h"
|
||||||
#include "mozilla/Dispatcher.h"
|
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "mozilla/HangMonitor.h"
|
#include "mozilla/HangMonitor.h"
|
||||||
#include "mozilla/IOInterposer.h"
|
#include "mozilla/IOInterposer.h"
|
||||||
#include "mozilla/ipc/MessageChannel.h"
|
#include "mozilla/ipc/MessageChannel.h"
|
||||||
#include "mozilla/ipc/BackgroundChild.h"
|
#include "mozilla/ipc/BackgroundChild.h"
|
||||||
|
#include "mozilla/SchedulerGroup.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
#include "nsXPCOMPrivate.h"
|
#include "nsXPCOMPrivate.h"
|
||||||
#include "mozilla/ChaosMode.h"
|
#include "mozilla/ChaosMode.h"
|
||||||
|
@ -1202,7 +1202,7 @@ nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
|
||||||
// and repeat the nested event loop since its state change hasn't happened yet.
|
// and repeat the nested event loop since its state change hasn't happened yet.
|
||||||
bool reallyWait = aMayWait && (mNestedEventLoopDepth > 0 || !ShuttingDown());
|
bool reallyWait = aMayWait && (mNestedEventLoopDepth > 0 || !ShuttingDown());
|
||||||
|
|
||||||
Maybe<ValidatingDispatcher::AutoProcessEvent> ape;
|
Maybe<SchedulerGroup::AutoProcessEvent> ape;
|
||||||
if (mIsMainThread == MAIN_THREAD) {
|
if (mIsMainThread == MAIN_THREAD) {
|
||||||
DoMainThreadSpecificProcessing(reallyWait);
|
DoMainThreadSpecificProcessing(reallyWait);
|
||||||
ape.emplace();
|
ape.emplace();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче