diff options
author | 2023-09-15 11:22:06 -0400 | |
---|---|---|
committer | 2023-09-15 08:22:06 -0700 | |
commit | 29b22175bf6fc726d0b028c7bf5619ab89fca09a (patch) | |
tree | f0664d677e6cd2d130c76db9fb135402ae2c1110 /src/bun.js/bindings/Process.h | |
parent | 75697890ce1040d2c2f9bc50499faf54b3205915 (diff) | |
download | bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.tar.gz bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.tar.zst bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.zip |
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 <jarred@jarredsumner.com>
Diffstat (limited to 'src/bun.js/bindings/Process.h')
-rw-r--r-- | src/bun.js/bindings/Process.h | 17 |
1 files changed, 12 insertions, 5 deletions
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<Process, Structure> m_cpuUsageStructure; + LazyProperty<Process, Structure> m_memoryUsageStructure; + LazyProperty<Process, JSObject> m_bindingUV; + LazyProperty<Process, JSObject> m_bindingNatives; + public: Process(JSC::Structure* structure, WebCore::JSDOMGlobalObject& globalObject, Ref<WebCore::EventEmitter>&& impl) : Base(structure, globalObject, WTFMove(impl)) @@ -50,9 +55,6 @@ public: return accessor; } - LazyProperty<JSObject, Structure> cpuUsageStructure; - LazyProperty<JSObject, Structure> memoryUsageStructure; - DECLARE_VISIT_CHILDREN; template<typename, SubspaceAccess mode> @@ -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 |