|
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 |
|
20 : public PDNSRequestChild |
|
21 , public nsICancelable |
|
22 { |
|
23 public: |
|
24 NS_DECL_THREADSAFE_ISUPPORTS |
|
25 NS_DECL_NSICANCELABLE |
|
26 |
|
27 DNSRequestChild(const nsCString& aHost, const uint32_t& aFlags, |
|
28 nsIDNSListener *aListener, nsIEventTarget *target); |
|
29 virtual ~DNSRequestChild() {} |
|
30 |
|
31 void AddIPDLReference() { |
|
32 AddRef(); |
|
33 } |
|
34 void ReleaseIPDLReference() { |
|
35 // we don't need an 'mIPCOpen' variable until/unless we add calls that might |
|
36 // try to send IPDL msgs to parent after ReleaseIPDLReference is called |
|
37 // (when IPDL channel torn down). |
|
38 Release(); |
|
39 } |
|
40 |
|
41 // Sends IPDL request to parent |
|
42 void StartRequest(); |
|
43 void CallOnLookupComplete(); |
|
44 |
|
45 private: |
|
46 virtual bool Recv__delete__(const DNSRequestResponse& reply) MOZ_OVERRIDE; |
|
47 |
|
48 nsCOMPtr<nsIDNSListener> mListener; |
|
49 nsCOMPtr<nsIEventTarget> mTarget; |
|
50 nsCOMPtr<nsIDNSRecord> mResultRecord; |
|
51 nsresult mResultStatus; |
|
52 nsCString mHost; |
|
53 uint16_t mFlags; |
|
54 }; |
|
55 |
|
56 } // namespace net |
|
57 } // namespace mozilla |
|
58 #endif // mozilla_net_DNSRequestChild_h |