src: add env->cppgc_allocation_handle() convenience method · nodejs/node@ca0f5a0 · GitHub
Skip to content

Commit ca0f5a0

Browse files
jasnelltargos
authored andcommitted
src: add env->cppgc_allocation_handle() convenience method
Reduce some of the boilerplate code needed to access the cppgc::AllocationHandle from the Node.js Environment. PR-URL: #58483 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 80cc17f commit ca0f5a0

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/README.md

Lines changed: 1 addition & 1 deletion

src/env-inl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ inline v8::Isolate* Environment::isolate() const {
205205
return isolate_;
206206
}
207207

208+
inline cppgc::AllocationHandle& Environment::cppgc_allocation_handle() const {
209+
return isolate_->GetCppHeap()->GetAllocationHandle();
210+
}
211+
208212
inline v8::ExternalMemoryAccounter* Environment::external_memory_accounter()
209213
const {
210214
return external_memory_accounter_;

src/env.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ class Environment final : public MemoryRetainer {
692692
void StartProfilerIdleNotifier();
693693

694694
inline v8::Isolate* isolate() const;
695+
inline cppgc::AllocationHandle& cppgc_allocation_handle() const;
695696
inline v8::ExternalMemoryAccounter* external_memory_accounter() const;
696697
inline uv_loop_t* event_loop() const;
697698
void TryLoadAddon(const char* filename,

src/node_contextify.cc

Lines changed: 2 additions & 6 deletions

0 commit comments

Comments
 (0)