script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
AudioDestinationNodeBinding.rs1#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::codegen::GenericBindings::AudioNodeBinding::AudioNode_Binding;
6use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
7use crate::import::base::*;
8
9pub use self::AudioDestinationNode_Binding::{Wrap, AudioDestinationNodeMethods, GetProtoObject, DefineDOMInterface};
10pub mod AudioDestinationNode_Binding {
11use crate::codegen::GenericBindings::AudioNodeBinding::AudioNode_Binding;
12use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
13use crate::import::module::*;
14
15unsafe extern "C" fn get_maxChannelCount<D: DomTypes>
16(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
17 let mut result = false;
18 wrap_panic(&mut || result = (|| {
19 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
20 let this = &*(this as *const D::AudioDestinationNode);
21 let result: u32 = this.MaxChannelCount();
22
23 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24 return true;
25 })());
26 result
27}
28
29
30static maxChannelCount_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
31
32pub(crate) fn init_maxChannelCount_getterinfo<D: DomTypes>() {
33 maxChannelCount_getterinfo.set(JSJitInfo {
34 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
35 getter: Some(get_maxChannelCount::<D>)
36 },
37 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
38 protoID: PrototypeList::ID::AudioDestinationNode as u16,
39 },
40 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 2 },
41 _bitfield_align_1: [],
42 _bitfield_1: __BindgenBitfieldUnit::new(
43 new_jsjitinfo_bitfield_1!(
44 JSJitInfo_OpType::Getter as u8,
45 JSJitInfo_AliasSet::AliasEverything as u8,
46 JSValueType::JSVAL_TYPE_DOUBLE as u8,
47 true,
48 false,
49 false,
50 false,
51 false,
52 false,
53 0,
54 ).to_ne_bytes()
55 ),
56});
57}
58unsafe extern "C" fn _finalize<D: DomTypes>
59(_cx: *mut GCContext, obj: *mut JSObject){
60 wrap_panic(&mut || {
61
62 let this = native_from_object_static::<D::AudioDestinationNode>(obj).unwrap();
63 finalize_common(this);
64 })
65}
66
67unsafe extern "C" fn _trace<D: DomTypes>
68(trc: *mut JSTracer, obj: *mut JSObject){
69 wrap_panic(&mut || {
70
71 let this = native_from_object_static::<D::AudioDestinationNode>(obj).unwrap();
72 if this.is_null() { return; } (*this).trace(trc);
74 })
75}
76
77
78static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
79
80pub(crate) fn init_class_ops<D: DomTypes>() {
81 CLASS_OPS.set(JSClassOps {
82 addProperty: None,
83 delProperty: None,
84 enumerate: None,
85 newEnumerate: None,
86 resolve: None,
87 mayResolve: None,
88 finalize: Some(_finalize::<D>),
89 call: None,
90 construct: None,
91 trace: Some(_trace::<D>),
92 });
93}
94
95pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
96
97pub(crate) fn init_domjs_class<D: DomTypes>() {
98 init_class_ops::<D>();
99 Class.set(DOMJSClass {
100 base: JSClass {
101 name: c"AudioDestinationNode".as_ptr(),
102 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
103 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
104 ,
105 cOps: unsafe { CLASS_OPS.get() },
106 spec: ptr::null(),
107 ext: ptr::null(),
108 oOps: ptr::null(),
109 },
110 dom_class:
111DOMClass {
112 interface_chain: [ PrototypeList::ID::EventTarget, PrototypeList::ID::AudioNode, PrototypeList::ID::AudioDestinationNode, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
113 depth: 2,
114 type_id: crate::codegen::InheritTypes::TopTypeId { eventtarget: (crate::codegen::InheritTypes::EventTargetTypeId::AudioNode(crate::codegen::InheritTypes::AudioNodeTypeId::AudioDestinationNode)) },
115 malloc_size_of: malloc_size_of_including_raw_self::<D::AudioDestinationNode> as unsafe fn(&mut _, _) -> _,
116 global: Globals::EMPTY,
117},
118 });
119}
120
121#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
122(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::AudioDestinationNode>, _can_gc: CanGc) -> DomRoot<D::AudioDestinationNode>{
123
124 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
125
126 let scope = scope.reflector().get_jsobject();
127 assert!(!scope.get().is_null());
128 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
129 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
130
131 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
132 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
133 assert!(!canonical_proto.is_null());
134
135
136 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
137 if let Some(given) = given_proto {
138 proto.set(*given);
139 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
140 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
141 }
142 } else {
143 proto.set(*canonical_proto);
144 }
145 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
146 cx.raw_cx(),
147 &Class.get().base,
148 proto.handle(),
149 ));
150 assert!(!obj.is_null());
151 JS_SetReservedSlot(
152 obj.get(),
153 DOM_OBJECT_SLOT,
154 &PrivateValue(raw.as_ptr() as *const libc::c_void),
155 );
156
157 let root = raw.reflect_with(obj.get());
158
159
160
161 DomRoot::from_ref(&*root)
162}
163
164pub trait AudioDestinationNodeMethods<D: DomTypes> {
165 fn MaxChannelCount(&self, ) -> u32;
166}
167static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
168
169pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
170 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
171 JSPropertySpec {
172 name: JSPropertySpec_Name { string_: c"maxChannelCount".as_ptr() },
173 attributes_: (JSPROP_ENUMERATE),
174 kind_: (JSPropertySpec_Kind::NativeAccessor),
175 u: JSPropertySpec_AccessorsOrValue {
176 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
177 getter: JSPropertySpec_Accessor {
178 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxChannelCount_getterinfo.get() } },
179 },
180 setter: JSPropertySpec_Accessor {
181 native: JSNativeWrapper { op: None, info: ptr::null() },
182 }
183 }
184 }
185 }
186,
187 JSPropertySpec::ZERO]))[..]
188,
189&Box::leak(Box::new([
190 JSPropertySpec {
191 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
192 attributes_: (JSPROP_READONLY),
193 kind_: (JSPropertySpec_Kind::Value),
194 u: JSPropertySpec_AccessorsOrValue {
195 value: JSPropertySpec_ValueWrapper {
196 type_: JSPropertySpec_ValueWrapper_Type::String,
197 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
198 string: c"AudioDestinationNode".as_ptr(),
199 }
200 }
201 }
202 }
203,
204 JSPropertySpec::ZERO]))[..]
205])));
206}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
207
208pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
209 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW)], (unsafe { sAttributes_specs.get() })[0]),
210 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
211}
212pub fn GetProtoObject<D: DomTypes>
213(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
214 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::AudioDestinationNode), CreateInterfaceObjects::<D>, rval)
216}
217
218
219static PrototypeClass: JSClass = JSClass {
220 name: c"AudioDestinationNodePrototype".as_ptr(),
221 flags:
222 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
224 cOps: ptr::null(),
225 spec: ptr::null(),
226 ext: ptr::null(),
227 oOps: ptr::null(),
228};
229
230
231static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
232
233pub(crate) fn init_interface_object<D: DomTypes>() {
234 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
235 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
236 b"function AudioDestinationNode() {\n [native code]\n}",
237 PrototypeList::ID::AudioDestinationNode,
238 2,
239 ));
240}
241
242pub fn DefineDOMInterface<D: DomTypes>
243(cx: SafeJSContext, global: HandleObject){
244 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::AudioDestinationNode),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
245}
246
247pub fn ConstructorEnabled<D: DomTypes>
248(aCx: SafeJSContext, aObj: HandleObject) -> bool{
249 is_exposed_in(aObj, Globals::WINDOW)
250}
251
252unsafe fn CreateInterfaceObjects<D: DomTypes>
253(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
254
255 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
256 AudioNode_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
257 assert!(!prototype_proto.is_null());
258
259 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
260 create_interface_prototype_object::<D>(cx,
261 global,
262 prototype_proto.handle(),
263 &PrototypeClass,
264 &[],
265 sAttributes.get(),
266 &[],
267 &[],
268 prototype.handle_mut());
269 assert!(!prototype.is_null());
270 assert!((*cache)[PrototypeList::ID::AudioDestinationNode as usize].is_null());
271 (*cache)[PrototypeList::ID::AudioDestinationNode as usize] = prototype.get();
272 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::AudioDestinationNode as isize),
273 ptr::null_mut(),
274 prototype.get());
275
276 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
277
278 AudioNode_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
279
280 assert!(!interface_proto.is_null());
281
282 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
283 create_noncallback_interface_object::<D>(cx,
284 global,
285 interface_proto.handle(),
286 INTERFACE_OBJECT_CLASS.get(),
287 &[],
288 &[],
289 &[],
290 prototype.handle(),
291 c"AudioDestinationNode",
292 0,
293 &[],
294 interface.handle_mut());
295 assert!(!interface.is_null());
296}
297
298
299 pub(crate) fn init_statics<D: DomTypes>() {
300 init_interface_object::<D>();
301 init_domjs_class::<D>();
302
303 init_maxChannelCount_getterinfo::<D>();
304
305
306 init_sAttributes_specs::<D>();
307init_sAttributes_prefs::<D>();
308 }
309 }