|
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/. */ |
|
4 |
|
5 #ifndef mozilla_dom_TCPSocketChild_h |
|
6 #define mozilla_dom_TCPSocketChild_h |
|
7 |
|
8 #include "mozilla/net/PTCPSocketChild.h" |
|
9 #include "nsITCPSocketChild.h" |
|
10 #include "nsCycleCollectionParticipant.h" |
|
11 #include "nsCOMPtr.h" |
|
12 #include "js/TypeDecls.h" |
|
13 |
|
14 #define TCPSOCKETCHILD_CID \ |
|
15 { 0xa589d96f, 0x7e09, 0x4edf, { 0xa0, 0x1a, 0xeb, 0x49, 0x51, 0xf4, 0x2f, 0x37 } } |
|
16 |
|
17 class nsITCPSocketInternal; |
|
18 |
|
19 namespace mozilla { |
|
20 namespace dom { |
|
21 |
|
22 class TCPSocketChildBase : public nsITCPSocketChild { |
|
23 public: |
|
24 NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketChildBase) |
|
25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
26 |
|
27 void AddIPDLReference(); |
|
28 void ReleaseIPDLReference(); |
|
29 |
|
30 protected: |
|
31 TCPSocketChildBase(); |
|
32 virtual ~TCPSocketChildBase(); |
|
33 |
|
34 nsCOMPtr<nsITCPSocketInternal> mSocket; |
|
35 bool mIPCOpen; |
|
36 }; |
|
37 |
|
38 class TCPSocketChild : public mozilla::net::PTCPSocketChild |
|
39 , public TCPSocketChildBase |
|
40 { |
|
41 public: |
|
42 NS_DECL_NSITCPSOCKETCHILD |
|
43 NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE; |
|
44 |
|
45 TCPSocketChild(); |
|
46 ~TCPSocketChild(); |
|
47 |
|
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 }; |
|
57 |
|
58 } // namespace dom |
|
59 } // namespace mozilla |
|
60 |
|
61 #endif |