1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 : */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "NeckoTargetHolder.h"
10 #include "nsContentUtils.h"
15 already_AddRefed
<nsISerialEventTarget
> NeckoTargetHolder::GetNeckoTarget() {
16 nsCOMPtr
<nsISerialEventTarget
> target
= mNeckoTarget
;
19 target
= GetMainThreadSerialEventTarget();
21 return target
.forget();
24 nsresult
NeckoTargetHolder::Dispatch(already_AddRefed
<nsIRunnable
>&& aRunnable
,
25 uint32_t aDispatchFlags
) {
27 return mNeckoTarget
->Dispatch(std::move(aRunnable
), aDispatchFlags
);
30 nsCOMPtr
<nsISerialEventTarget
> mainThreadTarget
=
31 GetMainThreadSerialEventTarget();
32 MOZ_ASSERT(mainThreadTarget
);
34 return mainThreadTarget
->Dispatch(std::move(aRunnable
), aDispatchFlags
);
38 } // namespace mozilla