1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library 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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#pragma once
22
23#if ENABLE(VIDEO_TRACK)
24
25#include "JSDOMConvertEnumeration.h"
26#include "JSDOMWrapper.h"
27#include "JSEventTarget.h"
28#include "TextTrack.h"
29#include <wtf/NeverDestroyed.h>
30
31namespace WebCore {
32
33class JSTextTrack : public JSEventTarget {
34public:
35 using Base = JSEventTarget;
36 using DOMWrapped = TextTrack;
37 static JSTextTrack* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TextTrack>&& impl)
38 {
39 JSTextTrack* ptr = new (NotNull, JSC::allocateCell<JSTextTrack>(globalObject->vm().heap)) JSTextTrack(structure, *globalObject, WTFMove(impl));
40 ptr->finishCreation(globalObject->vm());
41 return ptr;
42 }
43
44 static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
45 static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
46 static TextTrack* toWrapped(JSC::VM&, JSC::JSValue);
47
48 DECLARE_INFO;
49
50 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
51 {
52 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53 }
54
55 static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
56 static void visitChildren(JSCell*, JSC::SlotVisitor&);
57 void visitAdditionalChildren(JSC::SlotVisitor&);
58
59 static void visitOutputConstraints(JSCell*, JSC::SlotVisitor&);
60 template<typename, JSC::SubspaceAccess> static JSC::CompleteSubspace* subspaceFor(JSC::VM& vm) { return outputConstraintSubspaceFor(vm); }
61 static void heapSnapshot(JSCell*, JSC::HeapSnapshotBuilder&);
62 TextTrack& wrapped() const
63 {
64 return static_cast<TextTrack&>(Base::wrapped());
65 }
66protected:
67 JSTextTrack(JSC::Structure*, JSDOMGlobalObject&, Ref<TextTrack>&&);
68
69 void finishCreation(JSC::VM&);
70};
71
72class JSTextTrackOwner : public JSC::WeakHandleOwner {
73public:
74 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&, const char**);
75 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
76};
77
78inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TextTrack*)
79{
80 static NeverDestroyed<JSTextTrackOwner> owner;
81 return &owner.get();
82}
83
84inline void* wrapperKey(TextTrack* wrappableObject)
85{
86 return wrappableObject;
87}
88
89JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TextTrack&);
90inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TextTrack* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
91JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TextTrack>&&);
92inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TextTrack>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
93
94template<> struct JSDOMWrapperConverterTraits<TextTrack> {
95 using WrapperClass = JSTextTrack;
96 using ToWrappedReturnType = TextTrack*;
97};
98String convertEnumerationToString(TextTrack::Mode);
99template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TextTrack::Mode);
100
101template<> Optional<TextTrack::Mode> parseEnumeration<TextTrack::Mode>(JSC::ExecState&, JSC::JSValue);
102template<> const char* expectedEnumerationValues<TextTrack::Mode>();
103
104String convertEnumerationToString(TextTrack::Kind);
105template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, TextTrack::Kind);
106
107template<> Optional<TextTrack::Kind> parseEnumeration<TextTrack::Kind>(JSC::ExecState&, JSC::JSValue);
108template<> const char* expectedEnumerationValues<TextTrack::Kind>();
109
110
111} // namespace WebCore
112
113#endif // ENABLE(VIDEO_TRACK)
114