MessagePortChild.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #include "MessagePortChild.h"
  6. #include "MessagePort.h"
  7. #include "mozilla/dom/MessageEvent.h"
  8. #include "mozilla/ipc/PBackgroundChild.h"
  9. namespace mozilla {
  10. namespace dom {
  11. bool
  12. MessagePortChild::RecvStopSendingDataConfirmed()
  13. {
  14. MOZ_ASSERT(mPort);
  15. mPort->StopSendingDataConfirmed();
  16. MOZ_ASSERT(!mPort);
  17. return true;
  18. }
  19. bool
  20. MessagePortChild::RecvEntangled(nsTArray<MessagePortMessage>&& aMessages)
  21. {
  22. if (mPort) {
  23. mPort->Entangled(aMessages);
  24. }
  25. return true;
  26. }
  27. bool
  28. MessagePortChild::RecvReceiveData(nsTArray<MessagePortMessage>&& aMessages)
  29. {
  30. if (mPort) {
  31. mPort->MessagesReceived(aMessages);
  32. }
  33. return true;
  34. }
  35. void
  36. MessagePortChild::ActorDestroy(ActorDestroyReason aWhy)
  37. {
  38. if (mPort) {
  39. mPort->Closed();
  40. MOZ_ASSERT(!mPort);
  41. }
  42. }
  43. } // namespace dom
  44. } // namespace mozilla