mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
Replace deprecated GetContent with GetBackingStore (#3458)
This commit is contained in:
parent
7144bbed34
commit
50b6907bc3
2 changed files with 4 additions and 4 deletions
|
@ -175,7 +175,7 @@ v8::Local<v8::Uint8Array> ImportBuf(DenoIsolate* d, deno_buf buf) {
|
||||||
if (buf.data_len > GLOBAL_IMPORT_BUF_SIZE) {
|
if (buf.data_len > GLOBAL_IMPORT_BUF_SIZE) {
|
||||||
// Simple case. We allocate a new ArrayBuffer for this.
|
// Simple case. We allocate a new ArrayBuffer for this.
|
||||||
ab = v8::ArrayBuffer::New(d->isolate_, buf.data_len);
|
ab = v8::ArrayBuffer::New(d->isolate_, buf.data_len);
|
||||||
data = ab->GetContents().Data();
|
data = ab->GetBackingStore()->Data();
|
||||||
} else {
|
} else {
|
||||||
// Fast case. We reuse the global ArrayBuffer.
|
// Fast case. We reuse the global ArrayBuffer.
|
||||||
if (d->global_import_buf_.IsEmpty()) {
|
if (d->global_import_buf_.IsEmpty()) {
|
||||||
|
@ -183,7 +183,7 @@ v8::Local<v8::Uint8Array> ImportBuf(DenoIsolate* d, deno_buf buf) {
|
||||||
DCHECK_NULL(d->global_import_buf_ptr_);
|
DCHECK_NULL(d->global_import_buf_ptr_);
|
||||||
ab = v8::ArrayBuffer::New(d->isolate_, GLOBAL_IMPORT_BUF_SIZE);
|
ab = v8::ArrayBuffer::New(d->isolate_, GLOBAL_IMPORT_BUF_SIZE);
|
||||||
d->global_import_buf_.Reset(d->isolate_, ab);
|
d->global_import_buf_.Reset(d->isolate_, ab);
|
||||||
d->global_import_buf_ptr_ = ab->GetContents().Data();
|
d->global_import_buf_ptr_ = ab->GetBackingStore()->Data();
|
||||||
} else {
|
} else {
|
||||||
DCHECK(d->global_import_buf_ptr_);
|
DCHECK(d->global_import_buf_ptr_);
|
||||||
ab = d->global_import_buf_.Get(d->isolate_);
|
ab = d->global_import_buf_.Get(d->isolate_);
|
||||||
|
@ -233,7 +233,7 @@ void Send(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||||
if (args[1]->IsArrayBufferView()) {
|
if (args[1]->IsArrayBufferView()) {
|
||||||
auto view = v8::Local<v8::ArrayBufferView>::Cast(args[1]);
|
auto view = v8::Local<v8::ArrayBufferView>::Cast(args[1]);
|
||||||
auto data =
|
auto data =
|
||||||
reinterpret_cast<uint8_t*>(view->Buffer()->GetContents().Data());
|
reinterpret_cast<uint8_t*>(view->Buffer()->GetBackingStore()->Data());
|
||||||
control = {data + view->ByteOffset(), view->ByteLength()};
|
control = {data + view->ByteOffset(), view->ByteLength()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ class PinnedBuf {
|
||||||
PinnedBuf() : data_ptr_(nullptr), data_len_(0), pin_() {}
|
PinnedBuf() : data_ptr_(nullptr), data_len_(0), pin_() {}
|
||||||
|
|
||||||
explicit PinnedBuf(v8::Local<v8::ArrayBufferView> view) {
|
explicit PinnedBuf(v8::Local<v8::ArrayBufferView> view) {
|
||||||
auto buf = view->Buffer()->GetContents().Data();
|
auto buf = view->Buffer()->GetBackingStore()->Data();
|
||||||
ArrayBufferAllocator::global().Ref(buf);
|
ArrayBufferAllocator::global().Ref(buf);
|
||||||
|
|
||||||
data_ptr_ = reinterpret_cast<uint8_t*>(buf) + view->ByteOffset();
|
data_ptr_ = reinterpret_cast<uint8_t*>(buf) + view->ByteOffset();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue