mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 13:22:07 +00:00
38 lines
989 B
C++
38 lines
989 B
C++
#include "root.h"
|
|
#include <JavaScriptCore/StrongInlines.h>
|
|
#include "BunClientData.h"
|
|
#include "wtf/DebugHeap.h"
|
|
#include "Strong.h"
|
|
namespace Bun {
|
|
|
|
#if ENABLE(MALLOC_BREAKDOWN)
|
|
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StrongRef);
|
|
#endif
|
|
|
|
}
|
|
|
|
extern "C" void Bun__StrongRef__delete(Bun::StrongRef* strongRef)
|
|
{
|
|
delete strongRef;
|
|
}
|
|
|
|
extern "C" Bun::StrongRef* Bun__StrongRef__new(JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue encodedValue)
|
|
{
|
|
return new Bun::StrongRef(globalObject->vm(), JSC::JSValue::decode(encodedValue));
|
|
}
|
|
|
|
extern "C" JSC::EncodedJSValue Bun__StrongRef__get(Bun::StrongRef* strongRef)
|
|
{
|
|
return JSC::JSValue::encode(strongRef->m_cell.get());
|
|
}
|
|
|
|
extern "C" void Bun__StrongRef__set(Bun::StrongRef* strongRef, JSC::JSGlobalObject* globalObject, JSC::EncodedJSValue value)
|
|
{
|
|
strongRef->m_cell.set(globalObject->vm(), JSC::JSValue::decode(value));
|
|
}
|
|
|
|
extern "C" void Bun__StrongRef__clear(Bun::StrongRef* strongRef)
|
|
{
|
|
strongRef->m_cell.clear();
|
|
}
|