MCPcopy Create free account
hub / github.com/GNOME/gjs / associate_js_instance

Method associate_js_instance

gi/fundamental.cpp:61–75  ·  view source on GitHub ↗

* FundamentalInstance::associate_js_instance: * * Associates @gfundamental with @object so that @object can be retrieved in the * future if you have a pointer to @gfundamental. (Assuming @object has not been * garbage collected in the meantime.) */

Source from the content-addressed store, hash-verified

59 * garbage collected in the meantime.)
60 */
61bool FundamentalInstance::associate_js_instance(JSContext* cx, JSObject* object,
62 void* gfundamental) {
63 m_ptr = gfundamental;
64
65 GjsContextPrivate* gjs = GjsContextPrivate::from_cx(cx);
66 if (!gjs->fundamental_table().putNew(gfundamental, object)) {
67 JS_ReportOutOfMemory(cx);
68 return false;
69 }
70
71 debug_lifecycle(object, "associated JSObject with fundamental");
72
73 ref();
74 return true;
75}
76
77// Find the first constructor
78[[nodiscard]]

Callers 1

object_for_c_ptrMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected