diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-09-10 01:43:55 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-03-15 16:54:19 +0100 |
commit | fe8972a4ff4aee5ba48e01e3cad0c9464ba70285 (patch) | |
tree | dba151223fc5ec9e12bc2c954d5b81ebc6c46225 /src/node_messaging.h | |
parent | b0de48e85441ff710aab240fdfa8a34adbbee976 (diff) | |
download | node-new-fe8972a4ff4aee5ba48e01e3cad0c9464ba70285.tar.gz |
worker: implement worker.moveMessagePortToContext()
This enables using `MessagePort`s in different `vm.Context`s,
aiding with the isolation that the `vm` module seeks to provide.
Refs: https://github.com/ayojs/ayo/pull/111
PR-URL: https://github.com/nodejs/node/pull/26497
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_messaging.h')
-rw-r--r-- | src/node_messaging.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/node_messaging.h b/src/node_messaging.h index 99e344b8ca..aa2559af2c 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -158,12 +158,17 @@ class MessagePort : public HandleWrap { // Stop processing messages on this port as a receiving end. void Stop(); + /* constructor */ static void New(const v8::FunctionCallbackInfo<v8::Value>& args); + /* prototype methods */ static void PostMessage(const v8::FunctionCallbackInfo<v8::Value>& args); static void Start(const v8::FunctionCallbackInfo<v8::Value>& args); static void Stop(const v8::FunctionCallbackInfo<v8::Value>& args); static void Drain(const v8::FunctionCallbackInfo<v8::Value>& args); + /* static */ + static void MoveToContext(const v8::FunctionCallbackInfo<v8::Value>& args); + // Turns `a` and `b` into siblings, i.e. connects the sending side of one // to the receiving side of the other. This is not thread-safe. static void Entangle(MessagePort* a, MessagePort* b); |