Bug 1844673 [wpt PR 41130] - Update wpt metadata, a=testonly
[gecko.git] / netwerk / dns / DNSListenerProxy.cpp
blob8468edca2df83132d508d8411e3aafd7637acccc
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"
10 namespace mozilla {
11 namespace net {
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)
18 NS_INTERFACE_MAP_END
20 NS_IMETHODIMP
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;
32 }),
33 NS_DISPATCH_NORMAL);
36 } // namespace net
37 } // namespace mozilla