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 | #include "config.h" |
22 | |
23 | #if ENABLE(VIDEO_TRACK) |
24 | |
25 | #include "JSTextTrackCueGeneric.h" |
26 | |
27 | #include "JSDOMBinding.h" |
28 | #include "JSDOMExceptionHandling.h" |
29 | #include "JSDOMWrapperCache.h" |
30 | #include "ScriptExecutionContext.h" |
31 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
32 | #include <JavaScriptCore/JSCInlines.h> |
33 | #include <wtf/GetPtr.h> |
34 | #include <wtf/PointerPreparations.h> |
35 | #include <wtf/URL.h> |
36 | |
37 | |
38 | namespace WebCore { |
39 | using namespace JSC; |
40 | |
41 | class JSTextTrackCueGenericPrototype : public JSC::JSNonFinalObject { |
42 | public: |
43 | using Base = JSC::JSNonFinalObject; |
44 | static JSTextTrackCueGenericPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
45 | { |
46 | JSTextTrackCueGenericPrototype* ptr = new (NotNull, JSC::allocateCell<JSTextTrackCueGenericPrototype>(vm.heap)) JSTextTrackCueGenericPrototype(vm, globalObject, structure); |
47 | ptr->finishCreation(vm); |
48 | return ptr; |
49 | } |
50 | |
51 | DECLARE_INFO; |
52 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
53 | { |
54 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
55 | } |
56 | |
57 | private: |
58 | JSTextTrackCueGenericPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
59 | : JSC::JSNonFinalObject(vm, structure) |
60 | { |
61 | } |
62 | }; |
63 | |
64 | /* Hash table for prototype */ |
65 | const ClassInfo JSTextTrackCueGenericPrototype::s_info = { "TextTrackCueGenericPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextTrackCueGenericPrototype) }; |
66 | |
67 | const ClassInfo JSTextTrackCueGeneric::s_info = { "TextTrackCueGeneric" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTextTrackCueGeneric) }; |
68 | |
69 | JSTextTrackCueGeneric::JSTextTrackCueGeneric(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TextTrackCueGeneric>&& impl) |
70 | : JSVTTCue(structure, globalObject, WTFMove(impl)) |
71 | { |
72 | } |
73 | |
74 | void JSTextTrackCueGeneric::finishCreation(VM& vm) |
75 | { |
76 | Base::finishCreation(vm); |
77 | ASSERT(inherits(vm, info())); |
78 | |
79 | } |
80 | |
81 | JSObject* JSTextTrackCueGeneric::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
82 | { |
83 | return JSTextTrackCueGenericPrototype::create(vm, &globalObject, JSTextTrackCueGenericPrototype::createStructure(vm, &globalObject, JSVTTCue::prototype(vm, globalObject))); |
84 | } |
85 | |
86 | JSObject* JSTextTrackCueGeneric::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
87 | { |
88 | return getDOMPrototype<JSTextTrackCueGeneric>(vm, globalObject); |
89 | } |
90 | |
91 | void JSTextTrackCueGeneric::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
92 | { |
93 | auto* thisObject = jsCast<JSTextTrackCueGeneric*>(cell); |
94 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
95 | if (thisObject->scriptExecutionContext()) |
96 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
97 | Base::heapSnapshot(cell, builder); |
98 | } |
99 | |
100 | #if ENABLE(BINDING_INTEGRITY) |
101 | #if PLATFORM(WIN) |
102 | #pragma warning(disable: 4483) |
103 | extern "C" { extern void (*const __identifier("??_7TextTrackCueGeneric@WebCore@@6B@" )[])(); } |
104 | #else |
105 | extern "C" { extern void* _ZTVN7WebCore19TextTrackCueGenericE[]; } |
106 | #endif |
107 | #endif |
108 | |
109 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TextTrackCueGeneric>&& impl) |
110 | { |
111 | |
112 | #if ENABLE(BINDING_INTEGRITY) |
113 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
114 | #if PLATFORM(WIN) |
115 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7TextTrackCueGeneric@WebCore@@6B@" )); |
116 | #else |
117 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore19TextTrackCueGenericE[2]); |
118 | #endif |
119 | |
120 | // If this fails TextTrackCueGeneric does not have a vtable, so you need to add the |
121 | // ImplementationLacksVTable attribute to the interface definition |
122 | static_assert(std::is_polymorphic<TextTrackCueGeneric>::value, "TextTrackCueGeneric is not polymorphic" ); |
123 | |
124 | // If you hit this assertion you either have a use after free bug, or |
125 | // TextTrackCueGeneric has subclasses. If TextTrackCueGeneric has subclasses that get passed |
126 | // to toJS() we currently require TextTrackCueGeneric you to opt out of binding hardening |
127 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
128 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
129 | #endif |
130 | return createWrapper<TextTrackCueGeneric>(globalObject, WTFMove(impl)); |
131 | } |
132 | |
133 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TextTrackCueGeneric& impl) |
134 | { |
135 | return wrap(state, globalObject, impl); |
136 | } |
137 | |
138 | TextTrackCueGeneric* JSTextTrackCueGeneric::toWrapped(JSC::VM& vm, JSC::JSValue value) |
139 | { |
140 | if (auto* wrapper = jsDynamicCast<JSTextTrackCueGeneric*>(vm, value)) |
141 | return &wrapper->wrapped(); |
142 | return nullptr; |
143 | } |
144 | |
145 | } |
146 | |
147 | #endif // ENABLE(VIDEO_TRACK) |
148 | |