Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 842f936

Browse filesBrowse files
addaleaxBethGriggs
authored andcommitted
src: use Isolate::TryGetCurrent where appropriate
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>
1 parent 98f56d1 commit 842f936
Copy full SHA for 842f936

File tree

Expand file treeCollapse file tree

4 files changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ unsigned int reverted_cve = 0;
147147

148148
// util.h
149149
// Tells whether the per-process V8::Initialize() is called and
150-
// if it is safe to call v8::Isolate::GetCurrent().
150+
// if it is safe to call v8::Isolate::TryGetCurrent().
151151
bool v8_initialized = false;
152152

153153
// node_internals.h
Collapse file

‎src/node_errors.cc‎

Copy file name to clipboardExpand all lines: src/node_errors.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ void OnFatalError(const char* location, const char* message) {
430430
FPrintF(stderr, "FATAL ERROR: %s\n", message);
431431
}
432432

433-
Isolate* isolate = Isolate::GetCurrent();
433+
Isolate* isolate = Isolate::TryGetCurrent();
434434
Environment* env = nullptr;
435435
if (isolate != nullptr) {
436436
env = Environment::GetCurrent(isolate);
Collapse file

‎src/util.cc‎

Copy file name to clipboardExpand all lines: src/util.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ BufferValue::BufferValue(Isolate* isolate, Local<Value> value) {
128128

129129
void LowMemoryNotification() {
130130
if (per_process::v8_initialized) {
131-
auto isolate = Isolate::GetCurrent();
131+
auto isolate = Isolate::TryGetCurrent();
132132
if (isolate != nullptr) {
133133
isolate->LowMemoryNotification();
134134
}
Collapse file

‎src/util.h‎

Copy file name to clipboardExpand all lines: src/util.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ inline T MultiplyWithOverflowCheck(T a, T b);
9191

9292
namespace per_process {
9393
// Tells whether the per-process V8::Initialize() is called and
94-
// if it is safe to call v8::Isolate::GetCurrent().
94+
// if it is safe to call v8::Isolate::TryGetCurrent().
9595
extern bool v8_initialized;
9696
} // namespace per_process
9797

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.