Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set sw=2 ts=8 et 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
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_net_DNSRequestChild_h
8 : #define mozilla_net_DNSRequestChild_h
9 :
10 : #include "mozilla/net/PDNSRequestChild.h"
11 : #include "nsICancelable.h"
12 : #include "nsIDNSRecord.h"
13 : #include "nsIDNSListener.h"
14 : #include "nsIEventTarget.h"
15 :
16 : namespace mozilla {
17 : namespace net {
18 :
19 : class DNSRequestChild final
20 : : public PDNSRequestChild
21 : , public nsICancelable
22 : {
23 : public:
24 : NS_DECL_THREADSAFE_ISUPPORTS
25 : NS_DECL_NSICANCELABLE
26 :
27 : DNSRequestChild(const nsCString& aHost,
28 : const OriginAttributes& aOriginAttributes,
29 : const uint32_t& aFlags,
30 : const nsCString& aNetworkInterface,
31 : nsIDNSListener *aListener, nsIEventTarget *target);
32 :
33 0 : void AddIPDLReference() {
34 0 : AddRef();
35 0 : }
36 : void ReleaseIPDLReference();
37 :
38 : // Sends IPDL request to parent
39 : void StartRequest();
40 : void CallOnLookupComplete();
41 :
42 : protected:
43 : friend class CancelDNSRequestEvent;
44 : friend class ChildDNSService;
45 0 : virtual ~DNSRequestChild() {}
46 :
47 : virtual mozilla::ipc::IPCResult RecvLookupCompleted(const DNSRequestResponse& reply) override;
48 : virtual void ActorDestroy(ActorDestroyReason why) override;
49 :
50 : nsCOMPtr<nsIDNSListener> mListener;
51 : nsCOMPtr<nsIEventTarget> mTarget;
52 : nsCOMPtr<nsIDNSRecord> mResultRecord;
53 : nsresult mResultStatus;
54 : nsCString mHost;
55 : const OriginAttributes mOriginAttributes;
56 : uint16_t mFlags;
57 : nsCString mNetworkInterface;
58 : bool mIPCOpen;
59 : };
60 :
61 : } // namespace net
62 : } // namespace mozilla
63 :
64 : #endif // mozilla_net_DNSRequestChild_h
|