TCPServerSocketParent.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* -*- Mode: C++; tab-width: 8; 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 file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_TCPServerSocketParent_h
  6. #define mozilla_dom_TCPServerSocketParent_h
  7. #include "mozilla/net/PNeckoParent.h"
  8. #include "mozilla/net/PTCPServerSocketParent.h"
  9. #include "nsCycleCollectionParticipant.h"
  10. #include "nsCOMPtr.h"
  11. namespace mozilla {
  12. namespace dom {
  13. class TCPServerSocket;
  14. class TCPServerSocketEvent;
  15. class TCPSocketParent;
  16. class TCPServerSocketParent : public mozilla::net::PTCPServerSocketParent
  17. , public nsISupports
  18. {
  19. public:
  20. NS_DECL_CYCLE_COLLECTION_CLASS(TCPServerSocketParent)
  21. NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  22. TCPServerSocketParent(PNeckoParent* neckoParent, uint16_t aLocalPort,
  23. uint16_t aBacklog, bool aUseArrayBuffers);
  24. void Init();
  25. virtual bool RecvClose() override;
  26. virtual bool RecvRequestDelete() override;
  27. uint32_t GetAppId();
  28. bool GetInIsolatedMozBrowser();
  29. void AddIPDLReference();
  30. void ReleaseIPDLReference();
  31. void OnConnect(TCPServerSocketEvent* event);
  32. private:
  33. ~TCPServerSocketParent();
  34. nsresult SendCallbackAccept(TCPSocketParent *socket);
  35. virtual void ActorDestroy(ActorDestroyReason why) override;
  36. PNeckoParent* mNeckoParent;
  37. RefPtr<TCPServerSocket> mServerSocket;
  38. bool mIPCOpen;
  39. };
  40. } // namespace dom
  41. } // namespace mozilla
  42. #endif // mozilla_dom_TCPServerSocketParent_h