Skip to content

Commit

Permalink
src: remove uses of deprecated wasm TransferrableModule
Browse files Browse the repository at this point in the history
WasmModuleObject::TransferrableModule is deprecated and will be removed
in V8 v8.0. Replace all uses by CompiledWasmModule.

Refs: v8#101

PR-URL: #30026
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
  • Loading branch information
backes authored and addaleax committed Nov 8, 2019
1 parent da6dfd8 commit 69f19f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/node_messaging.cc
Expand Up @@ -13,6 +13,7 @@ using node::contextify::ContextifyContext;
using v8::Array;
using v8::ArrayBuffer;
using v8::BackingStore;
using v8::CompiledWasmModule;
using v8::Context;
using v8::EscapableHandleScope;
using v8::Exception;
Expand Down Expand Up @@ -58,7 +59,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
Environment* env,
const std::vector<MessagePort*>& message_ports,
const std::vector<Local<SharedArrayBuffer>>& shared_array_buffers,
const std::vector<WasmModuleObject::TransferrableModule>& wasm_modules)
const std::vector<CompiledWasmModule>& wasm_modules)
: message_ports_(message_ports),
shared_array_buffers_(shared_array_buffers),
wasm_modules_(wasm_modules) {}
Expand All @@ -82,7 +83,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
Isolate* isolate, uint32_t transfer_id) override {
CHECK_LE(transfer_id, wasm_modules_.size());
return WasmModuleObject::FromTransferrableModule(
return WasmModuleObject::FromCompiledModule(
isolate, wasm_modules_[transfer_id]);
}

Expand All @@ -91,7 +92,7 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
private:
const std::vector<MessagePort*>& message_ports_;
const std::vector<Local<SharedArrayBuffer>>& shared_array_buffers_;
const std::vector<WasmModuleObject::TransferrableModule>& wasm_modules_;
const std::vector<CompiledWasmModule>& wasm_modules_;
};

} // anonymous namespace
Expand Down Expand Up @@ -162,7 +163,7 @@ void Message::AddMessagePort(std::unique_ptr<MessagePortData>&& data) {
message_ports_.emplace_back(std::move(data));
}

uint32_t Message::AddWASMModule(WasmModuleObject::TransferrableModule&& mod) {
uint32_t Message::AddWASMModule(CompiledWasmModule&& mod) {
wasm_modules_.emplace_back(std::move(mod));
return wasm_modules_.size() - 1;
}
Expand Down Expand Up @@ -238,7 +239,7 @@ class SerializerDelegate : public ValueSerializer::Delegate {

Maybe<uint32_t> GetWasmModuleTransferId(
Isolate* isolate, Local<WasmModuleObject> module) override {
return Just(msg_->AddWASMModule(module->GetTransferrableModule()));
return Just(msg_->AddWASMModule(module->GetCompiledModule()));
}

void Finish() {
Expand Down
4 changes: 2 additions & 2 deletions src/node_messaging.h
Expand Up @@ -57,7 +57,7 @@ class Message : public MemoryRetainer {
void AddMessagePort(std::unique_ptr<MessagePortData>&& data);
// Internal method of Message that is called when a new WebAssembly.Module
// object is encountered in the incoming value's structure.
uint32_t AddWASMModule(v8::WasmModuleObject::TransferrableModule&& mod);
uint32_t AddWASMModule(v8::CompiledWasmModule&& mod);

// The MessagePorts that will be transferred, as recorded by Serialize().
// Used for warning user about posting the target MessagePort to itself,
Expand All @@ -76,7 +76,7 @@ class Message : public MemoryRetainer {
std::vector<std::shared_ptr<v8::BackingStore>> array_buffers_;
std::vector<std::shared_ptr<v8::BackingStore>> shared_array_buffers_;
std::vector<std::unique_ptr<MessagePortData>> message_ports_;
std::vector<v8::WasmModuleObject::TransferrableModule> wasm_modules_;
std::vector<v8::CompiledWasmModule> wasm_modules_;

friend class MessagePort;
};
Expand Down

0 comments on commit 69f19f4

Please sign in to comment.