From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../webrtc/transport/ipc/StunAddrsRequestChild.h | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 dom/media/webrtc/transport/ipc/StunAddrsRequestChild.h (limited to 'dom/media/webrtc/transport/ipc/StunAddrsRequestChild.h') diff --git a/dom/media/webrtc/transport/ipc/StunAddrsRequestChild.h b/dom/media/webrtc/transport/ipc/StunAddrsRequestChild.h new file mode 100644 index 0000000000..f487f52baf --- /dev/null +++ b/dom/media/webrtc/transport/ipc/StunAddrsRequestChild.h @@ -0,0 +1,64 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_net_StunAddrsRequestChild_h +#define mozilla_net_StunAddrsRequestChild_h + +#include "mozilla/net/PStunAddrsRequestChild.h" + +class nsISerialEventTarget; + +namespace mozilla::net { + +class StunAddrsListener { + public: + virtual void OnMDNSQueryComplete(const nsCString& hostname, + const Maybe& address) = 0; + virtual void OnStunAddrsAvailable(const NrIceStunAddrArray& addrs) = 0; + + NS_IMETHOD_(MozExternalRefCountType) AddRef(); + NS_IMETHOD_(MozExternalRefCountType) Release(); + + protected: + virtual ~StunAddrsListener() = default; + + ThreadSafeAutoRefCnt mRefCnt; + NS_DECL_OWNINGTHREAD +}; + +class StunAddrsRequestChild final : public PStunAddrsRequestChild { + friend class PStunAddrsRequestChild; + + public: + explicit StunAddrsRequestChild(StunAddrsListener* listener); + + NS_IMETHOD_(MozExternalRefCountType) AddRef(); + NS_IMETHOD_(MozExternalRefCountType) Release(); + + // Not sure why AddIPDLReference & ReleaseIPDLReference don't come + // from PStunAddrsRequestChild since the IPC plumbing seem to + // expect this. + void AddIPDLReference() { AddRef(); } + void ReleaseIPDLReference() { Release(); } + + void Cancel(); + + protected: + virtual ~StunAddrsRequestChild() = default; + + virtual mozilla::ipc::IPCResult RecvOnMDNSQueryComplete( + const nsACString& aHostname, const Maybe& aAddress) override; + + virtual mozilla::ipc::IPCResult RecvOnStunAddrsAvailable( + const NrIceStunAddrArray& addrs) override; + + RefPtr mListener; + + ThreadSafeAutoRefCnt mRefCnt; + NS_DECL_OWNINGTHREAD +}; + +} // namespace mozilla::net + +#endif // mozilla_net_StunAddrsRequestChild_h -- cgit v1.2.3