PaintWorkletImpl.cpp (1352B)
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/. */ 6 7 #include "PaintWorkletImpl.h" 8 9 #include "PaintWorkletGlobalScope.h" 10 #include "mozilla/dom/Worklet.h" 11 #include "mozilla/dom/WorkletThread.h" 12 13 namespace mozilla { 14 15 /* static */ already_AddRefed<dom::Worklet> PaintWorkletImpl::CreateWorklet( 16 nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal) { 17 MOZ_ASSERT(NS_IsMainThread()); 18 19 RefPtr<PaintWorkletImpl> impl = new PaintWorkletImpl(aWindow, aPrincipal); 20 return MakeAndAddRef<dom::Worklet>(aWindow, std::move(impl)); 21 } 22 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 29 } 30 31 PaintWorkletImpl::~PaintWorkletImpl() = default; 32 33 already_AddRefed<dom::WorkletGlobalScope> 34 PaintWorkletImpl::ConstructGlobalScope(JSContext* aCx) { 35 dom::WorkletThread::AssertIsOnWorkletThread(); 36 37 return MakeAndAddRef<dom::PaintWorkletGlobalScope>(this); 38 } 39 40 } // namespace mozilla