From 749a13b76c351d515ed489844ece575b8918d2ed Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 7 Oct 2017 14:39:02 -0700 Subject: worker: support MessagePort passing in messages Support passing `MessagePort` instances through other `MessagePort`s, as expected by the `MessagePort` spec. Thanks to Stephen Belanger for reviewing this change in its original PR. Refs: https://github.com/ayojs/ayo/pull/106 PR-URL: https://github.com/nodejs/node/pull/20876 Reviewed-By: Gireesh Punathil Reviewed-By: Benjamin Gruenbaum Reviewed-By: Shingo Inoue Reviewed-By: Matteo Collina Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: John-David Dalton Reviewed-By: Gus Caplan --- src/node_messaging.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/node_messaging.h') diff --git a/src/node_messaging.h b/src/node_messaging.h index 7bd60163ea..074267bb67 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -37,9 +37,14 @@ class Message { v8::Local input, v8::Local transfer_list); + // Internal method of Message that is called once serialization finishes + // and that transfers ownership of `data` to this message. + void AddMessagePort(std::unique_ptr&& data); + private: MallocedBuffer main_message_buf_; std::vector> array_buffer_contents_; + std::vector> message_ports_; friend class MessagePort; }; -- cgit v1.2.3