Bug 1874684 - Part 37: Fix unified compilation. r=allstarschh
[gecko.git] / layout / style / PaintWorkletImpl.cpp
blob14d38b8a1eaa1851686c10be46a517106ce14c2e
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 https://mozilla.org/MPL/2.0/. */
7 #include "PaintWorkletImpl.h"
9 #include "PaintWorkletGlobalScope.h"
10 #include "mozilla/dom/Worklet.h"
11 #include "mozilla/dom/WorkletThread.h"
13 namespace mozilla {
15 /* static */ already_AddRefed<dom::Worklet> PaintWorkletImpl::CreateWorklet(
16 nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal) {
17 MOZ_ASSERT(NS_IsMainThread());
19 RefPtr<PaintWorkletImpl> impl = new PaintWorkletImpl(aWindow, aPrincipal);
20 return MakeAndAddRef<dom::Worklet>(aWindow, std::move(impl));
23 PaintWorkletImpl::PaintWorkletImpl(nsPIDOMWindowInner* aWindow,
24 nsIPrincipal* aPrincipal)
25 : WorkletImpl(aWindow, aPrincipal) {
26 #ifdef RELEASE_OR_BETA
27 MOZ_CRASH("This code should not go to release/beta yet!");
28 #endif
31 PaintWorkletImpl::~PaintWorkletImpl() = default;
33 already_AddRefed<dom::WorkletGlobalScope>
34 PaintWorkletImpl::ConstructGlobalScope() {
35 dom::WorkletThread::AssertIsOnWorkletThread();
37 return MakeAndAddRef<dom::PaintWorkletGlobalScope>(this);
40 } // namespace mozilla