-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
src: use Isolate::TryGetCurrent where appropriate #39954
Conversation
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.
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. |
This reverts commit 1fc4d43.
@danbev Sure, done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
This comment has been minimized.
This comment has been minimized.
@@ -91,7 +91,7 @@ inline T MultiplyWithOverflowCheck(T a, T b); | |||
|
|||
namespace per_process { | |||
// 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(). | |||
extern bool v8_initialized; |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
Landed in 9f6fed7...9f7412a |
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 <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit 1fc4d43. PR-URL: #39954 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
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 <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This reverts commit 1fc4d43. PR-URL: #39954 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
In two places, we call
Isolate::GetCurrent()
even though that istechnically invalid usage of the function.
Now that V8 exposes
Isolate::TryGetCurrent()
, we can do thisin a proper way.