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}
This commit is contained in:
Steve Anton 2019-01-25 12:49:14 -08:00 committed by Commit Bot
parent 48c5493393
commit e76ca61238
4 changed files with 11 additions and 6 deletions

2
DEPS
View File

@ -1428,6 +1428,8 @@ include_rules = [
"+rtc_tools", "+rtc_tools",
# Abseil whitelist. Keep this in sync with abseil-in-webrtc.md. # Abseil whitelist. Keep this in sync with abseil-in-webrtc.md.
"+absl/algorithm/algorithm.h",
"+absl/algorithm/container.h",
"+absl/base/attributes.h", "+absl/base/attributes.h",
"+absl/container/inlined_vector.h", "+absl/container/inlined_vector.h",
"+absl/memory/memory.h", "+absl/memory/memory.h",

View File

@ -20,6 +20,8 @@ adds the first use.
`absl::is_trivially_copy_assignable`, and `absl::is_trivially_copy_assignable`, and
`absl::is_trivially_destructible` from `absl/meta/type_traits.h`. `absl::is_trivially_destructible` from `absl/meta/type_traits.h`.
* `absl::variant` and related stuff from `absl/types/variant.h`. * `absl::variant` and related stuff from `absl/types/variant.h`.
* The functions in `absl/algorithm/algorithm.h` and
`absl/algorithm/container.h`
## **Disallowed** ## **Disallowed**

View File

@ -102,6 +102,7 @@ rtc_static_library("rtc_p2p") {
"../rtc_base/third_party/sigslot", "../rtc_base/third_party/sigslot",
"../system_wrappers:field_trial", "../system_wrappers:field_trial",
"../system_wrappers:metrics", "../system_wrappers:metrics",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/memory", "//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional", "//third_party/abseil-cpp/absl/types:optional",

View File

@ -10,11 +10,11 @@
#include "p2p/base/p2p_transport_channel.h" #include "p2p/base/p2p_transport_channel.h"
#include <algorithm>
#include <iterator> #include <iterator>
#include <set> #include <set>
#include <utility> #include <utility>
#include "absl/algorithm/container.h"
#include "api/candidate.h" #include "api/candidate.h"
#include "logging/rtc_event_log/ice_logger.h" #include "logging/rtc_event_log/ice_logger.h"
#include "p2p/base/candidate_pair_interface.h" #include "p2p/base/candidate_pair_interface.h"
@ -1460,9 +1460,9 @@ void P2PTransportChannel::MaybeStartPinging() {
} }
int64_t now = rtc::TimeMillis(); int64_t now = rtc::TimeMillis();
if (std::any_of( if (absl::c_any_of(connections_, [this, now](const Connection* c) {
connections_.begin(), connections_.end(), return IsPingable(c, now);
[this, now](const Connection* c) { return IsPingable(c, now); })) { })) {
RTC_LOG(LS_INFO) << ToString() RTC_LOG(LS_INFO) << ToString()
<< ": Have a pingable connection for the first time; " << ": Have a pingable connection for the first time; "
"starting to ping."; "starting to ping.";
@ -1996,8 +1996,8 @@ void P2PTransportChannel::CheckAndPing() {
// When the selected connection is not receiving or not writable, or any // When the selected connection is not receiving or not writable, or any
// active connection has not been pinged enough times, use the weak ping // active connection has not been pinged enough times, use the weak ping
// interval. // interval.
bool need_more_pings_at_weak_interval = std::any_of( bool need_more_pings_at_weak_interval =
connections_.begin(), connections_.end(), [](Connection* conn) { absl::c_any_of(connections_, [](Connection* conn) {
return conn->active() && return conn->active() &&
conn->num_pings_sent() < MIN_PINGS_AT_WEAK_PING_INTERVAL; conn->num_pings_sent() < MIN_PINGS_AT_WEAK_PING_INTERVAL;
}); });