-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
src: remove pushValueToArray and setupProcessObject #24264
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
Changes from 1 commit
a9f8f33
3e3e9b7
fa1c240
a96a222
d79ed5d
70fa3c1
a54d0c6
db5e5fa
0b3568c
a44e978
fcaf05a
07b5417
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Instead of calling into JS from C++ to push values into an array, use the new Array::New API that takes a pointer and a length directly.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1424,25 +1424,17 @@ void Http2Session::HandleOriginFrame(const nghttp2_frame* frame) { | |
| nghttp2_extension ext = frame->ext; | ||
| nghttp2_ext_origin* origin = static_cast<nghttp2_ext_origin*>(ext.payload); | ||
|
|
||
| Local<Value> holder = Array::New(isolate); | ||
| Local<Function> fn = env()->push_values_to_array_function(); | ||
| Local<Value> argv[NODE_PUSH_VAL_TO_ARRAY_MAX]; | ||
| size_t nov = origin->nov; | ||
| std::vector<Local<Value>> origin_v(nov); | ||
|
|
||
| size_t n = 0; | ||
| while (n < origin->nov) { | ||
| size_t j = 0; | ||
| while (n < origin->nov && j < arraysize(argv)) { | ||
| auto entry = origin->ov[n++]; | ||
| argv[j++] = | ||
| String::NewFromOneByte(isolate, | ||
| entry.origin, | ||
| v8::NewStringType::kNormal, | ||
| entry.origin_len).ToLocalChecked(); | ||
| } | ||
| if (j > 0) | ||
| fn->Call(context, holder, j, argv).ToLocalChecked(); | ||
| for (size_t i = 0; i < nov; ++i) { | ||
| auto entry = origin->ov[i]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is copy-pasted, but I think getting rid of this |
||
| origin_v[i] = | ||
| String::NewFromOneByte( | ||
| isolate, entry.origin, v8::NewStringType::kNormal, entry.origin_len) | ||
| .ToLocalChecked(); | ||
| } | ||
|
|
||
| Local<Value> holder = Array::New(isolate, origin_v.data(), nov); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| MakeCallback(env()->onorigin_string(), 1, &holder); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.