From c721d444375a999f111a688e02706f5df4fe6687 Mon Sep 17 00:00:00 2001 From: Keyhan Vakil Date: Thu, 21 Jul 2022 04:42:31 +0000 Subject: [PATCH] src: remove usages of GetBackingStore in WASI This removes all usages of GetBackingStore in WASI. See the linked issue for an explanation. Refs: https://github.com/nodejs/node/issues/32226 Refs: https://github.com/nodejs/node/pull/43921 --- src/node_wasi.cc | 8 +++----- src/node_wasm_web_api.cc | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/node_wasi.cc b/src/node_wasi.cc index 965a619c8d4acd..b377228126543f 100644 --- a/src/node_wasi.cc +++ b/src/node_wasi.cc @@ -73,7 +73,6 @@ inline void Debug(WASI* wasi, Args&&... args) { } while (0) using v8::Array; -using v8::BackingStore; using v8::BigInt; using v8::Context; using v8::Exception; @@ -1654,10 +1653,9 @@ void WASI::_SetMemory(const FunctionCallbackInfo& args) { uvwasi_errno_t WASI::backingStore(char** store, size_t* byte_length) { Local memory = PersistentToLocal::Strong(this->memory_); - std::shared_ptr backing_store = - memory->Buffer()->GetBackingStore(); - *byte_length = backing_store->ByteLength(); - *store = static_cast(backing_store->Data()); + Local ab = memory->Buffer(); + *byte_length = ab->ByteLength(); + *store = static_cast(ab->Data()); CHECK_NOT_NULL(*store); return UVWASI_ESUCCESS; } diff --git a/src/node_wasm_web_api.cc b/src/node_wasm_web_api.cc index 67437034bbee34..6fe5a51b4c4202 100644 --- a/src/node_wasm_web_api.cc +++ b/src/node_wasm_web_api.cc @@ -105,12 +105,12 @@ void WasmStreamingObject::Push(const FunctionCallbackInfo& args) { if (LIKELY(chunk->IsArrayBufferView())) { Local view = chunk.As(); - bytes = view->Buffer()->GetBackingStore()->Data(); + bytes = view->Buffer()->Data(); offset = view->ByteOffset(); size = view->ByteLength(); } else if (LIKELY(chunk->IsArrayBuffer())) { Local buffer = chunk.As(); - bytes = buffer->GetBackingStore()->Data(); + bytes = buffer->Data(); offset = 0; size = buffer->ByteLength(); } else {