SharedMessagePortMessage.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_SharedMessagePortMessage_h
  6. #define mozilla_dom_SharedMessagePortMessage_h
  7. #include "mozilla/dom/StructuredCloneHolder.h"
  8. namespace mozilla {
  9. namespace dom {
  10. class MessagePortChild;
  11. class MessagePortMessage;
  12. class MessagePortParent;
  13. class SharedMessagePortMessage final : public StructuredCloneHolder
  14. {
  15. public:
  16. NS_INLINE_DECL_REFCOUNTING(SharedMessagePortMessage)
  17. SharedMessagePortMessage()
  18. : StructuredCloneHolder(CloningSupported, TransferringSupported,
  19. StructuredCloneScope::DifferentProcess)
  20. {}
  21. static void
  22. FromSharedToMessagesChild(
  23. MessagePortChild* aActor,
  24. const nsTArray<RefPtr<SharedMessagePortMessage>>& aData,
  25. nsTArray<MessagePortMessage>& aArray);
  26. static bool
  27. FromMessagesToSharedChild(
  28. nsTArray<MessagePortMessage>& aArray,
  29. FallibleTArray<RefPtr<SharedMessagePortMessage>>& aData);
  30. static bool
  31. FromSharedToMessagesParent(
  32. MessagePortParent* aActor,
  33. const nsTArray<RefPtr<SharedMessagePortMessage>>& aData,
  34. FallibleTArray<MessagePortMessage>& aArray);
  35. static bool
  36. FromMessagesToSharedParent(
  37. nsTArray<MessagePortMessage>& aArray,
  38. FallibleTArray<RefPtr<SharedMessagePortMessage>>& aData);
  39. private:
  40. ~SharedMessagePortMessage() {}
  41. };
  42. } // namespace dom
  43. } // namespace mozilla
  44. #endif // mozilla_dom_SharedMessagePortMessage_h