Remove std::string version of some functions that are no longer needed.

The absl::string_view versions can now be made pure virtual due to
downstream client changes. The std::string versions in the base
classes are still needed by downstream users, but will be removed
eventually.

Bug: webrtc:13579
Change-Id: Id757a07380f0518edf407ff5d0644511eb1e53d3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265980
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37349}
This commit is contained in:
Ali Tofigh 2022-06-23 13:43:02 +02:00 committed by WebRTC LUCI CQ
parent 7a66900683
commit 58ecd42deb
14 changed files with 12 additions and 55 deletions

View File

@ -225,16 +225,6 @@ class FakePortAllocator : public cricket::PortAllocator {
void SetNetworkIgnoreMask(int network_ignore_mask) override {}
cricket::PortAllocatorSession* CreateSessionInternal(
const std::string& content_name,
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd) override {
return CreateSessionInternal(absl::string_view(content_name), component,
absl::string_view(ice_ufrag),
absl::string_view(ice_pwd));
}
cricket::PortAllocatorSession* CreateSessionInternal(
absl::string_view content_name,
int component,

View File

@ -314,12 +314,13 @@ std::vector<IceParameters> PortAllocator::GetPooledIceCredentials() {
}
PortAllocatorSession* PortAllocator::CreateSessionInternal(
absl::string_view content_name,
const std::string& content_name,
int component,
absl::string_view ice_ufrag,
absl::string_view ice_pwd) {
return CreateSessionInternal(std::string(content_name), component,
std::string(ice_ufrag), std::string(ice_pwd));
const std::string& ice_ufrag,
const std::string& ice_pwd) {
return CreateSessionInternal(absl::string_view(content_name), component,
absl::string_view(ice_ufrag),
absl::string_view(ice_pwd));
}
Candidate PortAllocator::SanitizeCandidate(const Candidate& c) const {

View File

@ -609,12 +609,12 @@ class RTC_EXPORT PortAllocator : public sigslot::has_slots<> {
const std::string& content_name,
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd) = 0;
const std::string& ice_pwd);
virtual PortAllocatorSession* CreateSessionInternal(
absl::string_view content_name,
int component,
absl::string_view ice_ufrag,
absl::string_view ice_pwd);
absl::string_view ice_pwd) = 0;
const std::vector<std::unique_ptr<PortAllocatorSession>>& pooled_sessions() {
return pooled_sessions_;

View File

@ -20,8 +20,8 @@ PortInterface::PortInterface() = default;
PortInterface::~PortInterface() = default;
bool PortInterface::SupportsProtocol(absl::string_view protocol) const {
return SupportsProtocol(std::string(protocol));
bool PortInterface::SupportsProtocol(const std::string& protocol) const {
return SupportsProtocol(absl::string_view(protocol));
}
} // namespace cricket

View File

@ -63,8 +63,8 @@ class PortInterface {
// TODO(webrtc:13579): Remove std::string version once downstream users have
// migrated to the absl::string_view version.
virtual bool SupportsProtocol(const std::string& protocol) const = 0;
virtual bool SupportsProtocol(absl::string_view protocol) const;
virtual bool SupportsProtocol(const std::string& protocol) const;
virtual bool SupportsProtocol(absl::string_view protocol) const = 0;
// PrepareAddress will attempt to get an address for this port that other
// clients can send to. It may take some time before the address is ready.

View File

@ -179,10 +179,6 @@ class TestPort : public Port {
ICE_TYPE_PREFERENCE_HOST, 0, "", true);
}
virtual bool SupportsProtocol(const std::string& protocol) const {
return SupportsProtocol(absl::string_view(protocol));
}
virtual bool SupportsProtocol(absl::string_view protocol) const {
return true;
}

View File

@ -348,10 +348,6 @@ bool UDPPort::HandleIncomingPacket(rtc::AsyncPacketSocket* socket,
return true;
}
bool UDPPort::SupportsProtocol(const std::string& protocol) const {
return SupportsProtocol(absl::string_view(protocol));
}
bool UDPPort::SupportsProtocol(absl::string_view protocol) const {
return protocol == UDP_PROTOCOL_NAME;
}

View File

@ -101,7 +101,6 @@ class UDPPort : public Port {
const rtc::SocketAddress& remote_addr,
int64_t packet_time_us) override;
bool SupportsProtocol(const std::string& protocol) const override;
bool SupportsProtocol(absl::string_view protocol) const override;
ProtocolType GetProtocol() const override;

View File

@ -269,10 +269,6 @@ int TCPPort::GetError() {
return error_;
}
bool TCPPort::SupportsProtocol(const std::string& protocol) const {
return SupportsProtocol(absl::string_view(protocol));
}
bool TCPPort::SupportsProtocol(absl::string_view protocol) const {
return protocol == TCP_PROTOCOL_NAME || protocol == SSLTCP_PROTOCOL_NAME;
}

View File

@ -63,7 +63,6 @@ class TCPPort : public Port {
int GetOption(rtc::Socket::Option opt, int* value) override;
int SetOption(rtc::Socket::Option opt, int value) override;
int GetError() override;
bool SupportsProtocol(const std::string& protocol) const override;
bool SupportsProtocol(absl::string_view protocol) const override;
ProtocolType GetProtocol() const override;

View File

@ -763,10 +763,6 @@ void TurnPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
}
}
bool TurnPort::SupportsProtocol(const std::string& protocol) const {
return SupportsProtocol(absl::string_view(protocol));
}
bool TurnPort::SupportsProtocol(absl::string_view protocol) const {
// Turn port only connects to UDP candidates.
return protocol == UDP_PROTOCOL_NAME;

View File

@ -159,7 +159,6 @@ class TurnPort : public Port {
void OnSentPacket(rtc::AsyncPacketSocket* socket,
const rtc::SentPacket& sent_packet) override;
virtual void OnReadyToSend(rtc::AsyncPacketSocket* socket);
bool SupportsProtocol(const std::string& protocol) const override;
bool SupportsProtocol(absl::string_view protocol) const override;
void OnSocketConnect(rtc::AsyncPacketSocket* socket);

View File

@ -254,16 +254,6 @@ int BasicPortAllocator::GetNetworkIgnoreMask() const {
return mask;
}
PortAllocatorSession* BasicPortAllocator::CreateSessionInternal(
const std::string& content_name,
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd) {
return CreateSessionInternal(absl::string_view(content_name), component,
absl::string_view(ice_ufrag),
absl::string_view(ice_pwd));
}
PortAllocatorSession* BasicPortAllocator::CreateSessionInternal(
absl::string_view content_name,
int component,

View File

@ -68,11 +68,6 @@ class RTC_EXPORT BasicPortAllocator : public PortAllocator {
return socket_factory_.get();
}
PortAllocatorSession* CreateSessionInternal(
const std::string& content_name,
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd) override;
PortAllocatorSession* CreateSessionInternal(
absl::string_view content_name,
int component,