Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/api/callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ CallbackScope::CallbackScope(Isolate* isolate,
CallbackScope::CallbackScope(Environment* env,
Local<Object> object,
async_context asyncContext)
: private_(new InternalCallbackScope(env,
object,
asyncContext)),
try_catch_(env->isolate()) {
: resource_storage_(object),
private_(
new InternalCallbackScope(env, &resource_storage_, asyncContext)),
try_catch_(env->isolate()) {
try_catch_.SetVerbose(true);
}

Expand Down
2 changes: 2 additions & 0 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,8 @@ class NODE_EXTERN CallbackScope {
CallbackScope(CallbackScope&&) = delete;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we've had anyone try to misuse this, but I wonder if it wouldn't be worthwhile to delete the new operator to just generally discourage folks from trying to heap allocate this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, as @Flarna points out above, right now we're still doing this internally. Can do that in a follow-up though


private:
void* reserved_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a leftover or some preparation for a future change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the name I would assume this is a reservation for future change to not break the ABI.

v8::Local<v8::Object> resource_storage_;
InternalCallbackScope* private_;
v8::TryCatch try_catch_;
};
Expand Down
Loading