Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_TCPServerSocketChild_h
8 : #define mozilla_dom_TCPServerSocketChild_h
9 :
10 : #include "mozilla/net/PTCPServerSocketChild.h"
11 : #include "nsCycleCollectionParticipant.h"
12 : #include "nsCOMPtr.h"
13 :
14 : #define TCPSERVERSOCKETCHILD_CID \
15 : { 0x41a77ec8, 0xfd86, 0x409e, { 0xae, 0xa9, 0xaf, 0x2c, 0xa4, 0x07, 0xef, 0x8e } }
16 :
17 : class nsITCPServerSocketInternal;
18 :
19 : namespace mozilla {
20 : namespace dom {
21 :
22 : class TCPServerSocket;
23 :
24 : class TCPServerSocketChildBase : public nsISupports {
25 : public:
26 0 : NS_DECL_CYCLE_COLLECTION_CLASS(TCPServerSocketChildBase)
27 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 :
29 : void AddIPDLReference();
30 : void ReleaseIPDLReference();
31 :
32 : protected:
33 : TCPServerSocketChildBase();
34 : virtual ~TCPServerSocketChildBase();
35 :
36 : RefPtr<TCPServerSocket> mServerSocket;
37 : bool mIPCOpen;
38 : };
39 :
40 : class TCPServerSocketChild : public mozilla::net::PTCPServerSocketChild
41 : , public TCPServerSocketChildBase
42 : {
43 : public:
44 : NS_IMETHOD_(MozExternalRefCountType) Release() override;
45 :
46 : TCPServerSocketChild(TCPServerSocket* aServerSocket, uint16_t aLocalPort,
47 : uint16_t aBacklog, bool aUseArrayBuffers,
48 : nsIEventTarget* aIPCEventTarget);
49 : ~TCPServerSocketChild();
50 :
51 : void Close();
52 :
53 : virtual mozilla::ipc::IPCResult RecvCallbackAccept(PTCPSocketChild *socket) override;
54 : };
55 :
56 : } // namespace dom
57 : } // namespace mozilla
58 :
59 : #endif // mozilla_dom_TCPServerSocketChild_h
|