PMessagePort.ipdl 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. include protocol PBackground;
  5. include protocol PBlob;
  6. include DOMTypes;
  7. using struct mozilla::SerializedStructuredCloneBuffer
  8. from "ipc/IPCMessageUtils.h";
  9. namespace mozilla {
  10. namespace dom {
  11. struct MessagePortMessage
  12. {
  13. SerializedStructuredCloneBuffer data;
  14. PBlob[] blobs;
  15. MessagePortIdentifier[] transferredPorts;
  16. };
  17. // This protocol is used for the MessageChannel/MessagePort API
  18. protocol PMessagePort
  19. {
  20. manager PBackground;
  21. /* Many of these methods are used just for the shutdown sequence. The
  22. correct sequence for the child actor is:
  23. 1. SendStopSendingData();
  24. 2. RecvStopSendingDataConfirmed();
  25. 3. SendClose();
  26. 4. Recv__delete__(); */
  27. /* When the port is transferred the sequence is:
  28. 1. SendStopSendingData();
  29. 2. RecvStopSendingDataConfirmed();
  30. 3. SendDisentangle();
  31. 4. Recv__delete__(); */
  32. parent:
  33. async PostMessages(MessagePortMessage[] messages);
  34. async Disentangle(MessagePortMessage[] messages);
  35. async StopSendingData();
  36. async Close();
  37. child:
  38. async Entangled(MessagePortMessage[] messages);
  39. async ReceiveData(MessagePortMessage[] messages);
  40. async StopSendingDataConfirmed();
  41. async __delete__();
  42. };
  43. } // namespace dom
  44. } // namespace mozilla