From 88d9bac5ec4f6a075724bd4601079b404da9f991 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 24 May 2023 19:37:57 -0700 Subject: Support `with { type: "macro"}` in `bun build` (#3059) * [bun macro] Support `assert { type: "macro" }` and `with {type: "macro"}` * [bun macro] Pass through input as arguments instead of a JSNode * Fix hang when loading many entry points simultaneously with macros * do not clone --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/bun.js/bindings/ScriptExecutionContext.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/bun.js/bindings/ScriptExecutionContext.cpp') diff --git a/src/bun.js/bindings/ScriptExecutionContext.cpp b/src/bun.js/bindings/ScriptExecutionContext.cpp index 08e8e11ef..e8cae5e33 100644 --- a/src/bun.js/bindings/ScriptExecutionContext.cpp +++ b/src/bun.js/bindings/ScriptExecutionContext.cpp @@ -10,7 +10,7 @@ extern "C" void Bun__startLoop(us_loop_t* loop); namespace WebCore { -static unsigned lastUniqueIdentifier = 0; +static std::atomic lastUniqueIdentifier = 0; static Lock allScriptExecutionContextsMapLock; static HashMap& allScriptExecutionContextsMap() WTF_REQUIRES_LOCK(allScriptExecutionContextsMapLock) @@ -41,7 +41,7 @@ us_socket_context_t* ScriptExecutionContext::webSocketContextSSL() us_bun_socket_context_options_t opts; memset(&opts, 0, sizeof(us_bun_socket_context_options_t)); // adds root ca - opts.request_cert = true; + opts.request_cert = true; // but do not reject unauthorized opts.reject_unauthorized = false; this->m_ssl_client_websockets_ctx = us_create_bun_socket_context(1, loop, sizeof(size_t), opts); @@ -108,12 +108,12 @@ void ScriptExecutionContext::regenerateIdentifier() { Locker locker { allScriptExecutionContextsMapLock }; - ASSERT(allScriptExecutionContextsMap().contains(m_identifier)); - allScriptExecutionContextsMap().remove(m_identifier); + // ASSERT(allScriptExecutionContextsMap().contains(m_identifier)); + // allScriptExecutionContextsMap().remove(m_identifier); m_identifier = ++lastUniqueIdentifier; - ASSERT(!allScriptExecutionContextsMap().contains(m_identifier)); + // ASSERT(!allScriptExecutionContextsMap().contains(m_identifier)); allScriptExecutionContextsMap().add(m_identifier, this); } @@ -121,14 +121,14 @@ void ScriptExecutionContext::addToContextsMap() { Locker locker { allScriptExecutionContextsMapLock }; ASSERT(!allScriptExecutionContextsMap().contains(m_identifier)); - allScriptExecutionContextsMap().add(m_identifier, this); + // allScriptExecutionContextsMap().add(m_identifier, this); } void ScriptExecutionContext::removeFromContextsMap() { Locker locker { allScriptExecutionContextsMapLock }; ASSERT(allScriptExecutionContextsMap().contains(m_identifier)); - allScriptExecutionContextsMap().remove(m_identifier); + // allScriptExecutionContextsMap().remove(m_identifier); } } -- cgit v1.2.3