Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove usages of GetBackingStore in WASI #44077

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/node_wasi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1654,10 +1653,9 @@ void WASI::_SetMemory(const FunctionCallbackInfo<Value>& args) {

uvwasi_errno_t WASI::backingStore(char** store, size_t* byte_length) {
Local<WasmMemoryObject> memory = PersistentToLocal::Strong(this->memory_);
std::shared_ptr<BackingStore> backing_store =
memory->Buffer()->GetBackingStore();
*byte_length = backing_store->ByteLength();
*store = static_cast<char*>(backing_store->Data());
Local<v8::ArrayBuffer> ab = memory->Buffer();
*byte_length = ab->ByteLength();
*store = static_cast<char*>(ab->Data());
CHECK_NOT_NULL(*store);
return UVWASI_ESUCCESS;
}
Expand Down
4 changes: 2 additions & 2 deletions src/node_wasm_web_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ void WasmStreamingObject::Push(const FunctionCallbackInfo<Value>& args) {

if (LIKELY(chunk->IsArrayBufferView())) {
Local<ArrayBufferView> view = chunk.As<ArrayBufferView>();
bytes = view->Buffer()->GetBackingStore()->Data();
bytes = view->Buffer()->Data();
offset = view->ByteOffset();
size = view->ByteLength();
} else if (LIKELY(chunk->IsArrayBuffer())) {
Local<ArrayBuffer> buffer = chunk.As<ArrayBuffer>();
bytes = buffer->GetBackingStore()->Data();
bytes = buffer->Data();
offset = 0;
size = buffer->ByteLength();
} else {
Expand Down