void jsd_DestroyObjectManager(JSDContext* jsdc) { jsd_DestroyObjects(jsdc); JSD_LOCK_OBJECTS(jsdc); JS_HashTableDestroy(jsdc->objectsTable); JSD_UNLOCK_OBJECTS(jsdc); }
void jsd_DestroyScriptManager(JSDContext* jsdc) { JSD_LOCK_SCRIPTS(jsdc); if (jsdc->scriptsTable) JS_HashTableDestroy(jsdc->scriptsTable); JSD_UNLOCK_SCRIPTS(jsdc); }
void jsd_DestroyObjectManager(JSDContext* jsdc) { JSD_LOCK_OBJECTS(jsdc); while( !JS_CLIST_IS_EMPTY(&jsdc->objectsList) ) _destroyJSDObject(jsdc, (JSDObject*)JS_NEXT_LINK(&jsdc->objectsList)); JS_HashTableDestroy(jsdc->objectsTable); JSD_UNLOCK_OBJECTS(jsdc); }
/* NB: cx unused; js_FinishAtomState calls us with null cx. */ void js_FreeAtomState(JSContext *cx, JSAtomState *state) { JS_HashTableDestroy(state->table); #ifdef JS_THREADSAFE js_FinishLock(&state->lock); #endif memset(state, 0, sizeof *state); }
void jsd_DestroyAtomTable(JSDContext* jsdc) { if( jsdc->atoms ) { JS_HashTableEnumerateEntries(jsdc->atoms, _atom_smasher, nullptr); JS_HashTableDestroy(jsdc->atoms); jsdc->atoms = nullptr; } }
JSAutoAtomList::~JSAutoAtomList() { if (table) { JS_HashTableDestroy(table); } else { JSHashEntry *hep = list; while (hep) { JSHashEntry *next = hep->next; js_free_temp_entry(compiler, hep, HT_FREE_ENTRY); hep = next; } } }
static VALUE initialize_native(VALUE self, VALUE UNUSED(options)) { JohnsonRuntime* runtime; Data_Get_Struct(self, JohnsonRuntime, runtime); if ((runtime->js = JS_NewRuntime(0x100000)) && (runtime->jsids = create_id_hash()) && (runtime->rbids = create_id_hash()) ) { JS_SetRuntimePrivate(runtime->js, (void *)self); JS_SetGCCallbackRT(runtime->js, gc_callback); JSContext* context = johnson_get_current_context(runtime); if( (runtime->global = JS_GetGlobalObject(context)) && (JS_AddNamedRoot(context, &(runtime->global), "runtime->global")) ) { return self; } } if (runtime->rbids) JS_HashTableDestroy(runtime->rbids); if (runtime->jsids) JS_HashTableDestroy(runtime->jsids); if (runtime->js) JS_DestroyRuntime(runtime->js); rb_raise(rb_eRuntimeError, "Couldn't initialize the runtime!"); return Qnil; }
JSBool jsj_init_js_obj_reflections_table() { #ifdef PRESERVE_JSOBJECT_IDENTITY if(js_obj_reflections != NULL) { return JS_TRUE; } js_obj_reflections = JS_NewHashTable(128, NULL, JS_CompareValues, JS_CompareValues, NULL, NULL); if (!js_obj_reflections) return JS_FALSE; #ifdef JSJ_THREADSAFE js_obj_reflections_monitor = PR_NewMonitor(); if (!js_obj_reflections_monitor) { JS_HashTableDestroy(js_obj_reflections); return JS_FALSE; } #endif /* JSJ_THREADSAFE */ #endif /* PRESERVE_JSOBJECT_IDENTITY */ return JS_TRUE; }