Skip to content

Commit

Permalink
src: fix warning in node_messaging
Browse files Browse the repository at this point in the history
PR-URL: nodejs#26682
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
ZYSzys authored and addaleax committed Mar 15, 2019
1 parent c32615c commit 0752a18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using v8::String;
using v8::Value;
using v8::ValueDeserializer;
using v8::ValueSerializer;
using v8::WasmCompiledModule;
using v8::WasmModuleObject;

namespace node {
namespace worker {
Expand All @@ -49,7 +49,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<WasmCompiledModule::TransferrableModule>& wasm_modules)
const std::vector<WasmModuleObject::TransferrableModule>& wasm_modules)
: message_ports_(message_ports),
shared_array_buffers_(shared_array_buffers),
wasm_modules_(wasm_modules) {}
Expand All @@ -70,10 +70,10 @@ class DeserializerDelegate : public ValueDeserializer::Delegate {
return shared_array_buffers_[clone_id];
}

MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(
MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
Isolate* isolate, uint32_t transfer_id) override {
CHECK_LE(transfer_id, wasm_modules_.size());
return WasmCompiledModule::FromTransferrableModule(
return WasmModuleObject::FromTransferrableModule(
isolate, wasm_modules_[transfer_id]);
}

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

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

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

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

Expand Down Expand Up @@ -302,7 +302,7 @@ Maybe<bool> Message::Serialize(Environment* env,
Local<ArrayBuffer> ab = entry.As<ArrayBuffer>();
// If we cannot render the ArrayBuffer unusable in this Isolate and
// take ownership of its memory, copying the buffer will have to do.
if (!ab->IsNeuterable() || ab->IsExternal() ||
if (!ab->IsDetachable() || ab->IsExternal() ||
!env->isolate_data()->uses_node_allocator()) {
continue;
}
Expand Down Expand Up @@ -368,7 +368,7 @@ Maybe<bool> Message::Serialize(Environment* env,
// (a.k.a. externalize) the underlying memory region and render
// it inaccessible in this Isolate.
ArrayBuffer::Contents contents = ab->Externalize();
ab->Neuter();
ab->Detach();

CHECK(env->isolate_data()->uses_node_allocator());
env->isolate_data()->node_allocator()->UnregisterPointer(
Expand Down
4 changes: 2 additions & 2 deletions src/node_messaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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::WasmCompiledModule::TransferrableModule&& mod);
uint32_t AddWASMModule(v8::WasmModuleObject::TransferrableModule&& mod);

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

friend class MessagePort;
};
Expand Down

0 comments on commit 0752a18

Please sign in to comment.