Skip to content

Commit

Permalink
Replace deprecated GetContent with GetBackingStore (denoland#3458)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkassimo authored and ry committed Dec 7, 2019
1 parent 7144bbe commit 50b6907
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/libdeno/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ v8::Local<v8::Uint8Array> ImportBuf(DenoIsolate* d, deno_buf buf) {
if (buf.data_len > GLOBAL_IMPORT_BUF_SIZE) {
// Simple case. We allocate a new ArrayBuffer for this.
ab = v8::ArrayBuffer::New(d->isolate_, buf.data_len);
data = ab->GetContents().Data();
data = ab->GetBackingStore()->Data();
} else {
// Fast case. We reuse the global ArrayBuffer.
if (d->global_import_buf_.IsEmpty()) {
// Lazily initialize it.
DCHECK_NULL(d->global_import_buf_ptr_);
ab = v8::ArrayBuffer::New(d->isolate_, GLOBAL_IMPORT_BUF_SIZE);
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 {
DCHECK(d->global_import_buf_ptr_);
ab = d->global_import_buf_.Get(d->isolate_);
Expand Down Expand Up @@ -233,7 +233,7 @@ void Send(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args[1]->IsArrayBufferView()) {
auto view = v8::Local<v8::ArrayBufferView>::Cast(args[1]);
auto data =
reinterpret_cast<uint8_t*>(view->Buffer()->GetContents().Data());
reinterpret_cast<uint8_t*>(view->Buffer()->GetBackingStore()->Data());
control = {data + view->ByteOffset(), view->ByteLength()};
}

Expand Down
2 changes: 1 addition & 1 deletion core/libdeno/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class PinnedBuf {
PinnedBuf() : data_ptr_(nullptr), data_len_(0), pin_() {}

explicit PinnedBuf(v8::Local<v8::ArrayBufferView> view) {
auto buf = view->Buffer()->GetContents().Data();
auto buf = view->Buffer()->GetBackingStore()->Data();
ArrayBufferAllocator::global().Ref(buf);

data_ptr_ = reinterpret_cast<uint8_t*>(buf) + view->ByteOffset();
Expand Down

0 comments on commit 50b6907

Please sign in to comment.