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}
This commit is contained in:
parent
8f530e8d78
commit
ad631f0d35
@ -32,10 +32,8 @@ 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*> connections() const override {
|
||||
return rtc::ArrayView<const Connection*>(
|
||||
const_cast<const Connection**>(connections_.data()),
|
||||
connections_.size());
|
||||
rtc::ArrayView<const Connection* const> connections() const override {
|
||||
return connections_;
|
||||
}
|
||||
|
||||
bool HasPingableConnection() const override;
|
||||
|
||||
@ -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*> connections() const = 0;
|
||||
virtual rtc::ArrayView<const Connection* const> connections() const = 0;
|
||||
|
||||
// Is there a pingable connection ?
|
||||
// This function is used to boot-strap pinging, after this returns true
|
||||
|
||||
@ -35,7 +35,7 @@ class MockIceController : public cricket::IceControllerInterface {
|
||||
OnConnectionDestroyed,
|
||||
(const cricket::Connection*),
|
||||
(override));
|
||||
MOCK_METHOD(rtc::ArrayView<const cricket::Connection*>,
|
||||
MOCK_METHOD(rtc::ArrayView<const cricket::Connection* const>,
|
||||
connections,
|
||||
(),
|
||||
(const, override));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user