summaryrefslogtreecommitdiff
path: root/src/node_messaging.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-10-07 14:39:02 -0700
committerAnna Henningsen <anna@addaleax.net>2018-06-06 19:43:45 +0200
commit749a13b76c351d515ed489844ece575b8918d2ed (patch)
treee4e55ade0b6e8d1b0392b65dd295bb3542349367 /src/node_messaging.h
parente7a2367471177c96f454a18319cf8d2fb25482f9 (diff)
downloadandroid-node-v8-749a13b76c351d515ed489844ece575b8918d2ed.tar.gz
android-node-v8-749a13b76c351d515ed489844ece575b8918d2ed.tar.bz2
android-node-v8-749a13b76c351d515ed489844ece575b8918d2ed.zip
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 <gpunathi@in.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/node_messaging.h')
-rw-r--r--src/node_messaging.h5
1 files changed, 5 insertions, 0 deletions
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<v8::Value> input,
v8::Local<v8::Value> 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<MessagePortData>&& data);
+
private:
MallocedBuffer<char> main_message_buf_;
std::vector<MallocedBuffer<char>> array_buffer_contents_;
+ std::vector<std::unique_ptr<MessagePortData>> message_ports_;
friend class MessagePort;
};