Backed out 3 changesets (bug 1854934) for causing build bustages on widget/windows...
[gecko.git] / xpcom / threads / SchedulerGroup.cpp
blobed67fbbd786c1023aaab6004d1ad3631a6654762
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"
9 #include <utility>
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"
17 #include "nsINamed.h"
18 #include "nsQueryObject.h"
19 #include "nsThreadUtils.h"
21 using namespace mozilla;
23 /* static */
24 nsresult SchedulerGroup::Dispatch(TaskCategory aCategory,
25 already_AddRefed<nsIRunnable>&& aRunnable) {
26 if (NS_IsMainThread()) {
27 return NS_DispatchToCurrentThread(std::move(aRunnable));
28 } else {
29 return NS_DispatchToMainThread(std::move(aRunnable));