0

[cleanup] Replace base::ranges with std::ranges: cc/

Done entirely with `git grep` and `sed` + `git cl format`, no
hand-editing.

Bug: 386918226
Change-Id: I8658f3087c8f0c622737c44e9180b4822b6f5255
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6203441
Commit-Queue: Vladimir Levin <vmpstr@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1411817}
This commit is contained in:
Peter Kasting
2025-01-27 12:23:37 -08:00
committed by Chromium LUCI CQ
parent 8bc3191eed
commit 51968ce288
36 changed files with 126 additions and 142 deletions

@ -14,7 +14,6 @@
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "cc/animation/animation.h"
@ -842,7 +841,7 @@ void AnimationHost::AddToTicking(scoped_refptr<Animation> animation) {
void AnimationHost::RemoveFromTicking(scoped_refptr<Animation> animation) {
auto to_erase =
base::ranges::find(ticking_animations_.Write(*this), animation);
std::ranges::find(ticking_animations_.Write(*this), animation);
if (to_erase != ticking_animations_.Write(*this).end()) {
ticking_animations_.Write(*this).erase(to_erase);
}
@ -867,7 +866,7 @@ void AnimationHost::SetLayerTreeMutator(
WorkletAnimation* AnimationHost::FindWorkletAnimation(WorkletAnimationId id) {
// TODO(majidvp): Use a map to make lookup O(1)
auto animation =
base::ranges::find_if(ticking_animations_.Read(*this), [id](auto& it) {
std::ranges::find_if(ticking_animations_.Read(*this), [id](auto& it) {
return it->IsWorkletAnimation() &&
ToWorkletAnimation(it.get())->worklet_animation_id() == id;
});

@ -11,7 +11,6 @@
#include <vector>
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "cc/animation/animation.h"
#include "cc/animation/animation_host.h"
@ -249,7 +248,7 @@ void KeyframeEffect::AddKeyframeModel(
keyframe_model->TargetProperty() == TargetProperty::SCROLL_OFFSET);
// This is to make sure that keyframe models in the same group, i.e., start
// together, don't animate the same property.
DCHECK(base::ranges::none_of(
DCHECK(std::ranges::none_of(
keyframe_models(), [&](const auto& existing_keyframe_model) {
auto* cc_existing_keyframe_model =
KeyframeModel::ToCcKeyframeModel(existing_keyframe_model.get());
@ -273,7 +272,7 @@ void KeyframeEffect::AddKeyframeModel(
// We should never have more than one scroll offset animation queued on the
// same scrolling element as this would result in multiple automated
// scrolls.
DCHECK(base::ranges::none_of(
DCHECK(std::ranges::none_of(
keyframe_models(), [&](const auto& existing_keyframe_model) {
auto* cc_existing_keyframe_model =
KeyframeModel::ToCcKeyframeModel(existing_keyframe_model.get());
@ -1025,7 +1024,7 @@ void KeyframeEffect::MarkKeyframeModelsForDeletion(
cc_keyframe_model->group());
bool a_keyframe_model_in_same_group_is_not_finished =
base::ranges::any_of(keyframe_models_in_same_group, [&](size_t index) {
std::ranges::any_of(keyframe_models_in_same_group, [&](size_t index) {
auto* keyframe_model =
KeyframeModel::ToCcKeyframeModel(keyframe_models()[index].get());
return !keyframe_model->is_finished() ||

@ -4,12 +4,12 @@
#include "cc/benchmarks/micro_benchmark_controller.h"
#include <algorithm>
#include <limits>
#include <utility>
#include <vector>
#include "base/functional/callback.h"
#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "base/values.h"
#include "cc/benchmarks/invalidation_benchmark.h"
@ -79,7 +79,7 @@ int MicroBenchmarkController::GetNextIdAndIncrement() {
}
bool MicroBenchmarkController::SendMessage(int id, base::Value::Dict message) {
auto it = base::ranges::find(benchmarks_, id, &MicroBenchmark::id);
auto it = std::ranges::find(benchmarks_, id, &MicroBenchmark::id);
if (it == benchmarks_.end())
return false;
return (*it)->ProcessMessage(std::move(message));

@ -18,7 +18,6 @@
#include "base/metrics/histogram.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
@ -393,8 +392,8 @@ void Layer::ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer) {
// Find the index of |reference| in |children_|.
auto& inputs = inputs_.Write(*this);
auto reference_it = base::ranges::find(inputs.children, reference,
&scoped_refptr<Layer>::get);
auto reference_it =
std::ranges::find(inputs.children, reference, &scoped_refptr<Layer>::get);
CHECK(reference_it != inputs.children.end(), base::NotFatalUntil::M130);
size_t reference_index = reference_it - inputs.children.begin();
reference->RemoveFromParent();
@ -522,7 +521,7 @@ void Layer::RequestCopyOfOutput(
auto& inputs = EnsureLayerTreeInputs();
if (request->has_source()) {
const base::UnguessableToken& source = request->source();
auto it = base::ranges::find_if(
auto it = std::ranges::find_if(
inputs.copy_requests,
[&source](const std::unique_ptr<viz::CopyOutputRequest>& x) {
return x->has_source() && x->source() == source;

@ -4,8 +4,9 @@
#include "cc/layers/picture_layer_impl.h"
#include <algorithm>
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/timer/lap_timer.h"
#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/fake_raster_source.h"
@ -31,7 +32,7 @@ void AddTiling(float scale,
tiling->set_resolution(HIGH_RESOLUTION);
tiling->CreateAllTilesForTesting();
std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting();
base::ranges::copy(tiling_tiles, std::back_inserter(*all_tiles));
std::ranges::copy(tiling_tiles, std::back_inserter(*all_tiles));
}
class PictureLayerImplPerfTest : public LayerTreeImplTestBase,

@ -20,7 +20,6 @@
#include "base/debug/alias.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
@ -1917,7 +1916,7 @@ void CompositorFrameReporter::CalculateEventLatencyPrediction(
// TODO(crbug.com/40228308): Explore calculating predictions for multiple
// events. Currently only kGestureScrollUpdate event predictions
// are being calculated, consider including other stages in future changes.
auto event_it = base::ranges::find_if(
auto event_it = std::ranges::find_if(
events_metrics_, [](const std::unique_ptr<EventMetrics>& event) {
return event &&
event->type() == EventMetrics::EventType::kGestureScrollUpdate;
@ -1980,9 +1979,9 @@ void CompositorFrameReporter::CalculateEventLatencyPrediction(
}
// Determine dispatch-to-compositor transition stage duration.
auto stage_it = base::ranges::lower_bound(
stage_history_, dispatch_end_time, {},
&CompositorFrameReporter::StageData::start_time);
auto stage_it =
std::ranges::lower_bound(stage_history_, dispatch_end_time, {},
&CompositorFrameReporter::StageData::start_time);
if (stage_it != stage_history_.end()) {
if (dispatch_end_time < stage_it->start_time) {
base::TimeDelta stage_duration = stage_it->start_time - dispatch_end_time;

@ -4,13 +4,13 @@
#include "cc/metrics/compositor_frame_reporter.h"
#include <algorithm>
#include <array>
#include <memory>
#include <utility>
#include <vector>
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_tick_clock.h"
@ -188,11 +188,11 @@ class CompositorFrameReporterTest : public testing::Test {
const EventMetrics::List& events_metrics) {
std::vector<base::TimeTicks> event_times;
event_times.reserve(events_metrics.size());
base::ranges::transform(events_metrics, std::back_inserter(event_times),
[](const auto& event_metrics) {
return event_metrics->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
});
std::ranges::transform(events_metrics, std::back_inserter(event_times),
[](const auto& event_metrics) {
return event_metrics->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
});
return event_times;
}

@ -4,12 +4,12 @@
#include "cc/metrics/compositor_frame_reporting_controller.h"
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_tick_clock.h"
@ -308,11 +308,11 @@ class CompositorFrameReportingControllerTest : public testing::Test {
const EventMetrics::List& events_metrics) {
std::vector<base::TimeTicks> event_times;
event_times.reserve(events_metrics.size());
base::ranges::transform(events_metrics, std::back_inserter(event_times),
[](const auto& event_metrics) {
return event_metrics->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
});
std::ranges::transform(events_metrics, std::back_inserter(event_times),
[](const auto& event_metrics) {
return event_metrics->GetDispatchStageTimestamp(
EventMetrics::DispatchStage::kGenerated);
});
return event_times;
}

@ -12,7 +12,6 @@
#include "base/functional/bind.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "build/chromeos_buildflags.h"
#include "cc/base/features.h"
@ -328,7 +327,7 @@ void DroppedFrameCounter::ReportFrames() {
.GetPercentDroppedFrameBuckets();
DCHECK_EQ(sliding_window_buckets.size(),
std::size(smoothness_data.buckets));
base::ranges::copy(sliding_window_buckets, smoothness_data.buckets);
std::ranges::copy(sliding_window_buckets, smoothness_data.buckets);
smoothness_data.main_focused_median = SlidingWindowMedianPercentDropped(
SmoothnessStrategy::kMainFocusedStrategy);

@ -4,9 +4,10 @@
#include "cc/metrics/event_latency_tracing_recorder.h"
#include <algorithm>
#include "base/feature_list.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "base/trace_event/trace_id_helper.h"
#include "base/trace_event/typed_macros.h"
@ -324,7 +325,7 @@ void EventLatencyTracingRecorder::RecordEventLatencyTraceEventInternal(
DCHECK(viz_breakdown);
// Find the first compositor stage that starts at the same time or after the
// end of the final event dispatch stage.
auto stage_it = base::ranges::lower_bound(
auto stage_it = std::ranges::lower_bound(
*stage_history, dispatch_timestamp, {},
&CompositorFrameReporter::StageData::start_time);
// TODO(crbug.com/40843545): Ideally, at least the start time of

@ -4,10 +4,10 @@
#include "cc/metrics/ukm_manager.h"
#include <algorithm>
#include <utility>
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "cc/metrics/compositor_frame_reporter.h"
#include "components/viz/common/quads/compositor_frame.h"
@ -304,7 +304,7 @@ void UkmManager::RecordEventLatencyUKM(
// a begin-impl, and the event was handled on the renderer before that frame
// ended). To handle such cases, find the first stage that happens after the
// event's processing finished on the renderer.
auto stage_it = base::ranges::lower_bound(
auto stage_it = std::ranges::lower_bound(
stage_history, dispatch_timestamp, {},
&CompositorFrameReporter::StageData::start_time);
// TODO(crbug.com/40843545): Ideally, at least the start time of

@ -4,10 +4,10 @@
#include "cc/metrics/ukm_manager.h"
#include <algorithm>
#include <utility>
#include <vector>
#include "base/ranges/algorithm.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "cc/metrics/begin_main_frame_metrics.h"
@ -185,7 +185,7 @@ class UkmManagerTest : public testing::Test {
const EventMetrics::List& events_metrics) {
std::vector<DispatchTimestamps> event_times;
event_times.reserve(events_metrics.size());
base::ranges::transform(
std::ranges::transform(
events_metrics, std::back_inserter(event_times),
[](const auto& event_metrics) {
return DispatchTimestamps{

@ -13,7 +13,6 @@
#include "base/memory/values_equivalent.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/types/optional_util.h"
#include "build/build_config.h"
#include "cc/paint/draw_image.h"
@ -702,7 +701,7 @@ bool MatrixConvolutionPaintFilter::EqualsForTesting(
const MatrixConvolutionPaintFilter& other) const {
return OneInputPaintFilter::EqualsForTesting(other) &&
kernel_size_ == other.kernel_size_ &&
base::ranges::equal(kernel_, other.kernel_) && gain_ == other.gain_ &&
std::ranges::equal(kernel_, other.kernel_) && gain_ == other.gain_ &&
bias_ == other.bias_ && kernel_offset_ == other.kernel_offset_ &&
tile_mode_ == other.tile_mode_ &&
convolve_alpha_ == other.convolve_alpha_;
@ -983,10 +982,10 @@ sk_sp<PaintFilter> MergePaintFilter::SnapshotWithImagesInternal(
}
bool MergePaintFilter::EqualsForTesting(const MergePaintFilter& other) const {
return base::ranges::equal(
inputs_, other.inputs_, [](const auto& a, const auto& b) {
return AreValuesEqualForTesting(a, b); // IN-TEST
});
return std::ranges::equal(inputs_, other.inputs_,
[](const auto& a, const auto& b) {
return AreValuesEqualForTesting(a, b); // IN-TEST
});
}
MorphologyPaintFilter::MorphologyPaintFilter(MorphType morph_type,

@ -1963,7 +1963,7 @@ bool DrawSkottieOp::EqualsForTesting(const DrawSkottieOp& other) const {
text_map != other.text_map) {
return false;
}
return base::ranges::equal(
return std::ranges::equal(
images, other.images, [](const auto& a, const auto& b) {
return a.first == b.first &&
// PaintImage::IsSameForTesting() returns false in cases where
@ -2017,7 +2017,7 @@ bool SaveLayerAlphaOp::EqualsForTesting(const SaveLayerAlphaOp& other) const {
bool SaveLayerFiltersOp::EqualsForTesting(
const SaveLayerFiltersOp& other) const {
return flags.EqualsForTesting(other.flags) && // IN-TEST
base::ranges::equal(
std::ranges::equal(
filters, other.filters,
[](const sk_sp<PaintFilter>& lhs, const sk_sp<PaintFilter>& rhs) {
return base::ValuesEquivalent(

@ -13,7 +13,6 @@
#include <utility>
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/types/optional_util.h"
#include "cc/paint/display_item_list.h"
#include "cc/paint/paint_flags.h"
@ -551,10 +550,10 @@ bool PaintOpBuffer::EqualsForTesting(const PaintOpBuffer& other) const {
return false;
}
return base::ranges::equal(*this, other,
[](const PaintOp& a, const PaintOp& b) {
return a.EqualsForTesting(b); // IN-TEST
});
return std::ranges::equal(*this, other,
[](const PaintOp& a, const PaintOp& b) {
return a.EqualsForTesting(b); // IN-TEST
});
}
bool PaintOpBuffer::NeedsAdditionalInvalidationForLCDText(

@ -6,11 +6,11 @@
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include "base/ranges/algorithm.h"
#include "base/threading/simple_thread.h"
#include "base/trace_event/base_tracing.h"
#include "base/trace_event/trace_event.h"
@ -158,7 +158,7 @@ bool SingleThreadTaskGraphRunner::RunTaskWithLockAcquired() {
// Find the first category with any tasks to run. This task graph runner
// treats categories as an additional priority.
const auto& ready_to_run_namespaces = work_queue_.ready_to_run_namespaces();
auto found = base::ranges::find_if_not(
auto found = std::ranges::find_if_not(
ready_to_run_namespaces,
&TaskGraphWorkQueue::TaskNamespace::Vector::empty,
&TaskGraphWorkQueue::ReadyNamespaces::value_type::second);

@ -4,13 +4,13 @@
#include "cc/raster/staging_buffer_pool.h"
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
@ -258,7 +258,7 @@ std::unique_ptr<StagingBuffer> StagingBufferPool::AcquireStagingBuffer(
// Find a staging buffer that allows us to perform partial raster if possible.
if (use_partial_raster_ && previous_content_id) {
StagingBufferDeque::iterator it = base::ranges::find(
StagingBufferDeque::iterator it = std::ranges::find(
free_buffers_, previous_content_id, &StagingBuffer::content_id);
if (it != free_buffers_.end()) {
staging_buffer = std::move(*it);
@ -269,7 +269,7 @@ std::unique_ptr<StagingBuffer> StagingBufferPool::AcquireStagingBuffer(
// Find staging buffer of correct size and format.
if (!staging_buffer) {
StagingBufferDeque::iterator it = base::ranges::find_if(
StagingBufferDeque::iterator it = std::ranges::find_if(
free_buffers_,
[&size, format](const std::unique_ptr<StagingBuffer>& buffer) {
return buffer->size == size && buffer->format == format;

@ -6,9 +6,9 @@
#include <stdint.h>
#include <algorithm>
#include <utility>
#include "base/ranges/algorithm.h"
#include "base/threading/simple_thread.h"
#include "base/trace_event/heap_profiler.h"
#include "base/trace_event/trace_event.h"
@ -85,7 +85,7 @@ bool SynchronousTaskGraphRunner::RunTask() {
// Find the first category with any tasks to run. This task graph runner
// treats categories as an additional priority.
const auto& ready_to_run_namespaces = work_queue_.ready_to_run_namespaces();
auto found = base::ranges::find_if_not(
auto found = std::ranges::find_if_not(
ready_to_run_namespaces,
&TaskGraphWorkQueue::TaskNamespace::Vector::empty,
&TaskGraphWorkQueue::ReadyNamespaces::value_type::second);

@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <utility>
@ -14,7 +15,6 @@
#include "base/containers/contains.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_id_helper.h"
#include "base/trace_event/typed_macros.h"
@ -84,9 +84,9 @@ class DependentIterator {
} while (graph_->edges[current_index_].task != task_);
// Now find the node for the dependent of this edge.
auto it = base::ranges::find(graph_->nodes,
graph_->edges[current_index_].dependent.get(),
&TaskGraph::Node::task);
auto it = std::ranges::find(graph_->nodes,
graph_->edges[current_index_].dependent.get(),
&TaskGraph::Node::task);
CHECK(it != graph_->nodes.end(), base::NotFatalUntil::M130);
current_node_ = &(*it);
@ -182,8 +182,8 @@ void TaskGraphWorkQueue::ScheduleTasks(NamespaceToken token, TaskGraph* graph) {
// Remove any old nodes that are associated with this task. The result is
// that the old graph is left with all nodes not present in this graph,
// which we use below to determine what tasks need to be canceled.
auto old_it = base::ranges::find(task_namespace.graph.nodes, node.task,
&TaskGraph::Node::task);
auto old_it = std::ranges::find(task_namespace.graph.nodes, node.task,
&TaskGraph::Node::task);
if (old_it != task_namespace.graph.nodes.end()) {
std::swap(*old_it, task_namespace.graph.nodes.back());
// If old task is scheduled to run again and not yet started running,
@ -307,8 +307,8 @@ bool TaskGraphWorkQueue::ExternalDependencyCompletedForTask(
TaskNamespace* task_namespace = GetNamespaceForToken(token);
CHECK(task_namespace || task->state().IsCanceled());
if (task_namespace) {
auto iter = base::ranges::find(task_namespace->graph.nodes, task.get(),
&TaskGraph::Node::task);
auto iter = std::ranges::find(task_namespace->graph.nodes, task.get(),
&TaskGraph::Node::task);
if (iter == task_namespace->graph.nodes.end()) {
return false;
}
@ -373,8 +373,8 @@ void TaskGraphWorkQueue::CompleteTask(PrioritizedTask completed_task) {
scoped_refptr<Task> task(std::move(completed_task.task));
// Remove task from |running_tasks|.
auto it = base::ranges::find(task_namespace->running_tasks, task,
&CategorizedTask::second);
auto it = std::ranges::find(task_namespace->running_tasks, task,
&CategorizedTask::second);
CHECK(it != task_namespace->running_tasks.end(), base::NotFatalUntil::M130);
std::swap(*it, task_namespace->running_tasks.back());
task_namespace->running_tasks.pop_back();

@ -7,13 +7,13 @@
#include <stdint.h>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "cc/cc_export.h"
#include "cc/raster/task_graph_runner.h"
@ -124,15 +124,15 @@ class CC_EXPORT TaskGraphWorkQueue {
static bool HasReadyToRunTasksInNamespace(
const TaskNamespace* task_namespace) {
return !base::ranges::all_of(
task_namespace->ready_to_run_tasks, &PrioritizedTask::Vector::empty,
&TaskNamespace::ReadyTasks::value_type::second);
return !std::ranges::all_of(task_namespace->ready_to_run_tasks,
&PrioritizedTask::Vector::empty,
&TaskNamespace::ReadyTasks::value_type::second);
}
static bool HasTasksBlockedOnExternalDependencyInNamespace(
const TaskNamespace* task_namespace) {
return base::ranges::any_of(task_namespace->graph.nodes,
&TaskGraph::Node::has_external_dependency);
return std::ranges::any_of(task_namespace->graph.nodes,
&TaskGraph::Node::has_external_dependency);
}
static bool HasFinishedRunningTasksInNamespace(
@ -143,9 +143,9 @@ class CC_EXPORT TaskGraphWorkQueue {
}
bool HasReadyToRunTasks() const {
return !base::ranges::all_of(ready_to_run_namespaces_,
&TaskNamespace::Vector::empty,
&ReadyNamespaces::value_type::second);
return !std::ranges::all_of(ready_to_run_namespaces_,
&TaskNamespace::Vector::empty,
&ReadyNamespaces::value_type::second);
}
bool HasReadyToRunTasksForCategory(uint16_t category) const {
@ -156,7 +156,7 @@ class CC_EXPORT TaskGraphWorkQueue {
bool HasAnyNamespaces() const { return !namespaces_.empty(); }
bool HasFinishedRunningTasksInAllNamespaces() {
return base::ranges::all_of(
return std::ranges::all_of(
namespaces_, [](const TaskNamespaceMap::value_type& entry) {
return HasFinishedRunningTasksInNamespace(&entry.second);
});

@ -19,7 +19,6 @@
#include "base/functional/bind.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
@ -307,7 +306,7 @@ void ResourcePool::OnResourceReleased(size_t unique_id,
// TODO(danakj): Should busy_resources be a map?
auto busy_it =
base::ranges::find(busy_resources_, unique_id, &PoolResource::unique_id);
std::ranges::find(busy_resources_, unique_id, &PoolResource::unique_id);
// If the resource isn't busy then we made it available for reuse already
// somehow, even though it was exported to the ResourceProvider, or we evicted
// a resource that was still in use by the display compositor.

@ -12,7 +12,6 @@
#include "base/atomic_sequence_num.h"
#include "base/check.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "cc/paint/filter_operation.h"
#include "cc/slim/layer_tree.h"
#include "cc/slim/layer_tree_impl.h"
@ -127,7 +126,7 @@ void Layer::ReplaceChild(Layer* old_child, scoped_refptr<Layer> new_child) {
return;
}
auto it = base::ranges::find_if(
auto it = std::ranges::find_if(
children_, [&](auto& ptr) { return ptr.get() == old_child; });
CHECK(it != children_.end(), base::NotFatalUntil::M130);
old_child->SetParentSlim(nullptr);

@ -11,7 +11,6 @@
#include "base/auto_reset.h"
#include "base/containers/adapters.h"
#include "base/metrics/histogram.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "cc/base/histograms.h"
@ -160,7 +159,7 @@ void LayerTreeImpl::RequestCopyOfOutput(
std::unique_ptr<viz::CopyOutputRequest> request) {
if (request->has_source()) {
const base::UnguessableToken& source = request->source();
auto it = base::ranges::find_if(
auto it = std::ranges::find_if(
copy_requests_for_next_frame_,
[&source](const std::unique_ptr<viz::CopyOutputRequest>& x) {
return x->has_source() && x->source() == source;

@ -4,12 +4,12 @@
#include "cc/tiles/decoded_image_tracker.h"
#include <algorithm>
#include <unordered_map>
#include <vector>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/ranges/algorithm.h"
#include "base/test/test_mock_time_task_runner.h"
#include "cc/paint/paint_image_builder.h"
#include "cc/test/skia_common.h"
@ -25,8 +25,7 @@ class TestImageController : public ImageController {
: ImageController(nullptr, nullptr, base::DoNothing()) {}
void UnlockImageDecode(ImageDecodeRequestId id) override {
auto it =
base::ranges::find(locked_ids_, id, &LockedIds::value_type::first);
auto it = std::ranges::find(locked_ids_, id, &LockedIds::value_type::first);
ASSERT_FALSE(it == locked_ids_.end());
locked_ids_.erase(it);
}

@ -26,7 +26,6 @@
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/numerics/safe_math.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
#include "base/task/single_thread_task_runner.h"
@ -3746,7 +3745,7 @@ void GpuImageDecodeCache::UpdateMipsIfNeeded(const DrawImage& draw_image,
scoped_refptr<TileTask> GpuImageDecodeCache::GetTaskFromMapForClientId(
const ClientId client_id,
const ImageTaskMap& task_map) {
auto task_it = base::ranges::find_if(
auto task_it = std::ranges::find_if(
task_map,
[client_id](
const std::pair<ClientId, scoped_refptr<TileTask>> task_item) {

@ -159,7 +159,7 @@ void ImageController::StopWorkerTasks() {
bool ImageController::HasReadyToRunTask() const {
worker_state_->lock.AssertAcquired();
return base::ranges::any_of(
return std::ranges::any_of(
worker_state_->image_decode_queue.begin(),
worker_state_->image_decode_queue.end(),
[](const ImageDecodeRequest& request) -> bool {
@ -362,13 +362,13 @@ void ImageController::ExternalDependencyCompletedForTask(
request.has_external_dependency = false;
}
};
base::ranges::for_each(
std::ranges::for_each(
worker_state_->image_decode_queue.begin(),
worker_state_->image_decode_queue.end(), external_dependency_completed,
&std::pair<const ImageDecodeRequestId, ImageDecodeRequest>::second);
base::ranges::for_each(orphaned_decode_requests_.begin(),
orphaned_decode_requests_.end(),
external_dependency_completed);
std::ranges::for_each(orphaned_decode_requests_.begin(),
orphaned_decode_requests_.end(),
external_dependency_completed);
ScheduleImageDecodeOnWorkerIfNeeded();
}

@ -16,7 +16,6 @@
#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "cc/raster/raster_source.h"
#include "ui/gfx/geometry/rect_conversions.h"
@ -312,8 +311,8 @@ PictureLayerTiling* PictureLayerTilingSet::AddTiling(
}
int PictureLayerTilingSet::NumHighResTilings() const {
return base::ranges::count(tilings_, HIGH_RESOLUTION,
&PictureLayerTiling::resolution);
return std::ranges::count(tilings_, HIGH_RESOLUTION,
&PictureLayerTiling::resolution);
}
PictureLayerTiling* PictureLayerTilingSet::FindTilingWithScaleKey(
@ -328,7 +327,7 @@ PictureLayerTiling* PictureLayerTilingSet::FindTilingWithScaleKey(
PictureLayerTiling* PictureLayerTilingSet::FindTilingWithResolution(
TileResolution resolution) const {
auto iter =
base::ranges::find(tilings_, resolution, &PictureLayerTiling::resolution);
std::ranges::find(tilings_, resolution, &PictureLayerTiling::resolution);
if (iter == tilings_.end())
return nullptr;
return iter->get();
@ -379,8 +378,8 @@ void PictureLayerTilingSet::RemoveAllTilings() {
}
void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) {
auto iter = base::ranges::find(tilings_, tiling,
&std::unique_ptr<PictureLayerTiling>::get);
auto iter = std::ranges::find(tilings_, tiling,
&std::unique_ptr<PictureLayerTiling>::get);
if (iter == tilings_.end())
return;
tilings_.erase(iter);

@ -18,7 +18,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/numerics/ostream_operators.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/memory_dump_manager.h"
@ -637,7 +636,7 @@ void SoftwareImageDecodeCache::ReduceCacheUsageUntilWithinLimit(size_t limit) {
const CacheKey& key = it->first;
auto vector_it = frame_key_to_image_keys_.find(key.frame_key());
auto item_it = base::ranges::find(vector_it->second, key);
auto item_it = std::ranges::find(vector_it->second, key);
CHECK(item_it != vector_it->second.end(), base::NotFatalUntil::M130);
vector_it->second.erase(item_it);
if (vector_it->second.empty())

@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <limits>
#include <optional>
#include <string>
@ -21,7 +22,6 @@
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
@ -1271,7 +1271,7 @@ void TileManager::ScheduleTasks(PrioritizedWorkToSchedule work_to_schedule) {
for (auto& task : new_locked_image_tasks) {
auto decode_it =
base::ranges::find(graph_.nodes, task.get(), &TaskGraph::Node::task);
std::ranges::find(graph_.nodes, task.get(), &TaskGraph::Node::task);
// If this task is already in the graph, then we don't have to insert it.
if (decode_it != graph_.nodes.end())
continue;
@ -1545,7 +1545,7 @@ void TileManager::InsertNodesForRasterTask(TileTask* raster_task,
// Add decode task if it doesn't already exist in graph_.
auto decode_it =
base::ranges::find(graph_.nodes, decode_task, &TaskGraph::Node::task);
std::ranges::find(graph_.nodes, decode_task, &TaskGraph::Node::task);
// In rare circumstances, a background category task may come in before a
// foreground category task. In these cases, upgrade any background category

@ -19,7 +19,6 @@
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "cc/base/features.h"
#include "cc/base/math_util.h"
@ -1683,7 +1682,7 @@ bool LogDoubleBackgroundBlur(const LayerTreeImpl& layer_tree_impl,
gfx::Rect screen_space_rect = MathUtil::MapEnclosingClippedRect(
render_surface->screen_space_transform(),
render_surface->content_rect());
auto it = base::ranges::find_if(
auto it = std::ranges::find_if(
rects, [&screen_space_rect](
const std::pair<const LayerImpl*, gfx::Rect>& r) {
return r.second.Intersects(screen_space_rect);

@ -35,7 +35,6 @@
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/system/sys_info.h"
#include "base/task/common/task_annotator.h"
@ -1267,7 +1266,7 @@ static void AppendQuadsToFillScreen(
static viz::CompositorRenderPass* FindRenderPassById(
const viz::CompositorRenderPassList& list,
viz::CompositorRenderPassId id) {
auto it = base::ranges::find(list, id, &viz::CompositorRenderPass::id);
auto it = std::ranges::find(list, id, &viz::CompositorRenderPass::id);
return it == list.end() ? nullptr : it->get();
}

@ -6,6 +6,7 @@
#include <stddef.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <memory>
@ -17,7 +18,6 @@
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/angle_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
@ -15858,7 +15858,7 @@ TEST_P(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) {
size_t CountRenderPassesWithId(const viz::CompositorRenderPassList& list,
viz::CompositorRenderPassId id) {
return base::ranges::count(list, id, &viz::CompositorRenderPass::id);
return std::ranges::count(list, id, &viz::CompositorRenderPass::id);
}
TEST_P(LayerTreeHostImplTest, RemoveUnreferencedRenderPass) {

@ -26,7 +26,6 @@
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/parameter_pack.h"
#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
@ -1121,7 +1120,7 @@ void LayerTreeImpl::SetBackdropFilterMutated(
void LayerTreeImpl::AddPresentationCallbacks(
std::vector<PresentationTimeCallbackBuffer::Callback> callbacks) {
base::ranges::move(callbacks, std::back_inserter(presentation_callbacks_));
std::ranges::move(callbacks, std::back_inserter(presentation_callbacks_));
}
std::vector<PresentationTimeCallbackBuffer::Callback>
@ -1134,8 +1133,8 @@ LayerTreeImpl::TakePresentationCallbacks() {
void LayerTreeImpl::AddSuccessfulPresentationCallbacks(
std::vector<PresentationTimeCallbackBuffer::SuccessfulCallbackWithDetails>
callbacks) {
base::ranges::move(callbacks,
std::back_inserter(successful_presentation_callbacks_));
std::ranges::move(callbacks,
std::back_inserter(successful_presentation_callbacks_));
}
std::vector<PresentationTimeCallbackBuffer::SuccessfulCallbackWithDetails>
@ -1807,8 +1806,8 @@ LayerImpl* LayerTreeImpl::LayerById(int id) const {
// TODO(masonf): If this shows up on profiles, this could use
// a layer_element_map_ approach similar to LayerById().
LayerImpl* LayerTreeImpl::LayerByElementId(ElementId element_id) const {
auto it = base::ranges::find(base::Reversed(*this), element_id,
&LayerImpl::element_id);
auto it = std::ranges::find(base::Reversed(*this), element_id,
&LayerImpl::element_id);
if (it == rend())
return nullptr;
return *it;
@ -2211,7 +2210,7 @@ void LayerTreeImpl::RegisterPictureLayerImpl(PictureLayerImpl* layer) {
}
void LayerTreeImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
auto it = base::ranges::find(picture_layers_, layer);
auto it = std::ranges::find(picture_layers_, layer);
CHECK(it != picture_layers_.end(), base::NotFatalUntil::M130);
picture_layers_.erase(it);

@ -4,10 +4,9 @@
#include "cc/trees/layer_tree_mutator.h"
#include <algorithm>
#include <utility>
#include "base/ranges/algorithm.h"
namespace cc {
AnimationWorkletInput::AddAndUpdateState::AddAndUpdateState(
@ -27,17 +26,17 @@ AnimationWorkletInput::AddAndUpdateState::~AddAndUpdateState() = default;
#if DCHECK_IS_ON()
bool AnimationWorkletInput::ValidateId(int worklet_id) const {
return base::ranges::all_of(added_and_updated_animations,
[worklet_id](auto& it) {
return it.worklet_animation_id.worklet_id ==
worklet_id;
}) &&
base::ranges::all_of(updated_animations,
[worklet_id](auto& it) {
return it.worklet_animation_id.worklet_id ==
worklet_id;
}) &&
base::ranges::all_of(removed_animations, [worklet_id](auto& it) {
return std::ranges::all_of(added_and_updated_animations,
[worklet_id](auto& it) {
return it.worklet_animation_id.worklet_id ==
worklet_id;
}) &&
std::ranges::all_of(updated_animations,
[worklet_id](auto& it) {
return it.worklet_animation_id.worklet_id ==
worklet_id;
}) &&
std::ranges::all_of(removed_animations, [worklet_id](auto& it) {
return it.worklet_id == worklet_id;
});
}

@ -47,7 +47,7 @@ void PresentationTimeCallbackBuffer::RegisterMainThreadCallbacks(
// Splice the given `callbacks` onto the vector of existing callbacks.
auto& sink = GetOrMakeRegistration(frame_token).main_callbacks;
sink.reserve(sink.size() + callbacks.size());
base::ranges::move(callbacks, std::back_inserter(sink));
std::ranges::move(callbacks, std::back_inserter(sink));
}
void PresentationTimeCallbackBuffer::RegisterMainThreadSuccessfulCallbacks(
@ -60,7 +60,7 @@ void PresentationTimeCallbackBuffer::RegisterMainThreadSuccessfulCallbacks(
// Splice the given `callbacks` onto the vector of existing callbacks.
auto& sink = GetOrMakeRegistration(frame_token).main_successful_callbacks;
sink.reserve(sink.size() + callbacks.size());
base::ranges::move(callbacks, std::back_inserter(sink));
std::ranges::move(callbacks, std::back_inserter(sink));
}
void PresentationTimeCallbackBuffer::
@ -74,7 +74,7 @@ void PresentationTimeCallbackBuffer::
std::vector<SuccessfulCallback>& sink =
GetOrMakeRegistration(frame_token).compositor_successful_callbacks;
sink.reserve(sink.size() + callbacks.size());
base::ranges::move(callbacks, std::back_inserter(sink));
std::ranges::move(callbacks, std::back_inserter(sink));
}
PresentationTimeCallbackBuffer::PendingCallbacks::PendingCallbacks() = default;
@ -99,8 +99,8 @@ PresentationTimeCallbackBuffer::PopPendingCallbacks(uint32_t frame_token,
// Presentation time callbacks should be run whether presentation was
// successful or not.
base::ranges::move(info->main_callbacks,
std::back_inserter(result.main_callbacks));
std::ranges::move(info->main_callbacks,
std::back_inserter(result.main_callbacks));
info->main_callbacks.clear();
const bool should_keep_info =
@ -112,9 +112,9 @@ PresentationTimeCallbackBuffer::PopPendingCallbacks(uint32_t frame_token,
} else {
// Successful presentation time callbacks should only be run when the
// presentation was successful.
base::ranges::move(info->main_successful_callbacks,
std::back_inserter(result.main_successful_callbacks));
base::ranges::move(
std::ranges::move(info->main_successful_callbacks,
std::back_inserter(result.main_successful_callbacks));
std::ranges::move(
info->compositor_successful_callbacks,
std::back_inserter(result.compositor_successful_callbacks));
info = frame_token_infos_.erase(info);

@ -4,6 +4,7 @@
#include "cc/view_transition/view_transition_request.h"
#include <algorithm>
#include <map>
#include <memory>
#include <sstream>
@ -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 "components/viz/common/quads/compositor_frame_transition_directive.h"
#include "components/viz/common/quads/compositor_render_pass.h"