Allow use of functions in absl/algorithms

Bug: None
Change-Id: Id8311e6374228675cd34e413411611c77ed2d36d
Reviewed-on: https://webrtc-review.googlesource.com/c/119963
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26427}
diff --git a/DEPS b/DEPS
index 0dafe31..5eab1f2 100644
--- a/DEPS
+++ b/DEPS
@@ -1428,6 +1428,8 @@
   "+rtc_tools",
 
   # Abseil whitelist. Keep this in sync with abseil-in-webrtc.md.
+  "+absl/algorithm/algorithm.h",
+  "+absl/algorithm/container.h",
   "+absl/base/attributes.h",
   "+absl/container/inlined_vector.h",
   "+absl/memory/memory.h",
diff --git a/abseil-in-webrtc.md b/abseil-in-webrtc.md
index 1075aa9..117d515 100644
--- a/abseil-in-webrtc.md
+++ b/abseil-in-webrtc.md
@@ -20,6 +20,8 @@
   `absl::is_trivially_copy_assignable`, and
   `absl::is_trivially_destructible` from `absl/meta/type_traits.h`.
 * `absl::variant` and related stuff from `absl/types/variant.h`.
+* The functions in `absl/algorithm/algorithm.h` and
+  `absl/algorithm/container.h`
 
 ## **Disallowed**
 
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index 4ccb2fc..6148105 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -102,6 +102,7 @@
     "../rtc_base/third_party/sigslot",
     "../system_wrappers:field_trial",
     "../system_wrappers:metrics",
+    "//third_party/abseil-cpp/absl/algorithm:container",
     "//third_party/abseil-cpp/absl/memory",
     "//third_party/abseil-cpp/absl/strings",
     "//third_party/abseil-cpp/absl/types:optional",
diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc
index 6fee024..89f9199 100644
--- a/p2p/base/p2p_transport_channel.cc
+++ b/p2p/base/p2p_transport_channel.cc
@@ -10,11 +10,11 @@
 
 #include "p2p/base/p2p_transport_channel.h"
 
-#include <algorithm>
 #include <iterator>
 #include <set>
 #include <utility>
 
+#include "absl/algorithm/container.h"
 #include "api/candidate.h"
 #include "logging/rtc_event_log/ice_logger.h"
 #include "p2p/base/candidate_pair_interface.h"
@@ -1460,9 +1460,9 @@
   }
 
   int64_t now = rtc::TimeMillis();
-  if (std::any_of(
-          connections_.begin(), connections_.end(),
-          [this, now](const Connection* c) { return IsPingable(c, now); })) {
+  if (absl::c_any_of(connections_, [this, now](const Connection* c) {
+        return IsPingable(c, now);
+      })) {
     RTC_LOG(LS_INFO) << ToString()
                      << ": Have a pingable connection for the first time; "
                         "starting to ping.";
@@ -1996,8 +1996,8 @@
   // When the selected connection is not receiving or not writable, or any
   // active connection has not been pinged enough times, use the weak ping
   // interval.
-  bool need_more_pings_at_weak_interval = std::any_of(
-      connections_.begin(), connections_.end(), [](Connection* conn) {
+  bool need_more_pings_at_weak_interval =
+      absl::c_any_of(connections_, [](Connection* conn) {
         return conn->active() &&
                conn->num_pings_sent() < MIN_PINGS_AT_WEAK_PING_INTERVAL;
       });