Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM SVGComponentTransferFunctionElement.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #include "DOMSVGAnimatedNumberList.h"
4 : #include "SVGComponentTransferFunctionElementBinding.h"
5 : #include "SVGElementBinding.h"
6 : #include "WrapperFactory.h"
7 : #include "mozilla/OwningNonNull.h"
8 : #include "mozilla/dom/BindingUtils.h"
9 : #include "mozilla/dom/DOMJSClass.h"
10 : #include "mozilla/dom/NonRefcountedDOMObject.h"
11 : #include "mozilla/dom/SVGAnimatedEnumeration.h"
12 : #include "mozilla/dom/SVGAnimatedNumber.h"
13 : #include "mozilla/dom/SVGComponentTransferFunctionElement.h"
14 : #include "mozilla/dom/XrayExpandoClass.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : namespace SVGComponentTransferFunctionElementBinding {
20 :
21 : static_assert(IsRefcounted<NativeType>::value == IsRefcounted<SVGElementBinding::NativeType>::value,
22 : "Can't inherit from an interface with a different ownership model.");
23 :
24 : static bool
25 0 : get_type(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGComponentTransferFunctionElement* self, JSJitGetterCallArgs args)
26 : {
27 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedEnumeration>(self->Type()));
28 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
29 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
30 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
31 0 : return false;
32 : }
33 0 : return true;
34 : }
35 :
36 : static const JSJitInfo type_getterinfo = {
37 : { (JSJitGetterOp)get_type },
38 : { prototypes::id::SVGComponentTransferFunctionElement },
39 : { PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth },
40 : JSJitInfo::Getter,
41 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
42 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
43 : false, /* isInfallible. False in setters. */
44 : true, /* isMovable. Not relevant for setters. */
45 : true, /* isEliminatable. Not relevant for setters. */
46 : false, /* isAlwaysInSlot. Only relevant for getters. */
47 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
48 : false, /* isTypedMethod. Only relevant for methods. */
49 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
50 : };
51 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
52 : static_assert(0 < 1, "There is no slot for us");
53 :
54 : static bool
55 0 : get_tableValues(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGComponentTransferFunctionElement* self, JSJitGetterCallArgs args)
56 : {
57 0 : auto result(StrongOrRawPtr<mozilla::DOMSVGAnimatedNumberList>(self->TableValues()));
58 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
59 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
60 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
61 0 : return false;
62 : }
63 0 : return true;
64 : }
65 :
66 : static const JSJitInfo tableValues_getterinfo = {
67 : { (JSJitGetterOp)get_tableValues },
68 : { prototypes::id::SVGComponentTransferFunctionElement },
69 : { PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth },
70 : JSJitInfo::Getter,
71 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
72 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
73 : false, /* isInfallible. False in setters. */
74 : true, /* isMovable. Not relevant for setters. */
75 : true, /* isEliminatable. Not relevant for setters. */
76 : false, /* isAlwaysInSlot. Only relevant for getters. */
77 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
78 : false, /* isTypedMethod. Only relevant for methods. */
79 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
80 : };
81 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
82 : static_assert(0 < 1, "There is no slot for us");
83 :
84 : static bool
85 0 : get_slope(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGComponentTransferFunctionElement* self, JSJitGetterCallArgs args)
86 : {
87 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Slope()));
88 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
89 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
90 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
91 0 : return false;
92 : }
93 0 : return true;
94 : }
95 :
96 : static const JSJitInfo slope_getterinfo = {
97 : { (JSJitGetterOp)get_slope },
98 : { prototypes::id::SVGComponentTransferFunctionElement },
99 : { PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth },
100 : JSJitInfo::Getter,
101 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
102 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
103 : false, /* isInfallible. False in setters. */
104 : true, /* isMovable. Not relevant for setters. */
105 : true, /* isEliminatable. Not relevant for setters. */
106 : false, /* isAlwaysInSlot. Only relevant for getters. */
107 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
108 : false, /* isTypedMethod. Only relevant for methods. */
109 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
110 : };
111 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
112 : static_assert(0 < 1, "There is no slot for us");
113 :
114 : static bool
115 0 : get_intercept(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGComponentTransferFunctionElement* self, JSJitGetterCallArgs args)
116 : {
117 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Intercept()));
118 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
119 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
120 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
121 0 : return false;
122 : }
123 0 : return true;
124 : }
125 :
126 : static const JSJitInfo intercept_getterinfo = {
127 : { (JSJitGetterOp)get_intercept },
128 : { prototypes::id::SVGComponentTransferFunctionElement },
129 : { PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth },
130 : JSJitInfo::Getter,
131 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
132 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
133 : false, /* isInfallible. False in setters. */
134 : true, /* isMovable. Not relevant for setters. */
135 : true, /* isEliminatable. Not relevant for setters. */
136 : false, /* isAlwaysInSlot. Only relevant for getters. */
137 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
138 : false, /* isTypedMethod. Only relevant for methods. */
139 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
140 : };
141 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
142 : static_assert(0 < 1, "There is no slot for us");
143 :
144 : static bool
145 0 : get_amplitude(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGComponentTransferFunctionElement* self, JSJitGetterCallArgs args)
146 : {
147 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Amplitude()));
148 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
149 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
150 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
151 0 : return false;
152 : }
153 0 : return true;
154 : }
155 :
156 : static const JSJitInfo amplitude_getterinfo = {
157 : { (JSJitGetterOp)get_amplitude },
158 : { prototypes::id::SVGComponentTransferFunctionElement },
159 : { PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth },
160 : JSJitInfo::Getter,
161 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
162 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
163 : false, /* isInfallible. False in setters. */
164 : true, /* isMovable. Not relevant for setters. */
165 : true, /* isEliminatable. Not relevant for setters. */
166 : false, /* isAlwaysInSlot. Only relevant for getters. */
167 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
168 : false, /* isTypedMethod. Only relevant for methods. */
169 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
170 : };
171 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
172 : static_assert(0 < 1, "There is no slot for us");
173 :
174 : static bool
175 0 : get_exponent(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGComponentTransferFunctionElement* self, JSJitGetterCallArgs args)
176 : {
177 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Exponent()));
178 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
179 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
180 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
181 0 : return false;
182 : }
183 0 : return true;
184 : }
185 :
186 : static const JSJitInfo exponent_getterinfo = {
187 : { (JSJitGetterOp)get_exponent },
188 : { prototypes::id::SVGComponentTransferFunctionElement },
189 : { PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth },
190 : JSJitInfo::Getter,
191 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
192 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
193 : false, /* isInfallible. False in setters. */
194 : true, /* isMovable. Not relevant for setters. */
195 : true, /* isEliminatable. Not relevant for setters. */
196 : false, /* isAlwaysInSlot. Only relevant for getters. */
197 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
198 : false, /* isTypedMethod. Only relevant for methods. */
199 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
200 : };
201 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
202 : static_assert(0 < 1, "There is no slot for us");
203 :
204 : static bool
205 0 : get_offset(JSContext* cx, JS::Handle<JSObject*> obj, mozilla::dom::SVGComponentTransferFunctionElement* self, JSJitGetterCallArgs args)
206 : {
207 0 : auto result(StrongOrRawPtr<mozilla::dom::SVGAnimatedNumber>(self->Offset()));
208 0 : MOZ_ASSERT(!JS_IsExceptionPending(cx));
209 0 : if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
210 0 : MOZ_ASSERT(true || JS_IsExceptionPending(cx));
211 0 : return false;
212 : }
213 0 : return true;
214 : }
215 :
216 : static const JSJitInfo offset_getterinfo = {
217 : { (JSJitGetterOp)get_offset },
218 : { prototypes::id::SVGComponentTransferFunctionElement },
219 : { PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth },
220 : JSJitInfo::Getter,
221 : JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */
222 : JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */
223 : false, /* isInfallible. False in setters. */
224 : true, /* isMovable. Not relevant for setters. */
225 : true, /* isEliminatable. Not relevant for setters. */
226 : false, /* isAlwaysInSlot. Only relevant for getters. */
227 : false, /* isLazilyCachedInSlot. Only relevant for getters. */
228 : false, /* isTypedMethod. Only relevant for methods. */
229 : 0 /* Reserved slot index, if we're stored in a slot, else 0. */
230 : };
231 : static_assert(0 <= JSJitInfo::maxSlotIndex, "We won't fit");
232 : static_assert(0 < 1, "There is no slot for us");
233 :
234 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
235 : #if defined(__clang__)
236 : #pragma clang diagnostic push
237 : #pragma clang diagnostic ignored "-Wmissing-braces"
238 : #endif
239 : static const JSPropertySpec sAttributes_specs[] = {
240 : { "type", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &type_getterinfo, nullptr, nullptr },
241 : { "tableValues", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &tableValues_getterinfo, nullptr, nullptr },
242 : { "slope", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &slope_getterinfo, nullptr, nullptr },
243 : { "intercept", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &intercept_getterinfo, nullptr, nullptr },
244 : { "amplitude", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &litude_getterinfo, nullptr, nullptr },
245 : { "exponent", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &exponent_getterinfo, nullptr, nullptr },
246 : { "offset", JSPROP_SHARED | JSPROP_ENUMERATE, GenericBindingGetter, &offset_getterinfo, nullptr, nullptr },
247 : { nullptr, 0, nullptr, nullptr, nullptr, nullptr }
248 : };
249 : #if defined(__clang__)
250 : #pragma clang diagnostic pop
251 : #endif
252 :
253 :
254 : // Can't be const because the pref-enabled boolean needs to be writable
255 : static Prefable<const JSPropertySpec> sAttributes[] = {
256 : { nullptr, &sAttributes_specs[0] },
257 : { nullptr, nullptr }
258 : };
259 :
260 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
261 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
262 : static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
263 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
264 :
265 : // We deliberately use brace-elision to make Visual Studio produce better initalization code.
266 : #if defined(__clang__)
267 : #pragma clang diagnostic push
268 : #pragma clang diagnostic ignored "-Wmissing-braces"
269 : #endif
270 : static const ConstantSpec sConstants_specs[] = {
271 : { "SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN", JS::Int32Value(0) },
272 : { "SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY", JS::Int32Value(1) },
273 : { "SVG_FECOMPONENTTRANSFER_TYPE_TABLE", JS::Int32Value(2) },
274 : { "SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE", JS::Int32Value(3) },
275 : { "SVG_FECOMPONENTTRANSFER_TYPE_LINEAR", JS::Int32Value(4) },
276 : { "SVG_FECOMPONENTTRANSFER_TYPE_GAMMA", JS::Int32Value(5) },
277 : { 0, JS::UndefinedValue() }
278 : };
279 : #if defined(__clang__)
280 : #pragma clang diagnostic pop
281 : #endif
282 :
283 :
284 : // Can't be const because the pref-enabled boolean needs to be writable
285 : static Prefable<const ConstantSpec> sConstants[] = {
286 : { nullptr, &sConstants_specs[0] },
287 : { nullptr, nullptr }
288 : };
289 :
290 : static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
291 : "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
292 : static_assert(6 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
293 : "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
294 :
295 :
296 : static uint16_t sNativeProperties_sortedPropertyIndices[13];
297 : static PropertyInfo sNativeProperties_propertyInfos[13];
298 :
299 : static const NativePropertiesN<2> sNativeProperties = {
300 : false, 0,
301 : false, 0,
302 : false, 0,
303 : true, 0 /* sAttributes */,
304 : false, 0,
305 : false, 0,
306 : true, 1 /* sConstants */,
307 : -1,
308 : 13,
309 : sNativeProperties_sortedPropertyIndices,
310 : {
311 : { sAttributes, &sNativeProperties_propertyInfos[0] },
312 : { sConstants, &sNativeProperties_propertyInfos[7] }
313 : }
314 : };
315 : static_assert(13 < 1ull << CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount),
316 : "We have a property info count that is oversized");
317 :
318 : static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
319 : {
320 : "Function",
321 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_SLOTS_BASE),
322 : &sBoringInterfaceObjectClassClassOps,
323 : JS_NULL_CLASS_SPEC,
324 : JS_NULL_CLASS_EXT,
325 : &sInterfaceObjectClassObjectOps
326 : },
327 : eInterface,
328 : true,
329 : prototypes::id::SVGComponentTransferFunctionElement,
330 : PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth,
331 : sNativePropertyHooks,
332 : "function SVGComponentTransferFunctionElement() {\n [native code]\n}",
333 : SVGElementBinding::GetConstructorObject
334 : };
335 :
336 : static const DOMIfaceAndProtoJSClass sPrototypeClass = {
337 : {
338 : "SVGComponentTransferFunctionElementPrototype",
339 : JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE),
340 : JS_NULL_CLASS_OPS,
341 : JS_NULL_CLASS_SPEC,
342 : JS_NULL_CLASS_EXT,
343 : JS_NULL_OBJECT_OPS
344 : },
345 : eInterfacePrototype,
346 : false,
347 : prototypes::id::SVGComponentTransferFunctionElement,
348 : PrototypeTraits<prototypes::id::SVGComponentTransferFunctionElement>::Depth,
349 : sNativePropertyHooks,
350 : "[object SVGComponentTransferFunctionElementPrototype]",
351 : SVGElementBinding::GetProtoObject
352 : };
353 :
354 : JSObject*
355 0 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal)
356 : {
357 0 : return GetConstructorObjectHandle(aCx, aDefineOnGlobal);
358 : }
359 :
360 : const NativePropertyHooks sNativePropertyHooks[] = { {
361 : nullptr,
362 : nullptr,
363 : nullptr,
364 : { sNativeProperties.Upcast(), nullptr },
365 : prototypes::id::SVGComponentTransferFunctionElement,
366 : constructors::id::SVGComponentTransferFunctionElement,
367 : SVGElementBinding::sNativePropertyHooks,
368 : &DefaultXrayExpandoObjectClass
369 : } };
370 :
371 : void
372 0 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
373 : {
374 0 : JS::Handle<JSObject*> parentProto(SVGElementBinding::GetProtoObjectHandle(aCx));
375 0 : if (!parentProto) {
376 0 : return;
377 : }
378 :
379 0 : JS::Handle<JSObject*> constructorProto(SVGElementBinding::GetConstructorObjectHandle(aCx));
380 0 : if (!constructorProto) {
381 0 : return;
382 : }
383 :
384 : static bool sIdsInited = false;
385 0 : if (!sIdsInited && NS_IsMainThread()) {
386 0 : if (!InitIds(aCx, sNativeProperties.Upcast())) {
387 0 : return;
388 : }
389 0 : sIdsInited = true;
390 : }
391 :
392 0 : JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::SVGComponentTransferFunctionElement);
393 0 : JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::SVGComponentTransferFunctionElement);
394 0 : dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
395 : &sPrototypeClass.mBase, protoCache,
396 : constructorProto, &sInterfaceObjectClass.mBase, 0, nullptr,
397 : interfaceCache,
398 : sNativeProperties.Upcast(),
399 : nullptr,
400 : "SVGComponentTransferFunctionElement", aDefineOnGlobal,
401 : nullptr,
402 0 : false);
403 : }
404 :
405 : JS::Handle<JSObject*>
406 0 : GetProtoObjectHandle(JSContext* aCx)
407 : {
408 : /* Get the interface prototype object for this class. This will create the
409 : object as needed. */
410 0 : bool aDefineOnGlobal = true;
411 :
412 : /* Make sure our global is sane. Hopefully we can remove this sometime */
413 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
414 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
415 0 : return nullptr;
416 : }
417 :
418 : /* Check to see whether the interface objects are already installed */
419 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
420 0 : if (!protoAndIfaceCache.HasEntryInSlot(prototypes::id::SVGComponentTransferFunctionElement)) {
421 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
422 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
423 : }
424 :
425 : /*
426 : * The object might _still_ be null, but that's OK.
427 : *
428 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
429 : * traced by TraceProtoAndIfaceCache() and its contents are never
430 : * changed after they have been set.
431 : *
432 : * Calling address() avoids the read read barrier that does gray
433 : * unmarking, but it's not possible for the object to be gray here.
434 : */
435 :
436 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(prototypes::id::SVGComponentTransferFunctionElement);
437 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
438 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
439 : }
440 :
441 : JSObject*
442 0 : GetProtoObject(JSContext* aCx)
443 : {
444 0 : return GetProtoObjectHandle(aCx);
445 : }
446 :
447 : JS::Handle<JSObject*>
448 0 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal)
449 : {
450 : /* Get the interface object for this class. This will create the object as
451 : needed. */
452 :
453 : /* Make sure our global is sane. Hopefully we can remove this sometime */
454 0 : JSObject* global = JS::CurrentGlobalOrNull(aCx);
455 0 : if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
456 0 : return nullptr;
457 : }
458 :
459 : /* Check to see whether the interface objects are already installed */
460 0 : ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
461 0 : if (!protoAndIfaceCache.HasEntryInSlot(constructors::id::SVGComponentTransferFunctionElement)) {
462 0 : JS::Rooted<JSObject*> rootedGlobal(aCx, global);
463 0 : CreateInterfaceObjects(aCx, rootedGlobal, protoAndIfaceCache, aDefineOnGlobal);
464 : }
465 :
466 : /*
467 : * The object might _still_ be null, but that's OK.
468 : *
469 : * Calling fromMarkedLocation() is safe because protoAndIfaceCache is
470 : * traced by TraceProtoAndIfaceCache() and its contents are never
471 : * changed after they have been set.
472 : *
473 : * Calling address() avoids the read read barrier that does gray
474 : * unmarking, but it's not possible for the object to be gray here.
475 : */
476 :
477 0 : const JS::Heap<JSObject*>& entrySlot = protoAndIfaceCache.EntrySlotMustExist(constructors::id::SVGComponentTransferFunctionElement);
478 0 : MOZ_ASSERT(JS::ObjectIsNotGray(entrySlot));
479 0 : return JS::Handle<JSObject*>::fromMarkedLocation(entrySlot.address());
480 : }
481 :
482 : JSObject*
483 0 : GetConstructorObject(JSContext* aCx)
484 : {
485 0 : return GetConstructorObjectHandle(aCx);
486 : }
487 :
488 : } // namespace SVGComponentTransferFunctionElementBinding
489 :
490 :
491 :
492 : } // namespace dom
493 : } // namespace mozilla
|