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_TCPSocketChild_h
6 #define mozilla_dom_TCPSocketChild_h
8 #include "mozilla/net/PTCPSocketChild.h"
9 #include "nsITCPSocketChild.h"
10 #include "nsCycleCollectionParticipant.h"
11 #include "nsCOMPtr.h"
12 #include "js/TypeDecls.h"
14 #define TCPSOCKETCHILD_CID \
15 { 0xa589d96f, 0x7e09, 0x4edf, { 0xa0, 0x1a, 0xeb, 0x49, 0x51, 0xf4, 0x2f, 0x37 } }
17 class nsITCPSocketInternal;
19 namespace mozilla {
20 namespace dom {
22 class TCPSocketChildBase : public nsITCPSocketChild {
23 public:
24 NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketChildBase)
25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
27 void AddIPDLReference();
28 void ReleaseIPDLReference();
30 protected:
31 TCPSocketChildBase();
32 virtual ~TCPSocketChildBase();
34 nsCOMPtr<nsITCPSocketInternal> mSocket;
35 bool mIPCOpen;
36 };
38 class TCPSocketChild : public mozilla::net::PTCPSocketChild
39 , public TCPSocketChildBase
40 {
41 public:
42 NS_DECL_NSITCPSOCKETCHILD
43 NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE;
45 TCPSocketChild();
46 ~TCPSocketChild();
48 virtual bool RecvCallback(const nsString& aType,
49 const CallbackData& aData,
50 const nsString& aReadyState) MOZ_OVERRIDE;
51 virtual bool RecvRequestDelete() MOZ_OVERRIDE;
52 virtual bool RecvUpdateBufferedAmount(const uint32_t& aBufferred,
53 const uint32_t& aTrackingNumber) MOZ_OVERRIDE;
54 private:
55 JSObject* mWindowObj;
56 };
58 } // namespace dom
59 } // namespace mozilla
61 #endif