1/*
2 * Copyright (C) 2015, 2016 Canon Inc. All rights reserved.
3 * Copyright (C) 2016 Apple Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#pragma once
21
22#include "JSDOMConstructorBase.h"
23
24namespace WebCore {
25
26class JSDOMBuiltinConstructorBase : public JSDOMConstructorBase {
27public:
28 using Base = JSDOMConstructorBase;
29
30protected:
31 JSDOMBuiltinConstructorBase(JSC::Structure* structure, JSDOMGlobalObject& globalObject)
32 : JSDOMConstructorBase(structure, globalObject)
33 {
34 }
35
36 static void visitChildren(JSC::JSCell*, JSC::SlotVisitor&);
37
38 JSC::JSFunction* initializeFunction();
39 void setInitializeFunction(JSC::VM&, JSC::JSFunction&);
40
41 static void callFunctionWithCurrentArguments(JSC::ExecState&, JSC::JSObject& thisObject, JSC::JSFunction&);
42
43private:
44 JSC::WriteBarrier<JSC::JSFunction> m_initializeFunction;
45};
46
47inline JSC::JSFunction* JSDOMBuiltinConstructorBase::initializeFunction()
48{
49 return m_initializeFunction.get();
50}
51
52inline void JSDOMBuiltinConstructorBase::setInitializeFunction(JSC::VM& vm, JSC::JSFunction& function)
53{
54 m_initializeFunction.set(vm, this, &function);
55}
56
57
58} // namespace WebCore
59