Re:Type conversions from JavaScript to C++ in V8
by dkopi on Sunday April 03, 2016 @03:00PM
(#11417165)
Be ultra careful when doing this.
First of all - make sure to get, validate and store the buffer's length (ByteLength())
Secondly - GetContents() is only for temporary access to a buffer. if you store that pointer and use it later (//do whatever), there's a great chance it will get garbage collected.
Make sure to Externalize() the array if you intend on keeping the pointer for later.
Secondly - GetContents() is only for temporary access to a buffer. if you store that pointer and use it later (//do whatever), there's a great chance it will get garbage collected. Make sure to Externalize() the array if you intend on keeping the pointer for later.