aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ScriptExecutionContext.h
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-08-01 18:40:02 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-01 18:40:02 -0700
commit6c40d6f2f51474c6a38d509417db903385f48f2b (patch)
treed441b10de162e443d572b47ca9c278e3cd345f26 /src/bun.js/bindings/ScriptExecutionContext.h
parent0ced5520e6ae8061b2acaab2cbc26431e10182a6 (diff)
downloadbun-6c40d6f2f51474c6a38d509417db903385f48f2b.tar.gz
bun-6c40d6f2f51474c6a38d509417db903385f48f2b.tar.zst
bun-6c40d6f2f51474c6a38d509417db903385f48f2b.zip
add `BroadcastChannel` (#3922)
* copy and format * update `SerializedScriptValue.cpp` * use `expect().fail()` in message channel tests * rename `BroadcastChannelIdentifier.h` * copy registries * progress and tests * cleanup * worker and broadcast channel test * `BroadcastChannel` ref and unref * `MessagePort` ref, unref, and hasRef * remove `SecurityContext.cpp/h` * add types
Diffstat (limited to 'src/bun.js/bindings/ScriptExecutionContext.h')
-rw-r--r--src/bun.js/bindings/ScriptExecutionContext.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ScriptExecutionContext.h b/src/bun.js/bindings/ScriptExecutionContext.h
index 271c7e205..b32435240 100644
--- a/src/bun.js/bindings/ScriptExecutionContext.h
+++ b/src/bun.js/bindings/ScriptExecutionContext.h
@@ -3,6 +3,7 @@
#include "root.h"
#include "ActiveDOMObject.h"
#include "ContextDestructionObserver.h"
+#include "BunBroadcastChannelRegistry.h"
#include <wtf/CrossThreadTask.h>
#include <wtf/Function.h>
#include <wtf/HashSet.h>
@@ -81,6 +82,7 @@ public:
: m_vm(vm)
, m_globalObject(globalObject)
, m_identifier(0)
+ , m_broadcastChannelRegistry(BunBroadcastChannelRegistry::create())
{
regenerateIdentifier();
}
@@ -89,6 +91,7 @@ public:
: m_vm(vm)
, m_globalObject(globalObject)
, m_identifier(identifier)
+ , m_broadcastChannelRegistry(BunBroadcastChannelRegistry::create())
{
addToContextsMap();
}
@@ -210,6 +213,8 @@ public:
m_vm = &globalObject->vm();
}
+ BunBroadcastChannelRegistry& broadcastChannelRegistry() { return m_broadcastChannelRegistry; }
+
private:
JSC::VM* m_vm = nullptr;
JSC::JSGlobalObject* m_globalObject = nullptr;
@@ -219,6 +224,7 @@ private:
HashSet<MessagePort*> m_messagePorts;
HashSet<ContextDestructionObserver*> m_destructionObservers;
Vector<CompletionHandler<void()>> m_processMessageWithMessagePortsSoonHandlers;
+ Ref<BunBroadcastChannelRegistry> m_broadcastChannelRegistry;
bool m_willProcessMessageWithMessagePortsSoon { false };