Use base::ranges::transform() instead std::transform in //components and //content
1. Use base::ranges::transform() instead std::transform in //components and //content. 2. Simplify some code. Bug: 1368812 Change-Id: If11aebc2a25e38b8f7398e05631e3266cbc283c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5151747 Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org> Cr-Commit-Position: refs/heads/main@{#1244128}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
bd606706e7
commit
ed18e17887
components
content/public/test
@ -14,6 +14,7 @@
|
||||
#include "base/debug/debugging_buildflags.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "base/time/time.h"
|
||||
#include "build/build_config.h"
|
||||
@ -120,8 +121,8 @@ void CrashpadIntegration::SetUp(const base::FilePath& crashpad_database_path) {
|
||||
<< "Failed to read list of old pending reports. database='"
|
||||
<< database_dir_ << '\'';
|
||||
|
||||
std::transform(
|
||||
std::begin(old_reports), std::end(old_reports),
|
||||
base::ranges::transform(
|
||||
old_reports,
|
||||
std::inserter(ids_of_old_reports_, std::end(ids_of_old_reports_)),
|
||||
[](const crashpad::CrashReportDatabase::Report& report) {
|
||||
return report.uuid;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "components/safe_search_api/fake_url_checker_client.h"
|
||||
@ -55,8 +56,8 @@ ClientClassification ToAPIClassification(Classification classification,
|
||||
|
||||
auto Recorded(const std::map<CacheAccessStatus, int>& expected) {
|
||||
std::vector<base::Bucket> buckets_array;
|
||||
std::transform(
|
||||
expected.begin(), expected.end(), std::back_inserter(buckets_array),
|
||||
base::ranges::transform(
|
||||
expected, std::back_inserter(buckets_array),
|
||||
[](auto& entry) { return base::Bucket(entry.first, entry.second); });
|
||||
return base::BucketsInclude(buckets_array);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/process/kill.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/pattern.h"
|
||||
#include "base/strings/strcat.h"
|
||||
@ -1836,7 +1837,7 @@ std::vector<RenderFrameHost*> CollectAllRenderFrameHosts(
|
||||
std::vector<WebContents*> GetAllWebContents() {
|
||||
std::vector<WebContentsImpl*> all_wci = WebContentsImpl::GetAllWebContents();
|
||||
std::vector<WebContents*> all_wc;
|
||||
std::transform(all_wci.cbegin(), all_wci.cend(), std::back_inserter(all_wc),
|
||||
base::ranges::transform(all_wci, std::back_inserter(all_wc),
|
||||
[](WebContentsImpl* wc) { return wc; });
|
||||
|
||||
return all_wc;
|
||||
|
Reference in New Issue
Block a user