script_bindings/home/runner/work/servo/servo/target/debug/build/script_bindings-d55f55d5af1efaee/out/Bindings/
WebGLShaderBinding.rs

1/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
2
3#![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::WebGLObjectBinding::WebGLObject_Binding;
6use crate::import::base::*;
7
8pub use self::WebGLShader_Binding::{Wrap, GetProtoObject, DefineDOMInterface};
9pub mod WebGLShader_Binding {
10use crate::codegen::GenericBindings::WebGLObjectBinding::WebGLObject_Binding;
11use crate::import::module::*;
12
13unsafe extern "C" fn _finalize<D: DomTypes>
14(_cx: *mut GCContext, obj: *mut JSObject){
15    wrap_panic(&mut || {
16
17        let this = native_from_object_static::<D::WebGLShader>(obj).unwrap();
18        finalize_common(this);
19    })
20}
21
22unsafe extern "C" fn _trace<D: DomTypes>
23(trc: *mut JSTracer, obj: *mut JSObject){
24    wrap_panic(&mut || {
25
26        let this = native_from_object_static::<D::WebGLShader>(obj).unwrap();
27        if this.is_null() { return; } // GC during obj creation
28        (*this).trace(trc);
29    })
30}
31
32
33static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
34
35pub(crate) fn init_class_ops<D: DomTypes>() {
36    CLASS_OPS.set(JSClassOps {
37        addProperty: None,
38        delProperty: None,
39        enumerate: None,
40        newEnumerate: None,
41        resolve: None,
42        mayResolve: None,
43        finalize: Some(_finalize::<D>),
44        call: None,
45        construct: None,
46        trace: Some(_trace::<D>),
47    });
48}
49
50pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
51
52pub(crate) fn init_domjs_class<D: DomTypes>() {
53    init_class_ops::<D>();
54    Class.set(DOMJSClass {
55        base: JSClass {
56            name: c"WebGLShader".as_ptr(),
57            flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
58                   (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
59                   /* JSCLASS_HAS_RESERVED_SLOTS(1) */,
60            cOps: unsafe { CLASS_OPS.get() },
61            spec: ptr::null(),
62            ext: ptr::null(),
63            oOps: ptr::null(),
64        },
65        dom_class:
66DOMClass {
67    interface_chain: [ PrototypeList::ID::WebGLObject, PrototypeList::ID::WebGLShader, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
68    depth: 1,
69    type_id: crate::codegen::InheritTypes::TopTypeId { webglobject: (crate::codegen::InheritTypes::WebGLObjectTypeId::WebGLShader) },
70    malloc_size_of: malloc_size_of_including_raw_self::<D::WebGLShader> as unsafe fn(&mut _, _) -> _,
71    global: Globals::EMPTY,
72},
73    });
74}
75
76#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
77(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::WebGLShader>, _can_gc: CanGc) -> DomRoot<D::WebGLShader>{
78
79    let raw = Root::new(MaybeUnreflectedDom::from_box(object));
80
81    let scope = scope.reflector().get_jsobject();
82    assert!(!scope.get().is_null());
83    assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
84    let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
85
86    rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
87    GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
88    assert!(!canonical_proto.is_null());
89
90
91    rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
92    if let Some(given) = given_proto {
93        proto.set(*given);
94        if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
95            assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
96        }
97    } else {
98        proto.set(*canonical_proto);
99    }
100    rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
101        cx.raw_cx(),
102        &Class.get().base,
103        proto.handle(),
104    ));
105    assert!(!obj.is_null());
106    JS_SetReservedSlot(
107        obj.get(),
108        DOM_OBJECT_SLOT,
109        &PrivateValue(raw.as_ptr() as *const libc::c_void),
110    );
111
112    let root = raw.reflect_with(obj.get());
113
114
115
116    DomRoot::from_ref(&*root)
117}
118
119pub trait WebGLShaderMethods<D: DomTypes> {
120}
121static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
122
123pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
124    sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
125    JSPropertySpec {
126                    name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
127                    attributes_: (JSPROP_READONLY),
128                    kind_: (JSPropertySpec_Kind::Value),
129                    u: JSPropertySpec_AccessorsOrValue {
130                        value: JSPropertySpec_ValueWrapper {
131                            type_: JSPropertySpec_ValueWrapper_Type::String,
132                            __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
133                                string: c"WebGLShader".as_ptr(),
134                            }
135                        }
136                    }
137                }
138,
139    JSPropertySpec::ZERO]))[..]
140])));
141}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
142
143pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
144    sAttributes.set(Box::leak(Box::new([    Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
145}
146pub fn GetProtoObject<D: DomTypes>
147(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
148    /* Get the interface prototype object for this class.  This will create the
149       object as needed. */get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::WebGLShader), CreateInterfaceObjects::<D>, rval)
150}
151
152
153static PrototypeClass: JSClass = JSClass {
154    name: c"WebGLShaderPrototype".as_ptr(),
155    flags:
156        // JSCLASS_HAS_RESERVED_SLOTS()
157        (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
158    cOps: ptr::null(),
159    spec: ptr::null(),
160    ext: ptr::null(),
161    oOps: ptr::null(),
162};
163
164
165static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
166
167pub(crate) fn init_interface_object<D: DomTypes>() {
168    INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
169        Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
170        b"function WebGLShader() {\n    [native code]\n}",
171        PrototypeList::ID::WebGLShader,
172        1,
173    ));
174}
175
176pub fn DefineDOMInterface<D: DomTypes>
177(cx: SafeJSContext, global: HandleObject){
178    define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::WebGLShader),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
179}
180
181pub fn ConstructorEnabled<D: DomTypes>
182(aCx: SafeJSContext, aObj: HandleObject) -> bool{
183    is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW)
184}
185
186unsafe fn CreateInterfaceObjects<D: DomTypes>
187(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
188
189    rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
190    WebGLObject_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
191    assert!(!prototype_proto.is_null());
192
193    rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
194    create_interface_prototype_object::<D>(cx,
195                                      global,
196                                      prototype_proto.handle(),
197                                      &PrototypeClass,
198                                      &[],
199                                      sAttributes.get(),
200                                      &[],
201                                      &[],
202                                      prototype.handle_mut());
203    assert!(!prototype.is_null());
204    assert!((*cache)[PrototypeList::ID::WebGLShader as usize].is_null());
205    (*cache)[PrototypeList::ID::WebGLShader as usize] = prototype.get();
206    <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::WebGLShader as isize),
207                                  ptr::null_mut(),
208                                  prototype.get());
209
210    rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
211
212    WebGLObject_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
213
214    assert!(!interface_proto.is_null());
215
216    rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
217    create_noncallback_interface_object::<D>(cx,
218                                        global,
219                                        interface_proto.handle(),
220                                        INTERFACE_OBJECT_CLASS.get(),
221                                        &[],
222                                        &[],
223                                        &[],
224                                        prototype.handle(),
225                                        c"WebGLShader",
226                                        0,
227                                        &[],
228                                        interface.handle_mut());
229    assert!(!interface.is_null());
230}
231
232
233        pub(crate) fn init_statics<D: DomTypes>() {
234            init_interface_object::<D>();
235            init_domjs_class::<D>();
236
237
238
239
240            init_sAttributes_specs::<D>();
241init_sAttributes_prefs::<D>();
242        }
243        } // mod WebGLShader_Binding
244
245