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_TCPSocketChild_h michael@0: #define mozilla_dom_TCPSocketChild_h michael@0: michael@0: #include "mozilla/net/PTCPSocketChild.h" michael@0: #include "nsITCPSocketChild.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "js/TypeDecls.h" michael@0: michael@0: #define TCPSOCKETCHILD_CID \ michael@0: { 0xa589d96f, 0x7e09, 0x4edf, { 0xa0, 0x1a, 0xeb, 0x49, 0x51, 0xf4, 0x2f, 0x37 } } michael@0: michael@0: class nsITCPSocketInternal; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class TCPSocketChildBase : public nsITCPSocketChild { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketChildBase) michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: michael@0: void AddIPDLReference(); michael@0: void ReleaseIPDLReference(); michael@0: michael@0: protected: michael@0: TCPSocketChildBase(); michael@0: virtual ~TCPSocketChildBase(); michael@0: michael@0: nsCOMPtr mSocket; michael@0: bool mIPCOpen; michael@0: }; michael@0: michael@0: class TCPSocketChild : public mozilla::net::PTCPSocketChild michael@0: , public TCPSocketChildBase michael@0: { michael@0: public: michael@0: NS_DECL_NSITCPSOCKETCHILD michael@0: NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE; michael@0: michael@0: TCPSocketChild(); michael@0: ~TCPSocketChild(); michael@0: michael@0: virtual bool RecvCallback(const nsString& aType, michael@0: const CallbackData& aData, michael@0: const nsString& aReadyState) MOZ_OVERRIDE; michael@0: virtual bool RecvRequestDelete() MOZ_OVERRIDE; michael@0: virtual bool RecvUpdateBufferedAmount(const uint32_t& aBufferred, michael@0: const uint32_t& aTrackingNumber) MOZ_OVERRIDE; michael@0: private: michael@0: JSObject* mWindowObj; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif