Perfect your code
With built-in code review tools, GitHub makes it easy to raise the quality bar before you ship. Join the 36 million developers who've merged over 200 million pull requests.
Sign up for free See pricing for teams and enterprisesbuffer: make Buffer binding and prototype setup more straight-forward #25292
+120
−95
Conversation
joyeecheung
added some commits
Dec 31, 2018
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
added
C++
lib / src
labels
Dec 31, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Ping @nodejs/process @nodejs/buffer can I have some review please? |
joyeecheung
reviewed
Jan 2, 2019
| class FastBuffer extends Uint8Array {} | ||
|
|
||
| function addBufferPrototypeMethods(proto) { | ||
| proto.readUIntLE = readUIntLE; |
This comment has been minimized.
This comment has been minimized.
joyeecheung
Jan 2, 2019
Author
Member
Another way to do this is to put all these to the prototype of FastBuffer, I am not sure if there are any concerns about edge cases though
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Ping again..according to the GitHub reviewer recommendations: @BridgeAR @TimothyGu @addaleax |
joyeecheung
added
the
author ready
label
Jan 9, 2019
This comment has been minimized.
This comment has been minimized.
jasnell
approved these changes
Jan 9, 2019
BridgeAR
approved these changes
Jan 10, 2019
joyeecheung
added a commit
that referenced
this pull request
Jan 10, 2019
joyeecheung
added a commit
that referenced
this pull request
Jan 10, 2019
This comment has been minimized.
This comment has been minimized.
|
Landed in fa5af0d...842a35f |
joyeecheung
closed this
Jan 10, 2019
This comment has been minimized.
This comment has been minimized.
|
@joyeecheung Can you look into backporting this to v11.x-staging? |
addaleax
added
the
backport-requested-v11.x
label
Jan 15, 2019
This comment has been minimized.
This comment has been minimized.
|
I pushed a backport directly onto v11.x-staging. There was just a minor conflict in |
BridgeAR
added a commit
that referenced
this pull request
Jan 16, 2019
BridgeAR
added a commit
that referenced
this pull request
Jan 16, 2019
BridgeAR
added
backported-to-v11.x
and removed
backport-requested-v11.x
labels
Jan 16, 2019
BridgeAR
added a commit
that referenced
this pull request
Jan 16, 2019
BridgeAR
added a commit
that referenced
this pull request
Jan 16, 2019
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Jan 16, 2019
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Jan 16, 2019
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Jan 17, 2019
BridgeAR
added a commit
to BridgeAR/node
that referenced
this pull request
Jan 17, 2019
targos
added this to Backported
in v11.x
Jan 30, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
joyeecheung commentedDec 31, 2018
buffer: move initialization of buffer prototype into node.js
Instead of exposing
setBufferJSinlib/internal/buffer.jsafter deletingit from the binding and then do the initialization in
lib/buffer.js, which results in an implicit dependency onthe order in which these modules are loaded.
buffer: move Buffer prototype wiring into internal/buffer.js
Instead of exposing the Buffer prototype methods through an
object in
internal/buffer.jsand then iterating over itto put the methods on the prototype, create a function
in
internal/buffer.jsto do this.Also moves the creation of the
FastBufferclass intointernal/buffer.jsand expose it directly instead ofwriting it onto that module later.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes