Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef mozilla_dom_TCPSocketParent_h |
michael@0 | 6 | #define mozilla_dom_TCPSocketParent_h |
michael@0 | 7 | |
michael@0 | 8 | #include "mozilla/net/PTCPSocketParent.h" |
michael@0 | 9 | #include "nsITCPSocketParent.h" |
michael@0 | 10 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #include "nsIDOMTCPSocket.h" |
michael@0 | 13 | #include "js/TypeDecls.h" |
michael@0 | 14 | |
michael@0 | 15 | #define TCPSOCKETPARENT_CID \ |
michael@0 | 16 | { 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } } |
michael@0 | 17 | |
michael@0 | 18 | namespace mozilla { |
michael@0 | 19 | namespace dom { |
michael@0 | 20 | |
michael@0 | 21 | class PBrowserParent; |
michael@0 | 22 | |
michael@0 | 23 | class TCPSocketParentBase : public nsITCPSocketParent |
michael@0 | 24 | { |
michael@0 | 25 | public: |
michael@0 | 26 | NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketParentBase) |
michael@0 | 27 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 28 | |
michael@0 | 29 | void AddIPDLReference(); |
michael@0 | 30 | void ReleaseIPDLReference(); |
michael@0 | 31 | |
michael@0 | 32 | protected: |
michael@0 | 33 | TCPSocketParentBase(); |
michael@0 | 34 | virtual ~TCPSocketParentBase(); |
michael@0 | 35 | |
michael@0 | 36 | nsCOMPtr<nsITCPSocketIntermediary> mIntermediary; |
michael@0 | 37 | nsCOMPtr<nsIDOMTCPSocket> mSocket; |
michael@0 | 38 | bool mIPCOpen; |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | class TCPSocketParent : public mozilla::net::PTCPSocketParent |
michael@0 | 42 | , public TCPSocketParentBase |
michael@0 | 43 | { |
michael@0 | 44 | public: |
michael@0 | 45 | NS_DECL_NSITCPSOCKETPARENT |
michael@0 | 46 | NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE; |
michael@0 | 47 | |
michael@0 | 48 | TCPSocketParent() : mIntermediaryObj(nullptr) {} |
michael@0 | 49 | |
michael@0 | 50 | virtual bool RecvOpen(const nsString& aHost, const uint16_t& aPort, |
michael@0 | 51 | const bool& useSSL, const nsString& aBinaryType); |
michael@0 | 52 | |
michael@0 | 53 | virtual bool RecvStartTLS() MOZ_OVERRIDE; |
michael@0 | 54 | virtual bool RecvSuspend() MOZ_OVERRIDE; |
michael@0 | 55 | virtual bool RecvResume() MOZ_OVERRIDE; |
michael@0 | 56 | virtual bool RecvClose() MOZ_OVERRIDE; |
michael@0 | 57 | virtual bool RecvData(const SendableData& aData, |
michael@0 | 58 | const uint32_t& aTrackingNumber) MOZ_OVERRIDE; |
michael@0 | 59 | virtual bool RecvRequestDelete() MOZ_OVERRIDE; |
michael@0 | 60 | |
michael@0 | 61 | private: |
michael@0 | 62 | virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; |
michael@0 | 63 | |
michael@0 | 64 | JSObject* mIntermediaryObj; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | } // namespace dom |
michael@0 | 68 | } // namespace mozilla |
michael@0 | 69 | |
michael@0 | 70 | #endif |