Bug 1620594 - Part 2: Use SchedulerGroup::Dispatch instead of SystemGroup::Dispatch. r=nika

Depends on D67631

Differential Revision: https://phabricator.services.mozilla.com/D67632

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Farre 2020-04-07 15:16:33 +00:00
parent 63e21eec70
commit 36eaf82163
70 changed files with 219 additions and 169 deletions

View File

@ -50,6 +50,7 @@
#include "mozilla/AutoRestore.h"
#include "mozilla/MainThreadIdlePeriod.h"
#include "mozilla/PresShell.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_javascript.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/BrowsingContext.h"
@ -2278,8 +2279,8 @@ static void DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress,
json.Adopt(aDesc.formatJSONTelemetry(aCx, PR_Now()));
RefPtr<NotifyGCEndRunnable> notify =
new NotifyGCEndRunnable(std::move(json));
SystemGroup::Dispatch(TaskCategory::GarbageCollection,
notify.forget());
SchedulerGroup::Dispatch(TaskCategory::GarbageCollection,
notify.forget());
}
}

View File

@ -15,8 +15,8 @@
#include "mozilla/dom/ServiceWorkerManager.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StorageAccess.h"
#include "mozilla/SystemGroup.h"
#include "nsIGlobalObject.h"
#include "nsString.h"
@ -100,7 +100,7 @@ already_AddRefed<Promise> Clients::Get(const nsAString& aClientID,
scope, "ServiceWorkerGetClientStorageError",
nsTArray<nsString>());
});
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
outerPromise->MaybeResolveWithUndefined();
},
[outerPromise, holder](const CopyableErrorResult& aResult) {
@ -183,7 +183,7 @@ already_AddRefed<Promise> Clients::MatchAll(const ClientQueryOptions& aOptions,
scope, "ServiceWorkerGetClientStorageError",
nsTArray<nsString>());
});
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
clientList.Sort(MatchAllComparator());
outerPromise->MaybeResolve(clientList);

View File

@ -18,6 +18,7 @@
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/MozPromise.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/SystemGroup.h"
#include "jsfriendapi.h"
#include "nsIAsyncShutdown.h"
@ -100,7 +101,8 @@ RefPtr<GenericPromise> OnShutdown() {
}
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return ref;
}
@ -482,7 +484,8 @@ RefPtr<ClientOpPromise> ClaimOnMainThread(
scopeExit.release();
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise;
}

View File

@ -26,6 +26,7 @@
#include "mozilla/dom/ServiceWorker.h"
#include "mozilla/dom/ServiceWorkerContainer.h"
#include "mozilla/dom/ServiceWorkerManager.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StorageAccess.h"
#include "nsIContentSecurityPolicy.h"
#include "nsContentUtils.h"
@ -632,7 +633,8 @@ RefPtr<ClientOpPromise> ClientSource::Claim(const ClientClaimArgs& aArgs) {
if (NS_IsMainThread()) {
r->Run();
} else {
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
RefPtr<ClientOpPromise::Private> outerPromise =

View File

@ -14,7 +14,7 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/PClientManagerParent.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Unused.h"
namespace mozilla {
@ -75,7 +75,8 @@ void ClientSourceParent::KillInvalidChild() {
// there is a small window of time before we kill the process. This is why
// we start the actor destruction immediately above.
nsCOMPtr<nsIRunnable> r = new KillContentParentRunnable(std::move(process));
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
mozilla::ipc::IPCResult ClientSourceParent::RecvWorkerSyncPing() {
@ -152,7 +153,8 @@ IPCResult ClientSourceParent::RecvInheritController(
swm->NoteInheritedController(clientInfo, controller);
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
return IPC_OK();
@ -170,7 +172,8 @@ IPCResult ClientSourceParent::RecvNoteDOMContentLoaded() {
swm->MaybeCheckNavigationUpdate(clientInfo);
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
return IPC_OK();
}

View File

@ -6,8 +6,8 @@
#include "IPCBlobInputStreamThread.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/TaskCategory.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
@ -130,7 +130,7 @@ bool IPCBlobInputStreamThread::Initialize() {
if (!NS_IsMainThread()) {
RefPtr<Runnable> runnable = new ThreadInitializeRunnable();
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget());
return true;
}

View File

@ -20,6 +20,7 @@
#include "mozilla/LoadInfo.h"
#include "mozilla/NullPrincipal.h"
#include "mozilla/Preferences.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/SystemGroup.h"
#include "nsClassHashtable.h"
#include "nsContentUtils.h"
@ -385,8 +386,14 @@ class ReleasingTimerHolder final : public Runnable,
auto raii = MakeScopeExit([holder] { holder->CancelTimerAndRevokeURI(); });
nsresult rv = SystemGroup::EventTargetFor(TaskCategory::Other)
->Dispatch(holder.forget());
// ReleasingTimerHolder potentially dispatches after we've
// shutdown the main thread, so guard agains that.
if (NS_WARN_IF(gXPCOMThreadsShutDown)) {
return;
}
nsresult rv =
SchedulerGroup::Dispatch(TaskCategory::Other, holder.forget());
NS_ENSURE_SUCCESS_VOID(rv);
raii.release();

View File

@ -37,6 +37,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Result.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/SnappyCompressOutputStream.h"
#include "mozilla/SnappyUncompressInputStream.h"
#include "mozilla/StaticPtr.h"
@ -10405,7 +10406,7 @@ class DeserializeIndexValueHelper final : public Runnable {
RefPtr<Runnable> self = this;
const nsresult rv =
SystemGroup::Dispatch(TaskCategory::Other, self.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, self.forget());
if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv);
return;
@ -10516,7 +10517,7 @@ class DeserializeUpgradeValueHelper final : public Runnable {
RefPtr<Runnable> self = this;
const nsresult rv =
SystemGroup::Dispatch(TaskCategory::Other, self.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, self.forget());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

View File

@ -7,7 +7,6 @@
#include "ScriptErrorHelper.h"
#include "MainThreadUtils.h"
#include "mozilla/SystemGroup.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsIConsoleService.h"
@ -15,6 +14,8 @@
#include "nsString.h"
#include "nsThreadUtils.h"
#include "mozilla/SchedulerGroup.h"
namespace {
class ScriptErrorRunnable final : public mozilla::Runnable {
@ -165,7 +166,7 @@ void ScriptErrorHelper::Dump(const nsAString& aMessage,
new ScriptErrorRunnable(aMessage, aFilename, aLineNumber, aColumnNumber,
aSeverityFlag, aIsChrome, aInnerWindowID);
MOZ_ALWAYS_SUCCEEDS(
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget()));
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget()));
}
}
@ -183,7 +184,7 @@ void ScriptErrorHelper::DumpLocalizedMessage(
aMessageName, aFilename, aLineNumber, aColumnNumber, aSeverityFlag,
aIsChrome, aInnerWindowID);
MOZ_ALWAYS_SUCCEEDS(
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget()));
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget()));
}
}

