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) |
24 | |
25 | #include "JSVideoPlaybackQuality.h" |
26 | |
27 | #include "Document.h" |
28 | #include "JSDOMAttribute.h" |
29 | #include "JSDOMBinding.h" |
30 | #include "JSDOMConvertNumbers.h" |
31 | #include "JSDOMExceptionHandling.h" |
32 | #include "JSDOMWrapperCache.h" |
33 | #include "ScriptExecutionContext.h" |
34 | #include "Settings.h" |
35 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
36 | #include <JavaScriptCore/JSCInlines.h> |
37 | #include <wtf/GetPtr.h> |
38 | #include <wtf/PointerPreparations.h> |
39 | #include <wtf/URL.h> |
40 | |
41 | |
42 | namespace WebCore { |
43 | using namespace JSC; |
44 | |
45 | // Attributes |
46 | |
47 | JSC::EncodedJSValue jsVideoPlaybackQualityCreationTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
48 | JSC::EncodedJSValue jsVideoPlaybackQualityTotalVideoFrames(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | JSC::EncodedJSValue jsVideoPlaybackQualityDroppedVideoFrames(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | JSC::EncodedJSValue jsVideoPlaybackQualityCorruptedVideoFrames(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | JSC::EncodedJSValue jsVideoPlaybackQualityDisplayCompositedVideoFrames(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | JSC::EncodedJSValue jsVideoPlaybackQualityTotalFrameDelay(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
53 | |
54 | class JSVideoPlaybackQualityPrototype : public JSC::JSNonFinalObject { |
55 | public: |
56 | using Base = JSC::JSNonFinalObject; |
57 | static JSVideoPlaybackQualityPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
58 | { |
59 | JSVideoPlaybackQualityPrototype* ptr = new (NotNull, JSC::allocateCell<JSVideoPlaybackQualityPrototype>(vm.heap)) JSVideoPlaybackQualityPrototype(vm, globalObject, structure); |
60 | ptr->finishCreation(vm); |
61 | return ptr; |
62 | } |
63 | |
64 | DECLARE_INFO; |
65 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
66 | { |
67 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
68 | } |
69 | |
70 | private: |
71 | JSVideoPlaybackQualityPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
72 | : JSC::JSNonFinalObject(vm, structure) |
73 | { |
74 | } |
75 | |
76 | void finishCreation(JSC::VM&); |
77 | }; |
78 | |
79 | /* Hash table for prototype */ |
80 | |
81 | static const HashTableValue JSVideoPlaybackQualityPrototypeTableValues[] = |
82 | { |
83 | { "creationTime" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVideoPlaybackQualityCreationTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
84 | { "totalVideoFrames" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVideoPlaybackQualityTotalVideoFrames), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
85 | { "droppedVideoFrames" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVideoPlaybackQualityDroppedVideoFrames), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
86 | { "corruptedVideoFrames" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVideoPlaybackQualityCorruptedVideoFrames), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
87 | { "displayCompositedVideoFrames" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVideoPlaybackQualityDisplayCompositedVideoFrames), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
88 | { "totalFrameDelay" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsVideoPlaybackQualityTotalFrameDelay), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
89 | }; |
90 | |
91 | const ClassInfo JSVideoPlaybackQualityPrototype::s_info = { "VideoPlaybackQualityPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVideoPlaybackQualityPrototype) }; |
92 | |
93 | void JSVideoPlaybackQualityPrototype::finishCreation(VM& vm) |
94 | { |
95 | Base::finishCreation(vm); |
96 | reifyStaticProperties(vm, JSVideoPlaybackQuality::info(), JSVideoPlaybackQualityPrototypeTableValues, *this); |
97 | bool hasDisabledRuntimeProperties = false; |
98 | if (!downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings().videoQualityIncludesDisplayCompositingEnabled()) { |
99 | hasDisabledRuntimeProperties = true; |
100 | auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("displayCompositedVideoFrames" ), strlen("displayCompositedVideoFrames" )); |
101 | VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
102 | JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
103 | } |
104 | if (hasDisabledRuntimeProperties && structure()->isDictionary()) |
105 | flattenDictionaryObject(vm); |
106 | } |
107 | |
108 | const ClassInfo JSVideoPlaybackQuality::s_info = { "VideoPlaybackQuality" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSVideoPlaybackQuality) }; |
109 | |
110 | JSVideoPlaybackQuality::JSVideoPlaybackQuality(Structure* structure, JSDOMGlobalObject& globalObject, Ref<VideoPlaybackQuality>&& impl) |
111 | : JSDOMWrapper<VideoPlaybackQuality>(structure, globalObject, WTFMove(impl)) |
112 | { |
113 | } |
114 | |
115 | void JSVideoPlaybackQuality::finishCreation(VM& vm) |
116 | { |
117 | Base::finishCreation(vm); |
118 | ASSERT(inherits(vm, info())); |
119 | |
120 | } |
121 | |
122 | JSObject* JSVideoPlaybackQuality::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
123 | { |
124 | return JSVideoPlaybackQualityPrototype::create(vm, &globalObject, JSVideoPlaybackQualityPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
125 | } |
126 | |
127 | JSObject* JSVideoPlaybackQuality::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
128 | { |
129 | return getDOMPrototype<JSVideoPlaybackQuality>(vm, globalObject); |
130 | } |
131 | |
132 | void JSVideoPlaybackQuality::destroy(JSC::JSCell* cell) |
133 | { |
134 | JSVideoPlaybackQuality* thisObject = static_cast<JSVideoPlaybackQuality*>(cell); |
135 | thisObject->JSVideoPlaybackQuality::~JSVideoPlaybackQuality(); |
136 | } |
137 | |
138 | template<> inline JSVideoPlaybackQuality* IDLAttribute<JSVideoPlaybackQuality>::cast(ExecState& state, EncodedJSValue thisValue) |
139 | { |
140 | return jsDynamicCast<JSVideoPlaybackQuality*>(state.vm(), JSValue::decode(thisValue)); |
141 | } |
142 | |
143 | static inline JSValue jsVideoPlaybackQualityCreationTimeGetter(ExecState& state, JSVideoPlaybackQuality& thisObject, ThrowScope& throwScope) |
144 | { |
145 | UNUSED_PARAM(throwScope); |
146 | UNUSED_PARAM(state); |
147 | auto& impl = thisObject.wrapped(); |
148 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.creationTime()); |
149 | return result; |
150 | } |
151 | |
152 | EncodedJSValue jsVideoPlaybackQualityCreationTime(ExecState* state, EncodedJSValue thisValue, PropertyName) |
153 | { |
154 | return IDLAttribute<JSVideoPlaybackQuality>::get<jsVideoPlaybackQualityCreationTimeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "creationTime" ); |
155 | } |
156 | |
157 | static inline JSValue jsVideoPlaybackQualityTotalVideoFramesGetter(ExecState& state, JSVideoPlaybackQuality& thisObject, ThrowScope& throwScope) |
158 | { |
159 | UNUSED_PARAM(throwScope); |
160 | UNUSED_PARAM(state); |
161 | auto& impl = thisObject.wrapped(); |
162 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.totalVideoFrames()); |
163 | return result; |
164 | } |
165 | |
166 | EncodedJSValue jsVideoPlaybackQualityTotalVideoFrames(ExecState* state, EncodedJSValue thisValue, PropertyName) |
167 | { |
168 | return IDLAttribute<JSVideoPlaybackQuality>::get<jsVideoPlaybackQualityTotalVideoFramesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "totalVideoFrames" ); |
169 | } |
170 | |
171 | static inline JSValue jsVideoPlaybackQualityDroppedVideoFramesGetter(ExecState& state, JSVideoPlaybackQuality& thisObject, ThrowScope& throwScope) |
172 | { |
173 | UNUSED_PARAM(throwScope); |
174 | UNUSED_PARAM(state); |
175 | auto& impl = thisObject.wrapped(); |
176 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.droppedVideoFrames()); |
177 | return result; |
178 | } |
179 | |
180 | EncodedJSValue jsVideoPlaybackQualityDroppedVideoFrames(ExecState* state, EncodedJSValue thisValue, PropertyName) |
181 | { |
182 | return IDLAttribute<JSVideoPlaybackQuality>::get<jsVideoPlaybackQualityDroppedVideoFramesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "droppedVideoFrames" ); |
183 | } |
184 | |
185 | static inline JSValue jsVideoPlaybackQualityCorruptedVideoFramesGetter(ExecState& state, JSVideoPlaybackQuality& thisObject, ThrowScope& throwScope) |
186 | { |
187 | UNUSED_PARAM(throwScope); |
188 | UNUSED_PARAM(state); |
189 | auto& impl = thisObject.wrapped(); |
190 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.corruptedVideoFrames()); |
191 | return result; |
192 | } |
193 | |
194 | EncodedJSValue jsVideoPlaybackQualityCorruptedVideoFrames(ExecState* state, EncodedJSValue thisValue, PropertyName) |
195 | { |
196 | return IDLAttribute<JSVideoPlaybackQuality>::get<jsVideoPlaybackQualityCorruptedVideoFramesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "corruptedVideoFrames" ); |
197 | } |
198 | |
199 | static inline JSValue jsVideoPlaybackQualityDisplayCompositedVideoFramesGetter(ExecState& state, JSVideoPlaybackQuality& thisObject, ThrowScope& throwScope) |
200 | { |
201 | UNUSED_PARAM(throwScope); |
202 | UNUSED_PARAM(state); |
203 | auto& impl = thisObject.wrapped(); |
204 | JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.displayCompositedVideoFrames()); |
205 | return result; |
206 | } |
207 | |
208 | EncodedJSValue jsVideoPlaybackQualityDisplayCompositedVideoFrames(ExecState* state, EncodedJSValue thisValue, PropertyName) |
209 | { |
210 | return IDLAttribute<JSVideoPlaybackQuality>::get<jsVideoPlaybackQualityDisplayCompositedVideoFramesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "displayCompositedVideoFrames" ); |
211 | } |
212 | |
213 | static inline JSValue jsVideoPlaybackQualityTotalFrameDelayGetter(ExecState& state, JSVideoPlaybackQuality& thisObject, ThrowScope& throwScope) |
214 | { |
215 | UNUSED_PARAM(throwScope); |
216 | UNUSED_PARAM(state); |
217 | auto& impl = thisObject.wrapped(); |
218 | JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.totalFrameDelay()); |
219 | return result; |
220 | } |
221 | |
222 | EncodedJSValue jsVideoPlaybackQualityTotalFrameDelay(ExecState* state, EncodedJSValue thisValue, PropertyName) |
223 | { |
224 | return IDLAttribute<JSVideoPlaybackQuality>::get<jsVideoPlaybackQualityTotalFrameDelayGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "totalFrameDelay" ); |
225 | } |
226 | |
227 | void JSVideoPlaybackQuality::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
228 | { |
229 | auto* thisObject = jsCast<JSVideoPlaybackQuality*>(cell); |
230 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
231 | if (thisObject->scriptExecutionContext()) |
232 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
233 | Base::heapSnapshot(cell, builder); |
234 | } |
235 | |
236 | bool JSVideoPlaybackQualityOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
237 | { |
238 | UNUSED_PARAM(handle); |
239 | UNUSED_PARAM(visitor); |
240 | UNUSED_PARAM(reason); |
241 | return false; |
242 | } |
243 | |
244 | void JSVideoPlaybackQualityOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
245 | { |
246 | auto* jsVideoPlaybackQuality = static_cast<JSVideoPlaybackQuality*>(handle.slot()->asCell()); |
247 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
248 | uncacheWrapper(world, &jsVideoPlaybackQuality->wrapped(), jsVideoPlaybackQuality); |
249 | } |
250 | |
251 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<VideoPlaybackQuality>&& impl) |
252 | { |
253 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
254 | // attribute. You should remove that attribute. If the class has subclasses |
255 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
256 | // attribute to VideoPlaybackQuality. |
257 | static_assert(!std::is_polymorphic<VideoPlaybackQuality>::value, "VideoPlaybackQuality is polymorphic but the IDL claims it is not" ); |
258 | return createWrapper<VideoPlaybackQuality>(globalObject, WTFMove(impl)); |
259 | } |
260 | |
261 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, VideoPlaybackQuality& impl) |
262 | { |
263 | return wrap(state, globalObject, impl); |
264 | } |
265 | |
266 | VideoPlaybackQuality* JSVideoPlaybackQuality::toWrapped(JSC::VM& vm, JSC::JSValue value) |
267 | { |
268 | if (auto* wrapper = jsDynamicCast<JSVideoPlaybackQuality*>(vm, value)) |
269 | return &wrapper->wrapped(); |
270 | return nullptr; |
271 | } |
272 | |
273 | } |
274 | |
275 | #endif // ENABLE(VIDEO) |
276 | |