Skip to content

Commit

Permalink
fixup! src: use cppgc to manage ContextifyContext
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Jan 13, 2025
1 parent a4ef690 commit d08c61f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ ContextifyContext* ContextifyContext::New(Environment* env,
if (!(CreateV8Context(env->isolate(), object_template, snapshot_data, queue)
.ToLocal(&v8_context))) {
// Allocation failure, maximum call stack size reached, termination, etc.
return nullptr;
return {};
}
return New(v8_context, env, sandbox_obj, options);
}
Expand Down Expand Up @@ -254,7 +254,7 @@ ContextifyContext* ContextifyContext::New(Local<Context> v8_context,
// things down significantly and they are only needed in rare occasions
// in the vm contexts.
if (InitializeContextRuntime(v8_context).IsNothing()) {
return nullptr;
return {};
}

Local<Context> main_context = env->context();
Expand Down Expand Up @@ -306,7 +306,7 @@ ContextifyContext* ContextifyContext::New(Local<Context> v8_context,
ctor_name,
static_cast<v8::PropertyAttribute>(v8::DontEnum))
.IsNothing()) {
return nullptr;
return {};
}
}

Expand All @@ -319,15 +319,15 @@ ContextifyContext* ContextifyContext::New(Local<Context> v8_context,
env->host_defined_option_symbol(),
options->host_defined_options_id)
.IsNothing()) {
return nullptr;
return {};
}

env->AssignToContext(v8_context, nullptr, info);

if (!env->contextify_wrapper_template()
->NewInstance(v8_context)
.ToLocal(&wrapper)) {
return nullptr;
return {};
}

result = cppgc::MakeGarbageCollected<ContextifyContext>(
Expand All @@ -345,7 +345,7 @@ ContextifyContext* ContextifyContext::New(Local<Context> v8_context,
->SetPrivate(
v8_context, env->contextify_context_private_symbol(), wrapper)
.IsNothing()) {
return nullptr;
return {};
}

// Assign host_defined_options_id to the sandbox object or the global object
Expand All @@ -357,7 +357,7 @@ ContextifyContext* ContextifyContext::New(Local<Context> v8_context,
env->host_defined_option_symbol(),
options->host_defined_options_id)
.IsNothing()) {
return nullptr;
return {};
}
return result;
}
Expand Down
1 change: 0 additions & 1 deletion src/node_contextify.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

#include "base_object-inl.h"
#include "cppgc/prefinalizer.h"
#include "cppgc_helpers.h"
#include "node_context_data.h"
#include "node_errors.h"
Expand Down

0 comments on commit d08c61f

Please sign in to comment.