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