Revert "Correctly const-qualify return value of IceControllerInterface::connections()."

This reverts commit ad631f0d353011b8d4282577310abb48bf60ff67.

Reason for revert: error: virtual function 'connections' has a different return type ('ArrayView<const cricket::Connection *>') than the function it overrides (which has return type 'ArrayView<const Connection *const>')

Original change's description:
> Correctly const-qualify return value of IceControllerInterface::connections().
>
> This is intended to be a read-only view across a container of const
> Connection*, but due to the missing const, elements of the container
> could actually be re-assigned through the ArrayView.
>
> This was discovered when trying to roll Googletest, since Googletest was
> fixed to const-qualify converting actions:
> cbca6bc395
>
> Bug: chromium:1409870
> Change-Id: Iadd3abe6807111987e422b8510a23f2a4f7026ed
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329481
> Auto-Submit: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#41300}

Bug: chromium:1409870
Change-Id: Id0026eb7727a3d1408045d0040b3b080cca07832
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329762
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Manashi Sarkar <manashi@google.com>
Cr-Commit-Position: refs/heads/main@{#41307}
This commit is contained in:
Manashi Sarkar 2023-12-04 12:10:15 +00:00 committed by WebRTC LUCI CQ
parent be02328f0e
commit c925f50c1c
3 changed files with 6 additions and 4 deletions

View File

@ -32,8 +32,10 @@ class BasicIceController : public IceControllerInterface {
void SetSelectedConnection(const Connection* selected_connection) override;
void AddConnection(const Connection* connection) override;
void OnConnectionDestroyed(const Connection* connection) override;
rtc::ArrayView<const Connection* const> connections() const override {
return connections_;
rtc::ArrayView<const Connection*> connections() const override {
return rtc::ArrayView<const Connection*>(
const_cast<const Connection**>(connections_.data()),
connections_.size());
}
bool HasPingableConnection() const override;

View File

@ -101,7 +101,7 @@ class IceControllerInterface {
virtual void OnConnectionDestroyed(const Connection* connection) = 0;
// These are all connections that has been added and not destroyed.
virtual rtc::ArrayView<const Connection* const> connections() const = 0;
virtual rtc::ArrayView<const Connection*> connections() const = 0;
// Is there a pingable connection ?
// This function is used to boot-strap pinging, after this returns true

View File

@ -35,7 +35,7 @@ class MockIceController : public cricket::IceControllerInterface {
OnConnectionDestroyed,
(const cricket::Connection*),
(override));
MOCK_METHOD(rtc::ArrayView<const cricket::Connection* const>,
MOCK_METHOD(rtc::ArrayView<const cricket::Connection*>,
connections,
(),
(const, override));