Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HandleScope docs #287

Closed
wants to merge 3 commits into from
Closed

Fix HandleScope docs #287

wants to merge 3 commits into from

Conversation

rivertam
Copy link
Contributor

@rivertam rivertam commented Jun 18, 2018

It turns out HandleScope::New doesn't actually exist, so I'm not sure exactly how that happened.

Side note: Maybe it should, because I'm getting the error "Entering the V8 API without proper locking in place" when I just construct HandleScope so I think I'm missing something important that could be hidden using a factory function, but I don't know because I don't know why I'm running into this issue. =)

It turns out `HandleScope::New` doesn't actually exist, so I'm not sure exactly how that should happen.

Side note: Maybe it should, because I'm getting the error "Entering the V8 API without proper locking in place" when I just construct `HandleScope` so I think I'm missing something important that could be hidden using a factory function, but I don't know because I don't know why I'm running into this issue. =)
Copy link
Member

@NickNaso NickNaso left a comment

Choose a reason for hiding this comment

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

Just some suggestions.
@gabrielschulhof @mhdawson @kfarnung Someone of you have some time to review this PR?

@@ -15,10 +15,10 @@ the section titled (Object lifetime management)[object_lifetime_management].
Creates a new handle scope.

```cpp
HandleScope HandleScope::New(Napi:Env env);
HandleScope::HandleScope(Napi:Env env);
Copy link
Member

Choose a reason for hiding this comment

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

HandleScope(Napi::Env env);

@@ -28,11 +28,11 @@ Returns a new HandleScope
Creates a new handle scope.

```cpp
HandleScope HandleScope::New(napi_env env, napi_handle_scope scope);
HandleScope::HandleScope(Napi::Env env, Napi::HandleScope scope);
Copy link
Member

Choose a reason for hiding this comment

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

HandleScope(Napi::Env env, Napi::HandleScope scope);

@@ -15,10 +15,10 @@ the section titled (Object lifetime management)[object_lifetime_management].
Creates a new handle scope.
Copy link
Member

Choose a reason for hiding this comment

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

I think we should say "Creates a new handle scope on the stack"

@@ -28,11 +28,11 @@ Returns a new HandleScope
Creates a new handle scope.
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as above

@mhdawson
Copy link
Member

@rivertam thanks for catching that. You are correct that New does not exist and HandleScopes should be declared on the stack as opposed to allocated.

For example:

Value createScope(const CallbackInfo& info) {
  {
    HandleScope scope(info.Env());
    String::New(info.Env(), "inner-scope");
  }
  return String::New(info.Env(), "scope");
}

@mhdawson
Copy link
Member

@rivertam made a few additional suggestions, if you can update PR to include those I'll go ahead and land.

@mhdawson
Copy link
Member

@rivertam do you have time to update this PR based on the comments?

@rivertam
Copy link
Contributor Author

No I'm sorry. I've been working like crazy. Might be able to get to it next week sometime, but it's probably faster and more effective if you just take it from here.

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

mhdawson pushed a commit that referenced this pull request Jun 29, 2018
It turns out `HandleScope::New` doesn't actually exist, fix
up doc.

PR-URL: #287
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Nicola Del Gobbo <[email protected]>
@mhdawson
Copy link
Member

Landed as 86be13a

@mhdawson mhdawson closed this Jun 29, 2018
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this pull request Aug 24, 2022
It turns out `HandleScope::New` doesn't actually exist, fix
up doc.

PR-URL: nodejs/node-addon-api#287
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Nicola Del Gobbo <[email protected]>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this pull request Aug 26, 2022
It turns out `HandleScope::New` doesn't actually exist, fix
up doc.

PR-URL: nodejs/node-addon-api#287
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Nicola Del Gobbo <[email protected]>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this pull request Sep 19, 2022
It turns out `HandleScope::New` doesn't actually exist, fix
up doc.

PR-URL: nodejs/node-addon-api#287
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Nicola Del Gobbo <[email protected]>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this pull request Aug 11, 2023
It turns out `HandleScope::New` doesn't actually exist, fix
up doc.

PR-URL: nodejs/node-addon-api#287
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Nicola Del Gobbo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants