-
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
Change node_buffer to accept ArrayBuffer #16111
Conversation
Hey! Can anyone help me make this commit message better? @addaleax requested I pull this out from my other pull request here (#16042). @TimothyGu helped me with this part, and I'm afraid my understanding of the C++ side of things is somewhat limited, so happy to make any changes requested. |
@JemBijoux This is fine, but just so you know, what I had in mind is a different commit rather than a completely separate PR – if this is easier for you, cool. :) I think something like |
@TimothyGu Actually, sorry to be a bit of a killjoy, but it would be nice if we could also make |
@JemBijoux Thanks for refactoring! It's in my opinion that the changes in @addaleax Does ^^ answer your question? |
@addaleax Hah! I'm so embarrassed. (I'm used to the squash and merge flow usually.) Well not that embarrassed, but I did totally mistake your request. I can close and roll this back into the other (but as an additional commit on that branch). Maybe it's confusing if I keep making too many changes though, so confirm with me if I should or not... @TimothyGu :: Updated commit message and included that header file here now. I should probably remove it from the other pr now, but just wanna be sure I shouldn't just roll this all back into that. If i should, I'll use that commit message for it. 👍 Hah, can you tell I'm new to all this... |
@JemBijoux Doing it in a separate PR works just the same for me :) |
Although, tbh, I am having more doubts that this is really a good change … it seems like the kind of thing that might lock us into supporting weird APIs? There are things that you can’t do with |
Fair. I leave it to someone smarter than me to debate (since I'm not really aware of the implications). Just let me know. |
@JemBijoux Yeah, one of the problems I’m having as well is that it’s hard to actually see all the implications here – there’s no harm in thinking out loud about it yourself… |
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.
Seems reasonable. It'd be good to see some tests to verify ArrayBuffers really work properly here though, if at all possible.
} | ||
|
||
|
||
char* Data(Local<Value> val) { | ||
if (val->IsArrayBuffer()) { | ||
Local<ArrayBuffer> ab = val.As<v8::ArrayBuffer>(); |
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.
You shouldn't need the v8::
prefixes.
As a compromise, would it be acceptable to you to make all other Buffer methods/macros work with ArrayBuffer except for |
@TimothyGu Yes, I think that would be better. It still seems like this would be breaking with the design goals of the |
@TimothyGu Coming back to this… a few thoughts:
I’m sorry, I really don’t want this PR to end up stalling. I still think turning off the check in |
@addaleax 👍 to your argument, but free time has been a rarity these couple of days, so would appreciate it if you and @JemBijoux could get this PR into a landable shape. |
Ping @JemBijoux |
Hi! I apologize for this being long running. I sorta bit off more than I could chew. I think I mentioned earlier, but I don't really know what I'm doing in C++. (The PR was started during a code and learn, and when I got into it initially I thought I'd submit a js change; @TimothyGu really held my hand getting into most of this.) I'm very happy to work with someone to refactor/update this, but would it make more sense to just close this? Or if this is still a reasonable start, does anyone want to take over, or at the very least, take some time on a call to explain or pair code through it with me? Unfortunately, as it stands, I can only vaguely make sense of what is being requested for changes. Tackling this by myself could be a little messy. Inspired to help out and participate, but also a little out of my depth on this. 🙃 |
I'm going to close this in favor of @addaleax's suggestion in #16042 (comment). Even though implementing that suggestion would mean roundtripping between ArrayBuffer->Uint8Array->ArrayBuffer (in C++) I don't think performance will be our main concern at this moment. Thanks @JemBijoux for opening this. We can continue this over at #16042. |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src