michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_TCPSocketParent_h michael@0: #define mozilla_dom_TCPSocketParent_h michael@0: michael@0: #include "mozilla/net/PTCPSocketParent.h" michael@0: #include "nsITCPSocketParent.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIDOMTCPSocket.h" michael@0: #include "js/TypeDecls.h" michael@0: michael@0: #define TCPSOCKETPARENT_CID \ michael@0: { 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } } michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class PBrowserParent; michael@0: michael@0: class TCPSocketParentBase : public nsITCPSocketParent michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketParentBase) michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: michael@0: void AddIPDLReference(); michael@0: void ReleaseIPDLReference(); michael@0: michael@0: protected: michael@0: TCPSocketParentBase(); michael@0: virtual ~TCPSocketParentBase(); michael@0: michael@0: nsCOMPtr mIntermediary; michael@0: nsCOMPtr mSocket; michael@0: bool mIPCOpen; michael@0: }; michael@0: michael@0: class TCPSocketParent : public mozilla::net::PTCPSocketParent michael@0: , public TCPSocketParentBase michael@0: { michael@0: public: michael@0: NS_DECL_NSITCPSOCKETPARENT michael@0: NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE; michael@0: michael@0: TCPSocketParent() : mIntermediaryObj(nullptr) {} michael@0: michael@0: virtual bool RecvOpen(const nsString& aHost, const uint16_t& aPort, michael@0: const bool& useSSL, const nsString& aBinaryType); michael@0: michael@0: virtual bool RecvStartTLS() MOZ_OVERRIDE; michael@0: virtual bool RecvSuspend() MOZ_OVERRIDE; michael@0: virtual bool RecvResume() MOZ_OVERRIDE; michael@0: virtual bool RecvClose() MOZ_OVERRIDE; michael@0: virtual bool RecvData(const SendableData& aData, michael@0: const uint32_t& aTrackingNumber) MOZ_OVERRIDE; michael@0: virtual bool RecvRequestDelete() MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; michael@0: michael@0: JSObject* mIntermediaryObj; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif