Delete deprecated AsyncResolver and related classes To be submitted after downstream usage has been removed, but no earlier than December 1, 2023. Bug: webrtc:12598 Change-Id: Id9acbac591c48c0c5883fe8f06cf6a68471b70f0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323004 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41290}
diff --git a/api/BUILD.gn b/api/BUILD.gn index dfbf671..8cd0f02 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn
@@ -430,15 +430,10 @@ rtc_source_set("packet_socket_factory") { visibility = [ "*" ] - sources = [ - "async_resolver_factory.h", - "packet_socket_factory.h", - ] + sources = [ "packet_socket_factory.h" ] deps = [ ":async_dns_resolver", - ":wrapping_async_dns_resolver", "../rtc_base:async_packet_socket", - "../rtc_base:async_resolver_interface", "../rtc_base:proxy_info", "../rtc_base:socket_address", "../rtc_base/system:rtc_export", @@ -456,28 +451,6 @@ absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ] } -rtc_source_set("wrapping_async_dns_resolver") { - visibility = [ - ":*", - "../p2p:rtc_p2p", - ] - sources = [ - "wrapping_async_dns_resolver.cc", - "wrapping_async_dns_resolver.h", - ] - deps = [ - ":async_dns_resolver", - ":sequence_checker", - "../rtc_base:async_resolver_interface", - "../rtc_base:checks", - "../rtc_base:macromagic", - "../rtc_base:socket_address", - "../rtc_base:threading", - "../rtc_base/third_party/sigslot", - ] - absl_deps = [ "//third_party/abseil-cpp/absl/memory" ] -} - rtc_source_set("ref_count") { visibility = [ "*" ] sources = [ "ref_count.h" ]
diff --git a/api/async_resolver_factory.h b/api/async_resolver_factory.h deleted file mode 100644 index 997fe5c..0000000 --- a/api/async_resolver_factory.h +++ /dev/null
@@ -1,36 +0,0 @@ -/* - * Copyright 2018 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef API_ASYNC_RESOLVER_FACTORY_H_ -#define API_ASYNC_RESOLVER_FACTORY_H_ - -#include "rtc_base/async_resolver_interface.h" - -namespace webrtc { - -// An abstract factory for creating AsyncResolverInterfaces. This allows -// client applications to provide WebRTC with their own mechanism for -// performing DNS resolution. -// TODO(bugs.webrtc.org/12598): Deprecate and remove. -class [[deprecated("Use AsyncDnsResolverFactory")]] AsyncResolverFactory { - public: - AsyncResolverFactory() = default; - virtual ~AsyncResolverFactory() = default; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - // The caller should call Destroy on the returned object to delete it. - virtual rtc::AsyncResolverInterface* Create() = 0; -#pragma clang diagnostic pop -}; - -} // namespace webrtc - -#endif // API_ASYNC_RESOLVER_FACTORY_H_
diff --git a/api/ice_transport_interface.h b/api/ice_transport_interface.h index ecf5dc4..f4c7613 100644 --- a/api/ice_transport_interface.h +++ b/api/ice_transport_interface.h
@@ -14,7 +14,6 @@ #include <string> #include "api/async_dns_resolver.h" -#include "api/async_resolver_factory.h" #include "api/ref_count.h" #include "api/rtc_error.h" #include "api/rtc_event_log/rtc_event_log.h" @@ -61,19 +60,8 @@ } void set_async_dns_resolver_factory( AsyncDnsResolverFactoryInterface* async_dns_resolver_factory) { - RTC_DCHECK(!async_resolver_factory_); async_dns_resolver_factory_ = async_dns_resolver_factory; } - [[deprecated("Use async_dns_resolver_factory")]] AsyncResolverFactory* - async_resolver_factory() { - return async_resolver_factory_; - } - ABSL_DEPRECATED("bugs.webrtc.org/12598") - void set_async_resolver_factory( - AsyncResolverFactory* async_resolver_factory) { - RTC_DCHECK(!async_dns_resolver_factory_); - async_resolver_factory_ = async_resolver_factory; - } RtcEventLog* event_log() { return event_log_; } void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; } @@ -115,11 +103,6 @@ private: cricket::PortAllocator* port_allocator_ = nullptr; AsyncDnsResolverFactoryInterface* async_dns_resolver_factory_ = nullptr; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - // For backwards compatibility. Only one resolver factory can be set. - AsyncResolverFactory* async_resolver_factory_ = nullptr; -#pragma clang diagnostic pop RtcEventLog* event_log_ = nullptr; cricket::IceControllerFactoryInterface* ice_controller_factory_ = nullptr; cricket::ActiveIceControllerFactoryInterface* active_ice_controller_factory_ =
diff --git a/api/packet_socket_factory.h b/api/packet_socket_factory.h index e389ccb..78b93b5 100644 --- a/api/packet_socket_factory.h +++ b/api/packet_socket_factory.h
@@ -16,7 +16,6 @@ #include <vector> #include "api/async_dns_resolver.h" -#include "api/wrapping_async_dns_resolver.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/proxy_info.h" #include "rtc_base/system/rtc_export.h" @@ -72,26 +71,8 @@ const std::string& user_agent, const PacketSocketTcpOptions& tcp_options) = 0; - // The AsyncResolverInterface is deprecated; users are encouraged - // to switch to the AsyncDnsResolverInterface. - // TODO(bugs.webrtc.org/12598): Remove once all downstream users - // are converted. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [[deprecated]] virtual AsyncResolverInterface* CreateAsyncResolver() { - // Default implementation, so that downstream users can remove this - // immediately after changing to CreateAsyncDnsResolver - RTC_DCHECK_NOTREACHED(); - return nullptr; - } - virtual std::unique_ptr<webrtc::AsyncDnsResolverInterface> - CreateAsyncDnsResolver() { - // Default implementation, to aid in transition to AsyncDnsResolverInterface - return std::make_unique<webrtc::WrappingAsyncDnsResolver>( - CreateAsyncResolver()); - } -#pragma clang diagnostic pop + CreateAsyncDnsResolver() = 0; private: PacketSocketFactory(const PacketSocketFactory&) = delete;
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index 920e291..5286cc9 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h
@@ -80,7 +80,6 @@ #include "absl/types/optional.h" #include "api/adaptation/resource.h" #include "api/async_dns_resolver.h" -#include "api/async_resolver_factory.h" #include "api/audio/audio_mixer.h" #include "api/audio_codecs/audio_decoder_factory.h" #include "api/audio_codecs/audio_encoder_factory.h" @@ -1388,13 +1387,6 @@ // Factory for creating resolvers that look up hostnames in DNS std::unique_ptr<webrtc::AsyncDnsResolverFactoryInterface> async_dns_resolver_factory; - // Deprecated - use async_dns_resolver_factory -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [[deprecated("Use async_dns_resolver_factory")]] std::unique_ptr< - webrtc::AsyncResolverFactory> - async_resolver_factory; -#pragma clang diagnostic pop std::unique_ptr<webrtc::IceTransportFactory> ice_transport_factory; std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator; std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier;
diff --git a/api/test/pclf/media_configuration.h b/api/test/pclf/media_configuration.h index 5bcb308..5c3440c 100644 --- a/api/test/pclf/media_configuration.h +++ b/api/test/pclf/media_configuration.h
@@ -24,7 +24,6 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/array_view.h" -#include "api/async_resolver_factory.h" #include "api/audio/audio_mixer.h" #include "api/audio_options.h" #include "api/call/call_factory_interface.h"
diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h index 74470cd..034e13f 100644 --- a/api/test/peerconnection_quality_test_fixture.h +++ b/api/test/peerconnection_quality_test_fixture.h
@@ -25,7 +25,6 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/array_view.h" -#include "api/async_resolver_factory.h" #include "api/audio/audio_mixer.h" #include "api/call/call_factory_interface.h" #include "api/fec_controller.h"
diff --git a/api/wrapping_async_dns_resolver.h b/api/wrapping_async_dns_resolver.h deleted file mode 100644 index b384f97..0000000 --- a/api/wrapping_async_dns_resolver.h +++ /dev/null
@@ -1,135 +0,0 @@ -/* - * Copyright 2021 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef API_WRAPPING_ASYNC_DNS_RESOLVER_H_ -#define API_WRAPPING_ASYNC_DNS_RESOLVER_H_ - -#include <functional> -#include <memory> -#include <utility> - -#include "absl/memory/memory.h" -#include "api/async_dns_resolver.h" -#include "api/sequence_checker.h" -#include "rtc_base/async_resolver.h" -#include "rtc_base/async_resolver_interface.h" -#include "rtc_base/checks.h" -#include "rtc_base/socket_address.h" -#include "rtc_base/third_party/sigslot/sigslot.h" -#include "rtc_base/thread_annotations.h" - -// This file defines a DNS resolver that wraps an old-style -// AsyncResolver. -// It is part of the conversion to the newer interface, and will go away -// once conversion is finished. -// TODO(bugs.webrtc.org/12598): Delete this API. - -namespace webrtc { - -class [[deprecated("Use AsyncDnsResolver directly")]] WrappingAsyncDnsResolver; - -class [[deprecated( - "Use AsyncDnsResolver directly")]] RTC_EXPORT WrappingAsyncDnsResolverResult - : public AsyncDnsResolverResult { - public: - explicit WrappingAsyncDnsResolverResult(WrappingAsyncDnsResolver* owner) - : owner_(owner) {} - ~WrappingAsyncDnsResolverResult() {} - - // Note: Inline declaration not possible, since it refers to - // WrappingAsyncDnsResolver. - bool GetResolvedAddress(int family, rtc::SocketAddress* addr) const override; - int GetError() const override; - - private: - WrappingAsyncDnsResolver* const owner_; -}; - -class RTC_EXPORT WrappingAsyncDnsResolver : public AsyncDnsResolverInterface, - public sigslot::has_slots<> { - public: -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - explicit WrappingAsyncDnsResolver(rtc::AsyncResolverInterface* wrapped) - : wrapped_(absl::WrapUnique(wrapped)), result_(this) {} - - ~WrappingAsyncDnsResolver() override { - // Workaround to get around the fact that sigslot-using objects can't be - // destroyed from within their callback: Alert class users early. - // TODO(bugs.webrtc.org/12651): Delete this class once the sigslot users are - // gone. - RTC_CHECK(!within_resolve_result_); - wrapped_.release()->Destroy(false); - } - - void Start(const rtc::SocketAddress& addr, - absl::AnyInvocable<void()> callback) override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - PrepareToResolve(std::move(callback)); - wrapped_->Start(addr); - } - - void Start(const rtc::SocketAddress& addr, - int family, - absl::AnyInvocable<void()> callback) override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - PrepareToResolve(std::move(callback)); - wrapped_->Start(addr, family); - } - - const AsyncDnsResolverResult& result() const override { - RTC_DCHECK_RUN_ON(&sequence_checker_); - RTC_DCHECK_EQ(State::kResolved, state_); - return result_; - } - - private: - enum class State { kNotStarted, kStarted, kResolved }; - - friend class WrappingAsyncDnsResolverResult; - // For use by WrappingAsyncDnsResolverResult - rtc::AsyncResolverInterface* wrapped() const { - RTC_DCHECK_RUN_ON(&sequence_checker_); - return wrapped_.get(); - } - - void PrepareToResolve(absl::AnyInvocable<void()> callback) { - RTC_DCHECK_RUN_ON(&sequence_checker_); - RTC_DCHECK_EQ(State::kNotStarted, state_); - state_ = State::kStarted; - callback_ = std::move(callback); - wrapped_->SignalDone.connect(this, - &WrappingAsyncDnsResolver::OnResolveResult); - } - - void OnResolveResult(rtc::AsyncResolverInterface* ref) { - RTC_DCHECK_RUN_ON(&sequence_checker_); - RTC_DCHECK(state_ == State::kStarted); - RTC_DCHECK_EQ(ref, wrapped_.get()); - state_ = State::kResolved; - within_resolve_result_ = true; - callback_(); - within_resolve_result_ = false; - } - - // The class variables need to be accessed on a single thread. - SequenceChecker sequence_checker_; - absl::AnyInvocable<void()> callback_ RTC_GUARDED_BY(sequence_checker_); - std::unique_ptr<rtc::AsyncResolverInterface> wrapped_ - RTC_GUARDED_BY(sequence_checker_); - State state_ RTC_GUARDED_BY(sequence_checker_) = State::kNotStarted; - WrappingAsyncDnsResolverResult result_ RTC_GUARDED_BY(sequence_checker_); - bool within_resolve_result_ RTC_GUARDED_BY(sequence_checker_) = false; -#pragma clang diagnostic pop -}; - -} // namespace webrtc - -#endif // API_WRAPPING_ASYNC_DNS_RESOLVER_H_