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}
diff --git a/p2p/base/fake_port_allocator.h b/p2p/base/fake_port_allocator.h
index ce57608..e4528bc 100644
--- a/p2p/base/fake_port_allocator.h
+++ b/p2p/base/fake_port_allocator.h
@@ -226,16 +226,6 @@
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,
absl::string_view ice_ufrag,
diff --git a/p2p/base/port_allocator.cc b/p2p/base/port_allocator.cc
index 4963f34..099d8b27 100644
--- a/p2p/base/port_allocator.cc
+++ b/p2p/base/port_allocator.cc
@@ -314,12 +314,13 @@
}
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 {
diff --git a/p2p/base/port_allocator.h b/p2p/base/port_allocator.h
index 29f5326..5072bf9 100644
--- a/p2p/base/port_allocator.h
+++ b/p2p/base/port_allocator.h
@@ -609,12 +609,12 @@
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_;
diff --git a/p2p/base/port_interface.cc b/p2p/base/port_interface.cc
index ae9f320..997f9f9 100644
--- a/p2p/base/port_interface.cc
+++ b/p2p/base/port_interface.cc
@@ -20,8 +20,8 @@
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
diff --git a/p2p/base/port_interface.h b/p2p/base/port_interface.h
index 431de06..5b5265d 100644
--- a/p2p/base/port_interface.h
+++ b/p2p/base/port_interface.h
@@ -63,8 +63,8 @@
// 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.
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc
index c350034..b69ec4e 100644
--- a/p2p/base/port_unittest.cc
+++ b/p2p/base/port_unittest.cc
@@ -179,10 +179,6 @@
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;
}
diff --git a/p2p/base/stun_port.cc b/p2p/base/stun_port.cc
index 866d517..e48283c 100644
--- a/p2p/base/stun_port.cc
+++ b/p2p/base/stun_port.cc
@@ -348,10 +348,6 @@
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;
}
diff --git a/p2p/base/stun_port.h b/p2p/base/stun_port.h
index 2b04108..fd814a9 100644
--- a/p2p/base/stun_port.h
+++ b/p2p/base/stun_port.h
@@ -101,7 +101,6 @@
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;
diff --git a/p2p/base/tcp_port.cc b/p2p/base/tcp_port.cc
index 546b544..978ce12 100644
--- a/p2p/base/tcp_port.cc
+++ b/p2p/base/tcp_port.cc
@@ -269,10 +269,6 @@
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;
}
diff --git a/p2p/base/tcp_port.h b/p2p/base/tcp_port.h
index 8ef4963..063c173 100644
--- a/p2p/base/tcp_port.h
+++ b/p2p/base/tcp_port.h
@@ -63,7 +63,6 @@
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;
diff --git a/p2p/base/turn_port.cc b/p2p/base/turn_port.cc
index 6ab7bb1..f78015f 100644
--- a/p2p/base/turn_port.cc
+++ b/p2p/base/turn_port.cc
@@ -763,10 +763,6 @@
}
}
-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;
diff --git a/p2p/base/turn_port.h b/p2p/base/turn_port.h
index b5abe1a..08b3669 100644
--- a/p2p/base/turn_port.h
+++ b/p2p/base/turn_port.h
@@ -159,7 +159,6 @@
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);
diff --git a/p2p/client/basic_port_allocator.cc b/p2p/client/basic_port_allocator.cc
index 9500ed02..4cecc11 100644
--- a/p2p/client/basic_port_allocator.cc
+++ b/p2p/client/basic_port_allocator.cc
@@ -255,16 +255,6 @@
}
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,
absl::string_view ice_ufrag,
diff --git a/p2p/client/basic_port_allocator.h b/p2p/client/basic_port_allocator.h
index 9a423b9..86001b5 100644
--- a/p2p/client/basic_port_allocator.h
+++ b/p2p/client/basic_port_allocator.h
@@ -69,11 +69,6 @@
}
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,
absl::string_view ice_ufrag,