diff options
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/bindings/ScriptExecutionContext.h | 14 | ||||
-rw-r--r-- | src/bun.js/bindings/napi.cpp | 9 |
2 files changed, 8 insertions, 15 deletions
diff --git a/src/bun.js/bindings/ScriptExecutionContext.h b/src/bun.js/bindings/ScriptExecutionContext.h index 6f10dced7..5a43544df 100644 --- a/src/bun.js/bindings/ScriptExecutionContext.h +++ b/src/bun.js/bindings/ScriptExecutionContext.h @@ -173,22 +173,24 @@ public: { auto* task = new EventLoopTask(WTFMove(lambda)); reinterpret_cast<Zig::GlobalObject*>(m_globalObject)->queueTaskConcurrently(task); - } // Executes the task on context's thread asynchronously. - + } + // Executes the task on context's thread asynchronously. void postTask(Function<void(ScriptExecutionContext&)>&& lambda) { auto* task = new EventLoopTask(WTFMove(lambda)); reinterpret_cast<Zig::GlobalObject*>(m_globalObject)->queueTask(task); - } // Executes the task on context's thread asynchronously. + } + // Executes the task on context's thread asynchronously. void postTask(EventLoopTask* task) { reinterpret_cast<Zig::GlobalObject*>(m_globalObject)->queueTask(task); - } // Executes the task on context's thread asynchronously. - + } + // Executes the task on context's thread asynchronously. void postTaskOnTimeout(EventLoopTask* task, Seconds timeout) { reinterpret_cast<Zig::GlobalObject*>(m_globalObject)->queueTaskOnTimeout(task, static_cast<int>(timeout.milliseconds())); - } // Executes the task on context's thread asynchronously. + } + // Executes the task on context's thread asynchronously. void postTaskOnTimeout(Function<void(ScriptExecutionContext&)>&& lambda, Seconds timeout) { auto* task = new EventLoopTask(WTFMove(lambda)); diff --git a/src/bun.js/bindings/napi.cpp b/src/bun.js/bindings/napi.cpp index 2562242a8..72ca50dcb 100644 --- a/src/bun.js/bindings/napi.cpp +++ b/src/bun.js/bindings/napi.cpp @@ -1766,15 +1766,6 @@ extern "C" napi_status napi_create_external(napi_env env, void* data, auto* structure = Bun::NapiExternal::createStructure(vm, globalObject, globalObject->objectPrototype()); JSValue value = JSValue(Bun::NapiExternal::create(vm, structure, data, finalize_hint, finalize_cb)); - // With `fsevents`, their napi_create_external seems to get immediatly garbage - // collected for some unknown reason. - // See https://github.com/oven-sh/bun/issues/3978 and `fsevents.test.ts` - JSC::Strong<Unknown>* strong = new JSC::Strong<Unknown>(vm, value); - globalObject->scriptExecutionContext()->postTask([strong](auto& context) -> void { - strong->clear(); - delete strong; - }); - *result = toNapi(value); return napi_ok; } |