From 29b22175bf6fc726d0b028c7bf5619ab89fca09a Mon Sep 17 00:00:00 2001 From: dave caruso Date: Fri, 15 Sep 2023 11:22:06 -0400 Subject: feat(runtime): add `process.binding` `uv`/`natives`/`config` + make global object properties lazy (#5355) * binding uv * we did that * some more bindings * fix doc * fix uv * yo * static hash table nonsense <3 * huge refactor to the global object i am not ready for merge conflicts * it works part 3 * lose --------- Co-authored-by: Jarred Sumner --- src/bun.js/bindings/Process.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/bun.js/bindings/Process.h') diff --git a/src/bun.js/bindings/Process.h b/src/bun.js/bindings/Process.h index ab344c7fe..1615aabdd 100644 --- a/src/bun.js/bindings/Process.h +++ b/src/bun.js/bindings/Process.h @@ -6,7 +6,7 @@ #include "BunClientData.h" #include "JSEventEmitter.h" -namespace Zig { +namespace Bun { // TODO: find a better place for this int getRSS(size_t* rss); @@ -16,6 +16,11 @@ using namespace JSC; class Process : public WebCore::JSEventEmitter { using Base = WebCore::JSEventEmitter; + LazyProperty m_cpuUsageStructure; + LazyProperty m_memoryUsageStructure; + LazyProperty m_bindingUV; + LazyProperty m_bindingNatives; + public: Process(JSC::Structure* structure, WebCore::JSDOMGlobalObject& globalObject, Ref&& impl) : Base(structure, globalObject, WTFMove(impl)) @@ -50,9 +55,6 @@ public: return accessor; } - LazyProperty cpuUsageStructure; - LazyProperty memoryUsageStructure; - DECLARE_VISIT_CHILDREN; template @@ -69,6 +71,11 @@ public: } void finishCreation(JSC::VM& vm); + + inline Structure* cpuUsageStructure() { return m_cpuUsageStructure.getInitializedOnMainThread(this); } + inline Structure* memoryUsageStructure() { return m_memoryUsageStructure.getInitializedOnMainThread(this); } + inline JSObject* bindingUV() { return m_bindingUV.getInitializedOnMainThread(this); } + inline JSObject* bindingNatives() { return m_bindingNatives.getInitializedOnMainThread(this); } }; -} // namespace Zig \ No newline at end of file +} // namespace Bun \ No newline at end of file -- cgit v1.2.3