mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
src: migrate off ArrayBuffer::GetContents
V8 deprecates `GetContents()` in favour of `GetBackingStore()`. Update our code to reflect that. V8 also deprecates `Externalize()` and `IsExternal()`; we should be able to remove all usage of this once V8 8.0 is there. PR-URL: https://github.com/nodejs/node/pull/30339 Refs: https://github.com/v8/v8/commit/bfe3d6bce734e596e312465e207bcfd55a59fe34 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This commit is contained in:
1 parent
f8c069f5b8
commit
e66a2acc4c
13 files changed
+67
-44
No files matched your search
+5
-8
@@ -192,16 +192,13 @@ bool HasInstance(Local<Object> obj) {
|
||||
char* Data(Local<Value> val) {
|
||||
CHECK(val->IsArrayBufferView());
|
||||
Local<ArrayBufferView> ui = val.As<ArrayBufferView>();
|
||||
ArrayBuffer::Contents ab_c = ui->Buffer()->GetContents();
|
||||
return static_cast<char*>(ab_c.Data()) + ui->ByteOffset();
|
||||
return static_cast<char*>(ui->Buffer()->GetBackingStore()->Data()) +
|
||||
ui->ByteOffset();
|
||||
}
|
||||
|
||||
|
||||
char* Data(Local<Object> obj) {
|
||||
CHECK(obj->IsArrayBufferView());
|
||||
Local<ArrayBufferView> ui = obj.As<ArrayBufferView>();
|
||||
ArrayBuffer::Contents ab_c = ui->Buffer()->GetContents();
|
||||
return static_cast<char*>(ab_c.Data()) + ui->ByteOffset();
|
||||
return Data(obj.As<Value>());
|
||||
}
|
||||
|
||||
|
||||
@@ -1060,13 +1057,13 @@ static void EncodeInto(const FunctionCallbackInfo<Value>& args) {
|
||||
Local<Uint8Array> dest = args[1].As<Uint8Array>();
|
||||
Local<ArrayBuffer> buf = dest->Buffer();
|
||||
char* write_result =
|
||||
static_cast<char*>(buf->GetContents().Data()) + dest->ByteOffset();
|
||||
static_cast<char*>(buf->GetBackingStore()->Data()) + dest->ByteOffset();
|
||||
size_t dest_length = dest->ByteLength();
|
||||
|
||||
// results = [ read, written ]
|
||||
Local<Uint32Array> result_arr = args[2].As<Uint32Array>();
|
||||
uint32_t* results = reinterpret_cast<uint32_t*>(
|
||||
static_cast<char*>(result_arr->Buffer()->GetContents().Data()) +
|
||||
static_cast<char*>(result_arr->Buffer()->GetBackingStore()->Data()) +
|
||||
result_arr->ByteOffset());
|
||||
|
||||
int nchars;
|
||||
|
||||
Reference in new issue
Block a user