1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/SchedulerGroup.h"
11 #include "jsfriendapi.h"
12 #include "mozilla/Atomics.h"
13 #include "mozilla/Telemetry.h"
14 #include "mozilla/Unused.h"
15 #include "mozilla/dom/DocGroup.h"
16 #include "mozilla/dom/ScriptSettings.h"
18 #include "nsQueryObject.h"
19 #include "nsThreadUtils.h"
21 using namespace mozilla
;
24 nsresult
SchedulerGroup::Dispatch(TaskCategory aCategory
,
25 already_AddRefed
<nsIRunnable
>&& aRunnable
) {
26 if (NS_IsMainThread()) {
27 return NS_DispatchToCurrentThread(std::move(aRunnable
));
29 return NS_DispatchToMainThread(std::move(aRunnable
));