[cleanup] Replace base::ranges with std::ranges: services/
Done entirely with `git grep` and `sed` + `git cl format`, no hand-editing. Bug: 386918226 Change-Id: I81f5c7da2f7ff208aee257190ac82e0734cce819 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6201962 Owners-Override: Peter Kasting <pkasting@chromium.org> Commit-Queue: Peter Kasting <pkasting@chromium.org> Auto-Submit: Peter Kasting <pkasting@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/main@{#1411642}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2eb886d873
commit
f9d73bf132
services
accessibility
android
features
audio
group_coordinator-impl.hloopback_stream.ccloopback_stream_unittest.ccoutput_controller.ccstream_factory.cc
cert_verifier
cert_net_url_loader
data_decoder
public
device
compute_pressure
generic_sensor
platform_sensor.ccplatform_sensor_chromeos.ccplatform_sensor_fusion.ccplatform_sensor_linux.ccplatform_sensor_provider_chromeos.ccplatform_sensor_util.cc
geolocation
fake_position_cache.ccgeolocation_context.ccgeolocation_provider_impl.cclocation_provider_manager_unittest.ccnetwork_location_provider.ccnetwork_location_request.ccposition_cache_impl.ccwifi_data_provider_chromeos.cc
hid
public
cpp
serial
usb
image_annotation
media_session
network
attribution
cookie_settings.ccignore_errors_cert_verifier.ccnetwork_change_manager.ccnetwork_context.ccnetwork_context_unittest.ccnetwork_service_network_delegate.ccnetwork_service_unittest.ccoblivious_http_request_handler.ccorb
p2p
prefetch_matches.ccprefetch_url_loader_client_unittest.ccpublic
cpp
sct_auditing
shared_dictionary
tcp_bound_socket_unittest.cctrust_tokens
boringssl_trust_token_test_utils.cctrust_token_key_commitment_parser.cctrust_token_key_commitments_unittest.cctrust_token_key_filtering_unittest.cctrust_token_request_issuance_helper.cctrust_token_request_signing_helper.cctrust_token_request_signing_helper_unittest.cctrust_token_store.cc
url_loader.ccweb_bundle
preferences
public
proxy_resolver
screen_ai
service_manager
tracing
video_capture
webnn
@ -209,7 +209,7 @@ int32_t AccessibilityWindowInfoDataWrapper::GetWindowId() const {
|
||||
}
|
||||
|
||||
void AccessibilityWindowInfoDataWrapper::AddVirtualChild(int32_t child_id) {
|
||||
if (base::ranges::find(virtual_child_ids_, child_id) !=
|
||||
if (std::ranges::find(virtual_child_ids_, child_id) !=
|
||||
virtual_child_ids_.end()) {
|
||||
LOG(ERROR) << "Given child id already exists as a virtual child.";
|
||||
} else {
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/accessibility/android/auto_complete_handler.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "services/accessibility/android/accessibility_info_data_wrapper.h"
|
||||
#include "services/accessibility/android/accessibility_node_info_data_wrapper.h"
|
||||
#include "services/accessibility/android/accessibility_window_info_data_wrapper.h"
|
||||
@ -217,9 +217,9 @@ TEST_F(AutoCompleteHandlerTest, PreEventAndPostSerialize) {
|
||||
AutoCompleteHandler::CreateIfNecessary(tree_source(), *event_data);
|
||||
ASSERT_EQ(2U, create_result.size());
|
||||
|
||||
auto editable1_handler = base::ranges::find(
|
||||
auto editable1_handler = std::ranges::find(
|
||||
create_result, 1, &AutoCompleteHandler::IdAndHandler::first);
|
||||
auto editable2_handler = base::ranges::find(
|
||||
auto editable2_handler = std::ranges::find(
|
||||
create_result, 2, &AutoCompleteHandler::IdAndHandler::first);
|
||||
ASSERT_NE(editable1_handler, create_result.end());
|
||||
ASSERT_NE(editable2_handler, create_result.end());
|
||||
|
@ -113,7 +113,7 @@ PaneTitleHandler::CreateIfNecessary(
|
||||
const auto& itr = event_data.int_list_properties->find(
|
||||
mojom::AccessibilityEventIntListProperty::CONTENT_CHANGE_TYPES);
|
||||
if (itr == event_data.int_list_properties->end() ||
|
||||
base::ranges::find(
|
||||
std::ranges::find(
|
||||
itr->second,
|
||||
static_cast<int32_t>(mojom::ContentChangeType::PANE_APPEARED)) ==
|
||||
itr->second.end()) {
|
||||
|
@ -81,8 +81,8 @@ v8::Local<v8::Value> V8ValueConverter::ToArrayBuffer(
|
||||
const base::Value::BlobStorage& value) const {
|
||||
v8::Local<v8::ArrayBuffer> buffer =
|
||||
v8::ArrayBuffer::New(isolate, value.size());
|
||||
base::ranges::copy(value,
|
||||
static_cast<uint8_t*>(buffer->GetBackingStore()->Data()));
|
||||
std::ranges::copy(value,
|
||||
static_cast<uint8_t*>(buffer->GetBackingStore()->Data()));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,12 @@
|
||||
#ifndef SERVICES_AUDIO_GROUP_COORDINATOR_IMPL_H_
|
||||
#define SERVICES_AUDIO_GROUP_COORDINATOR_IMPL_H_
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
#define DCHECK_INCREMENT_MUTATION_COUNT() ++mutation_count_
|
||||
@ -65,7 +66,7 @@ void GroupCoordinator<Member>::UnregisterMember(
|
||||
|
||||
const auto group_it = FindGroup(group_id);
|
||||
std::vector<Member*>& members = group_it->second.members;
|
||||
const auto member_it = base::ranges::find(members, member);
|
||||
const auto member_it = std::ranges::find(members, member);
|
||||
CHECK(member_it != members.end(), base::NotFatalUntil::M130);
|
||||
members.erase(member_it);
|
||||
DCHECK_INCREMENT_MUTATION_COUNT();
|
||||
@ -101,7 +102,7 @@ void GroupCoordinator<Member>::RemoveObserver(
|
||||
|
||||
const auto group_it = FindGroup(group_id);
|
||||
std::vector<Observer*>& observers = group_it->second.observers;
|
||||
const auto it = base::ranges::find(observers, observer);
|
||||
const auto it = std::ranges::find(observers, observer);
|
||||
CHECK(it != observers.end(), base::NotFatalUntil::M130);
|
||||
observers.erase(it);
|
||||
DCHECK_INCREMENT_MUTATION_COUNT();
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/audio/loopback_stream.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/sync_socket.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/time/default_tick_clock.h"
|
||||
@ -261,7 +261,7 @@ void LoopbackStream::FlowNetwork::RemoveInput(SnooperNode* node) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(control_sequence_);
|
||||
|
||||
base::AutoLock scoped_lock(lock_);
|
||||
const auto it = base::ranges::find(inputs_, node);
|
||||
const auto it = std::ranges::find(inputs_, node);
|
||||
CHECK(it != inputs_.end(), base::NotFatalUntil::M130);
|
||||
inputs_.erase(it);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/audio/loopback_stream.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@ -12,7 +13,6 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/unguessable_token.h"
|
||||
@ -162,7 +162,7 @@ class LoopbackStreamTest : public testing::Test {
|
||||
|
||||
void RemoveSource(FakeLoopbackGroupMember* source) {
|
||||
const auto it =
|
||||
base::ranges::find_if(sources_, base::MatchesUniquePtr(source));
|
||||
std::ranges::find_if(sources_, base::MatchesUniquePtr(source));
|
||||
if (it != sources_.end()) {
|
||||
coordinator_.UnregisterMember(group_id_, source);
|
||||
sources_.erase(it);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@ -18,7 +19,6 @@
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
@ -521,7 +521,7 @@ void OutputController::StopSnooping(Snooper* snooper) {
|
||||
|
||||
// The list will only update on this thread, and only be read on the realtime
|
||||
// audio thread.
|
||||
const auto it = base::ranges::find(snoopers_, snooper);
|
||||
const auto it = std::ranges::find(snoopers_, snooper);
|
||||
CHECK(it != snoopers_.end(), base::NotFatalUntil::M130);
|
||||
// We also don't care about ordering, so swap and pop rather than erase.
|
||||
base::AutoLock lock(snooper_lock_);
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/audio/stream_factory.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "base/unguessable_token.h"
|
||||
@ -165,7 +165,7 @@ void StreamFactory::BindMuter(
|
||||
group_id);
|
||||
|
||||
// Find the existing LocalMuter for this group, or create one on-demand.
|
||||
auto it = base::ranges::find(muters_, group_id, &LocalMuter::group_id);
|
||||
auto it = std::ranges::find(muters_, group_id, &LocalMuter::group_id);
|
||||
LocalMuter* muter;
|
||||
if (it == muters_.end()) {
|
||||
auto muter_ptr = std::make_unique<LocalMuter>(&coordinator_, group_id);
|
||||
@ -257,8 +257,8 @@ void StreamFactory::DestroyMuter(base::WeakPtr<LocalMuter> muter) {
|
||||
auto do_destroy = [](base::WeakPtr<StreamFactory> weak_this,
|
||||
base::WeakPtr<LocalMuter> muter) {
|
||||
if (weak_this && muter) {
|
||||
const auto it = base::ranges::find_if(
|
||||
weak_this->muters_, base::MatchesUniquePtr(muter.get()));
|
||||
const auto it = std::ranges::find_if(weak_this->muters_,
|
||||
base::MatchesUniquePtr(muter.get()));
|
||||
|
||||
// The LocalMuter can still have receivers if a receiver was bound after
|
||||
// DestroyMuter is called but before the do_destroy task is run.
|
||||
@ -278,7 +278,7 @@ void StreamFactory::DestroyLoopbackStream(LoopbackStream* stream) {
|
||||
DCHECK(stream);
|
||||
|
||||
const auto it =
|
||||
base::ranges::find_if(loopback_streams_, base::MatchesUniquePtr(stream));
|
||||
std::ranges::find_if(loopback_streams_, base::MatchesUniquePtr(stream));
|
||||
CHECK(it != loopback_streams_.end(), base::NotFatalUntil::M130);
|
||||
loopback_streams_.erase(it);
|
||||
|
||||
|
@ -58,6 +58,7 @@
|
||||
|
||||
#include "services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
@ -72,7 +73,6 @@
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/numerics/safe_math.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
@ -469,7 +469,7 @@ void Job::AttachRequest(
|
||||
void Job::DetachRequest(CertNetFetcherURLLoader::RequestCore* request) {
|
||||
std::unique_ptr<Job> delete_this;
|
||||
|
||||
auto it = base::ranges::find(requests_, request);
|
||||
auto it = std::ranges::find(requests_, request);
|
||||
CHECK(it != requests_.end(), base::NotFatalUntil::M130);
|
||||
requests_.erase(it);
|
||||
|
||||
|
@ -469,8 +469,8 @@ TEST_F(SafeWebBundleParserTest, ParseWebBundleWithRelativeUrls) {
|
||||
|
||||
std::vector<GURL> requests;
|
||||
requests.reserve(metadata->requests.size());
|
||||
base::ranges::transform(metadata->requests, std::back_inserter(requests),
|
||||
[](const auto& entry) { return entry.first; });
|
||||
std::ranges::transform(metadata->requests, std::back_inserter(requests),
|
||||
[](const auto& entry) { return entry.first; });
|
||||
EXPECT_THAT(requests, UnorderedElementsAreArray(
|
||||
{GURL("https://test.example.org/absolute-url"),
|
||||
GURL("https://example.com/relative-url-1"),
|
||||
|
@ -177,7 +177,7 @@ mojom::PressureState CpuProbeManager::CalculateState(const CpuSample& sample) {
|
||||
// with thresholds defining the state.
|
||||
const auto& kStateThresholds = state_thresholds();
|
||||
|
||||
auto it = base::ranges::lower_bound(kStateThresholds, sample.cpu_utilization);
|
||||
auto it = std::ranges::lower_bound(kStateThresholds, sample.cpu_utilization);
|
||||
if (it == kStateThresholds.end()) {
|
||||
NOTREACHED() << "unexpected value: " << sample.cpu_utilization;
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ bool PlatformSensor::UpdateSharedBuffer(const SensorReading& reading) {
|
||||
// previous value.
|
||||
if (GetReportingMode() == mojom::ReportingMode::ON_CHANGE &&
|
||||
last_rounded_reading_.has_value() &&
|
||||
base::ranges::equal(rounded_reading.raw.values,
|
||||
last_rounded_reading_->raw.values)) {
|
||||
std::ranges::equal(rounded_reading.raw.values,
|
||||
last_rounded_reading_->raw.values)) {
|
||||
return false;
|
||||
}
|
||||
// Save rounded value for next comparison.
|
||||
@ -278,7 +278,7 @@ bool PlatformSensor::IsSignificantlyDifferent(const SensorReading& lhs,
|
||||
case mojom::SensorType::ABSOLUTE_ORIENTATION_QUATERNION:
|
||||
case mojom::SensorType::RELATIVE_ORIENTATION_QUATERNION:
|
||||
case mojom::SensorType::MAGNETOMETER:
|
||||
return !base::ranges::equal(lhs.raw.values, rhs.raw.values);
|
||||
return !std::ranges::equal(lhs.raw.values, rhs.raw.values);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/device/generic_sensor/platform_sensor_chromeos.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/time/time.h"
|
||||
#include "services/device/public/cpp/generic_sensor/sensor_traits.h"
|
||||
@ -349,7 +349,7 @@ void PlatformSensorChromeOS::GetAllChannelIdsCallback(
|
||||
iio_channel_ids_ = iio_channel_ids;
|
||||
|
||||
for (const std::string& channel : required_channel_ids_) {
|
||||
auto it = base::ranges::find(iio_channel_ids_, channel);
|
||||
auto it = std::ranges::find(iio_channel_ids_, channel);
|
||||
if (it == iio_channel_ids_.end()) {
|
||||
LOG(ERROR) << "Missing channel: " << channel;
|
||||
ResetOnError();
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "services/device/generic_sensor/platform_sensor_fusion.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
#include "base/check.h"
|
||||
@ -17,7 +18,6 @@
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/time/time.h"
|
||||
#include "services/device/generic_sensor/platform_sensor_fusion_algorithm.h"
|
||||
#include "services/device/generic_sensor/platform_sensor_provider.h"
|
||||
@ -124,7 +124,7 @@ PlatformSensorFusion::PlatformSensorFusion(
|
||||
|
||||
fusion_algorithm_->set_fusion_sensor(this);
|
||||
|
||||
if (base::ranges::any_of(source_sensors_, [](const auto& pair) {
|
||||
if (std::ranges::any_of(source_sensors_, [](const auto& pair) {
|
||||
return pair.second->GetReportingMode() ==
|
||||
mojom::ReportingMode::ON_CHANGE;
|
||||
})) {
|
||||
|
@ -4,9 +4,10 @@
|
||||
|
||||
#include "services/device/generic_sensor/platform_sensor_linux.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/time/time.h"
|
||||
#include "services/device/generic_sensor/linux/sensor_data_linux.h"
|
||||
#include "services/device/generic_sensor/platform_sensor_reader_linux.h"
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "chromeos/components/sensors/sensor_util.h"
|
||||
@ -201,7 +200,7 @@ PlatformSensorProviderChromeOS::ParseLocation(
|
||||
chromeos::sensors::mojom::kLocationBase,
|
||||
chromeos::sensors::mojom::kLocationLid,
|
||||
chromeos::sensors::mojom::kLocationCamera};
|
||||
const auto it = base::ranges::find(location_strings, raw_location.value());
|
||||
const auto it = std::ranges::find(location_strings, raw_location.value());
|
||||
if (it == std::end(location_strings))
|
||||
return std::nullopt;
|
||||
|
||||
@ -417,7 +416,7 @@ bool PlatformSensorProviderChromeOS::AreAllSensorsReady() const {
|
||||
if (!sensor_ids_received_)
|
||||
return false;
|
||||
|
||||
return base::ranges::all_of(sensors_, [](const auto& sensor) {
|
||||
return std::ranges::all_of(sensors_, [](const auto& sensor) {
|
||||
return sensor.second.ignored ||
|
||||
(sensor.second.scale.has_value() &&
|
||||
(!DeviceNeedsLocationWithTypes(sensor.second.types) ||
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
#include "services/device/generic_sensor/platform_sensor_util.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "services/device/public/cpp/generic_sensor/sensor_reading.h"
|
||||
|
||||
namespace device {
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
#include "services/device/geolocation/fake_position_cache.h"
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "services/device/geolocation/wifi_data.h"
|
||||
#include "services/device/public/cpp/geolocation/geoposition.h"
|
||||
|
||||
@ -36,7 +37,7 @@ void FakePositionCache::CachePosition(const WifiData& wifi_data,
|
||||
const mojom::Geoposition* FakePositionCache::FindPosition(
|
||||
const WifiData& wifi_data) {
|
||||
auto it =
|
||||
base::ranges::find_if(data, [&wifi_data](const auto& candidate_pair) {
|
||||
std::ranges::find_if(data, [&wifi_data](const auto& candidate_pair) {
|
||||
return SetsEqual(wifi_data.access_point_data,
|
||||
candidate_pair.first.access_point_data);
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ void GeolocationContext::OnPermissionRevoked(const url::Origin& origin) {
|
||||
|
||||
void GeolocationContext::OnConnectionError(GeolocationImpl* impl) {
|
||||
auto it =
|
||||
base::ranges::find(impls_, impl, &std::unique_ptr<GeolocationImpl>::get);
|
||||
std::ranges::find(impls_, impl, &std::unique_ptr<GeolocationImpl>::get);
|
||||
CHECK(it != impls_.end(), base::NotFatalUntil::M130);
|
||||
impls_.erase(it);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/device/geolocation/geolocation_provider_impl.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
@ -17,7 +18,6 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/singleton.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/time/default_tick_clock.h"
|
||||
#include "build/build_config.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "services/device/geolocation/location_provider_manager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
@ -17,7 +18,6 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/test/bind.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "base/test/task_environment.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/device/geolocation/network_location_provider.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
@ -12,7 +13,6 @@
|
||||
#include "base/location.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/task/task_runner.h"
|
||||
@ -95,7 +95,7 @@ void NetworkLocationProvider::FillDiagnostics(
|
||||
}
|
||||
diagnostics.network_location_diagnostics =
|
||||
mojom::NetworkLocationDiagnostics::New();
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
wifi_data_.access_point_data,
|
||||
std::back_inserter(
|
||||
diagnostics.network_location_diagnostics->access_point_data),
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
@ -22,7 +23,6 @@
|
||||
#include "base/metrics/histogram.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/escape.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
@ -130,7 +130,7 @@ std::vector<mojom::AccessPointDataPtr> RequestToMojom(
|
||||
return {};
|
||||
}
|
||||
std::vector<mojom::AccessPointDataPtr> request;
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
*access_points_list, std::back_inserter(request),
|
||||
[&wifi_timestamp](const base::Value& ap_value) {
|
||||
const auto& ap_dict = ap_value.GetDict();
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
#include "services/device/geolocation/position_cache_impl.h"
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "components/device_event_log/device_event_log.h"
|
||||
#include "services/device/geolocation/wifi_data.h"
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/ranges/functional.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "chromeos/ash/components/network/geolocation_handler.h"
|
||||
#include "chromeos/ash/components/network/network_handler.h"
|
||||
@ -61,8 +62,8 @@ std::optional<WifiData> GetWifiData() {
|
||||
}
|
||||
|
||||
// Sort AP sightings by age, most recent first.
|
||||
base::ranges::sort(access_points, base::ranges::greater(),
|
||||
&ash::WifiAccessPoint::timestamp);
|
||||
std::ranges::sort(access_points, std::ranges::greater(),
|
||||
&ash::WifiAccessPoint::timestamp);
|
||||
|
||||
// Truncate to kApUseLimit.
|
||||
if (access_points.size() > kApUseLimit) {
|
||||
|
@ -4,9 +4,10 @@
|
||||
|
||||
#include "services/device/hid/hid_connection.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "components/device_event_log/device_event_log.h"
|
||||
#include "services/device/public/cpp/hid/hid_report_type.h"
|
||||
#include "services/device/public/cpp/hid/hid_report_utils.h"
|
||||
@ -18,7 +19,7 @@ namespace {
|
||||
|
||||
bool HasAlwaysProtectedCollection(
|
||||
const std::vector<mojom::HidCollectionInfoPtr>& collections) {
|
||||
return base::ranges::any_of(collections, [](const auto& collection) {
|
||||
return std::ranges::any_of(collections, [](const auto& collection) {
|
||||
return IsAlwaysProtected(*collection->usage, HidReportType::kInput) ||
|
||||
IsAlwaysProtected(*collection->usage, HidReportType::kOutput) ||
|
||||
IsAlwaysProtected(*collection->usage, HidReportType::kFeature);
|
||||
|
@ -9,9 +9,10 @@
|
||||
|
||||
#include "services/device/hid/hid_connection_impl.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
|
||||
namespace device {
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/device/hid/hid_connection_win.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
@ -14,7 +15,6 @@
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/win/object_watcher.h"
|
||||
#include "components/device_event_log/device_event_log.h"
|
||||
#include "services/device/public/cpp/device_features.h"
|
||||
@ -327,8 +327,8 @@ void HidConnectionWin::OnWriteComplete(HANDLE file_handle,
|
||||
|
||||
std::unique_ptr<PendingHidTransfer> HidConnectionWin::UnlinkTransfer(
|
||||
PendingHidTransfer* transfer) {
|
||||
auto it = base::ranges::find(transfers_, transfer,
|
||||
&std::unique_ptr<PendingHidTransfer>::get);
|
||||
auto it = std::ranges::find(transfers_, transfer,
|
||||
&std::unique_ptr<PendingHidTransfer>::get);
|
||||
CHECK(it != transfers_.end(), base::NotFatalUntil::M130);
|
||||
std::unique_ptr<PendingHidTransfer> saved_transfer = std::move(*it);
|
||||
transfers_.erase(it);
|
||||
|
@ -300,7 +300,7 @@ std::vector<mojom::HidReportDescriptionPtr> CreateReportDescriptions(
|
||||
auto report_items = preparsed_data.GetReportItems(report_type);
|
||||
|
||||
// Sort items by |report_id| and |bit_index|.
|
||||
base::ranges::sort(report_items, [](const auto& a, const auto& b) {
|
||||
std::ranges::sort(report_items, [](const auto& a, const auto& b) {
|
||||
if (a.report_id < b.report_id)
|
||||
return true;
|
||||
if (a.report_id == b.report_id)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "services/device/public/cpp/generic_sensor/sensor_mojom_traits.h"
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace mojo {
|
||||
|
||||
@ -45,7 +45,7 @@ bool StructTraits<
|
||||
}
|
||||
|
||||
out->raw.timestamp = data.timestamp();
|
||||
base::ranges::copy(raw_values, out->raw.values);
|
||||
std::ranges::copy(raw_values, out->raw.values);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ bool CollectionHasUnprotectedReports(
|
||||
const mojom::HidCollectionInfo& collection) {
|
||||
const HidReportType report_types[] = {
|
||||
HidReportType::kInput, HidReportType::kOutput, HidReportType::kFeature};
|
||||
return base::ranges::any_of(report_types, [&collection](auto report_type) {
|
||||
return std::ranges::any_of(report_types, [&collection](auto report_type) {
|
||||
return !ReportsForType(collection, report_type).empty() &&
|
||||
!IsAlwaysProtected(*collection.usage, report_type);
|
||||
});
|
||||
@ -80,7 +80,7 @@ const mojom::HidCollectionInfo* FindCollectionWithReport(
|
||||
|
||||
// Return the first collection with a report of type `report_type`, or
|
||||
// nullptr if there is no report of that type.
|
||||
auto find_it = base::ranges::find_if(
|
||||
auto find_it = std::ranges::find_if(
|
||||
device.collections, [report_type](const auto& collection) {
|
||||
return !ReportsForType(*collection, report_type).empty();
|
||||
});
|
||||
@ -99,7 +99,7 @@ const mojom::HidCollectionInfo* FindCollectionWithReport(
|
||||
|
||||
// Return the collection containing a report with `report_id` and type
|
||||
// `report_type`, or nullptr if it is not in any collection.
|
||||
auto find_it = base::ranges::find_if(
|
||||
auto find_it = std::ranges::find_if(
|
||||
device.collections, [report_id, report_type](const auto& collection) {
|
||||
return base::Contains(ReportsForType(*collection, report_type),
|
||||
report_id,
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/device/public/cpp/test/fake_usb_device.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -13,7 +14,6 @@
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "services/device/public/cpp/test/mock_usb_mojo_device.h"
|
||||
#include "services/device/public/cpp/usb/usb_utils.h"
|
||||
|
||||
@ -127,7 +127,7 @@ void FakeUsbDevice::ClaimInterface(uint8_t interface_number,
|
||||
}
|
||||
|
||||
const mojom::UsbDeviceInfo& device_info = device_->GetDeviceInfo();
|
||||
auto config_it = base::ranges::find(
|
||||
auto config_it = std::ranges::find(
|
||||
device_info.configurations, device_info.active_configuration,
|
||||
&mojom::UsbConfigurationInfo::configuration_value);
|
||||
if (config_it == device_info.configurations.end()) {
|
||||
@ -137,8 +137,8 @@ void FakeUsbDevice::ClaimInterface(uint8_t interface_number,
|
||||
}
|
||||
|
||||
auto interface_it =
|
||||
base::ranges::find((*config_it)->interfaces, interface_number,
|
||||
&mojom::UsbInterfaceInfo::interface_number);
|
||||
std::ranges::find((*config_it)->interfaces, interface_number,
|
||||
&mojom::UsbInterfaceInfo::interface_number);
|
||||
if (interface_it == (*config_it)->interfaces.end()) {
|
||||
std::move(callback).Run(mojom::UsbClaimInterfaceResult::kFailure);
|
||||
LOG(ERROR) << "No such interface in " << (*config_it)->interfaces.size()
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
#include "services/device/public/cpp/usb/usb_ids.h"
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace device {
|
||||
|
||||
// static
|
||||
const UsbVendor* UsbIds::FindVendor(uint16_t vendor_id) {
|
||||
const UsbVendor key = {/*name=*/{}, /*products=*/{}, vendor_id};
|
||||
auto it = base::ranges::lower_bound(
|
||||
auto it = std::ranges::lower_bound(
|
||||
vendors_, key, [](const auto& a, const auto& b) { return a.id < b.id; });
|
||||
if (it == vendors_.end() || it->id != vendor_id) {
|
||||
return nullptr;
|
||||
@ -36,7 +36,7 @@ const char* UsbIds::GetProductName(uint16_t vendor_id, uint16_t product_id) {
|
||||
}
|
||||
|
||||
const UsbProduct key = {product_id, /*name=*/{}};
|
||||
auto it = base::ranges::lower_bound(
|
||||
auto it = std::ranges::lower_bound(
|
||||
vendor->products, key,
|
||||
[](const auto& a, const auto& b) { return a.id < b.id; });
|
||||
if (it == vendor->products.end() || it->id != product_id) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/device/serial/serial_port_manager_impl.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@ -12,7 +13,6 @@
|
||||
#include "base/command_line.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/test/bind.h"
|
||||
#include "base/test/gmock_callback_support.h"
|
||||
@ -422,7 +422,7 @@ TEST_F(SerialPortManagerImplTest, BluetoothDeviceChanged) {
|
||||
TestFuture<std::vector<mojom::SerialPortInfoPtr>> get_devices_future;
|
||||
port_manager->GetDevices(get_devices_future.GetCallback());
|
||||
auto port_it =
|
||||
base::ranges::find_if(get_devices_future.Get(), [&](const auto& port) {
|
||||
std::ranges::find_if(get_devices_future.Get(), [&](const auto& port) {
|
||||
return port->path == base::FilePath::FromASCII(kDeviceAddress);
|
||||
});
|
||||
ASSERT_NE(port_it, get_devices_future.Get().end());
|
||||
@ -462,7 +462,7 @@ TEST_F(SerialPortManagerImplTest, BluetoothDeviceConnectedStateChanged) {
|
||||
TestFuture<std::vector<mojom::SerialPortInfoPtr>> get_devices_future;
|
||||
port_manager->GetDevices(get_devices_future.GetCallback());
|
||||
auto port_it =
|
||||
base::ranges::find_if(get_devices_future.Get(), [&](const auto& port) {
|
||||
std::ranges::find_if(get_devices_future.Get(), [&](const auto& port) {
|
||||
return port->path == base::FilePath::FromASCII(kDeviceAddress);
|
||||
});
|
||||
ASSERT_NE(port_it, get_devices_future.Get().end());
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
@ -17,7 +18,6 @@
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "services/device/public/cpp/usb/usb_utils.h"
|
||||
#include "services/device/usb/usb_device.h"
|
||||
@ -173,8 +173,8 @@ bool DeviceImpl::HasControlTransferPermission(
|
||||
interface = device_handle_->FindInterfaceByEndpoint(index & 0xff);
|
||||
} else {
|
||||
auto interface_it =
|
||||
base::ranges::find(config->interfaces, index & 0xff,
|
||||
&mojom::UsbInterfaceInfo::interface_number);
|
||||
std::ranges::find(config->interfaces, index & 0xff,
|
||||
&mojom::UsbInterfaceInfo::interface_number);
|
||||
if (interface_it != config->interfaces.end())
|
||||
interface = interface_it->get();
|
||||
}
|
||||
@ -267,8 +267,8 @@ void DeviceImpl::ClaimInterface(uint8_t interface_number,
|
||||
}
|
||||
|
||||
auto interface_it =
|
||||
base::ranges::find(config->interfaces, interface_number,
|
||||
&mojom::UsbInterfaceInfo::interface_number);
|
||||
std::ranges::find(config->interfaces, interface_number,
|
||||
&mojom::UsbInterfaceInfo::interface_number);
|
||||
if (interface_it == config->interfaces.end()) {
|
||||
std::move(callback).Run(mojom::UsbClaimInterfaceResult::kFailure);
|
||||
return;
|
||||
|
@ -9,11 +9,10 @@
|
||||
#pragma allow_unsafe_buffers
|
||||
#endif
|
||||
|
||||
#include "services/device/usb/mojo/device_impl.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
@ -27,7 +26,6 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
@ -39,6 +37,7 @@
|
||||
#include "mojo/public/cpp/test_support/test_utils.h"
|
||||
#include "services/device/usb/mock_usb_device.h"
|
||||
#include "services/device/usb/mock_usb_device_handle.h"
|
||||
#include "services/device/usb/mojo/device_impl.h"
|
||||
#include "services/device/usb/usb_descriptors.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
@ -994,11 +993,11 @@ TEST_F(USBDeviceImplTest, GenericTransfer) {
|
||||
|
||||
std::string message1 = "say hello please";
|
||||
std::vector<uint8_t> fake_outbound_data(message1.size());
|
||||
base::ranges::copy(message1, fake_outbound_data.begin());
|
||||
std::ranges::copy(message1, fake_outbound_data.begin());
|
||||
|
||||
std::string message2 = "hello world!";
|
||||
std::vector<uint8_t> fake_inbound_data(message2.size());
|
||||
base::ranges::copy(message2, fake_inbound_data.begin());
|
||||
std::ranges::copy(message2, fake_inbound_data.begin());
|
||||
|
||||
AddMockConfig(ConfigBuilder(1).AddInterface(7, 0, 1, 2, 3).Build());
|
||||
AddMockOutboundData(fake_outbound_data);
|
||||
@ -1064,11 +1063,11 @@ TEST_F(USBDeviceImplTest, IsochronousTransfer) {
|
||||
|
||||
std::string outbound_data = "aaaaaaaabbbbbbbbccccccccdddddddd";
|
||||
std::vector<uint8_t> fake_outbound_data(outbound_data.size());
|
||||
base::ranges::copy(outbound_data, fake_outbound_data.begin());
|
||||
std::ranges::copy(outbound_data, fake_outbound_data.begin());
|
||||
|
||||
std::string inbound_data = "ddddddddccccccccbbbbbbbbaaaaaaaa";
|
||||
std::vector<uint8_t> fake_inbound_data(inbound_data.size());
|
||||
base::ranges::copy(inbound_data, fake_inbound_data.begin());
|
||||
std::ranges::copy(inbound_data, fake_inbound_data.begin());
|
||||
|
||||
AddMockConfig(ConfigBuilder(1).AddInterface(7, 0, 1, 2, 3).Build());
|
||||
AddMockOutboundPackets(fake_outbound_data, std::move(fake_packets_in));
|
||||
@ -1120,11 +1119,11 @@ TEST_F(USBDeviceImplTest, IsochronousTransferOutBufferSizeMismatch) {
|
||||
|
||||
std::string outbound_data = "aaaaaaaabbbbbbbbccccccccdddddddd";
|
||||
std::vector<uint8_t> fake_outbound_data(outbound_data.size());
|
||||
base::ranges::copy(outbound_data, fake_outbound_data.begin());
|
||||
std::ranges::copy(outbound_data, fake_outbound_data.begin());
|
||||
|
||||
std::string inbound_data = "ddddddddccccccccbbbbbbbbaaaaaaaa";
|
||||
std::vector<uint8_t> fake_inbound_data(inbound_data.size());
|
||||
base::ranges::copy(inbound_data, fake_inbound_data.begin());
|
||||
std::ranges::copy(inbound_data, fake_inbound_data.begin());
|
||||
|
||||
AddMockConfig(ConfigBuilder(/*configuration_value=*/1)
|
||||
.AddInterface(/*interface_number=*/7,
|
||||
@ -1173,11 +1172,11 @@ TEST_F(USBDeviceImplTest, IsochronousTransferPacketLengthsOverflow) {
|
||||
|
||||
std::string outbound_data = "aaaaaaaabbbbbbbb";
|
||||
std::vector<uint8_t> fake_outbound_data(outbound_data.size());
|
||||
base::ranges::copy(outbound_data, fake_outbound_data.begin());
|
||||
std::ranges::copy(outbound_data, fake_outbound_data.begin());
|
||||
|
||||
std::string inbound_data = "bbbbbbbbaaaaaaaa";
|
||||
std::vector<uint8_t> fake_inbound_data(inbound_data.size());
|
||||
base::ranges::copy(inbound_data, fake_inbound_data.begin());
|
||||
std::ranges::copy(inbound_data, fake_inbound_data.begin());
|
||||
|
||||
AddMockConfig(ConfigBuilder(/*configuration_value=*/1)
|
||||
.AddInterface(/*interface_number=*/7,
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <linux/usbdevice_fs.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
@ -26,7 +27,6 @@
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
@ -992,8 +992,8 @@ void UsbDeviceHandleUsbfs::OnTimeout(Transfer* transfer) {
|
||||
std::unique_ptr<UsbDeviceHandleUsbfs::Transfer>
|
||||
UsbDeviceHandleUsbfs::RemoveFromTransferList(Transfer* transfer_ptr) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
auto it = base::ranges::find(transfers_, transfer_ptr,
|
||||
&std::unique_ptr<Transfer>::get);
|
||||
auto it = std::ranges::find(transfers_, transfer_ptr,
|
||||
&std::unique_ptr<Transfer>::get);
|
||||
CHECK(it != transfers_.end(), base::NotFatalUntil::M130);
|
||||
std::unique_ptr<Transfer> transfer = std::move(*it);
|
||||
transfers_.erase(it);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <winioctl.h>
|
||||
#include <winusb.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
@ -24,7 +25,6 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/threading/scoped_blocking_call.h"
|
||||
@ -1009,8 +1009,8 @@ UsbDeviceHandleWin::Request* UsbDeviceHandleWin::MakeRequest(
|
||||
|
||||
std::unique_ptr<UsbDeviceHandleWin::Request> UsbDeviceHandleWin::UnlinkRequest(
|
||||
UsbDeviceHandleWin::Request* request_ptr) {
|
||||
auto it = base::ranges::find(requests_, request_ptr,
|
||||
&std::unique_ptr<Request>::get);
|
||||
auto it =
|
||||
std::ranges::find(requests_, request_ptr, &std::unique_ptr<Request>::get);
|
||||
CHECK(it != requests_.end(), base::NotFatalUntil::M130);
|
||||
std::unique_ptr<Request> request = std::move(*it);
|
||||
requests_.erase(it);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/image_annotation/annotator.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
@ -18,7 +19,6 @@
|
||||
#include "base/location.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/values.h"
|
||||
@ -1103,11 +1103,11 @@ std::string Annotator::ComputePreferredLanguage(
|
||||
|
||||
std::string page_language = NormalizeLanguageCode(in_page_language);
|
||||
std::vector<std::string> accept_languages = client_->GetAcceptLanguages();
|
||||
base::ranges::transform(accept_languages, accept_languages.begin(),
|
||||
NormalizeLanguageCode);
|
||||
std::ranges::transform(accept_languages, accept_languages.begin(),
|
||||
NormalizeLanguageCode);
|
||||
std::vector<std::string> top_languages = client_->GetTopLanguages();
|
||||
base::ranges::transform(top_languages, top_languages.begin(),
|
||||
NormalizeLanguageCode);
|
||||
std::ranges::transform(top_languages, top_languages.begin(),
|
||||
NormalizeLanguageCode);
|
||||
|
||||
// If the page language is a server language and it's in the list of accept
|
||||
// languages or top languages for this user, return that.
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/media_session/audio_focus_manager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -11,7 +12,6 @@
|
||||
#include "base/containers/adapters.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/test/power_monitor_test.h"
|
||||
#include "base/test/task_environment.h"
|
||||
@ -243,9 +243,8 @@ class AudioFocusManagerTest
|
||||
private:
|
||||
int GetCountForType(mojom::AudioFocusType type) {
|
||||
const auto audio_focus_requests = GetRequests();
|
||||
return base::ranges::count(
|
||||
audio_focus_requests, type,
|
||||
&mojom::AudioFocusRequestState::audio_focus_type);
|
||||
return std::ranges::count(audio_focus_requests, type,
|
||||
&mojom::AudioFocusRequestState::audio_focus_type);
|
||||
}
|
||||
|
||||
std::vector<mojom::AudioFocusRequestStatePtr> GetRequests() {
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include "services/media_session/public/cpp/test/mock_media_session.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
|
||||
namespace media_session {
|
||||
namespace test {
|
||||
@ -82,8 +82,8 @@ void MockMediaSessionMojoObserver::MediaSessionInfoChanged(
|
||||
session_info_->microphone_state == wanted_microphone_state_ ||
|
||||
session_info_->camera_state == wanted_camera_state_ ||
|
||||
(wanted_audio_video_states_ &&
|
||||
base::ranges::is_permutation(*session_info_->audio_video_states,
|
||||
*wanted_audio_video_states_))) {
|
||||
std::ranges::is_permutation(*session_info_->audio_video_states,
|
||||
*wanted_audio_video_states_))) {
|
||||
QuitWaitingIfNeeded();
|
||||
}
|
||||
}
|
||||
@ -189,7 +189,7 @@ void MockMediaSessionMojoObserver::WaitForCameraState(
|
||||
|
||||
void MockMediaSessionMojoObserver::WaitForAudioVideoStates(
|
||||
const std::vector<mojom::MediaAudioVideoState>& wanted_states) {
|
||||
if (session_info_ && base::ranges::is_permutation(
|
||||
if (session_info_ && std::ranges::is_permutation(
|
||||
*session_info_->audio_video_states, wanted_states)) {
|
||||
return;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@ -13,7 +14,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/types/cxx23_to_underlying.h"
|
||||
#include "net/http/structured_headers.h"
|
||||
@ -98,7 +98,7 @@ void ApplyGrease(std::vector<net::structured_headers::DictionaryMember>& dict,
|
||||
if (dict.size() > 1 && options.reverse) {
|
||||
// Dictionaries retain order during serialization, so reordering helps
|
||||
// ensure that recipients do not depend on it.
|
||||
base::ranges::reverse(dict);
|
||||
std::ranges::reverse(dict);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/cookie_settings.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
@ -15,7 +16,6 @@
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/to_string.h"
|
||||
#include "base/types/optional_ref.h"
|
||||
#include "base/types/optional_util.h"
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
#include "services/network/ignore_errors_cert_verifier.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "crypto/sha2.h"
|
||||
#include "net/base/hash_value.h"
|
||||
@ -100,7 +100,7 @@ int IgnoreErrorsCertVerifier::Verify(const RequestParams& params,
|
||||
if (ignore_errors) {
|
||||
verify_result->Reset();
|
||||
verify_result->verified_cert = params.certificate();
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
spki_fingerprints, std::back_inserter(verify_result->public_key_hashes),
|
||||
[](const SHA256HashValue& v) { return HashValue(v); });
|
||||
if (!params.ocsp_response().empty()) {
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
#include "services/network/network_change_manager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "net/base/network_change_notifier.h"
|
||||
@ -110,7 +110,7 @@ size_t NetworkChangeManager::GetNumClientsForTesting() const {
|
||||
|
||||
void NetworkChangeManager::NotificationPipeBroken(
|
||||
mojom::NetworkChangeManagerClient* client) {
|
||||
clients_.erase(base::ranges::find(
|
||||
clients_.erase(std::ranges::find(
|
||||
clients_, client, &mojo::Remote<mojom::NetworkChangeManagerClient>::get));
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -2469,7 +2468,7 @@ const net::HttpAuthPreferences* NetworkContext::GetHttpAuthPreferences() const {
|
||||
}
|
||||
|
||||
size_t NetworkContext::NumOpenWebTransports() const {
|
||||
return base::ranges::count(web_transports_, false, &WebTransport::torn_down);
|
||||
return std::ranges::count(web_transports_, false, &WebTransport::torn_down);
|
||||
}
|
||||
|
||||
bool NetworkContext::AllURLLoaderFactoriesAreBoundToNetworkForTesting(
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "base/metrics/field_trial.h"
|
||||
#include "base/power_monitor/power_monitor.h"
|
||||
#include "base/power_monitor/power_monitor_source.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/escape.h"
|
||||
#include "base/strings/strcat.h"
|
||||
@ -6861,7 +6860,7 @@ TEST_F(NetworkContextTest, HangingHeaderClientAbortDuringOnHeadersReceived) {
|
||||
const net::cookie_util::ParsedRequestCookies& cookies,
|
||||
std::string_view name) {
|
||||
auto it =
|
||||
base::ranges::find(cookies, name, [](const auto& p) { return p.first; });
|
||||
std::ranges::find(cookies, name, [](const auto& p) { return p.first; });
|
||||
if (it == cookies.end()) {
|
||||
return ::testing::AssertionFailure() << "no cookie named " << name;
|
||||
}
|
||||
@ -6873,7 +6872,7 @@ TEST_F(NetworkContextTest, HangingHeaderClientAbortDuringOnHeadersReceived) {
|
||||
std::string_view name,
|
||||
std::string_view value) {
|
||||
auto it =
|
||||
base::ranges::find(cookies, name, [](const auto& p) { return p.first; });
|
||||
std::ranges::find(cookies, name, [](const auto& p) { return p.first; });
|
||||
if (it == cookies.end()) {
|
||||
return ::testing::AssertionFailure() << "no cookie named " << name;
|
||||
}
|
||||
@ -9632,7 +9631,7 @@ TEST_F(NetworkContextTest, ExemptUrlFromNetworkRevocationForNonce_InvalidURLs) {
|
||||
const std::string& url) {
|
||||
return network_context->IsNetworkForNonceAndUrlAllowed(nonce, GURL(url));
|
||||
};
|
||||
ASSERT_TRUE(base::ranges::all_of(invalid_urls, is_network_allowed));
|
||||
ASSERT_TRUE(std::ranges::all_of(invalid_urls, is_network_allowed));
|
||||
ASSERT_TRUE(
|
||||
network_context->IsNetworkForNonceAndUrlAllowed(nonce, GURL(valid_url)));
|
||||
|
||||
@ -9643,7 +9642,7 @@ TEST_F(NetworkContextTest, ExemptUrlFromNetworkRevocationForNonce_InvalidURLs) {
|
||||
EXPECT_TRUE(revoked.Wait());
|
||||
|
||||
// Now the `invalid_urls` and the `valid_url` all have network disabled.
|
||||
ASSERT_TRUE(base::ranges::none_of(invalid_urls, is_network_allowed));
|
||||
ASSERT_TRUE(std::ranges::none_of(invalid_urls, is_network_allowed));
|
||||
ASSERT_FALSE(
|
||||
network_context->IsNetworkForNonceAndUrlAllowed(nonce, GURL(valid_url)));
|
||||
|
||||
@ -9657,7 +9656,7 @@ TEST_F(NetworkContextTest, ExemptUrlFromNetworkRevocationForNonce_InvalidURLs) {
|
||||
|
||||
// Now the `valid_url` should be exempted. The `invalid_urls` are still
|
||||
// disabled for network.
|
||||
ASSERT_TRUE(base::ranges::none_of(invalid_urls, is_network_allowed));
|
||||
ASSERT_TRUE(std::ranges::none_of(invalid_urls, is_network_allowed));
|
||||
ASSERT_TRUE(
|
||||
network_context->IsNetworkForNonceAndUrlAllowed(nonce, GURL(valid_url)));
|
||||
}
|
||||
@ -10278,7 +10277,7 @@ class StorageAccessHeaderNetworkContextTest : public NetworkContextTest {
|
||||
ContentSettingsType content_type,
|
||||
std::initializer_list<PatternsAndSetting> patterns) {
|
||||
std::vector<ContentSettingPatternSource> settings;
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
patterns, std::back_inserter(settings),
|
||||
[](const PatternsAndSetting& patterns_and_setting) {
|
||||
return ContentSettingPatternSource(
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/network/network_service_network_delegate.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "base/debug/dump_without_crashing.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/types/optional_util.h"
|
||||
#include "build/build_config.h"
|
||||
@ -360,7 +360,7 @@ void NetworkServiceNetworkDelegate::OnCanSendReportingReports(
|
||||
}
|
||||
|
||||
std::vector<url::Origin> origin_vector;
|
||||
base::ranges::copy(origins, std::back_inserter(origin_vector));
|
||||
std::ranges::copy(origins, std::back_inserter(origin_vector));
|
||||
client->OnCanSendReportingReports(
|
||||
origin_vector,
|
||||
base::BindOnce(
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/network_service.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@ -17,7 +18,6 @@
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/escape.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -724,8 +724,8 @@ TEST_F(NetworkServiceTest, DisableDohUpgradeProviders) {
|
||||
auto FindProviderFeature =
|
||||
[](std::string_view provider) -> base::test::FeatureRef {
|
||||
const auto it =
|
||||
base::ranges::find(net::DohProviderEntry::GetList(), provider,
|
||||
&net::DohProviderEntry::provider);
|
||||
std::ranges::find(net::DohProviderEntry::GetList(), provider,
|
||||
&net::DohProviderEntry::provider);
|
||||
CHECK(it != net::DohProviderEntry::GetList().end())
|
||||
<< "Provider named \"" << provider
|
||||
<< "\" not found in DoH provider list.";
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "base/i18n/time_formatting.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "mojo/public/cpp/bindings/remote_set.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/http/http_log_util.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@ -19,7 +20,6 @@
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "net/base/mime_sniffer.h"
|
||||
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
|
||||
@ -164,7 +164,7 @@ const auto& GetNeverSniffedMimeTypes() {
|
||||
|
||||
// All items need to be lower-case, to support case-insensitive comparisons
|
||||
// later.
|
||||
DCHECK(base::ranges::all_of(kNeverSniffedMimeTypes, [](const auto& s) {
|
||||
DCHECK(std::ranges::all_of(kNeverSniffedMimeTypes, [](const auto& s) {
|
||||
return s == base::ToLowerASCII(s);
|
||||
}));
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
@ -23,7 +24,6 @@
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "net/base/mime_sniffer.h"
|
||||
|
||||
|
@ -11,13 +11,14 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/numerics/byte_conversions.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/test/bind.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
@ -38,8 +39,8 @@ FakeP2PSocketDelegate::~FakeP2PSocketDelegate() {
|
||||
}
|
||||
|
||||
void FakeP2PSocketDelegate::DestroySocket(P2PSocket* socket) {
|
||||
auto it = base::ranges::find(sockets_to_be_destroyed_, socket,
|
||||
&std::unique_ptr<P2PSocket>::get);
|
||||
auto it = std::ranges::find(sockets_to_be_destroyed_, socket,
|
||||
&std::unique_ptr<P2PSocket>::get);
|
||||
CHECK(it != sockets_to_be_destroyed_.end());
|
||||
sockets_to_be_destroyed_.erase(it);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/prefetch_matches.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
@ -26,7 +27,6 @@
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/memory/stack_allocated.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "build/buildflag.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/base/load_flags_to_string.h"
|
||||
|
@ -6,12 +6,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "base/time/time.h"
|
||||
@ -148,7 +148,7 @@ mojo_base::BigBuffer TestBigBuffer() {
|
||||
MATCHER(BigBufferHasExpectedContents,
|
||||
"does the BigBuffer have the right contents") {
|
||||
auto expected = TestBigBuffer();
|
||||
return base::ranges::equal(base::span(expected), base::span(arg));
|
||||
return std::ranges::equal(base::span(expected), base::span(arg));
|
||||
}
|
||||
|
||||
// Returns a RedirectInfo object that is useful for use in tests. It is
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@ -12,7 +13,6 @@
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_split.h"
|
||||
@ -443,7 +443,7 @@ bool ParseHost(std::string_view host, mojom::CSPSource* csp_source) {
|
||||
for (int i = 0; std::string_view piece : host_pieces) {
|
||||
// Only a trailing dot is allowed.
|
||||
if ((piece.empty() && i + 1 < std::ssize(host_pieces)) ||
|
||||
!base::ranges::all_of(piece, [](auto c) {
|
||||
!std::ranges::all_of(piece, [](auto c) {
|
||||
return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) || c == '-';
|
||||
})) {
|
||||
return false;
|
||||
@ -465,8 +465,8 @@ bool ParsePort(std::string_view port, mojom::CSPSource* csp_source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!base::ranges::all_of(port,
|
||||
base::IsAsciiDigit<std::string_view::value_type>)) {
|
||||
if (!std::ranges::all_of(port,
|
||||
base::IsAsciiDigit<std::string_view::value_type>)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -750,7 +750,7 @@ mojom::CSPSourceListPtr ParseSourceList(
|
||||
}
|
||||
|
||||
if (contains_none &&
|
||||
base::ranges::any_of(tokens, [](const auto& token) -> bool {
|
||||
std::ranges::any_of(tokens, [](const auto& token) -> bool {
|
||||
return !base::EqualsCaseInsensitiveASCII(token, "'report-sample'") &&
|
||||
!base::EqualsCaseInsensitiveASCII(token, "'none'");
|
||||
})) {
|
||||
@ -800,7 +800,7 @@ network::mojom::CSPRequireTrustedTypesFor ParseRequireTrustedTypesFor(
|
||||
// This implements tt-policy-name from
|
||||
// https://w3c.github.io/trusted-types/dist/spec/#trusted-types-csp-directive
|
||||
bool IsValidTrustedTypesPolicyName(std::string_view value) {
|
||||
return base::ranges::all_of(value, [](char c) {
|
||||
return std::ranges::all_of(value, [](char c) {
|
||||
return base::IsAsciiAlpha(c) || base::IsAsciiDigit(c) ||
|
||||
base::Contains("-#=_/@.%", c);
|
||||
});
|
||||
@ -971,7 +971,7 @@ void AddContentSecurityPolicyFromHeader(
|
||||
out->self_origin = ComputeSelfOrigin(base_url);
|
||||
|
||||
for (auto directive : directives) {
|
||||
if (!base::ranges::all_of(directive.first, IsDirectiveNameCharacter)) {
|
||||
if (!std::ranges::all_of(directive.first, IsDirectiveNameCharacter)) {
|
||||
out->parsing_errors.emplace_back(base::StringPrintf(
|
||||
"The Content-Security-Policy directive name '%s' contains one or "
|
||||
"more invalid characters. Only ASCII alphanumeric characters or "
|
||||
@ -999,7 +999,7 @@ void AddContentSecurityPolicyFromHeader(
|
||||
}
|
||||
out->raw_directives[directive_name] = std::string(directive.second);
|
||||
|
||||
if (!base::ranges::all_of(directive.second, IsDirectiveValueCharacter)) {
|
||||
if (!std::ranges::all_of(directive.second, IsDirectiveValueCharacter)) {
|
||||
out->parsing_errors.emplace_back(base::StringPrintf(
|
||||
"The value for the Content-Security-Policy directive '%s' contains "
|
||||
"one or more invalid characters. In a source expression, "
|
||||
@ -1538,7 +1538,7 @@ bool Subsumes(const mojom::ContentSecurityPolicy& policy_a,
|
||||
CSPDirectiveName::FrameAncestors, CSPDirectiveName::FormAction,
|
||||
CSPDirectiveName::FencedFrameSrc};
|
||||
|
||||
return base::ranges::all_of(directives, [&](CSPDirectiveName directive) {
|
||||
return std::ranges::all_of(directives, [&](CSPDirectiveName directive) {
|
||||
auto required = GetSourceList(directive, policy_a);
|
||||
if (!required.second)
|
||||
return true;
|
||||
|
@ -4,10 +4,11 @@
|
||||
|
||||
#include "services/network/public/cpp/content_security_policy/csp_source_list.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
|
||||
#include "services/network/public/cpp/content_security_policy/csp_source.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
@ -186,8 +187,8 @@ bool UrlSourceListSubsumes(
|
||||
|
||||
// Every item in |source_list_b| must be subsumed by at least one item in
|
||||
// |source_list_a|.
|
||||
return base::ranges::all_of(source_list_b, [&](const auto& source_b) {
|
||||
return base::ranges::any_of(source_list_a, [&](const auto& source_a) {
|
||||
return std::ranges::all_of(source_list_b, [&](const auto& source_b) {
|
||||
return std::ranges::any_of(source_list_a, [&](const auto& source_a) {
|
||||
return CSPSourceSubsumes(*source_a, *source_b);
|
||||
});
|
||||
});
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
#include "services/network/public/cpp/content_security_policy/csp_source_list.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
|
||||
#include "services/network/public/mojom/content_security_policy.mojom.h"
|
||||
@ -56,13 +57,13 @@ std::vector<mojom::CSPSourceListPtr> ParseToVectorOfSourceLists(
|
||||
mojom::CSPDirectiveName directive,
|
||||
const std::vector<std::string>& values) {
|
||||
std::vector<std::string> csp_values(values.size());
|
||||
base::ranges::transform(values, csp_values.begin(),
|
||||
[directive](const std::string& s) {
|
||||
return ToString(directive) + " " + s;
|
||||
});
|
||||
std::ranges::transform(values, csp_values.begin(),
|
||||
[directive](const std::string& s) {
|
||||
return ToString(directive) + " " + s;
|
||||
});
|
||||
std::vector<mojom::ContentSecurityPolicyPtr> policies = Parse(csp_values);
|
||||
std::vector<mojom::CSPSourceListPtr> sources(policies.size());
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
policies, sources.begin(),
|
||||
[directive](mojom::ContentSecurityPolicyPtr& p) {
|
||||
return mojom::CSPSourceListPtr(std::move(p->directives[directive]));
|
||||
@ -73,7 +74,7 @@ std::vector<mojom::CSPSourceListPtr> ParseToVectorOfSourceLists(
|
||||
std::vector<const mojom::CSPSourceList*> ToRawPointers(
|
||||
const std::vector<mojom::CSPSourceListPtr>& list) {
|
||||
std::vector<const mojom::CSPSourceList*> out(list.size());
|
||||
base::ranges::transform(list, out.begin(), &mojom::CSPSourceListPtr::get);
|
||||
std::ranges::transform(list, out.begin(), &mojom::CSPSourceListPtr::get);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "base/containers/fixed_flat_set.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "net/base/mime_util.h"
|
||||
#include "net/http/http_byte_range.h"
|
||||
@ -101,8 +100,9 @@ bool IsCorsUnsafeRequestHeaderByte(char c) {
|
||||
// |value| should be lower case.
|
||||
bool IsCorsSafelistedLowerCaseContentType(const std::string& value) {
|
||||
DCHECK_EQ(value, base::ToLowerASCII(value));
|
||||
if (base::ranges::any_of(value, IsCorsUnsafeRequestHeaderByte))
|
||||
if (std::ranges::any_of(value, IsCorsUnsafeRequestHeaderByte)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<std::string> mime_type =
|
||||
net::ExtractMimeTypeFromMediaType(value,
|
||||
@ -387,10 +387,10 @@ bool IsCorsSafelistedHeader(const std::string& name, const std::string& value) {
|
||||
// Verify the values of all non-secure headers (except `intervention`).
|
||||
const std::string lower_value = base::ToLowerASCII(value);
|
||||
if (lower_name == "accept") {
|
||||
return !base::ranges::any_of(value, IsCorsUnsafeRequestHeaderByte);
|
||||
return !std::ranges::any_of(value, IsCorsUnsafeRequestHeaderByte);
|
||||
} else if (lower_name == "accept-language" ||
|
||||
lower_name == "content-language") {
|
||||
return base::ranges::all_of(value, [](char c) {
|
||||
return std::ranges::all_of(value, [](char c) {
|
||||
return (0x30 <= c && c <= 0x39) || (0x41 <= c && c <= 0x5a) ||
|
||||
(0x61 <= c && c <= 0x7a) || c == 0x20 || c == 0x2a || c == 0x2c ||
|
||||
c == 0x2d || c == 0x2e || c == 0x3b || c == 0x3d;
|
||||
@ -404,7 +404,7 @@ bool IsCorsSafelistedHeader(const std::string& name, const std::string& value) {
|
||||
// - Only one range is provided
|
||||
// - No suffix (bytes=-x) ranges
|
||||
|
||||
if (base::ranges::any_of(lower_value, [](char c) {
|
||||
if (std::ranges::any_of(lower_value, [](char c) {
|
||||
return net::HttpUtil::IsLWS(c) || c == ',';
|
||||
})) {
|
||||
return false;
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
#include "services/network/public/cpp/cross_origin_opener_policy_parser.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string_view>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/http/structured_headers.h"
|
||||
@ -86,8 +86,8 @@ void ParseHeader(std::string_view header_value,
|
||||
mojom::CrossOriginOpenerPolicyValue::kNoopenerAllowPopups;
|
||||
}
|
||||
}
|
||||
auto it = base::ranges::find(item->params, kReportTo,
|
||||
&std::pair<std::string, Item>::first);
|
||||
auto it = std::ranges::find(item->params, kReportTo,
|
||||
&std::pair<std::string, Item>::first);
|
||||
if (it != item->params.end() && it->second.is_string()) {
|
||||
*endpoint = it->second.GetString();
|
||||
}
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
#include "services/network/public/cpp/first_party_sets_mojom_traits.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/version.h"
|
||||
#include "mojo/public/cpp/base/version_mojom_traits.h"
|
||||
#include "mojo/public/cpp/bindings/enum_traits.h"
|
||||
@ -117,7 +117,7 @@ bool StructTraits<network::mojom::GlobalFirstPartySetsDataView,
|
||||
if (public_sets_version.IsValid() && !sets.ReadAliases(&aliases))
|
||||
return false;
|
||||
|
||||
if (!base::ranges::all_of(aliases, [&](const auto& pair) {
|
||||
if (!std::ranges::all_of(aliases, [&](const auto& pair) {
|
||||
return entries.contains(pair.second);
|
||||
})) {
|
||||
return false;
|
||||
@ -134,7 +134,7 @@ bool StructTraits<network::mojom::GlobalFirstPartySetsDataView,
|
||||
|
||||
// The manual_config must contain both the alias overrides and their
|
||||
// corresponding canonical overrides, none of which may be deletions.
|
||||
if (!base::ranges::all_of(manual_aliases, [&](const auto& pair) {
|
||||
if (!std::ranges::all_of(manual_aliases, [&](const auto& pair) {
|
||||
std::optional<net::FirstPartySetEntryOverride> aliased_override =
|
||||
manual_config.FindOverride(pair.first);
|
||||
std::optional<net::FirstPartySetEntryOverride> canonical_override =
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/public/cpp/is_potentially_trustworthy.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
@ -16,7 +17,6 @@
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/strings/pattern.h"
|
||||
#include "base/strings/string_split.h"
|
||||
@ -372,8 +372,8 @@ std::vector<std::string> SecureOriginAllowlist::GetCurrentAllowlist() {
|
||||
|
||||
std::vector<std::string> result;
|
||||
result.reserve(cmdline_allowlist_.size() + auxiliary_allowlist_.size());
|
||||
base::ranges::copy(cmdline_allowlist_, std::back_inserter(result));
|
||||
base::ranges::copy(auxiliary_allowlist_, std::back_inserter(result));
|
||||
std::ranges::copy(cmdline_allowlist_, std::back_inserter(result));
|
||||
std::ranges::copy(auxiliary_allowlist_, std::back_inserter(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
#include "services/network/public/cpp/supports_loading_mode/supports_loading_mode_parser.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <ranges>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/http/structured_headers.h"
|
||||
#include "services/network/public/mojom/supports_loading_mode.mojom.h"
|
||||
@ -56,7 +56,7 @@ mojom::SupportsLoadingModePtr ParseSupportsLoadingMode(
|
||||
// Each supported token maps 1:1 to an enumerator.
|
||||
const auto& token = item.item.GetString();
|
||||
const auto* it =
|
||||
base::ranges::find(kKnownLoadingModes, token, &KnownLoadingMode::token);
|
||||
std::ranges::find(kKnownLoadingModes, token, &KnownLoadingMode::token);
|
||||
if (it == std::ranges::end(kKnownLoadingModes)) {
|
||||
continue;
|
||||
}
|
||||
@ -66,7 +66,7 @@ mojom::SupportsLoadingModePtr ParseSupportsLoadingMode(
|
||||
|
||||
// Order and repetition are not significant.
|
||||
// Canonicalize by making the vector sorted and unique.
|
||||
base::ranges::sort(modes);
|
||||
std::ranges::sort(modes);
|
||||
auto repeated = std::ranges::unique(modes);
|
||||
modes.erase(repeated.begin(), repeated.end());
|
||||
return mojom::SupportsLoadingMode::New(std::move(modes));
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
#include "services/network/resolve_host_request.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/types/optional_util.h"
|
||||
#include "net/base/host_port_pair.h"
|
||||
@ -179,7 +179,7 @@ ResolveHostRequest::GetEndpointResultsWithMetadata() const {
|
||||
// addresses(non-protocol endpoints), and this information is passed as
|
||||
// another parameter at least in OnComplete method, so drop that here to avoid
|
||||
// providing redundant information.
|
||||
base::ranges::copy_if(
|
||||
std::ranges::copy_if(
|
||||
*endpoint_results, std::back_inserter(endpoint_results_with_metadata),
|
||||
[](const auto& result) {
|
||||
return !result.metadata.supported_protocol_alpns.empty();
|
||||
|
@ -593,10 +593,9 @@ void RestrictedCookieManager::CookieListToGetAllForUrlCallback(
|
||||
if (!maybe_included_cookies.empty() && IsPartitionedCookiesEnabled()) {
|
||||
UMA_HISTOGRAM_COUNTS_100(
|
||||
"Net.RestrictedCookieManager.PartitionedCookiesInScript",
|
||||
base::ranges::count_if(result,
|
||||
[](const net::CookieWithAccessResult& c) {
|
||||
return c.cookie.IsPartitioned();
|
||||
}));
|
||||
std::ranges::count_if(result, [](const net::CookieWithAccessResult& c) {
|
||||
return c.cookie.IsPartitioned();
|
||||
}));
|
||||
}
|
||||
|
||||
std::move(callback).Run(result);
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "services/network/sct_auditing/sct_auditing_handler.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/files/file_path.h"
|
||||
@ -13,7 +15,6 @@
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/bind_post_task.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
@ -114,7 +115,7 @@ void SCTAuditingHandler::MaybeEnqueueReport(
|
||||
// a valid signature, and thus are expected to be public certificates. If
|
||||
// there are no valid SCTs, there's no need to report anything.
|
||||
net::SignedCertificateTimestampAndStatusList validated_scts;
|
||||
base::ranges::copy_if(
|
||||
std::ranges::copy_if(
|
||||
signed_certificate_timestamps, std::back_inserter(validated_scts),
|
||||
[](const auto& sct) { return sct.status == net::ct::SCT_STATUS_OK; });
|
||||
if (validated_scts.empty()) {
|
||||
@ -149,7 +150,7 @@ void SCTAuditingHandler::MaybeEnqueueReport(
|
||||
// Find the corresponding log entry metadata.
|
||||
const std::vector<mojom::CTLogInfoPtr>& logs =
|
||||
owner_network_context_->network_service()->log_list();
|
||||
auto log = base::ranges::find(logs, sct->log_id, &mojom::CTLogInfo::id);
|
||||
auto log = std::ranges::find(logs, sct->log_id, &mojom::CTLogInfo::id);
|
||||
// It's possible that log entry metadata may not exist for a few reasons:
|
||||
//
|
||||
// 1) The PKI Metadata component has not yet been loaded and no log list
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/network/shared_dictionary/simple_url_pattern_matcher.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -216,7 +216,7 @@ SimpleUrlPatternMatcher::CreatePatternInit(
|
||||
// Spec: If the result of running protocol component matches a special
|
||||
// scheme given protocol component is true, then set parser’s protocol
|
||||
// matches a special scheme flag to true.
|
||||
protocol_matches_a_special_scheme_flag = base::ranges::any_of(
|
||||
protocol_matches_a_special_scheme_flag = std::ranges::any_of(
|
||||
url::GetStandardSchemes(),
|
||||
[&protocol_component](const std::string& scheme) {
|
||||
return protocol_component->Match(scheme);
|
||||
@ -430,10 +430,10 @@ SimpleUrlPatternMatcher::CreateFromPatternInit(
|
||||
}
|
||||
protocol_component = std::move(protocol_component_result.value());
|
||||
protocol_matches_a_special_scheme_flag =
|
||||
base::ranges::any_of(url::GetStandardSchemes(),
|
||||
[&protocol_component](const std::string& scheme) {
|
||||
return protocol_component->Match(scheme);
|
||||
});
|
||||
std::ranges::any_of(url::GetStandardSchemes(),
|
||||
[&protocol_component](const std::string& scheme) {
|
||||
return protocol_component->Match(scheme);
|
||||
});
|
||||
}
|
||||
|
||||
#define MAYBE_COMPILE_PATTERN(type, callback, options) \
|
||||
|
@ -366,7 +366,7 @@ TEST_F(TCPBoundSocketTest, ReadWrite) {
|
||||
}
|
||||
if (result != MOJO_RESULT_OK)
|
||||
break;
|
||||
base::ranges::fill(buffer, 0);
|
||||
std::ranges::fill(buffer, 0);
|
||||
client_socket_send_handle->EndWriteData(buffer.size());
|
||||
}
|
||||
// Wait for write error on the client socket. Don't check exact error, out of
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/trust_tokens/boringssl_trust_token_test_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@ -12,7 +13,6 @@
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "services/network/trust_tokens/scoped_boringssl_bytes.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/boringssl/src/include/openssl/base.h"
|
||||
@ -161,11 +161,11 @@ bssl::UniquePtr<TRUST_TOKEN> TestTrustTokenIssuer::Redeem(
|
||||
};
|
||||
|
||||
EXPECT_EQ(received_private_metadata, kPrivateMetadata);
|
||||
EXPECT_NE(base::ranges::find_if(keys_,
|
||||
[&received_public_metadata](auto& key) {
|
||||
return key.key_id ==
|
||||
received_public_metadata;
|
||||
}),
|
||||
EXPECT_NE(std::ranges::find_if(keys_,
|
||||
[&received_public_metadata](auto& key) {
|
||||
return key.key_id ==
|
||||
received_public_metadata;
|
||||
}),
|
||||
std::end(keys_));
|
||||
|
||||
return bssl::UniquePtr<TRUST_TOKEN>(redeemed_token);
|
||||
@ -200,11 +200,11 @@ bssl::UniquePtr<TRUST_TOKEN> TestTrustTokenIssuer::RedeemOverMessage(
|
||||
}
|
||||
|
||||
EXPECT_EQ(received_private_metadata, 1);
|
||||
EXPECT_NE(base::ranges::find_if(keys_,
|
||||
[&received_public_metadata](auto& key) {
|
||||
return key.key_id ==
|
||||
received_public_metadata;
|
||||
}),
|
||||
EXPECT_NE(std::ranges::find_if(keys_,
|
||||
[&received_public_metadata](auto& key) {
|
||||
return key.key_id ==
|
||||
received_public_metadata;
|
||||
}),
|
||||
std::end(keys_));
|
||||
|
||||
return bssl::UniquePtr<TRUST_TOKEN>(redeemed_token);
|
||||
|
@ -4,10 +4,11 @@
|
||||
|
||||
#include "services/network/trust_tokens/trust_token_key_commitment_parser.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "services/network/public/mojom/trust_tokens.mojom.h"
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
#include "services/network/trust_tokens/trust_token_key_commitments.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/test/bind.h"
|
||||
#include "base/test/scoped_command_line.h"
|
||||
#include "base/test/task_environment.h"
|
||||
@ -217,7 +217,7 @@ TEST(TrustTokenKeyCommitments, FiltersKeys) {
|
||||
|
||||
auto result = GetCommitmentForOrigin(commitments, origin);
|
||||
EXPECT_EQ(result->keys.size(), max_keys);
|
||||
EXPECT_TRUE(base::ranges::all_of(
|
||||
EXPECT_TRUE(std::ranges::all_of(
|
||||
result->keys, [](const mojom::TrustTokenVerificationKeyPtr& key) {
|
||||
return key->expiry == base::Time::Now() + base::Minutes(1);
|
||||
}));
|
||||
|
@ -2,13 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "services/network/trust_tokens/trust_token_key_filtering.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "services/network/public/mojom/trust_tokens.mojom-forward.h"
|
||||
#include "services/network/public/mojom/trust_tokens.mojom.h"
|
||||
#include "services/network/trust_tokens/trust_token_key_filtering.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace network {
|
||||
@ -118,11 +119,11 @@ TEST(TrustTokenKeyFiltering, MixOfPastAndFutureKeys) {
|
||||
RetainSoonestToExpireTrustTokenKeys(&keys, 3);
|
||||
|
||||
EXPECT_EQ(keys.size(), 2u);
|
||||
EXPECT_TRUE(base::ranges::any_of(
|
||||
EXPECT_TRUE(std::ranges::any_of(
|
||||
keys, [&early_key](const mojom::TrustTokenVerificationKeyPtr& key) {
|
||||
return mojo::Equals(key, early_key);
|
||||
}));
|
||||
EXPECT_TRUE(base::ranges::any_of(
|
||||
EXPECT_TRUE(std::ranges::any_of(
|
||||
keys, [&late_key](const mojom::TrustTokenVerificationKeyPtr& key) {
|
||||
return mojo::Equals(key, late_key);
|
||||
}));
|
||||
@ -159,15 +160,15 @@ TEST(TrustTokenKeyFiltering, BreaksTiesBasedOnBody) {
|
||||
RetainSoonestToExpireTrustTokenKeys(&keys, 3);
|
||||
|
||||
EXPECT_EQ(keys.size(), 3u);
|
||||
EXPECT_TRUE(base::ranges::any_of(
|
||||
EXPECT_TRUE(std::ranges::any_of(
|
||||
keys, [&a_key](const mojom::TrustTokenVerificationKeyPtr& key) {
|
||||
return mojo::Equals(key, a_key);
|
||||
}));
|
||||
EXPECT_TRUE(base::ranges::any_of(
|
||||
EXPECT_TRUE(std::ranges::any_of(
|
||||
keys, [&b_key](const mojom::TrustTokenVerificationKeyPtr& key) {
|
||||
return mojo::Equals(key, b_key);
|
||||
}));
|
||||
EXPECT_TRUE(base::ranges::any_of(
|
||||
EXPECT_TRUE(std::ranges::any_of(
|
||||
keys, [&early_key](const mojom::TrustTokenVerificationKeyPtr& key) {
|
||||
return mojo::Equals(key, early_key);
|
||||
}));
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
#include "services/network/trust_tokens/trust_token_request_issuance_helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/trust_tokens/trust_token_request_signing_helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@ -14,7 +15,6 @@
|
||||
#include "base/base64.h"
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/network/trust_tokens/trust_token_request_signing_helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@ -13,7 +14,6 @@
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
#include "services/network/trust_tokens/trust_token_store.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
|
||||
#include "services/network/public/cpp/is_potentially_trustworthy.h"
|
||||
#include "services/network/public/cpp/trust_token_parameterization.h"
|
||||
@ -224,11 +224,11 @@ std::vector<TrustToken> TrustTokenStore::RetrieveMatchingTokens(
|
||||
if (!config)
|
||||
return matching_tokens;
|
||||
|
||||
base::ranges::copy_if(config->tokens(), std::back_inserter(matching_tokens),
|
||||
[&key_matcher](const TrustToken& token) {
|
||||
return token.has_signing_key() &&
|
||||
key_matcher.Run(token.signing_key());
|
||||
});
|
||||
std::ranges::copy_if(config->tokens(), std::back_inserter(matching_tokens),
|
||||
[&key_matcher](const TrustToken& token) {
|
||||
return token.has_signing_key() &&
|
||||
key_matcher.Run(token.signing_key());
|
||||
});
|
||||
|
||||
return matching_tokens;
|
||||
}
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/not_fatal_until.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/sequence_checker.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -1695,8 +1694,8 @@ mojom::URLResponseHeadPtr URLLoader::BuildResponseHead() const {
|
||||
response->has_range_requested =
|
||||
url_request_->extra_request_headers().HasHeader(
|
||||
net::HttpRequestHeaders::kRange);
|
||||
base::ranges::copy(url_request_->response_info().dns_aliases,
|
||||
std::back_inserter(response->dns_aliases));
|
||||
std::ranges::copy(url_request_->response_info().dns_aliases,
|
||||
std::back_inserter(response->dns_aliases));
|
||||
// [spec]: https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
|
||||
// 13. Set response’s request-includes-credentials to includeCredentials.
|
||||
response->request_include_credentials = url_request_->allow_credentials();
|
||||
|
@ -4,10 +4,11 @@
|
||||
|
||||
#include "services/network/web_bundle/web_bundle_manager.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/time/time.h"
|
||||
#include "components/web_package/web_bundle_utils.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/network/web_bundle/web_bundle_url_loader_factory.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
@ -748,7 +748,7 @@ void WebBundleURLLoaderFactory::OnMetadataParsed(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!base::ranges::all_of(metadata->requests, [this](const auto& entry) {
|
||||
if (!std::ranges::all_of(metadata->requests, [this](const auto& entry) {
|
||||
return IsAllowedExchangeUrl(entry.first);
|
||||
})) {
|
||||
std::string error_message = "Exchange URL is not valid.";
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include "services/preferences/public/cpp/dictionary_value_update.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
|
||||
@ -294,8 +294,8 @@ std::vector<std::string> DictionaryValueUpdate::ConcatPath(
|
||||
const std::vector<std::string_view>& path) {
|
||||
std::vector<std::string> full_path = base_path;
|
||||
full_path.reserve(full_path.size() + path.size());
|
||||
base::ranges::transform(path, std::back_inserter(full_path),
|
||||
[](std::string_view s) { return std::string(s); });
|
||||
std::ranges::transform(path, std::back_inserter(full_path),
|
||||
[](std::string_view s) { return std::string(s); });
|
||||
return full_path;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/proxy_resolver/proxy_resolver_impl.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -11,7 +12,6 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
@ -199,7 +199,7 @@ void MockProxyResolverV8Tracing::GetProxyForURL(
|
||||
}
|
||||
|
||||
void MockProxyResolverV8Tracing::WaitForCancel() {
|
||||
while (base::ranges::any_of(pending_jobs_, &Job::cancelled)) {
|
||||
while (std::ranges::any_of(pending_jobs_, &Job::cancelled)) {
|
||||
base::RunLoop run_loop;
|
||||
cancel_callback_ = run_loop.QuitClosure();
|
||||
run_loop.Run();
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/ranges.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "services/screen_ai/public/mojom/screen_ai_service.mojom.h"
|
||||
#include "services/strings/grit/services_strings.h"
|
||||
@ -30,7 +29,7 @@
|
||||
#include "ui/gfx/geometry/rect_f.h"
|
||||
#include "ui/gfx/geometry/transform.h"
|
||||
|
||||
namespace ranges = base::ranges;
|
||||
namespace ranges = std::ranges;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
#include "services/service_manager/service_instance.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "build/build_config.h"
|
||||
@ -39,15 +39,15 @@ std::set<std::string> GetRequiredCapabilities(
|
||||
// Start by looking for requirements specific to the target identity.
|
||||
auto it = source_requirements.find(target_service);
|
||||
if (it != source_requirements.end()) {
|
||||
base::ranges::copy(it->second,
|
||||
std::inserter(capabilities, capabilities.begin()));
|
||||
std::ranges::copy(it->second,
|
||||
std::inserter(capabilities, capabilities.begin()));
|
||||
}
|
||||
|
||||
// Apply wild card rules too.
|
||||
it = source_requirements.find("*");
|
||||
if (it != source_requirements.end()) {
|
||||
base::ranges::copy(it->second,
|
||||
std::inserter(capabilities, capabilities.begin()));
|
||||
std::ranges::copy(it->second,
|
||||
std::inserter(capabilities, capabilities.begin()));
|
||||
}
|
||||
return capabilities;
|
||||
}
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
#include "services/service_manager/service_instance_registry.h"
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "services/service_manager/public/cpp/manifest.h"
|
||||
#include "services/service_manager/service_instance.h"
|
||||
|
||||
@ -194,7 +195,7 @@ ServiceInstance* ServiceInstanceRegistry::FindMatchInEntries(
|
||||
|
||||
bool ServiceInstanceRegistry::EraseEntry(const base::Token& guid,
|
||||
std::vector<Entry>* entries) {
|
||||
auto it = base::ranges::find(*entries, guid, &Entry::guid);
|
||||
auto it = std::ranges::find(*entries, guid, &Entry::guid);
|
||||
if (it == entries->end())
|
||||
return false;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/tracing/perfetto/consumer_host.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@ -14,7 +15,6 @@
|
||||
#include "base/containers/span.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -271,7 +271,7 @@ void ConsumerHost::TracingSession::OnPerfettoEvents(
|
||||
// Data sources are first reported as being stopped before starting, so once
|
||||
// all the data sources we know about have started we can declare tracing
|
||||
// begun.
|
||||
bool all_data_sources_started = base::ranges::all_of(
|
||||
bool all_data_sources_started = std::ranges::all_of(
|
||||
data_source_states_,
|
||||
[](std::pair<DataSourceHandle, bool> state) { return state.second; });
|
||||
if (!all_data_sources_started)
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "components/tracing/common/tracing_switches.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/perfetto/include/perfetto/tracing/core/trace_config.h"
|
||||
@ -167,7 +166,7 @@ TEST_F(TraceStartupConfigTest, ContentWithAbsoluteResultFilePath) {
|
||||
ASSERT_TRUE(result_file_path.IsAbsolute());
|
||||
|
||||
std::string result_file_path_str = result_file_path.AsUTF8Unsafe();
|
||||
auto it = base::ranges::find(result_file_path_str, '\\');
|
||||
auto it = std::ranges::find(result_file_path_str, '\\');
|
||||
while (it != result_file_path_str.end()) {
|
||||
auto it2 = result_file_path_str.insert(it, '\\');
|
||||
it = std::find(it2 + 2, result_file_path_str.end(), '\\');
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "services/video_capture/broadcasting_receiver.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/memory/platform_shared_memory_region.h"
|
||||
#include "base/memory/unsafe_shared_memory_region.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "build/build_config.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
||||
#include "mojo/public/cpp/system/platform_handle.h"
|
||||
@ -406,7 +406,7 @@ void BroadcastingReceiver::OnStopped() {
|
||||
void BroadcastingReceiver::OnClientFinishedConsumingFrame(
|
||||
int32_t buffer_context_id) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
auto buffer_context_iter = base::ranges::find(
|
||||
auto buffer_context_iter = std::ranges::find(
|
||||
buffer_contexts_, buffer_context_id, &BufferContext::buffer_context_id);
|
||||
CHECK(buffer_context_iter != buffer_contexts_.end());
|
||||
buffer_context_iter->DecreaseConsumerCount();
|
||||
@ -435,7 +435,7 @@ std::vector<BroadcastingReceiver::BufferContext>::iterator
|
||||
BroadcastingReceiver::FindUnretiredBufferContextFromBufferId(
|
||||
int32_t buffer_id) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
return base::ranges::find_if(
|
||||
return std::ranges::find_if(
|
||||
buffer_contexts_, [buffer_id](const BufferContext& entry) {
|
||||
return !entry.is_retired() && entry.buffer_id() == buffer_id;
|
||||
});
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
#include "services/video_capture/public/cpp/mock_video_frame_handler.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
||||
@ -58,7 +59,7 @@ void MockVideoFrameHandler::OnFrameReadyInBuffer(
|
||||
}
|
||||
|
||||
void MockVideoFrameHandler::OnBufferRetired(int32_t buffer_id) {
|
||||
auto iter = base::ranges::find(known_buffer_ids_, buffer_id);
|
||||
auto iter = std::ranges::find(known_buffer_ids_, buffer_id);
|
||||
CHECK(iter != known_buffer_ids_.end());
|
||||
known_buffer_ids_.erase(iter);
|
||||
DoOnBufferRetired(buffer_id);
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
#include "services/video_capture/shared_memory_virtual_device_mojo_adapter.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "media/capture/video/scoped_buffer_pool_reservation.h"
|
||||
#include "media/capture/video/video_capture_buffer_pool_impl.h"
|
||||
#include "media/capture/video/video_capture_buffer_pool_util.h"
|
||||
@ -63,7 +63,7 @@ void SharedMemoryVirtualDeviceMojoAdapter::RequestFrameBuffer(
|
||||
|
||||
// Remove dropped buffer if there is one.
|
||||
if (buffer_id_to_drop != media::VideoCaptureBufferPool::kInvalidId) {
|
||||
auto entry_iter = base::ranges::find(known_buffer_ids_, buffer_id_to_drop);
|
||||
auto entry_iter = std::ranges::find(known_buffer_ids_, buffer_id_to_drop);
|
||||
if (entry_iter != known_buffer_ids_.end()) {
|
||||
known_buffer_ids_.erase(entry_iter);
|
||||
if (producer_.is_bound())
|
||||
|
@ -2,8 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/test/bind.h"
|
||||
#include "build/build_config.h"
|
||||
@ -191,7 +192,7 @@ TEST_F(FakeVideoCaptureDeviceTest, BuffersGetRetiredWhenDeviceIsStopped) {
|
||||
base::RunLoop wait_for_on_stopped_loop;
|
||||
EXPECT_CALL(video_frame_handler, DoOnBufferRetired(_))
|
||||
.WillRepeatedly(Invoke([&known_buffer_ids](int32_t buffer_id) {
|
||||
auto iter = base::ranges::find(known_buffer_ids, buffer_id);
|
||||
auto iter = std::ranges::find(known_buffer_ids, buffer_id);
|
||||
ASSERT_TRUE(iter != known_buffer_ids.end());
|
||||
known_buffer_ids.erase(iter);
|
||||
}));
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "base/numerics/byte_conversions.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -632,7 +631,7 @@ std::string_view GetActivationParam(
|
||||
|
||||
base::FixedArray<int32_t> Ui32ToI32(base::span<const uint32_t> data) {
|
||||
base::FixedArray<int32_t> output(data.size());
|
||||
base::ranges::transform(data, output.begin(), [](uint32_t val) {
|
||||
std::ranges::transform(data, output.begin(), [](uint32_t val) {
|
||||
return base::checked_cast<int32_t>(val);
|
||||
});
|
||||
return output;
|
||||
@ -1205,7 +1204,7 @@ GraphBuilderCoreml::GraphBuilderCoreml(
|
||||
context_properties_(std::move(context_properties)),
|
||||
device_(device),
|
||||
internal_operand_id_(
|
||||
base::ranges::max_element(
|
||||
std::ranges::max_element(
|
||||
graph_info_->id_to_operand_map,
|
||||
{},
|
||||
[](const auto& id_operand) { return id_operand.first; })
|
||||
@ -1978,7 +1977,7 @@ GraphBuilderCoreml::AddOperationForConcat(
|
||||
uint32_t axis,
|
||||
CoreML::Specification::MILSpec::Block& block) {
|
||||
CHECK(
|
||||
base::ranges::all_of(input_operand_ids, [&](uint64_t input_operand_id) {
|
||||
std::ranges::all_of(input_operand_ids, [&](uint64_t input_operand_id) {
|
||||
return context_properties_.data_type_limits.concat_inputs.Has(
|
||||
MILDataTypeToOperandType(
|
||||
GetOperandInfo(input_operand_id).mil_data_type));
|
||||
@ -3322,15 +3321,17 @@ GraphBuilderCoreml::AddOperationForLayerNormalization(
|
||||
}
|
||||
|
||||
// TODO: crbug.com/356905058: Figure out if unordered axes should be allowed.
|
||||
if (!base::ranges::is_sorted(operation.axes)) {
|
||||
if (!std::ranges::is_sorted(operation.axes)) {
|
||||
return NewNotSupportedError("Axes must be ordered for layerNormalization.");
|
||||
}
|
||||
|
||||
// TODO: crbug.com/391423301: CoreML crashes for kCpu when axes are not
|
||||
// consecutive, needs emulation.
|
||||
if (device_ == mojom::CreateContextOptions::Device::kCpu) {
|
||||
bool is_consecutive = base::ranges::adjacent_find(operation.axes,
|
||||
[](auto a, auto b) { return (a + 1) != b; }) == operation.axes.end();
|
||||
bool is_consecutive =
|
||||
std::ranges::adjacent_find(operation.axes, [](auto a, auto b) {
|
||||
return (a + 1) != b;
|
||||
}) == operation.axes.end();
|
||||
if (!is_consecutive) {
|
||||
return NewNotSupportedError(
|
||||
"Axes must be consecutive for layerNormalization on cpu.");
|
||||
@ -4219,7 +4220,7 @@ GraphBuilderCoreml::AddOperationForResample2d(
|
||||
MILDataTypeToOperandType(input_operand_info.mil_data_type)));
|
||||
|
||||
const std::array<size_t, 2> supported_axes = {2, 3};
|
||||
CHECK(base::ranges::equal(operation.axes, supported_axes));
|
||||
CHECK(std::ranges::equal(operation.axes, supported_axes));
|
||||
|
||||
static constexpr char kParamScaleFactorHeight[] = "scale_factor_height";
|
||||
static constexpr char kParamScaleFactorWidth[] = "scale_factor_width";
|
||||
|
@ -7,6 +7,7 @@
|
||||
#import <CoreML/CoreML.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "base/apple/foundation_util.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
@ -588,14 +588,14 @@ void GraphImplCoreml::DispatchImpl(
|
||||
// them as shared/read-only.
|
||||
std::vector<scoped_refptr<QueueableResourceStateBase>> shared_resources;
|
||||
shared_resources.reserve(named_inputs.size());
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
named_input_buffer_states, std::back_inserter(shared_resources),
|
||||
[](const auto& name_and_state) { return name_and_state.second; });
|
||||
|
||||
// Exclusively reserve all output tensors, which will be written to.
|
||||
std::vector<scoped_refptr<QueueableResourceStateBase>> exclusive_resources;
|
||||
exclusive_resources.reserve(named_outputs.size());
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
named_output_buffer_states, std::back_inserter(exclusive_resources),
|
||||
[](const auto& name_and_state) { return name_and_state.second; });
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@ -3968,7 +3967,7 @@ base::expected<void, mojom::ErrorPtr> CreateOperatorNodeForGru(
|
||||
|
||||
base::FixedArray<DML_OPERATOR_DESC> activation_dml_descs(
|
||||
activation_operator_descs.size());
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
activation_operator_descs, std::begin(activation_dml_descs),
|
||||
[](const auto& activation_operator_desc) {
|
||||
return activation_operator_desc.GetActivationDmlDesc();
|
||||
@ -4624,7 +4623,7 @@ base::expected<void, mojom::ErrorPtr> CreateOperatorNodeForLstm(
|
||||
|
||||
base::FixedArray<DML_OPERATOR_DESC> activation_dml_descs(
|
||||
activation_operator_descs.size());
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
activation_operator_descs, activation_dml_descs.begin(),
|
||||
[](const auto& activation_operator_desc) {
|
||||
return activation_operator_desc.GetActivationDmlDesc();
|
||||
@ -5542,7 +5541,7 @@ bool IsDispatchBindingValid(
|
||||
const base::flat_map<std::string_view, WebNNTensorImpl*>& named_tensors,
|
||||
const base::flat_map<std::string, base::WeakPtr<const WebNNTensorImpl>>&
|
||||
prev_named_tensors) {
|
||||
return base::ranges::equal(
|
||||
return std::ranges::equal(
|
||||
named_tensors, prev_named_tensors,
|
||||
[](const auto& pair, const auto& previous_pair) {
|
||||
const auto& [name, tensor] = pair;
|
||||
@ -6064,10 +6063,9 @@ base::expected<void, mojom::ErrorPtr> GraphImplDml::CreateAndBuildInternal(
|
||||
// `id_to_operand_map`. It might be used for inserting new operands into maps
|
||||
// when adding operations.
|
||||
uint64_t next_operand_id = 0;
|
||||
base::ranges::for_each(
|
||||
id_to_operand_map, [&next_operand_id](auto& key_value) {
|
||||
next_operand_id = std::max(next_operand_id, key_value.first + 1);
|
||||
});
|
||||
std::ranges::for_each(id_to_operand_map, [&next_operand_id](auto& key_value) {
|
||||
next_operand_id = std::max(next_operand_id, key_value.first + 1);
|
||||
});
|
||||
|
||||
// Fuse the operations in `mojom::GraphInfo` wherever possible to optimize the
|
||||
// graph's compute performance.
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "base/notreached.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
@ -297,7 +296,7 @@ base::expected<void, std::string> ValidateRecurrentNetworkOperand(
|
||||
label, base::StringPrintf("The %s operand should be a %zu-D tensor.",
|
||||
operand_name, expected_shape.size())));
|
||||
}
|
||||
if (!base::ranges::equal(operand.shape(), expected_shape)) {
|
||||
if (!std::ranges::equal(operand.shape(), expected_shape)) {
|
||||
return base::unexpected(ErrorWithLabel(
|
||||
label,
|
||||
base::StringPrintf("The %s operand shape is invalid.", operand_name)));
|
||||
@ -416,8 +415,8 @@ ValidateSplitAndInferOutput(const ContextProperties& context_properties,
|
||||
attributes.splits)) {
|
||||
const auto& splits =
|
||||
absl::get<base::span<const uint32_t>>(attributes.splits);
|
||||
if (base::ranges::any_of(splits,
|
||||
[](uint32_t split) { return split == 0; })) {
|
||||
if (std::ranges::any_of(splits,
|
||||
[](uint32_t split) { return split == 0; })) {
|
||||
return base::unexpected(
|
||||
ErrorWithLabel(label, "All splits must be greater than zero."));
|
||||
}
|
||||
@ -868,7 +867,7 @@ ValidateScaleZeroPointOperandShapeIsCompatibleWithInput(
|
||||
}
|
||||
}
|
||||
|
||||
if (!base::ranges::equal(scale_shape, zero_point_shape)) {
|
||||
if (!std::ranges::equal(scale_shape, zero_point_shape)) {
|
||||
return base::unexpected(ErrorWithLabel(
|
||||
label, "The shape of scale and zero point must be the same."));
|
||||
}
|
||||
@ -1338,7 +1337,7 @@ base::expected<OperandDescriptor, std::string> ValidateGatherAndInferOutput(
|
||||
output_shape.reserve(checked_output_rank.ValueOrDie());
|
||||
for (uint32_t i = 0; i < input.Rank(); ++i) {
|
||||
if (i == axis) {
|
||||
base::ranges::copy(indices.shape(), std::back_inserter(output_shape));
|
||||
std::ranges::copy(indices.shape(), std::back_inserter(output_shape));
|
||||
} else {
|
||||
output_shape.push_back(input.shape()[i]);
|
||||
}
|
||||
@ -1458,10 +1457,10 @@ base::expected<OperandDescriptor, std::string> ValidateGatherNDAndInferOutput(
|
||||
|
||||
std::vector<uint32_t> output_shape;
|
||||
output_shape.reserve(checked_output_rank.ValueOrDie());
|
||||
base::ranges::copy(indices.shape().begin(), indices.shape().end() - 1,
|
||||
std::back_inserter(output_shape));
|
||||
base::ranges::copy(input.shape().begin() + indices_last_dimension_size,
|
||||
input.shape().end(), std::back_inserter(output_shape));
|
||||
std::ranges::copy(indices.shape().begin(), indices.shape().end() - 1,
|
||||
std::back_inserter(output_shape));
|
||||
std::ranges::copy(input.shape().begin() + indices_last_dimension_size,
|
||||
input.shape().end(), std::back_inserter(output_shape));
|
||||
|
||||
return OperandDescriptor::Create(context_properties, input.data_type(),
|
||||
std::move(output_shape), label);
|
||||
@ -1505,13 +1504,13 @@ base::expected<OperandDescriptor, std::string> ValidateGemmAndInferOutput(
|
||||
|
||||
std::vector<uint32_t> shape_a = a.shape();
|
||||
if (attributes.a_transpose) {
|
||||
base::ranges::reverse(shape_a);
|
||||
std::ranges::reverse(shape_a);
|
||||
}
|
||||
// The second input 2-D tensor with shape [K, N] if bTranspose is false, or
|
||||
// [N, K] if bTranspose is true.
|
||||
std::vector<uint32_t> shape_b = b.shape();
|
||||
if (attributes.b_transpose) {
|
||||
base::ranges::reverse(shape_b);
|
||||
std::ranges::reverse(shape_b);
|
||||
}
|
||||
// The number of columns in the first matrix must be equal to the number of
|
||||
// rows in the second matrix.
|
||||
@ -1860,7 +1859,7 @@ ValidateLayerNormalizationAndInferOutput(
|
||||
// The dimensions for layerNormalization to reduce along.
|
||||
std::vector<uint32_t> reduction_dimensions;
|
||||
reduction_dimensions.reserve(axes.size());
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
axes, std::back_inserter(reduction_dimensions),
|
||||
[&input_dimensions](uint32_t axis) { return input_dimensions[axis]; });
|
||||
|
||||
@ -2635,11 +2634,11 @@ base::expected<OperandDescriptor, std::string> ValidateScatterNDAndInferOutput(
|
||||
|
||||
std::vector<uint32_t> expected_updates_shape;
|
||||
expected_updates_shape.reserve(checked_updates_rank.ValueOrDie());
|
||||
base::ranges::copy(indices.shape().begin(), indices.shape().end() - 1,
|
||||
std::back_inserter(expected_updates_shape));
|
||||
base::ranges::copy(input.shape().begin() + indices_last_dim_size,
|
||||
input.shape().end(),
|
||||
std::back_inserter(expected_updates_shape));
|
||||
std::ranges::copy(indices.shape().begin(), indices.shape().end() - 1,
|
||||
std::back_inserter(expected_updates_shape));
|
||||
std::ranges::copy(input.shape().begin() + indices_last_dim_size,
|
||||
input.shape().end(),
|
||||
std::back_inserter(expected_updates_shape));
|
||||
|
||||
if (expected_updates_shape != updates.shape()) {
|
||||
return base::unexpected(
|
||||
@ -2725,7 +2724,7 @@ base::expected<OperandDescriptor, std::string> ValidateWhereAndInferOutput(
|
||||
base::expected<void, std::string> ValidateAxes(base::span<const uint32_t> axes,
|
||||
uint32_t rank,
|
||||
std::string_view label) {
|
||||
if (base::ranges::any_of(axes, [rank](uint32_t axis) {
|
||||
if (std::ranges::any_of(axes, [rank](uint32_t axis) {
|
||||
return base::MakeStrictNum(axis) >= rank;
|
||||
})) {
|
||||
return base::unexpected(ErrorWithLabel(
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include "services/webnn/public/cpp/operand_descriptor.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
#include "base/containers/to_vector.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/types/expected_macros.h"
|
||||
#include "services/webnn/public/cpp/context_properties.h"
|
||||
#include "services/webnn/public/cpp/webnn_errors.h"
|
||||
@ -35,7 +35,7 @@ base::expected<uint64_t, std::string> ValidateAndGetByteLength(
|
||||
|
||||
// Enforce dimension range according to
|
||||
// https://www.w3.org/TR/webnn/#valid-dimension.
|
||||
if (base::ranges::any_of(shape, [](uint32_t dimension) {
|
||||
if (std::ranges::any_of(shape, [](uint32_t dimension) {
|
||||
return !base::CheckedNumeric<int32_t>(dimension).IsValid();
|
||||
})) {
|
||||
return base::unexpected(
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "services/webnn/public/cpp/operand_descriptor.h"
|
||||
#include "services/webnn/public/cpp/supported_data_types.h"
|
||||
|
||||
@ -51,7 +51,7 @@ struct SupportedTensors {
|
||||
|
||||
bool SupportsAll(
|
||||
std::initializer_list<OperandDescriptor> operand_descriptors) const {
|
||||
return base::ranges::all_of(
|
||||
return std::ranges::all_of(
|
||||
operand_descriptors,
|
||||
[this](const OperandDescriptor& operand_descriptor) {
|
||||
return Supports(operand_descriptor);
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include "services/webnn/public/cpp/webnn_errors.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "services/webnn/public/cpp/operand_descriptor.h"
|
||||
@ -22,7 +22,7 @@ static constexpr char kInputParam[] = "input";
|
||||
|
||||
std::string SupportedDataTypesString(SupportedDataTypes supported_types) {
|
||||
std::vector<std::string> type_strings;
|
||||
base::ranges::transform(
|
||||
std::ranges::transform(
|
||||
supported_types, std::back_inserter(type_strings),
|
||||
[](OperandDataType type) { return DataTypeToString(type); });
|
||||
return base::StrCat(
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
#include "services/webnn/tflite/buffer_content.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "third_party/tflite/buildflags.h"
|
||||
#include "third_party/tflite/src/tensorflow/lite/util.h"
|
||||
|
||||
@ -33,7 +34,7 @@ BufferContent::BufferContent(size_t size)
|
||||
::tflite::kDefaultTensorAlignment)),
|
||||
size_(size) {
|
||||
// `base::AlignedAlloc` does not return initialized memory.
|
||||
base::ranges::fill(AsSpan(), 0);
|
||||
std::ranges::fill(AsSpan(), 0);
|
||||
}
|
||||
|
||||
BufferContent::~BufferContent() = default;
|
||||
|
@ -7,7 +7,9 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <concepts>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
@ -16,8 +18,6 @@
|
||||
#include "base/containers/span.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/ranges/functional.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/types/expected.h"
|
||||
#include "base/types/expected_macros.h"
|
||||
@ -264,8 +264,8 @@ base::expected<TfLitePadding, std::string> GetTfLitePaddingMode(
|
||||
std::vector<uint32_t> GetIndexOfSortedValue(base::span<const uint32_t> axes) {
|
||||
std::vector<uint32_t> sorted_indices(axes.size());
|
||||
std::iota(sorted_indices.begin(), sorted_indices.end(), 0);
|
||||
base::ranges::sort(sorted_indices, base::ranges::less(),
|
||||
[axes](uint32_t index) { return axes[index]; });
|
||||
std::ranges::sort(sorted_indices, std::ranges::less(),
|
||||
[axes](uint32_t index) { return axes[index]; });
|
||||
return sorted_indices;
|
||||
}
|
||||
|
||||
@ -1085,24 +1085,24 @@ auto GraphBuilderTflite::FinishAndTakeResult(
|
||||
int32_t* graph_input_ids = nullptr;
|
||||
auto graph_input_ids_index = builder_.CreateUninitializedVector<int32_t>(
|
||||
input_operands.size(), &graph_input_ids);
|
||||
base::ranges::transform(input_operands, graph_input_ids, get_index);
|
||||
std::ranges::transform(input_operands, graph_input_ids, get_index);
|
||||
|
||||
std::vector<std::pair<std::string, int>> input_name_to_index;
|
||||
input_name_to_index.reserve(input_operands.size());
|
||||
base::ranges::transform(input_operands,
|
||||
std::back_inserter(input_name_to_index),
|
||||
get_name_and_index);
|
||||
std::ranges::transform(input_operands,
|
||||
std::back_inserter(input_name_to_index),
|
||||
get_name_and_index);
|
||||
|
||||
int32_t* graph_output_ids = nullptr;
|
||||
auto graph_output_ids_index = builder_.CreateUninitializedVector<int32_t>(
|
||||
output_operands.size(), &graph_output_ids);
|
||||
base::ranges::transform(output_operands, graph_output_ids, get_index);
|
||||
std::ranges::transform(output_operands, graph_output_ids, get_index);
|
||||
|
||||
std::vector<std::pair<std::string, int>> output_name_to_index;
|
||||
output_name_to_index.reserve(output_operands.size());
|
||||
base::ranges::transform(output_operands,
|
||||
std::back_inserter(output_name_to_index),
|
||||
get_name_and_index);
|
||||
std::ranges::transform(output_operands,
|
||||
std::back_inserter(output_name_to_index),
|
||||
get_name_and_index);
|
||||
|
||||
// Insert the cast operator for the graph output operand after the unsupported
|
||||
// float16 inference operation.
|
||||
@ -1146,7 +1146,7 @@ uint32_t GraphBuilderTflite::SerializeBuffer(base::span<const uint8_t> buffer) {
|
||||
std::fill_n(std::back_inserter(buffer_data_), padding, 0);
|
||||
CHECK_EQ(buffer_data_.size() % kWeightsAlignment, 0u);
|
||||
|
||||
base::ranges::copy(buffer, std::back_inserter(buffer_data_));
|
||||
std::ranges::copy(buffer, std::back_inserter(buffer_data_));
|
||||
const auto buffer_index = base::checked_cast<uint32_t>(buffers_.size());
|
||||
buffers_.emplace_back(
|
||||
::tflite::CreateBuffer(builder_, /*data=*/0, offset, buffer.size()));
|
||||
@ -1624,7 +1624,7 @@ auto GraphBuilderTflite::InsertPadOperation(const TensorInfo& input_tensor_info,
|
||||
// [beginning_height, ending_height], [beginning_width, ending_width], [0,
|
||||
// 0]].
|
||||
std::array<int32_t, 8> tflite_paddings = {};
|
||||
base::ranges::copy(paddings, tflite_paddings.begin() + 2);
|
||||
std::ranges::copy(paddings, tflite_paddings.begin() + 2);
|
||||
|
||||
// The shape of padding is [n, 2], where n is the rank of input as described
|
||||
// here https://www.tensorflow.org/mlir/tfl_ops#tflmirror_pad_tflmirrorpadop.
|
||||
@ -3866,7 +3866,7 @@ int32_t GraphBuilderTflite::TransposeAndReshapeLayerNormalizationScaleBias(
|
||||
// transposed to [1, 4, 3] and then reshaped to [1, 1, 4, 3].
|
||||
std::optional<int32_t> transpose_tensor_index;
|
||||
const std::vector<uint32_t> sorted_indices = GetIndexOfSortedValue(axes);
|
||||
if (!base::ranges::is_sorted(sorted_indices)) {
|
||||
if (!std::ranges::is_sorted(sorted_indices)) {
|
||||
transpose_tensor_index =
|
||||
InsertTransposeOperation(scale_or_bias_tensor_info, sorted_indices);
|
||||
}
|
||||
@ -4389,28 +4389,28 @@ base::FixedArray<int64_t> GraphBuilderTflite::GetConstantInt64Value(
|
||||
return GetInt64ZeroPointFromInt4(operand_id);
|
||||
}
|
||||
case OperandDataType::kInt8: {
|
||||
base::ranges::copy(GetConstantValue<int8_t>(operand_id),
|
||||
typed_value.begin());
|
||||
std::ranges::copy(GetConstantValue<int8_t>(operand_id),
|
||||
typed_value.begin());
|
||||
break;
|
||||
}
|
||||
case OperandDataType::kUint8: {
|
||||
base::ranges::copy(GetConstantValue<uint8_t>(operand_id),
|
||||
typed_value.begin());
|
||||
std::ranges::copy(GetConstantValue<uint8_t>(operand_id),
|
||||
typed_value.begin());
|
||||
break;
|
||||
}
|
||||
case OperandDataType::kInt32: {
|
||||
base::ranges::copy(GetConstantValue<int32_t>(operand_id),
|
||||
typed_value.begin());
|
||||
std::ranges::copy(GetConstantValue<int32_t>(operand_id),
|
||||
typed_value.begin());
|
||||
break;
|
||||
}
|
||||
case OperandDataType::kUint32: {
|
||||
base::ranges::copy(GetConstantValue<uint32_t>(operand_id),
|
||||
typed_value.begin());
|
||||
std::ranges::copy(GetConstantValue<uint32_t>(operand_id),
|
||||
typed_value.begin());
|
||||
break;
|
||||
}
|
||||
case OperandDataType::kInt64: {
|
||||
base::ranges::copy(GetConstantValue<int64_t>(operand_id),
|
||||
typed_value.begin());
|
||||
std::ranges::copy(GetConstantValue<int64_t>(operand_id),
|
||||
typed_value.begin());
|
||||
break;
|
||||
}
|
||||
case OperandDataType::kFloat32:
|
||||
@ -4883,7 +4883,7 @@ auto GraphBuilderTflite::SerializeResample2d(
|
||||
GetOperand(resample2d.input_operand_id).descriptor));
|
||||
|
||||
const std::array<uint32_t, 2> supported_axes = {1, 2};
|
||||
CHECK(base::ranges::equal(resample2d.axes, supported_axes));
|
||||
CHECK(std::ranges::equal(resample2d.axes, supported_axes));
|
||||
|
||||
// Create tflite builtin options for resize mode that is align_corner = false
|
||||
// and half_pixel_center = true by default. WebNN will support coordinate
|
||||
@ -4976,7 +4976,7 @@ auto GraphBuilderTflite::SerializeReverse(const mojom::Reverse& reverse)
|
||||
// tensor need to be reversed slice by slice.
|
||||
ASSIGN_OR_RETURN(std::vector<int32_t> signed_axes,
|
||||
ToSignedDimensions(reverse.axes));
|
||||
base::ranges::sort(signed_axes);
|
||||
std::ranges::sort(signed_axes);
|
||||
std::vector<int32_t> contiguous_axes = {signed_axes[0]};
|
||||
std::optional<int32_t> previous_reverse_tensor_index;
|
||||
for (size_t i = 1; i < signed_axes.size(); ++i) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user