View File

@ -26,6 +26,7 @@
#include "mozilla/ProcessHangMonitorIPC.h"
#include "mozilla/RemoteDecoderManagerChild.h"
#include "mozilla/Unused.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/TelemetryIPC.h"
@ -739,7 +740,7 @@ bool ContentChild::Init(MessageLoop* aIOLoop, base::ProcessId aParentPid,
#ifdef NIGHTLY_BUILD
// NOTE: We have to register the annotator on the main thread, as annotators
// only affect a single thread.
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("RegisterPendingInputEventHangAnnotator", [] {
BackgroundHangMonitor::RegisterAnnotator(
@ -1258,7 +1259,7 @@ void ContentChild::GetProcessName(nsAString& aName) const {
void ContentChild::LaunchRDDProcess() {
SynchronousTask task("LaunchRDDProcess");
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("LaunchRDDProcess", [&task, this] {
AutoCompleteTask complete(&task);

View File

@ -8,6 +8,7 @@
#include "mozilla/dom/AudioDeviceInfo.h"
#include "mozilla/dom/BaseAudioContextBinding.h"
#include "mozilla/dom/WorkletThread.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Unused.h"
@ -90,7 +91,7 @@ ThreadedDriver::~ThreadedDriver() {
if (mThread) {
nsCOMPtr<nsIRunnable> event =
new MediaTrackGraphShutdownThreadRunnable(mThread.forget());
SystemGroup::Dispatch(TaskCategory::Other, event.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, event.forget());
}
}

View File

@ -8,8 +8,8 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/Logging.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/ErrorNames.h"
#include "mozilla/SchedulerGroup.h"
using mozilla::media::TimeUnit;
@ -29,7 +29,7 @@ void MediaResource::Destroy() {
delete this;
return;
}
nsresult rv = SystemGroup::Dispatch(
nsresult rv = SchedulerGroup::Dispatch(
TaskCategory::Other,
NewNonOwningRunnableMethod("MediaResource::Destroy", this,
&MediaResource::Destroy));

View File

@ -15,10 +15,10 @@
#include "VorbisUtils.h"
#include "mozilla/Base64.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/TaskCategory.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/Telemetry.h"
@ -572,7 +572,7 @@ void LogToBrowserConsole(const nsAString& aMsg) {
nsString msg(aMsg);
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction(
"LogToBrowserConsole", [msg]() { LogToBrowserConsole(msg); });
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
return;
}
nsCOMPtr<nsIConsoleService> console(

View File

@ -9,7 +9,7 @@
#include "DDLogUtils.h"
#include "DDMediaLogs.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Unused.h"
namespace mozilla {
@ -112,7 +112,7 @@ bool DecoderDoctorLogger::EnsureLogIsEnabled() {
MOZ_ASSERT(mediaLogsConstruction.mMediaLogs);
sMediaLogs = mediaLogsConstruction.mMediaLogs;
// Setup shutdown-time clean-up.
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(
MOZ_ALWAYS_SUCCEEDS(SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("DDLogger shutdown setup", [] {
sDDLogShutdowner = MakeUnique<DDLogShutdowner>();

View File

@ -6,7 +6,7 @@
#include "GMPCrashHelper.h"
#include "runnable_utils.h"
#include "nsThreadUtils.h"
#include "SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
namespace mozilla {
@ -17,8 +17,8 @@ void GMPCrashHelper::Destroy() {
if (NS_IsMainThread()) {
delete this;
} else {
// Don't addref, as then we'd end up releasing after the detele runs!
SystemGroup::Dispatch(
// Don't addref, as then we'd end up releasing after the delete runs!
SchedulerGroup::Dispatch(
TaskCategory::Other,
NewNonOwningRunnableMethod("GMPCrashHelper::Destroy", this,
&GMPCrashHelper::Destroy));

View File

@ -12,10 +12,10 @@
#include "mozIGeckoMediaPluginChromeService.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/SystemGroup.h"
#include "nsComponentManagerUtils.h"
#include "nsCOMPtr.h"
#include "nsIObserverService.h"
@ -388,7 +388,7 @@ GeckoMediaPluginServiceChild::GetServiceChild() {
if (mGetServiceChildPromises.Length() == 1) {
nsCOMPtr<nsIRunnable> r =
WrapRunnable(contentChild, &dom::ContentChild::SendCreateGMPService);
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
return promise;
}

View File

@ -7,7 +7,7 @@
#define __GMPTestMonitor_h__
#include "nsThreadUtils.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
class GMPTestMonitor {
public:
@ -27,10 +27,10 @@ class GMPTestMonitor {
public:
void SetFinished() {
mozilla::SystemGroup::Dispatch(mozilla::TaskCategory::Other,
mozilla::NewNonOwningRunnableMethod(
"GMPTestMonitor::MarkFinished", this,
&GMPTestMonitor::MarkFinished));
mozilla::SchedulerGroup::Dispatch(mozilla::TaskCategory::Other,
mozilla::NewNonOwningRunnableMethod(
"GMPTestMonitor::MarkFinished", this,
&GMPTestMonitor::MarkFinished));
}
private:

View File

@ -7,6 +7,7 @@
#include "gtest/gtest.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SchedulerGroup.h"
#include "ChromiumCDMCallback.h"
#include "GMPTestMonitor.h"
@ -194,11 +195,10 @@ static void ClearCDMStorage(already_AddRefed<nsIRunnable> aContinuation,
nsIThread* aTarget, PRTime aSince = -1) {
RefPtr<ClearCDMStorageTask> task(
new ClearCDMStorageTask(std::move(aContinuation), aTarget, aSince));
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
}
static void SimulatePBModeExit() {
// SystemGroup::EventTargetFor() doesn't support NS_DISPATCH_SYNC.
NS_DispatchToMainThread(new NotifyObserversTask("last-pb-context-exited"),
NS_DISPATCH_SYNC);
}
@ -508,7 +508,7 @@ class CDMStorageTest {
EnumerateCDMStorageDir(NS_LITERAL_CSTRING("id"),
NodeIdCollector(siteInfo.get()));
// Invoke "Forget this site" on the main thread.
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NewRunnableMethod<UniquePtr<NodeInfo>&&>(
"CDMStorageTest::TestForgetThisSite_Forget", this,
@ -920,7 +920,7 @@ class CDMStorageTest {
NewRunnableMethod("CDMStorageTest::Shutdown", this,
&CDMStorageTest::Shutdown),
std::move(aContinuation), mNodeId));
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
}
void Shutdown() {
@ -938,7 +938,7 @@ class CDMStorageTest {
Shutdown();
nsCOMPtr<nsIRunnable> task = NewRunnableMethod(
"CDMStorageTest::Dummy", this, &CDMStorageTest::Dummy);
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
}
void SessionMessage(const nsACString& aSessionId, uint32_t aMessageType,

View File

@ -11,6 +11,7 @@
#include "mozilla/dom/ImageEncoder.h"
#include "mozilla/dom/MediaStreamTrack.h"
#include "mozilla/dom/VideoStreamTrack.h"
#include "mozilla/SchedulerGroup.h"
#include "nsThreadUtils.h"
#include "VideoSegment.h"
@ -183,7 +184,7 @@ void CaptureTask::PostTrackEndEvent() {
IC_LOG("Got MediaTrack track removed or finished event.");
nsCOMPtr<nsIRunnable> event = new TrackEndRunnable(this);
SystemGroup::Dispatch(TaskCategory::Other, event.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, event.forget());
}
} // namespace mozilla

View File

@ -20,6 +20,7 @@
#include "PDMFactory.h"
#include "VPXDecoder.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/dom/DOMMozPromiseRequestHolder.h"
@ -255,7 +256,7 @@ already_AddRefed<Promise> MediaCapabilities::DecodingInfo(
// once at a time as it can quickly exhaust the system resources
// otherwise.
static RefPtr<AllocPolicy> sVideoAllocPolicy = [&taskQueue]() {
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction(
"MediaCapabilities::AllocPolicy:Video", []() {

View File

@ -11,6 +11,7 @@
#include "mozilla/AbstractThread.h"
#include "mozilla/Atomics.h"
#include "mozilla/PodOperations.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
@ -133,7 +134,7 @@ OggDemuxer::~OggDemuxer() {
Telemetry::Accumulate(
Telemetry::HistogramID::MEDIA_OGG_LOADED_IS_CHAINED, isChained);
});
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
}
}

View File

@ -10,7 +10,7 @@
#include "MediaInfo.h"
#include "PDMFactory.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
#ifdef MOZ_WIDGET_ANDROID
# include "mozilla/jni/Utils.h"
#endif
@ -93,7 +93,7 @@ NotNull<AllocPolicy*> GlobalAllocPolicy::Instance(TrackType aTrack) {
StaticMutexAutoLock lock(sMutex);
if (aTrack == TrackType::kAudioTrack) {
static RefPtr<AllocPolicyImpl> sAudioPolicy = []() {
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction(
"GlobalAllocPolicy::GlobalAllocPolicy:Audio", []() {
@ -104,7 +104,7 @@ NotNull<AllocPolicy*> GlobalAllocPolicy::Instance(TrackType aTrack) {
return WrapNotNull(sAudioPolicy.get());
}
static RefPtr<AllocPolicyImpl> sVideoPolicy = []() {
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction(
"GlobalAllocPolicy::GlobalAllocPolicy:Audio", []() {

View File

@ -26,6 +26,7 @@
#include "mozilla/AbstractThread.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Logging.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/Telemetry.h"
@ -117,7 +118,7 @@ class DeleteObjectTask : public Runnable {
template <class T>
void DeleteOnMainThread(UniquePtr<T>&& aObject) {
nsCOMPtr<nsIRunnable> r = new DeleteObjectTask<T>(std::move(aObject));
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
LayersBackend GetCompositorBackendType(

View File

@ -13,6 +13,8 @@
#include "nsIScriptError.h"
#include "AudioEventTimeline.h"
#include "mozilla/SchedulerGroup.h"
namespace mozilla {
LazyLogModule gWebAudioAPILog("WebAudioAPI");
@ -99,7 +101,7 @@ void WebAudioUtils::LogToDeveloperConsole(uint64_t aWindowID,
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction(
"dom::WebAudioUtils::LogToDeveloperConsole",
[aWindowID, aKey] { LogToDeveloperConsole(aWindowID, aKey); });
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
return;
}

View File

@ -9,7 +9,7 @@
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ThreadLocal.h"
#include "mozilla/TimeStamp.h"
@ -41,8 +41,8 @@ class FlushRejections : public CancelableRunnable {
return;
}
sDispatched.set(true);
SystemGroup::Dispatch(TaskCategory::Other,
do_AddRef(new FlushRejections()));
SchedulerGroup::Dispatch(TaskCategory::Other,
do_AddRef(new FlushRejections()));
}
static void FlushSync() {

View File

@ -60,7 +60,8 @@ RefPtr<ServiceWorkerRegistrationPromise> ServiceWorkerContainerProxy::Register(
scopeExit.release();
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise;
}
@ -87,7 +88,8 @@ ServiceWorkerContainerProxy::GetRegistration(const ClientInfo& aClientInfo,
scopeExit.release();
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise;
}
@ -112,7 +114,8 @@ ServiceWorkerContainerProxy::GetRegistrations(const ClientInfo& aClientInfo) {
scopeExit.release();
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise;
}
@ -137,7 +140,8 @@ RefPtr<ServiceWorkerRegistrationPromise> ServiceWorkerContainerProxy::GetReady(
scopeExit.release();
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise;
}

View File

@ -30,8 +30,8 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/BindingDeclarations.h"
@ -380,7 +380,8 @@ bool ServiceWorkerOp::MaybeStart(RemoteWorkerChild* aOwner,
mStarted = true;
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return true;
}

View File

@ -6,6 +6,7 @@
#include "ServiceWorkerProxy.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "ServiceWorkerInfo.h"
@ -83,7 +84,8 @@ void ServiceWorkerProxy::Init(ServiceWorkerParent* aActor) {
// returns.
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
"ServiceWorkerProxy::Init", this, &ServiceWorkerProxy::InitOnMainThread);
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
void ServiceWorkerProxy::RevokeActor(ServiceWorkerParent* aActor) {
@ -94,7 +96,8 @@ void ServiceWorkerProxy::RevokeActor(ServiceWorkerParent* aActor) {
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
__func__, this, &ServiceWorkerProxy::StopListeningOnMainThread);
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
void ServiceWorkerProxy::PostMessage(RefPtr<ServiceWorkerCloneData>&& aData,
@ -110,7 +113,8 @@ void ServiceWorkerProxy::PostMessage(RefPtr<ServiceWorkerCloneData>&& aData,
}
self->mInfo->PostMessage(std::move(data), aClientInfo, aClientState);
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
} // namespace dom

View File

@ -10,6 +10,8 @@
#include "ServiceWorkerPrivate.h"
#include "ServiceWorkerRegistrationListener.h"
#include "mozilla/SchedulerGroup.h"
namespace mozilla {
namespace dom {
@ -664,7 +666,8 @@ void ServiceWorkerRegistrationInfo::TransitionWaitingToActive() {
swm->CheckPendingReadyPromises();
}
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
UpdateRegistrationState();
NotifyChromeRegistrationListeners();

View File

@ -6,6 +6,7 @@
#include "ServiceWorkerRegistrationProxy.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "ServiceWorkerManager.h"
#include "ServiceWorkerRegistrationParent.h"
@ -185,7 +186,8 @@ void ServiceWorkerRegistrationProxy::Init(
nsCOMPtr<nsIRunnable> r =
NewRunnableMethod("ServiceWorkerRegistrationProxy::Init", this,
&ServiceWorkerRegistrationProxy::InitOnMainThread);
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
void ServiceWorkerRegistrationProxy::RevokeActor(
@ -198,7 +200,8 @@ void ServiceWorkerRegistrationProxy::RevokeActor(
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
__func__, this,
&ServiceWorkerRegistrationProxy::StopListeningOnMainThread);
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
RefPtr<GenericPromise> ServiceWorkerRegistrationProxy::Unregister() {
@ -227,7 +230,8 @@ RefPtr<GenericPromise> ServiceWorkerRegistrationProxy::Unregister() {
scopeExit.release();
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise;
}
@ -376,7 +380,8 @@ RefPtr<ServiceWorkerRegistrationPromise> ServiceWorkerRegistrationProxy::Update(
scopeExit.release();
});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise;
}

View File

@ -12,6 +12,7 @@
#include "MainThreadUtils.h"
#include "ServiceWorkerUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/RemoteWorkerService.h"
@ -112,7 +113,8 @@ void ReportServiceWorkerShutdownProgress(uint32_t aShutdownStateId,
if (NS_IsMainThread()) {
MOZ_ALWAYS_SUCCEEDS(r->Run());
} else {
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
}

View File

@ -9,6 +9,7 @@
#include "mozilla/dom/StorageBinding.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StorageAccess.h"
#include "nsPIDOMWindow.h"
@ -136,7 +137,7 @@ void Storage::NotifyChange(Storage* aStorage, nsIPrincipal* aPrincipal,
if (aImmediateDispatch) {
Unused << r->Run();
} else {
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
}

View File

@ -7,6 +7,7 @@
#include "StorageActivityService.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPtr.h"
#include "nsIMutableArray.h"
#include "nsSupportsPrimitives.h"
@ -59,7 +60,7 @@ void StorageActivityService::SendActivity(
StorageActivityService::SendActivity(principal);
});
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
/* static */
@ -84,7 +85,7 @@ void StorageActivityService::SendActivity(const nsACString& aOrigin) {
if (NS_IsMainThread()) {
Unused << r->Run();
} else {
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
}

View File

@ -8,8 +8,8 @@
#include <utility>
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/dom/RemoteWorkerParent.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/BackgroundUtils.h"
@ -251,7 +251,8 @@ void RemoteWorkerManager::ForEachActor(Callback&& aCallback) const {
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
__func__, [proxyReleaseArray = std::move(proxyReleaseArray)] {});
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
}
/**
@ -304,7 +305,7 @@ RemoteWorkerManager::SelectTargetActorForServiceWorker(
});
MOZ_ALWAYS_SUCCEEDS(
SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
actor = aActor;
return false;
@ -431,9 +432,7 @@ void RemoteWorkerManager::LaunchNewContentProcess(
});
});
nsCOMPtr<nsIEventTarget> target =
SystemGroup::EventTargetFor(TaskCategory::Other);
target->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
} // namespace dom

View File

@ -94,9 +94,7 @@ void RemoteWorkerParent::ActorDestroy(IProtocol::ActorDestroyReason) {
RefPtr<UnregisterActorRunnable> r =
new UnregisterActorRunnable(parent.forget());
nsCOMPtr<nsIEventTarget> target =
SystemGroup::EventTargetFor(TaskCategory::Other);
target->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
if (mController) {

View File

@ -14,7 +14,6 @@
#include "mozilla/Services.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/SystemGroup.h"
#include "nsIObserverService.h"
#include "nsIThread.h"
#include "nsThreadUtils.h"
@ -146,9 +145,7 @@ void RemoteWorkerService::ShutdownOnTargetThread() {
self->mThread = nullptr;
});
nsCOMPtr<nsIEventTarget> target =
SystemGroup::EventTargetFor(TaskCategory::Other);
target->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
NS_IMETHODIMP

View File

@ -7,8 +7,8 @@
#include "SharedWorkerService.h"
#include "mozilla/dom/RemoteWorkerTypes.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/SystemGroup.h"
#include "nsProxyRelease.h"
namespace mozilla {
@ -159,9 +159,7 @@ void SharedWorkerService::GetOrCreateWorkerManager(
new GetOrCreateWorkerManagerRunnable(this, aActor, aData, aWindowID,
aPortIdentifier);
nsCOMPtr<nsIEventTarget> target =
SystemGroup::EventTargetFor(TaskCategory::Other);
nsresult rv = target->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
nsresult rv = SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
Unused << NS_WARN_IF(NS_FAILED(rv));
}

View File

@ -6,7 +6,7 @@
#include "VsyncIOThreadHolder.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
namespace mozilla {
namespace gfx {
@ -25,9 +25,10 @@ VsyncIOThreadHolder::~VsyncIOThreadHolder() {
if (NS_IsMainThread()) {
mThread->AsyncShutdown();
} else {
SystemGroup::Dispatch(TaskCategory::Other,
NewRunnableMethod("nsIThread::AsyncShutdown", mThread,
&nsIThread::AsyncShutdown));
SchedulerGroup::Dispatch(
TaskCategory::Other,
NewRunnableMethod("nsIThread::AsyncShutdown", mThread,
&nsIThread::AsyncShutdown));
}
}

View File

@ -11,9 +11,9 @@
#include "gfxPlatform.h" // for gfxPlatform
#include "MainThreadUtils.h"
#include "mozilla/Atomics.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_layers.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
#include "mozilla/layers/CompositableForwarder.h"
@ -413,7 +413,7 @@ static void DestroyTextureData(TextureData* aTextureData,
if (aMainThreadOnly && !NS_IsMainThread()) {
RefPtr<LayersIPCChannel> allocatorRef = aAllocator;
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction(
"layers::DestroyTextureData",

View File

@ -13,8 +13,8 @@
#include "mozilla/layers/SourceSurfaceSharedData.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/layers/RenderRootStateManager.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_image.h"
#include "mozilla/SystemGroup.h" // for SystemGroup
namespace mozilla {
namespace layers {
@ -79,7 +79,7 @@ void SharedSurfacesChild::SharedUserData::Destroy(void* aClosure) {
RefPtr<SharedUserData> data =
dont_AddRef(static_cast<SharedUserData*>(aClosure));
if (data->mShared || !data->mKeys.IsEmpty()) {
SystemGroup::Dispatch(TaskCategory::Other, data.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, data.forget());
}
}
@ -279,8 +279,8 @@ void SharedSurfacesChild::Share(SourceSurfaceSharedData* aSurface) {
RefPtr<SourceSurfaceSharedData> mSurface;
};
SystemGroup::Dispatch(TaskCategory::Other,
MakeAndAddRef<ShareRunnable>(aSurface));
SchedulerGroup::Dispatch(TaskCategory::Other,
MakeAndAddRef<ShareRunnable>(aSurface));
return;
}
@ -502,7 +502,7 @@ void SharedSurfacesAnimation::Destroy() {
nsCOMPtr<nsIRunnable> task =
NewRunnableMethod("SharedSurfacesAnimation::Destroy", this,
&SharedSurfacesAnimation::Destroy);
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
return;
}

View File

@ -7,9 +7,9 @@
#include "gfxCrashReporterUtils.h"
#include <string.h> // for strcmp
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/SchedulerGroup.h" // for SchedulerGroup
#include "mozilla/Services.h" // for GetObserverService
#include "mozilla/StaticMutex.h"
#include "mozilla/SystemGroup.h" // for SystemGroup
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/RefPtr.h" // for RefPtr
#include "MainThreadUtils.h" // for NS_IsMainThread
@ -100,7 +100,7 @@ void ScopedGfxFeatureReporter::WriteAppNote(char statusChar,
if (!gFeaturesAlreadyReported) {
gFeaturesAlreadyReported = new nsTArray<nsCString>;
nsCOMPtr<nsIRunnable> r = new RegisterObserverRunnable();
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
nsAutoCString featureString;
@ -121,7 +121,7 @@ void ScopedGfxFeatureReporter::AppNote(const nsACString& aMessage) {
CrashReporter::AppendAppNotesToCrashReport(aMessage);
} else {
nsCOMPtr<nsIRunnable> r = new AppendAppNotesRunnable(aMessage);
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
}

View File

@ -10,6 +10,7 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Monitor.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_image.h"
#include "mozilla/TimeStamp.h"
#include "nsCOMPtr.h"
@ -91,7 +92,7 @@ class DecodePoolImpl {
// pool explicitly. Otherwise we could try to shut down the same thread
// twice.
if (removed) {
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NewRunnableMethod("DecodePoolImpl::ShutdownThread", aThisThread,
&nsIThread::AsyncShutdown));

View File

@ -22,6 +22,7 @@
#include "nsMediaFragmentURIParser.h"
#include "nsContentUtils.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_image.h"
namespace mozilla {
@ -80,7 +81,7 @@ static void NotifyImageLoading(nsIURI* aURI) {
nsCOMPtr<nsIURI> uri(aURI);
nsCOMPtr<nsIRunnable> ev = NS_NewRunnableFunction(
"NotifyImageLoading", [uri]() -> void { NotifyImageLoading(uri); });
SystemGroup::Dispatch(TaskCategory::Other, ev.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, ev.forget());
return;
}

View File

@ -8,8 +8,8 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/mscom/Utils.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticLocalPtr.h"
#include "mozilla/SystemGroup.h"
#include "nsThreadUtils.h"
#include "private/pprthred.h"
@ -134,7 +134,7 @@ nsCOMPtr<nsIThread> EnsureMTA::GetMTAThread() {
return bgData;
}
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("mscom::EnsureMTA::GetMTAThread",
std::move(setClearOnShutdown)));

View File

@ -11,9 +11,9 @@
#include "mozilla/Assertions.h"
#include "mozilla/BackgroundHangMonitor.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/mscom/SpinEvent.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Unused.h"
#include "private/prpriv.h" // For PR_GetThreadID
#include <winternl.h> // For NTSTATUS and NTAPI
@ -154,8 +154,8 @@ bool MainThreadInvoker::Invoke(already_AddRefed<nsIRunnable>&& aRunnable) {
// 2. Post a Gecko runnable (which always runs). If the APC hasn't run, the
// Gecko runnable runs it. Otherwise, it does nothing.
if (NS_FAILED(SystemGroup::Dispatch(TaskCategory::Other,
do_AddRef(syncRunnable)))) {
if (NS_FAILED(SchedulerGroup::Dispatch(TaskCategory::Other,
do_AddRef(syncRunnable)))) {
return false;
}

View File

@ -10,7 +10,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/mscom/EnsureMTA.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/UniquePtr.h"
#include "nsError.h"
#include "nsThreadUtils.h"
@ -41,7 +41,7 @@ struct MainThreadRelease {
aPtr->Release();
return;
}
DebugOnly<nsresult> rv = SystemGroup::Dispatch(
DebugOnly<nsresult> rv = SchedulerGroup::Dispatch(
TaskCategory::Other,
NewNonOwningRunnableMethod("mscom::MainThreadRelease", aPtr,
&T::Release));

View File

@ -18,11 +18,11 @@
#include "js/Utility.h"
#include "mozilla/Attributes.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/dom/ChromeUtils.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/SystemGroup.h"
#include "nsCCUncollectableMarker.h"
#include "nsCycleCollectionParticipant.h"
@ -126,7 +126,7 @@ static void OffThreadScriptLoaderCallback(JS::OffThreadToken* aToken,
scriptCompiler->SetToken(aToken);
SystemGroup::Dispatch(TaskCategory::Other, scriptCompiler.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, scriptCompiler.forget());
}
bool AsyncScriptCompiler::StartCompile(JSContext* aCx) {

View File

@ -12,8 +12,8 @@
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/Preferences.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Services.h"
#include "mozilla/SystemGroup.h"
#include "nsIConsoleService.h"
#include "mozilla/dom/Document.h"
#include "nsIDocShell.h"
@ -145,7 +145,8 @@ ErrorReporter::~ErrorReporter() {
// short-term caching.
if (sSpecCache && sSpecCache->IsInUse() && !sSpecCache->IsPending()) {
nsCOMPtr<nsIRunnable> runnable(sSpecCache);
nsresult rv = SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
nsresult rv =
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget());
if (NS_FAILED(rv)) {
// Peform the "deferred" cleanup immediately if the dispatch fails.
sSpecCache->Run();

View File

@ -18,6 +18,7 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/URLPreloader.h"
#include "nsIRunnable.h"
#include "nsITimedChannel.h"
@ -2365,7 +2366,7 @@ nsresult Loader::PostLoadEvent(nsIURI* aURI, StyleSheet* aSheet,
} else if (mDocGroup) {
rv = mDocGroup->Dispatch(TaskCategory::Other, runnable.forget());
} else {
rv = SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
rv = SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget());
}
if (NS_FAILED(rv)) {

View File

@ -37,6 +37,7 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/GeckoBindings.h"
#include "mozilla/PreferenceSheet.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPresData.h"
#include "mozilla/Likely.h"
#include "nsIURI.h"
@ -207,7 +208,7 @@ void Gecko_LoadData_Drop(StyleLoadData* aData) {
task->Run();
} else {
// if Resolve was not called at some point, mDocGroup is not set.
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
}
}

View File

@ -32,6 +32,7 @@
#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/Services.h"
#include "mozilla/ServoStyleSet.h"
@ -3079,7 +3080,7 @@ class PWRunnable : public Runnable {
// ref counted pointer off main thread.
nsresult rvCopy = rv;
nsCOMPtr<nsIFile> fileCopy(mFile);
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("Preferences::WriterRunnable",
[fileCopy, rvCopy] {

View File

@ -19,14 +19,12 @@
#include "mozilla/mozalloc.h"
#if defined(MOZILLA_INTERNAL_API)
# include "MainThreadUtils.h"
# include "mozilla/SystemGroup.h"
# include "nsISupportsImpl.h"
# include "nsString.h"
# include "nsThreadUtils.h"
# include "prthread.h"
# include "mozilla/SchedulerGroup.h"
#endif // defined(MOZILLA_INTERNAL_API)
// For PCUNICODE_STRING
@ -150,7 +148,7 @@ class DllServices : public detail::DllServicesBase {
"DllServices::NotifyDllLoad", this, &DllServices::NotifyDllLoad,
std::move(aModLoadInfo)));
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget());
}
void DispatchModuleLoadBacklogNotification(
@ -160,7 +158,7 @@ class DllServices : public detail::DllServicesBase {
"DllServices::NotifyModuleLoadBacklog", this,
&DllServices::NotifyModuleLoadBacklog, std::move(aEvents)));
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget());
}
# if defined(DEBUG)

View File

@ -35,6 +35,7 @@
#include "mozilla/OriginAttributes.h"
#include "mozilla/Preferences.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/Telemetry.h"
@ -1261,7 +1262,7 @@ Predictor::LearnNative(nsIURI* targetURI, nsIURI* sourceURI,
RefPtr<PredictorLearnRunnable> runnable = new PredictorLearnRunnable(
targetURI, sourceURI, reason, originAttributes);
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget());
return NS_OK;
}

View File

@ -10,8 +10,8 @@
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/net/CookieJarSettings.h"
#include "mozilla/net/NeckoChannelParams.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Unused.h"
#include "nsGlobalWindowInner.h"
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
@ -116,14 +116,10 @@ CookieJarSettings::CookieJarSettings(uint32_t aCookieBehavior, State aState)
CookieJarSettings::~CookieJarSettings() {
if (!NS_IsMainThread() && !mCookiePermissions.IsEmpty()) {
nsCOMPtr<nsIEventTarget> systemGroupEventTarget =
SystemGroup::EventTargetFor(TaskCategory::Other);
MOZ_ASSERT(systemGroupEventTarget);
RefPtr<Runnable> r = new ReleaseCookiePermissions(mCookiePermissions);
MOZ_ASSERT(mCookiePermissions.IsEmpty());
systemGroupEventTarget->Dispatch(r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
}

View File

@ -9,6 +9,7 @@
#include "mozilla/net/DNSRequestChild.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/net/SocketProcessChild.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Unused.h"
#include "nsIDNSRecord.h"
@ -239,7 +240,7 @@ DNSRequestChild::DNSRequestChild(
void DNSRequestChild::StartRequest() {
// we can only do IPDL on the main thread
if (!NS_IsMainThread()) {
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NewRunnableMethod("net::DNSRequestChild::StartRequest", this,
&DNSRequestChild::StartRequest));
@ -347,7 +348,7 @@ DNSRequestChild::Cancel(nsresult reason) {
if (CanSend()) {
// We can only do IPDL on the main thread
nsCOMPtr<nsIRunnable> runnable = new CancelDNSRequestEvent(this, reason);
SystemGroup::Dispatch(TaskCategory::Other, runnable.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, runnable.forget());
}
return NS_OK;
}

View File

@ -7,6 +7,7 @@
#include "InterceptedHttpChannel.h"
#include "nsContentSecurityManager.h"
#include "nsEscape.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/dom/ChannelInfo.h"
#include "mozilla/dom/PerformanceStorage.h"
#include "nsHttpChannel.h"
@ -378,7 +379,8 @@ void InterceptedHttpChannel::MaybeCallStatusAndProgress() {
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(
"InterceptedHttpChannel::MaybeCallStatusAndProgress", this,
&InterceptedHttpChannel::MaybeCallStatusAndProgress);
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return;
}

View File

@ -13,6 +13,7 @@
#include "mozilla/dom/ServiceWorkerUtils.h"
#include "mozilla/net/HttpChannelParent.h"
#include "mozilla/net/RedirectChannelRegistrar.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Unused.h"
#include "nsIHttpHeaderVisitor.h"
#include "nsIPrompt.h"
@ -286,7 +287,8 @@ ParentChannelListener::ChannelIntercepted(nsIInterceptedChannel* aChannel) {
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<nsresult>(
"ParentChannelListener::CancelInterception", aChannel,
&nsIInterceptedChannel::CancelInterception, NS_BINDING_ABORTED);
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
MOZ_ALWAYS_SUCCEEDS(
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()));
return NS_OK;
}

View File

@ -8,6 +8,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/Encoding.h"
#include "mozilla/SchedulerGroup.h"
#include "nsContentUtils.h"
#include "nsHtml5Tokenizer.h"
#include "nsIHttpChannel.h"
@ -19,7 +20,6 @@
#include "nsIDocShell.h"
#include "nsIScriptError.h"
#include "mozilla/Preferences.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/StaticPrefs_intl.h"
#include "mozilla/StaticPrefs_html5.h"
#include "mozilla/UniquePtrExtensions.h"
@ -1121,8 +1121,8 @@ nsresult nsHtml5StreamParser::OnStartRequest(nsIRequest* aRequest) {
// the request.
nsCOMPtr<nsIRunnable> runnable =
new MaybeRunCollector(mExecutor->GetDocument()->GetDocShell());
mozilla::SystemGroup::Dispatch(mozilla::TaskCategory::GarbageCollection,
runnable.forget());
mozilla::SchedulerGroup::Dispatch(
mozilla::TaskCategory::GarbageCollection, runnable.forget());
}
}

View File

@ -11,6 +11,7 @@
#include "mozilla/gfx/GPUParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h" // For RemoteTypePrefix
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Unused.h"
#include "mozilla/GfxMessageUtils.h" // For ParamTraits<GeckoProcessType>
#include "mozilla/ResultExtensions.h"
@ -304,7 +305,7 @@ void nsHangDetails::Submit() {
});
nsresult rv =
SystemGroup::Dispatch(TaskCategory::Other, notifyObservers.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, notifyObservers.forget());
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
}

View File

@ -7,9 +7,9 @@
#include "Fuzzyfox.h"
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/TimeStamp.h"
#include "nsComponentManagerUtils.h"
#include "nsIPrefBranch.h"
@ -50,7 +50,7 @@ void Fuzzyfox::Start() {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<Fuzzyfox> r = new Fuzzyfox();
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
Fuzzyfox::Fuzzyfox()
@ -111,7 +111,7 @@ Fuzzyfox::Observe(nsISupports* aObject, const char* aTopic,
if (sFuzzyfoxInitializing) {
// Queue a runnable
nsCOMPtr<nsIRunnable> r = this;
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
} else {
mStartTime = 0;
mTickType = eUptick;
@ -123,9 +123,9 @@ Fuzzyfox::Observe(nsISupports* aObject, const char* aTopic,
return NS_OK;
}
#define DISPATCH_AND_RETURN() \
nsCOMPtr<nsIRunnable> r = this; \
SystemGroup::Dispatch(TaskCategory::Other, r.forget()); \
#define DISPATCH_AND_RETURN() \
nsCOMPtr<nsIRunnable> r = this; \
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget()); \
return NS_OK
NS_IMETHODIMP

View File

@ -12,6 +12,7 @@
#include "mozilla/gfx/GPUParent.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/net/SocketProcessChild.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPrefs_toolkit.h"
#include "mozilla/StaticPtr.h"
@ -343,6 +344,6 @@ void TelemetryIPCAccumulator::DeInitializeGlobalState() {
void TelemetryIPCAccumulator::DispatchToMainThread(
already_AddRefed<nsIRunnable>&& aEvent) {
SystemGroup::EventTargetFor(TaskCategory::Other)
->Dispatch(std::move(aEvent), nsIEventTarget::DISPATCH_NORMAL);
SchedulerGroup::Dispatch(TaskCategory::Other,
std::move(aEvent));
}

View File

@ -10,9 +10,9 @@
#include <psapi.h>
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Services.h"
#include "mozilla/StaticLocalPtr.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/UntrustedModulesProcessor.h"
#include "nsCOMPtr.h"
#include "nsIObserverService.h"
@ -46,7 +46,7 @@ DllServices* DllServices::Get() {
return dllSvc.forget();
}
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("mozilla::DllServices::Get",
std::move(setClearOnShutdown)));

View File

@ -51,10 +51,10 @@
#include "mozilla/ExtensionPolicyService.h"
#include "mozilla/extensions/WebExtensionPolicy.h"
#include "mozilla/Printf.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Services.h"
#include "mozilla/StackWalk.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/ThreadLocal.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Tuple.h"
@ -4035,7 +4035,7 @@ static void TriggerPollJSSamplingOnMainThread() {
nsCOMPtr<nsIRunnable> task =
NS_NewRunnableFunction("TriggerPollJSSamplingOnMainThread",
[]() { PollJSSamplingForCurrentThread(); });
SystemGroup::Dispatch(TaskCategory::Other, task.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, task.forget());
}
}

View File

@ -16,8 +16,8 @@
#include "js/JSON.h"
#include "js/Value.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Services.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/TypedArray.h"
#include "nsIFileStreams.h"
@ -216,7 +216,7 @@ nsProfiler::WaitOnePeriodicSampling(JSContext* aCx, Promise** aPromise) {
new nsMainThreadPtrHolder<Promise>(
"WaitOnePeriodicSampling promise for Sampler", promise))](
SamplingState aSamplingState) mutable {
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction(
"nsProfiler::WaitOnePeriodicSampling result on main thread",
@ -883,7 +883,7 @@ RefPtr<nsProfiler::SymbolTablePromise> nsProfiler::GetSymbolTableMozPromise(
SymbolTable symbolTable;
bool succeeded = profiler_get_symbol_table(
debugPath.get(), breakpadID.get(), &symbolTable);
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction(
"nsProfiler::GetSymbolTableMozPromise result on main thread",

View File

@ -24,6 +24,7 @@
#include "nsIObserverService.h"
#include "mozilla/Services.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/TimeStamp.h"
#include "gfxPlatformGtk.h"
@ -113,7 +114,7 @@ nsClipboard::Observe(nsISupports* aSubject, const char* aTopic,
// Save global clipboard content to CLIPBOARD_MANAGER.
// gtk_clipboard_store() can run an event loop, so call from a dedicated
// runnable.
return SystemGroup::Dispatch(
return SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("gtk_clipboard_store()", []() {
gtk_clipboard_store(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));

View File

@ -23,6 +23,7 @@
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/Preferences.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/WindowsVersion.h"
#include "mozilla/Unused.h"
#include "nsIContentPolicy.h"
@ -2105,7 +2106,7 @@ const WinUtils::WhitelistVec& WinUtils::GetWhitelistedPaths() {
if (NS_IsMainThread()) {
setClearFn();
} else {
SystemGroup::Dispatch(
SchedulerGroup::Dispatch(
TaskCategory::Other,
NS_NewRunnableFunction("WinUtils::GetWhitelistedPaths",
std::move(setClearFn)));

View File

@ -10,8 +10,8 @@
#include "js/Debug.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/SchedulerGroup.h"
namespace mozilla {
@ -26,8 +26,8 @@ nsresult DebuggerOnGCRunnable::Enqueue(JSContext* aCx,
RefPtr<DebuggerOnGCRunnable> runOnGC =
new DebuggerOnGCRunnable(std::move(gcEvent));
if (NS_IsMainThread()) {
return SystemGroup::Dispatch(TaskCategory::GarbageCollection,
runOnGC.forget());
return SchedulerGroup::Dispatch(TaskCategory::GarbageCollection,
runOnGC.forget());
} else {
return NS_DispatchToCurrentThread(runOnGC);
}

View File

@ -28,8 +28,8 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/Preferences.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Services.h"
#include "mozilla/SystemGroup.h"
#if defined(ANDROID)
# include <android/log.h>
@ -405,7 +405,7 @@ nsresult nsConsoleService::LogMessageWithMode(
// avoid failing in XPCShell tests
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
if (mainThread) {
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, r.forget());
}
}

View File

@ -31,7 +31,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/Services.h"
#include "mozilla/SystemGroup.h"
#include "nsXPCOMPrivate.h"
#include "mozilla/ChaosMode.h"
#include "mozilla/Telemetry.h"
@ -498,7 +497,7 @@ void nsThread::ThreadFunc(void* aArg) {
MOZ_ASSERT(context->mTerminatingThread == self);
event = do_QueryObject(new nsThreadShutdownAckEvent(context));
if (context->mIsMainThreadJoining) {
SystemGroup::Dispatch(TaskCategory::Other, event.forget());
SchedulerGroup::Dispatch(TaskCategory::Other, event.forget());
} else {
context->mJoiningThread->Dispatch(event, NS_DISPATCH_NORMAL);
}

View File

@ -12,7 +12,7 @@
#include "nsMemory.h"
#include "prinrval.h"
#include "mozilla/Logging.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/SchedulerGroup.h"
#include "nsThreadSyncDispatch.h"
#include <mutex>
@ -157,9 +157,10 @@ void nsThreadPool::ShutdownThread(nsIThread* aThread) {
// shutdown requires this thread have an event loop (and it may not, see bug
// 10204784). The simplest way to cover all cases is to asynchronously
// shutdown aThread from the main thread.
SystemGroup::Dispatch(TaskCategory::Other,
NewRunnableMethod("nsIThread::AsyncShutdown", aThread,
&nsIThread::AsyncShutdown));
SchedulerGroup::Dispatch(
TaskCategory::Other,
NewRunnableMethod("nsIThread::AsyncShutdown", aThread,
&nsIThread::AsyncShutdown));
}
// This event 'runs' for the lifetime of the worker thread. The actual