Skip to content

Commit

Permalink
fix: use EnvironmentData::TryGetCurrent in report
Browse files Browse the repository at this point in the history
PR-URL: #167
  • Loading branch information
legendecas authored Apr 26, 2022
1 parent 74b7090 commit f2c1109
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/commands/report/uv_statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static void walkHandle(uv_handle_t* h, void* arg) {

void NodeReport::SetUvStatistics(JSONWriter* writer) {
writer->json_arraystart("libuvHandles");
EnvironmentData* env_data = EnvironmentData::GetCurrent(isolate_);
EnvironmentData* env_data = EnvironmentData::TryGetCurrent();
if (env_data != nullptr) {
uv_loop_t* loop = env_data->loop();
uv_walk(loop, walkHandle, (void*)writer);
Expand Down
2 changes: 1 addition & 1 deletion src/xpf_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace xprofiler {
*/

inline void AtExit(v8::Isolate* isolate, void (*cb)(void* arg), void* arg) {
#if NODE_MAJOR_VERSION >= 10
#if NODE_MODULE_VERSION >= NODE_10_0_MODULE_VERSION
// node::GetCurrentEnvironment is available since v10.x.
// We don't need to support multiple environments before v10.x.
node::Environment* env =
Expand Down
2 changes: 1 addition & 1 deletion src/xpf_v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HandleScope {
};

inline v8::Isolate* TryGetCurrentIsolate() {
#if NODE_MODULE_VERSION > NODE_16_0_MODULE_VERSION
#if NODE_MODULE_VERSION >= NODE_16_0_MODULE_VERSION
return v8::Isolate::TryGetCurrent();
#else
return v8::Isolate::GetCurrent();
Expand Down

0 comments on commit f2c1109

Please sign in to comment.