Skip to content

src: use Isolate::TryGetCurrent where appropriate - #39954

Closed
addaleax wants to merge 2 commits into
nodejs:masterfrom
addaleax:trygetcurrent
Closed

src: use Isolate::TryGetCurrent where appropriate#39954
addaleax wants to merge 2 commits into
nodejs:masterfrom
addaleax:trygetcurrent

Conversation

@addaleax

Copy link
Copy Markdown
Member

In two places, we call Isolate::GetCurrent() even though that is
technically invalid usage of the function.
Now that V8 exposes Isolate::TryGetCurrent(), we can do this
in a proper way.

In two places, we call `Isolate::GetCurrent()` even though that is
technically invalid usage of the function.
Now that V8 exposes `Isolate::TryGetCurrent()`, we can do this
in a proper way.
@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Aug 31, 2021
@danbev

Copy link
Copy Markdown
Contributor

We should be able to revert 1fc4d43 after this commit. I can open a pull request after this one has landed, or if you like you can include the revert in this pr.

@addaleax

Copy link
Copy Markdown
MemberAuthor

@danbev Sure, done!

@tniessentniessen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still LGTM

@targostargos added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2021
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2021
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@RaisinTenRaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 5, 2021
Comment threadsrc/util.h
// Tells whether the per-process V8::Initialize() is called and
// if it is safe to call v8::Isolate::GetCurrent().
// if it is safe to call v8::Isolate::TryGetCurrent().
externbool v8_initialized;

@legendecaslegendecasSep 5, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we still need this as it claiming that it tells "if it is safe to call v8::Isolate::GetCurrent"?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Yeah … I don’t know why, but v8::Isolate::TryGetCurrent() is not something you can call without V8 being initialized first.

@targostargos added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 8, 2021
@github-actionsgithub-actionsBot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 8, 2021
@github-actions

Copy link
Copy Markdown
Contributor

Landed in 9f6fed7...9f7412a

nodejs-github-bot pushed a commit that referenced this pull request Sep 8, 2021
In two places, we call `Isolate::GetCurrent()` even though that is
technically invalid usage of the function.
Now that V8 exposes `Isolate::TryGetCurrent()`, we can do this
in a proper way.
PR-URL: #39954
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Sep 8, 2021
This reverts commit 1fc4d43.
PR-URL: #39954
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
BethGriggs pushed a commit that referenced this pull request Sep 21, 2021
In two places, we call `Isolate::GetCurrent()` even though that is
technically invalid usage of the function.
Now that V8 exposes `Isolate::TryGetCurrent()`, we can do this
in a proper way.
PR-URL: #39954
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
BethGriggs pushed a commit that referenced this pull request Sep 21, 2021
This reverts commit 1fc4d43.
PR-URL: #39954
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@BethGriggsBethGriggs mentioned this pull request Sep 21, 2021
1 task
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@addaleax@danbev@nodejs-github-bot@jasnell@targos@cjihrig@tniessen@legendecas@RaisinTen