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/. */
7 #include "mozilla/net/DNSListenerProxy.h"
8 #include "nsICancelable.h"
13 NS_IMPL_ADDREF(DNSListenerProxy
)
14 NS_IMPL_RELEASE(DNSListenerProxy
)
15 NS_INTERFACE_MAP_BEGIN(DNSListenerProxy
)
16 NS_INTERFACE_MAP_ENTRY(nsIDNSListener
)
17 NS_INTERFACE_MAP_ENTRY_CONCRETE(DNSListenerProxy
)
21 DNSListenerProxy::OnLookupComplete(nsICancelable
* aRequest
,
22 nsIDNSRecord
* aRecord
, nsresult aStatus
) {
23 RefPtr
<DNSListenerProxy
> self
= this;
24 nsCOMPtr
<nsICancelable
> request
= aRequest
;
25 nsCOMPtr
<nsIDNSRecord
> record
= aRecord
;
26 return mTargetThread
->Dispatch(
27 NS_NewRunnableFunction("DNSListenerProxy::OnLookupComplete",
28 [self
, request
, record
, aStatus
]() {
29 Unused
<< self
->mListener
->OnLookupComplete(
30 request
, record
, aStatus
);
31 self
->mListener
= nullptr;
37 } // namespace mozilla