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/. */
6 
7 #include "mozilla/dom/DispatcherTrait.h"
8 
9 #include "mozilla/AbstractThread.h"
10 #include "mozilla/SchedulerGroup.h"
11 
12 using namespace mozilla;
13 using namespace mozilla::dom;
14 
Dispatch(TaskCategory aCategory,already_AddRefed<nsIRunnable> && aRunnable)15 nsresult DispatcherTrait::Dispatch(TaskCategory aCategory,
16                                    already_AddRefed<nsIRunnable>&& aRunnable) {
17   return SchedulerGroup::UnlabeledDispatch(aCategory, std::move(aRunnable));
18 }
19 
EventTargetFor(TaskCategory aCategory) const20 nsISerialEventTarget* DispatcherTrait::EventTargetFor(
21     TaskCategory aCategory) const {
22   return GetMainThreadSerialEventTarget();
23 }
24 
AbstractMainThreadFor(TaskCategory aCategory)25 AbstractThread* DispatcherTrait::AbstractMainThreadFor(TaskCategory aCategory) {
26   // Return non DocGroup version by default.
27   return AbstractThread::MainThread();
28 }
29