| | 1429 | == [TransferList](p) == #TransferList |
| | 1430 | |
| | 1431 | Summary: [TransferList] allows a SerializedScriptValue parameter used |
| | 1432 | with the structured clone algorithm to specify another parameter used |
| | 1433 | to pass the transfer list. |
| | 1434 | |
| | 1435 | Usage: The possible usage is [TransferList=XXX] where XXX is another |
| | 1436 | parameter in the same method signature as the SerializedScriptValue |
| | 1437 | parameter on which the modifier is placed. The referenced parameter |
| | 1438 | should be of type "Array" to be compatible with the Web Messaging |
| | 1439 | standard. |
| | 1440 | |
| | 1441 | When this modifier is used, the code generation automatically creates |
| | 1442 | a MessagePortArray and completes the structured clone algorithm using |
| | 1443 | the input data from the JavaScript caller. The resulting |
| | 1444 | MessagePortArray is then passed to the implementation's method |
| | 1445 | signature in place of the Array parameter referenced. |
| | 1446 | |
| | 1447 | Example: |
| | 1448 | {{{ |
| | 1449 | interface Worker { |
| | 1450 | void postMessage(in [TransferList=transfer] SerializedScriptValue data, in [Optional=DefaultIsUndefined] Array transfer); |
| | 1451 | } |
| | 1452 | }}} |
| | 1453 | And in the implementation: |
| | 1454 | {{{ |
| | 1455 | class Worker { |
| | 1456 | virtual void postMessage(PassRefPtr<SerializedScriptValue> data, const MessagePortArray& ports); |
| | 1457 | } |
| | 1458 | }}} |
| | 1459 | |