mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
The HTML structured serialize algorithm treats transferable and serializable as two different bits. A web platform interface can be both transferable and serializable. Splits BaseObject::TransferMode to be able to compose the two bits and distinguishes the transferable and cloneable. PR-URL: https://github.com/nodejs/node/pull/47956 Refs: https://github.com/v8/v8/commit/cf13b9b46572a9824d2d632abdd48c56161ace02 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
42 lines
732 B
JavaScript
42 lines
732 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
markTransferMode,
|
|
kClone,
|
|
kDeserialize,
|
|
} = require('internal/worker/js_transferable');
|
|
|
|
process.emitWarning(
|
|
'These APIs are for internal testing only. Do not use them.',
|
|
'internal/test/transfer');
|
|
|
|
// Used as part of parallel/test-messaging-maketransferable.
|
|
// This has to exist within the lib/internal/ path in order
|
|
// for deserialization to work.
|
|
|
|
class E {
|
|
constructor(b) {
|
|
this.b = b;
|
|
}
|
|
}
|
|
|
|
class F extends E {
|
|
constructor(b) {
|
|
super(b);
|
|
markTransferMode(this, true, false);
|
|
}
|
|
|
|
[kClone]() {
|
|
return {
|
|
data: { b: this.b },
|
|
deserializeInfo: 'internal/test/transfer:F',
|
|
};
|
|
}
|
|
|
|
[kDeserialize]({ b }) {
|
|
this.b = b;
|
|
}
|
|
}
|
|
|
|
module.exports = { E, F };
|