Add IceControllerInterface::GetConnections() and fix return type.

This is a replacement for `connections()`, which is const-qualified but
returns a `rtc::ArrayView<const cricket::Connection*>`. Unfortunately,
this is a view of mutable pointers to `const cricket::Connection`
objects: this means that the pointers in `IceControllerInterface`'s
backing store can be reassigned.

Returning `rtc::ArrayView<const cricket::Connection* const>` is more
consistent with how a view returned from a const-qualified method should
behave. Unfortunately, there are downstream overrides of this method, so
instead of just fixing this outright, add a new method with the correct
return type. Once downstream is updated, the old method can then be
removed.

Bug: chromium:1409870, webrtc:15702
Change-Id: I3d8f0c2f0bcf4c393ee63959cb61761ac00a28ab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329962
Reviewed-by: Jonas Oreland <jonaso@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#41318}
diff --git a/p2p/base/ice_controller_interface.h b/p2p/base/ice_controller_interface.h
index 8b63ed3..fb421cf 100644
--- a/p2p/base/ice_controller_interface.h
+++ b/p2p/base/ice_controller_interface.h
@@ -19,6 +19,7 @@
 #include "p2p/base/connection.h"
 #include "p2p/base/ice_switch_reason.h"
 #include "p2p/base/ice_transport_internal.h"
+#include "rtc_base/checks.h"
 #include "rtc_base/system/rtc_export.h"
 
 namespace cricket {
@@ -53,7 +54,7 @@
 // Connection::ForgetLearnedState - return in SwitchResult
 //
 // The IceController shall keep track of all connections added
-// (and not destroyed) and give them back using the connections()-function-
+// (and not destroyed) and give them back using the GetConnections() function.
 //
 // When a Connection gets destroyed
 // - signals on Connection::SignalDestroyed
@@ -101,7 +102,17 @@
   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> GetConnections() const {
+    // Stub implementation to simplify downstream roll.
+    RTC_CHECK_NOTREACHED();
+    return {};
+  }
+  // TODO(bugs.webrtc.org/15702): Remove this after downstream is cleaned up.
+  virtual rtc::ArrayView<const Connection*> connections() const {
+    // Stub implementation to simplify downstream removal.
+    RTC_CHECK_NOTREACHED();
+    return {};
+  }
 
   // Is there a pingable connection ?
   // This function is used to boot-strap pinging, after this returns true