GeezerVison is showing github.com — src: skip the Environment lookup when it is already known · nodejs/node@ef5fd79
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/api/async_resource.cc +9-7Lines changed: 9 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,14 +41,16 @@ MaybeLocal<Value> AsyncResource::MakeCallback(Local<Function> callback, |
41 | 41 | int argc, |
42 | 42 | Local<Value>* argv) { |
43 | 43 | auto isolate = env_->isolate(); |
| 44 | + // The resource already knows its Environment, so it is not looked up again |
| 45 | + // from the creation context of the callback, which must belong to it. |
44 | 46 | // As in Node-API: node::MakeCallback() would run it with no frame. |
45 | | - return InternalMakeCallback(isolate, |
46 | | - get_resource(), |
47 | | - callback, |
48 | | - argc, |
49 | | - argv, |
50 | | - async_context_, |
51 | | - context_frame_.Get(isolate)); |
| 47 | + return MakeCallbackInEnvironment(env_, |
| 48 | + get_resource(), |
| 49 | + callback, |
| 50 | + argc, |
| 51 | + argv, |
| 52 | + async_context_, |
| 53 | + context_frame_.Get(isolate)); |
52 | 54 | } |
53 | 55 |
|
54 | 56 | MaybeLocal<Value> AsyncResource::MakeCallback(const char* method, |
|
Collapse file
Copy file name to clipboardExpand all lines: src/env.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1911,7 +1911,7 @@ void Environment::CheckImmediate(uv_check_t* handle) { |
1911 | 1911 | return; |
1912 | 1912 |
|
1913 | 1913 | do { |
1914 | | - MakeCallback(env->isolate(), |
| 1914 | + MakeCallback(env, |
1915 | 1915 | env->process_object(), |
1916 | 1916 | env->immediate_callback_function(), |
1917 | 1917 | 0, |
|