-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
src: use predefined AliasedBuffer types in the code base #27334
Conversation
Instead of allowing the callers to instantiate the template with any numeric types (such as aliasing a Uint8Array to double[]), predefine types that make sense and use those instead.
@@ -251,6 +249,12 @@ class AliasedBuffer { | |||
NativeT* buffer_; | |||
v8::Global<V8T> js_array_; | |||
}; | |||
|
|||
typedef AliasedBufferBase<int32_t, v8::Int32Array> AliasedInt32Array; |
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.
Another reason for doing this is that it would be easier to implement something like AliasedInt32Array::ForEach()
if we add a static list in the case like what we do for the BaseObject
s - then we'll be able to iterate over all known aliased buffers in the heap snapshot generator, as well as do bookkeeping for snapshot [de]serialization (we'll record the indexes of the TypedArrays and ArrayBuffers in the snapshot during serialization, and deserialize them into C++ later to keep the states consistent)
Instead of allowing the callers to instantiate the template with any numeric types (such as aliasing a Uint8Array to double[]), predefine types that make sense and use those instead. PR-URL: #27334 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 0ae46a7 |
Instead of allowing the callers to instantiate the template with any numeric types (such as aliasing a Uint8Array to double[]), predefine types that make sense and use those instead. PR-URL: #27334 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Instead of allowing the callers to instantiate the template
with any numeric types (such as aliasing a Uint8Array to double[]),
predefine types that make sense and use those instead.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes