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(MEDIA_STREAM)
24
25#include "JSDOMConvertDictionary.h"
26#include "JSDOMConvertEnumeration.h"
27#include "JSDOMWrapper.h"
28#include "JSEventTarget.h"
29#include "MediaDevices.h"
30#include <wtf/NeverDestroyed.h>
31
32namespace WebCore {
33
34class JSMediaDevices : public JSEventTarget {
35public:
36 using Base = JSEventTarget;
37 using DOMWrapped = MediaDevices;
38 static JSMediaDevices* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<MediaDevices>&& impl)
39 {
40 JSMediaDevices* ptr = new (NotNull, JSC::allocateCell<JSMediaDevices>(globalObject->vm().heap)) JSMediaDevices(structure, *globalObject, WTFMove(impl));
41 ptr->finishCreation(globalObject->vm());
42 return ptr;
43 }
44
45 static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
46 static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
47 static MediaDevices* toWrapped(JSC::VM&, JSC::JSValue);
48
49 DECLARE_INFO;
50
51 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
52 {
53 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
54 }
55
56 static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
57 static void heapSnapshot(JSCell*, JSC::HeapSnapshotBuilder&);
58 MediaDevices& wrapped() const
59 {
60 return static_cast<MediaDevices&>(Base::wrapped());
61 }
62protected:
63 JSMediaDevices(JSC::Structure*, JSDOMGlobalObject&, Ref<MediaDevices>&&);
64
65 void finishCreation(JSC::VM&);
66};
67
68class JSMediaDevicesOwner : public JSC::WeakHandleOwner {
69public:
70 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&, const char**);
71 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
72};
73
74inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, MediaDevices*)
75{
76 static NeverDestroyed<JSMediaDevicesOwner> owner;
77 return &owner.get();
78}
79
80inline void* wrapperKey(MediaDevices* wrappableObject)
81{
82 return wrappableObject;
83}
84
85JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, MediaDevices&);
86inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, MediaDevices* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
87JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<MediaDevices>&&);
88inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<MediaDevices>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
89
90template<> struct JSDOMWrapperConverterTraits<MediaDevices> {
91 using WrapperClass = JSMediaDevices;
92 using ToWrappedReturnType = MediaDevices*;
93};
94#if ENABLE(MEDIA_STREAM)
95
96String convertEnumerationToString(MediaDevices::DisplayCaptureSurfaceType);
97template<> JSC::JSString* convertEnumerationToJS(JSC::ExecState&, MediaDevices::DisplayCaptureSurfaceType);
98
99template<> Optional<MediaDevices::DisplayCaptureSurfaceType> parseEnumeration<MediaDevices::DisplayCaptureSurfaceType>(JSC::ExecState&, JSC::JSValue);
100template<> const char* expectedEnumerationValues<MediaDevices::DisplayCaptureSurfaceType>();
101
102#endif
103
104#if ENABLE(MEDIA_STREAM)
105
106template<> MediaDevices::StreamConstraints convertDictionary<MediaDevices::StreamConstraints>(JSC::ExecState&, JSC::JSValue);
107
108#endif
109
110
111} // namespace WebCore
112
113#endif // ENABLE(MEDIA_STREAM)
114