|
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 #include "mozilla/net/PTCPServerSocketChild.h" |
|
6 #include "nsITCPServerSocketChild.h" |
|
7 #include "nsCycleCollectionParticipant.h" |
|
8 #include "nsCOMPtr.h" |
|
9 |
|
10 #define TCPSERVERSOCKETCHILD_CID \ |
|
11 { 0x41a77ec8, 0xfd86, 0x409e, { 0xae, 0xa9, 0xaf, 0x2c, 0xa4, 0x07, 0xef, 0x8e } } |
|
12 |
|
13 class nsITCPServerSocketInternal; |
|
14 |
|
15 namespace mozilla { |
|
16 namespace dom { |
|
17 |
|
18 class TCPServerSocketChildBase : public nsITCPServerSocketChild { |
|
19 public: |
|
20 NS_DECL_CYCLE_COLLECTION_CLASS(TCPServerSocketChildBase) |
|
21 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
22 |
|
23 void AddIPDLReference(); |
|
24 void ReleaseIPDLReference(); |
|
25 |
|
26 protected: |
|
27 TCPServerSocketChildBase(); |
|
28 virtual ~TCPServerSocketChildBase(); |
|
29 |
|
30 nsCOMPtr<nsITCPServerSocketInternal> mServerSocket; |
|
31 bool mIPCOpen; |
|
32 }; |
|
33 |
|
34 class TCPServerSocketChild : public mozilla::net::PTCPServerSocketChild |
|
35 , public TCPServerSocketChildBase |
|
36 { |
|
37 public: |
|
38 NS_DECL_NSITCPSERVERSOCKETCHILD |
|
39 NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE; |
|
40 |
|
41 TCPServerSocketChild(); |
|
42 ~TCPServerSocketChild(); |
|
43 |
|
44 virtual bool RecvCallbackAccept(PTCPSocketChild *socket) MOZ_OVERRIDE; |
|
45 virtual bool RecvCallbackError(const nsString& aMessage, |
|
46 const nsString& aFilename, |
|
47 const uint32_t& aLineNumber, |
|
48 const uint32_t& aColumnNumber) MOZ_OVERRIDE; |
|
49 }; |
|
50 |
|
51 } // namespace dom |
|
52 } // namespace mozilla |