7b7aaecca4adc6d0e8f87779d17774858896d02e - chromium/src

45 views
Skip to first unread message

dch...@chromium.org

unread,
Feb 26, 2022, 12:58:33 PM2/26/22
to chromium...@chromium.org
commit 7b7aaecca4adc6d0e8f87779d17774858896d02e
Author: Daniel Cheng <dch...@chromium.org>
AuthorDate: Sat Feb 26 17:57:25 2022
Commit: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
CommitDate: Sat Feb 26 17:57:25 2022

Migrate base::{size,empty,data} to STL equivalents in //components.

Bug: 1299695
Change-Id: Ia2ef2239d649b2a50569cad9b3f293ca23510b68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3491962
Reviewed-by: Lei Zhang <the...@chromium.org>
Commit-Queue: Lei Zhang <the...@chromium.org>
Owners-Override: Lei Zhang <the...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#975484}

diff --git a/components/autofill/content/renderer/form_autofill_util_browsertest.cc b/components/autofill/content/renderer/form_autofill_util_browsertest.cc
index 9ec880b..69155f0 100644
--- a/components/autofill/content/renderer/form_autofill_util_browsertest.cc
+++ b/components/autofill/content/renderer/form_autofill_util_browsertest.cc
@@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

-#include "base/strings/stringprintf.h"
#include "components/autofill/content/renderer/form_autofill_util.h"

-#include "base/cxx17_backports.h"
#include "base/metrics/field_trial.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "components/autofill/content/renderer/test_utils.h"
@@ -457,7 +456,7 @@
{u"name3", true},
{u"name4", false},
};
- const size_t number_of_cases = base::size(kExpectedFields);
+ const size_t number_of_cases = std::size(kExpectedFields);
ASSERT_EQ(number_of_cases, target.fields.size());
for (size_t i = 0; i < number_of_cases; ++i) {
EXPECT_EQ(kExpectedFields[i].name, target.fields[i].name);
@@ -499,7 +498,7 @@
{u"name3", false},
{u"name4", true},
};
- const size_t number_of_cases = base::size(kExpectedFields);
+ const size_t number_of_cases = std::size(kExpectedFields);
ASSERT_EQ(number_of_cases, target.fields.size());
for (size_t i = 0; i < number_of_cases; ++i) {
EXPECT_EQ(kExpectedFields[i].name, target.fields[i].name);
diff --git a/components/autofill/content/renderer/html_based_username_detector_browsertest.cc b/components/autofill/content/renderer/html_based_username_detector_browsertest.cc
index e31dc6f..64ec0a1 100644
--- a/components/autofill/content/renderer/html_based_username_detector_browsertest.cc
+++ b/components/autofill/content/renderer/html_based_username_detector_browsertest.cc
@@ -181,7 +181,7 @@
// Occurrence doesn't count.
{{"identity_name", "idn", "johnsmith"}, {"id", "xid", "123"}, "xid"}};

- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
SCOPED_TRACE(testing::Message() << "Iteration " << i);

const std::string& form_html =
@@ -253,7 +253,7 @@
"noword",
}};

- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
SCOPED_TRACE(testing::Message() << "Iteration " << i);

const std::string& form_html =
diff --git a/components/autofill/content/renderer/html_based_username_detector_vocabulary.cc b/components/autofill/content/renderer/html_based_username_detector_vocabulary.cc
index b843cfe..c02344e 100644
--- a/components/autofill/content/renderer/html_based_username_detector_vocabulary.cc
+++ b/components/autofill/content/renderer/html_based_username_detector_vocabulary.cc
@@ -4,7 +4,7 @@

#include "components/autofill/content/renderer/html_based_username_detector_vocabulary.h"

-#include "base/cxx17_backports.h"
+#include <iterator>

namespace autofill {

@@ -23,7 +23,7 @@
"second", "passwort", "middlename", "paroladordine",
"codice", "pasvorto", "familyname", "inomboloyokuvula",
"modpas", "salasana", "motdepasse", "numeraeleiloaesesi"};
-const size_t kNegativeLatinSize = base::size(kNegativeLatin);
+const size_t kNegativeLatinSize = std::size(kNegativeLatin);

const char* const kNegativeNonLatin[] = {"fjalëkalim",
"የይለፍቃል",
@@ -74,7 +74,7 @@
"mậtkhẩu",
"פּאַראָל",
"ọrọigbaniwọle"};
-const size_t kNegativeNonLatinSize = base::size(kNegativeNonLatin);
+const size_t kNegativeNonLatinSize = std::size(kNegativeNonLatin);

const char* const kUsernameLatin[] = {
"gatti", "uzantonomo", "solonanarana", "nombredeusuario",
@@ -86,7 +86,7 @@
"mosebedisi", "kasutajanimi", "ainmcleachdaidh", "igamalomsebenzisi",
"nomdusuari", "lomsebenzisi", "jenengpanganggo", "ingoakaiwhakamahi",
"nomeutente", "namapengguna"};
-const size_t kUsernameLatinSize = base::size(kUsernameLatin);
+const size_t kUsernameLatinSize = std::size(kUsernameLatin);

const char* const kUsernameNonLatin[] = {"用户名",
"کاتيجونالو",
@@ -146,7 +146,7 @@
"ব্যবহারকারীরনাম",
"užívateľskémeno",
"ឈ្មោះអ្នកប្រើប្រាស់"};
-const size_t kUsernameNonLatinSize = base::size(kUsernameNonLatin);
+const size_t kUsernameNonLatinSize = std::size(kUsernameNonLatin);

const char* const kUserLatin[] = {
"user", "wosuta", "gebruiker", "utilizator",
@@ -159,7 +159,7 @@
"usuari", "kasutaja", "defnyddiwr", "kaiwhakamahi",
"utente", "korisnik", "mosebedisi", "foydalanuvchi",
"uzanto", "pengguna", "mushandisi"};
-const size_t kUserLatinSize = base::size(kUserLatin);
+const size_t kUserLatinSize = std::size(kUserLatin);

const char* const kUserNonLatin[] = {"用户",
"użytkownik",
@@ -218,7 +218,7 @@
"пайдаланушы",
"အသုံးပြုသူကို",
"käyttäjä"};
-const size_t kUserNonLatinSize = base::size(kUserNonLatin);
+const size_t kUserNonLatinSize = std::size(kUserNonLatin);

const char* const kTechnicalWords[] = {
"uid", "newtel", "uaccount", "regaccount", "ureg",
@@ -226,9 +226,9 @@
"loginname", "membername", "uname", "ucreate", "loginmail",
"accountname", "umail", "loginreg", "accountid", "loginaccount",
"ulogin", "regemail", "newmobile", "accountlogin"};
-const size_t kTechnicalWordsSize = base::size(kTechnicalWords);
+const size_t kTechnicalWordsSize = std::size(kTechnicalWords);

const char* const kWeakWords[] = {"id", "login", "mail"};
-const size_t kWeakWordsSize = base::size(kWeakWords);
+const size_t kWeakWordsSize = std::size(kWeakWords);

} // namespace autofill
diff --git a/components/autofill/core/browser/autofill_address_util.cc b/components/autofill/core/browser/autofill_address_util.cc
index e1649f4..18f48c4 100644
--- a/components/autofill/core/browser/autofill_address_util.cc
+++ b/components/autofill/core/browser/autofill_address_util.cc
@@ -193,7 +193,7 @@
}

return profile.ConstructInferredLabel(
- kDetailsFields, base::size(kDetailsFields),
+ kDetailsFields, std::size(kDetailsFields),
/*num_fields_to_include=*/2, ui_language_code);
}

diff --git a/components/autofill/core/browser/autofill_data_util.cc b/components/autofill/core/browser/autofill_data_util.cc
index cfb055fe..c76a024b 100644
--- a/components/autofill/core/browser/autofill_data_util.cc
+++ b/components/autofill/core/browser/autofill_data_util.cc
@@ -8,7 +8,6 @@
#include <iterator>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/i18n/char_iterator.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
@@ -121,7 +120,7 @@
void StripPrefixes(std::vector<base::StringPiece16>* name_tokens) {
auto iter = name_tokens->begin();
while (iter != name_tokens->end()) {
- if (!ContainsString(name_prefixes, base::size(name_prefixes), *iter))
+ if (!ContainsString(name_prefixes, std::size(name_prefixes), *iter))
break;
++iter;
}
@@ -134,7 +133,7 @@
// Removes common name suffixes from |name_tokens|.
void StripSuffixes(std::vector<base::StringPiece16>* name_tokens) {
while (!name_tokens->empty()) {
- if (!ContainsString(name_suffixes, base::size(name_suffixes),
+ if (!ContainsString(name_suffixes, std::size(name_suffixes),
name_tokens->back())) {
break;
}
@@ -223,13 +222,13 @@
// ones)
surname_length = std::max<size_t>(
1, StartsWithAny(name, korean_multi_char_surnames,
- base::size(korean_multi_char_surnames)));
+ std::size(korean_multi_char_surnames)));
} else {
// Default to 1 character if the surname is not in
// |common_cjk_multi_char_surnames|.
surname_length = std::max<size_t>(
1, StartsWithAny(name, common_cjk_multi_char_surnames,
- base::size(common_cjk_multi_char_surnames)));
+ std::size(common_cjk_multi_char_surnames)));
}
parts->family = std::u16string(name.substr(0, surname_length));
parts->given = std::u16string(name.substr(surname_length));
@@ -427,7 +426,7 @@
reverse_family_tokens.push_back(name_tokens.back());
name_tokens.pop_back();
while (name_tokens.size() >= 1 &&
- ContainsString(family_name_prefixes, base::size(family_name_prefixes),
+ ContainsString(family_name_prefixes, std::size(family_name_prefixes),
name_tokens.back())) {
reverse_family_tokens.push_back(name_tokens.back());
name_tokens.pop_back();
diff --git a/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc b/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc
index c7935e8..22051ec 100644
--- a/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc
+++ b/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc
@@ -5,10 +5,10 @@
#include "components/autofill/core/browser/autofill_ie_toolbar_import_win.h"

#include <stddef.h>
+#include <windows.h>

#include <string>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
#include "components/autofill/core/browser/data_model/autofill_profile.h"
@@ -18,8 +18,6 @@
#include "components/os_crypt/os_crypt_mocker.h"
#include "testing/gtest/include/gtest/gtest.h"

-#include <windows.h>
-
using base::win::RegKey;

namespace autofill {
@@ -159,13 +157,13 @@
profile_key.Create(HKEY_CURRENT_USER, kProfileKey, KEY_ALL_ACCESS);
EXPECT_TRUE(profile_key.Valid());

- CreateSubkey(&profile_key, L"0", profile1, base::size(profile1));
- CreateSubkey(&profile_key, L"1", profile2, base::size(profile2));
+ CreateSubkey(&profile_key, L"0", profile1, std::size(profile1));
+ CreateSubkey(&profile_key, L"1", profile2, std::size(profile2));

RegKey cc_key;
cc_key.Create(HKEY_CURRENT_USER, kCreditCardKey, KEY_ALL_ACCESS);
EXPECT_TRUE(cc_key.Valid());
- CreateSubkey(&cc_key, L"0", credit_card, base::size(credit_card));
+ CreateSubkey(&cc_key, L"0", credit_card, std::size(credit_card));
EncryptAndWrite(&cc_key, &empty_password);
EncryptAndWrite(&cc_key, &empty_salt);

diff --git a/components/autofill/core/browser/browser_autofill_manager_unittest.cc b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
index c506a55..530a2f9 100644
--- a/components/autofill/core/browser/browser_autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/browser_autofill_manager_unittest.cc
@@ -15,7 +15,6 @@

#include "base/base64.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/hash/hash.h"
#include "base/memory/raw_ptr.h"
@@ -7542,8 +7541,8 @@
FormSubmitted(form);

EXPECT_EQ(form.fields.size(), form_seen_by_ahm.fields.size());
- ASSERT_EQ(base::size(test_fields), form_seen_by_ahm.fields.size());
- for (size_t i = 0; i < base::size(test_fields); ++i) {
+ ASSERT_EQ(std::size(test_fields), form_seen_by_ahm.fields.size());
+ for (size_t i = 0; i < std::size(test_fields); ++i) {
EXPECT_EQ(
form_seen_by_ahm.fields[i].should_autocomplete,
test_fields[i].expected_field_type != CREDIT_CARD_VERIFICATION_CODE);
diff --git a/components/autofill/core/browser/data_model/autofill_profile.cc b/components/autofill/core/browser/data_model/autofill_profile.cc
index 439ef76..dabbf46 100644
--- a/components/autofill/core/browser/data_model/autofill_profile.cc
+++ b/components/autofill/core/browser/data_model/autofill_profile.cc
@@ -11,7 +11,6 @@
#include <ostream>
#include <set>

-#include "base/cxx17_backports.h"
#include "base/guid.h"
#include "base/hash/sha1.h"
#include "base/i18n/case_conversion.h"
@@ -166,9 +165,9 @@

std::vector<ServerFieldType> default_fields;
if (!suggested_fields) {
- default_fields.assign(kDefaultDistinguishingFields,
- kDefaultDistinguishingFields +
- base::size(kDefaultDistinguishingFields));
+ default_fields.assign(
+ kDefaultDistinguishingFields,
+ kDefaultDistinguishingFields + std::size(kDefaultDistinguishingFields));
if (excluded_field == UNKNOWN_TYPE) {
distinguishing_fields->swap(default_fields);
return;
diff --git a/components/autofill/core/browser/data_model/autofill_profile_unittest.cc b/components/autofill/core/browser/data_model/autofill_profile_unittest.cc
index bb98e352..50c2e6b 100644
--- a/components/autofill/core/browser/data_model/autofill_profile_unittest.cc
+++ b/components/autofill/core/browser/data_model/autofill_profile_unittest.cc
@@ -10,7 +10,6 @@
#include <string>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/format_macros.h"
#include "base/guid.h"
#include "base/strings/utf_string_conversions.h"
@@ -307,7 +306,7 @@
};

std::vector<std::u16string> labels;
- for (size_t i = 0; i < base::size(kExpectedLabels); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedLabels); ++i) {
AutofillProfile::CreateInferredLabels(ToRawPointerVector(profiles), nullptr,
UNKNOWN_TYPE, i, "en-US", &labels);
ASSERT_FALSE(labels.empty());
@@ -341,7 +340,7 @@
};

std::vector<std::u16string> labels;
- for (size_t i = 0; i < base::size(kExpectedLabels); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedLabels); ++i) {
AutofillProfile::CreateInferredLabels(ToRawPointerVector(profiles), nullptr,
UNKNOWN_TYPE, i, "en-US", &labels);
ASSERT_FALSE(labels.empty());
@@ -385,7 +384,7 @@
};

std::vector<std::u16string> labels;
- for (size_t i = 0; i < base::size(kExpectedLabels); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedLabels); ++i) {
AutofillProfile::CreateInferredLabels(ToRawPointerVector(profiles), nullptr,
UNKNOWN_TYPE, i, "en-US", &labels);
ASSERT_FALSE(labels.empty());
@@ -422,7 +421,7 @@
};

std::vector<std::u16string> labels;
- for (size_t i = 0; i < base::size(kExpectedLabels); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedLabels); ++i) {
AutofillProfile::CreateInferredLabels(ToRawPointerVector(profiles), nullptr,
UNKNOWN_TYPE, i, "en-US", &labels);
ASSERT_FALSE(labels.empty());
@@ -455,7 +454,7 @@
};

std::vector<std::u16string> labels;
- for (size_t i = 0; i < base::size(kExpectedLabels); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedLabels); ++i) {
AutofillProfile::CreateInferredLabels(ToRawPointerVector(profiles), nullptr,
UNKNOWN_TYPE, i, "en-US", &labels);
ASSERT_FALSE(labels.empty());
diff --git a/components/autofill/core/browser/form_parsing/phone_field.cc b/components/autofill/core/browser/form_parsing/phone_field.cc
index c9cb5b3..96550d4 100644
--- a/components/autofill/core/browser/form_parsing/phone_field.cc
+++ b/components/autofill/core/browser/form_parsing/phone_field.cc
@@ -11,7 +11,6 @@
#include <utility>

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
@@ -220,12 +219,12 @@
// The form owns the following variables, so they should not be deleted.
AutofillField* parsed_fields[FIELD_MAX];

- for (size_t i = 0; i < base::size(kPhoneFieldGrammars); ++i) {
+ for (size_t i = 0; i < std::size(kPhoneFieldGrammars); ++i) {
memset(parsed_fields, 0, sizeof(parsed_fields));
size_t saved_cursor = scanner->SaveCursor();

// Attempt to parse according to the next grammar.
- for (; i < base::size(kPhoneFieldGrammars) &&
+ for (; i < std::size(kPhoneFieldGrammars) &&
kPhoneFieldGrammars[i].regex != REGEX_SEPARATOR;
++i) {
const bool is_country_code_field =
@@ -254,7 +253,7 @@
}
}

- if (i >= base::size(kPhoneFieldGrammars)) {
+ if (i >= std::size(kPhoneFieldGrammars)) {
scanner->RewindTo(saved_cursor);
return nullptr; // Parsing failed.
}
@@ -264,11 +263,11 @@
// Proceed to the next grammar.
do {
++i;
- } while (i < base::size(kPhoneFieldGrammars) &&
+ } while (i < std::size(kPhoneFieldGrammars) &&
kPhoneFieldGrammars[i].regex != REGEX_SEPARATOR);

scanner->RewindTo(saved_cursor);
- if (i + 1 == base::size(kPhoneFieldGrammars)) {
+ if (i + 1 == std::size(kPhoneFieldGrammars)) {
return nullptr; // Tried through all the possibilities - did not match.
}
}
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc
index 63eb25b..581f013 100644
--- a/components/autofill/core/browser/form_structure_unittest.cc
+++ b/components/autofill/core/browser/form_structure_unittest.cc
@@ -4720,7 +4720,7 @@
encoder.Encode(form_signature, FieldSignature(),
RandomizedEncoder::FORM_URL, full_url));
ASSERT_EQ(static_cast<size_t>(upload.field_size()),
- base::size(kFieldMetadata));
+ std::size(kFieldMetadata));

ASSERT_EQ(1, upload.randomized_form_metadata().button_title().size());
EXPECT_EQ(upload.randomized_form_metadata()
diff --git a/components/autofill/core/browser/geo/country_data.cc b/components/autofill/core/browser/geo/country_data.cc
index 7f52b42..e6213b0 100644
--- a/components/autofill/core/browser/geo/country_data.cc
+++ b/components/autofill/core/browser/geo/country_data.cc
@@ -6,7 +6,6 @@

#include <utility>

-#include "base/cxx17_backports.h"
#include "base/memory/singleton.h"
#include "components/strings/grit/components_strings.h"
#include "third_party/icu/source/common/unicode/locid.h"
@@ -293,7 +292,7 @@
// based on |kCountryAddressImportRequirementsData|.
std::vector<std::string> GetCountryCodes() {
std::vector<std::string> country_codes;
- country_codes.reserve(base::size(kCountryAddressImportRequirementsData));
+ country_codes.reserve(std::size(kCountryAddressImportRequirementsData));
for (const auto& static_data : kCountryAddressImportRequirementsData) {
country_codes.push_back(static_data.country_code);
}
diff --git a/components/autofill/core/browser/webdata/autofill_table_unittest.cc b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
index 3d07812..a2f5af2 100644
--- a/components/autofill/core/browser/webdata/autofill_table_unittest.cc
+++ b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
@@ -11,7 +11,6 @@
#include <utility>

#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/guid.h"
@@ -248,8 +247,8 @@
AutofillChange(AutofillChange::REMOVE,
AutofillKey(u"Favorite Color", u"Green")),
};
- EXPECT_EQ(base::size(kExpectedChanges), changes.size());
- for (size_t i = 0; i < base::size(kExpectedChanges); ++i) {
+ EXPECT_EQ(std::size(kExpectedChanges), changes.size());
+ for (size_t i = 0; i < std::size(kExpectedChanges); ++i) {
EXPECT_EQ(kExpectedChanges[i], changes[i]);
}

@@ -492,7 +491,7 @@
const char16_t kName[] = u"foo";
const char16_t kValue[] = u"bar";
// A value which contains terminating character.
- std::u16string value(kValue, base::size(kValue));
+ std::u16string value(kValue, std::size(kValue));

AutofillEntry entry0(MakeAutofillEntry(kName, kValue, 1, -1));
AutofillEntry entry1(MakeAutofillEntry(kName, value, 2, 3));
diff --git a/components/autofill/ios/form_util/fill_js_unittest.mm b/components/autofill/ios/form_util/fill_js_unittest.mm
index b5b1b914..73e94e2 100644
--- a/components/autofill/ios/form_util/fill_js_unittest.mm
+++ b/components/autofill/ios/form_util/fill_js_unittest.mm
@@ -5,7 +5,6 @@
#import <Foundation/Foundation.h>
#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "base/strings/sys_string_conversions.h"
#import "components/autofill/ios/form_util/form_util_java_script_feature.h"
#import "ios/web/public/test/web_test_with_web_state.h"
@@ -51,7 +50,7 @@
{@"javascript:login()", @"javascript:login()"},
};

- for (size_t i = 0; i < base::size(test_data); i++) {
+ for (size_t i = 0; i < std::size(test_data); i++) {
TestData& data = test_data[i];
NSString* html_action =
data.html_action == nil
diff --git a/components/autofill_assistant/browser/string_conversions_util.cc b/components/autofill_assistant/browser/string_conversions_util.cc
index a3b5d34..8df527e 100644
--- a/components/autofill_assistant/browser/string_conversions_util.cc
+++ b/components/autofill_assistant/browser/string_conversions_util.cc
@@ -4,7 +4,6 @@

#include "components/autofill_assistant/browser/string_conversions_util.h"

-#include "base/cxx17_backports.h"
#include "base/i18n/char_iterator.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
@@ -39,7 +38,7 @@
char bytes[4];
UBool error = false;
size_t offset = 0;
- U8_APPEND(bytes, offset, base::size(bytes), source, error);
+ U8_APPEND(bytes, offset, std::size(bytes), source, error);
if (error == false) {
target->append(bytes, offset);
}
diff --git a/components/base32/base32_unittest.cc b/components/base32/base32_unittest.cc
index 8935782..53d0660 100644
--- a/components/base32/base32_unittest.cc
+++ b/components/base32/base32_unittest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/base32/base32.h"
+
#include <string>

-#include "base/cxx17_backports.h"
-#include "components/base32/base32.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base32 {
@@ -19,7 +19,7 @@
"", "MY", "MZXQ", "MZXW6", "MZXW6YQ", "MZXW6YTB", "MZXW6YTBOI"};

// Run the tests, with one more letter in the input every pass.
- for (size_t i = 0; i < base::size(expected); ++i) {
+ for (size_t i = 0; i < std::size(expected); ++i) {
base::StringPiece test_substr(test_str, i);
std::string encoded_output =
Base32Encode(test_substr, Base32EncodePolicy::OMIT_PADDING);
@@ -38,7 +38,7 @@
"MZXW6YQ=", "MZXW6YTB", "MZXW6YTBOI======"};

// Run the tests, with one more letter in the input every pass.
- for (size_t i = 0; i < base::size(expected); ++i) {
+ for (size_t i = 0; i < std::size(expected); ++i) {
base::StringPiece test_substr(test_str, i);
std::string encoded_output = Base32Encode(test_substr);
EXPECT_EQ(expected[i], encoded_output);
diff --git a/components/blocklist/opt_out_blocklist/opt_out_blocklist_unittest.cc b/components/blocklist/opt_out_blocklist/opt_out_blocklist_unittest.cc
index 2d35241..ced4465 100644
--- a/components/blocklist/opt_out_blocklist/opt_out_blocklist_unittest.cc
+++ b/components/blocklist/opt_out_blocklist/opt_out_blocklist_unittest.cc
@@ -14,7 +14,6 @@

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
@@ -1113,7 +1112,7 @@
BlocklistReason::kBlocklistNotLoaded,
BlocklistReason::kUserOptedOutInSession,
};
- EXPECT_EQ(base::size(expected_reasons), passed_reasons_.size());
+ EXPECT_EQ(std::size(expected_reasons), passed_reasons_.size());
for (size_t i = 0; i < passed_reasons_.size(); i++) {
EXPECT_EQ(expected_reasons[i], passed_reasons_[i]);
}
@@ -1150,7 +1149,7 @@
BlocklistReason::kUserOptedOutInSession,
BlocklistReason::kUserOptedOutInGeneral,
};
- EXPECT_EQ(base::size(expected_reasons), passed_reasons_.size());
+ EXPECT_EQ(std::size(expected_reasons), passed_reasons_.size());
for (size_t i = 0; i < passed_reasons_.size(); i++) {
EXPECT_EQ(expected_reasons[i], passed_reasons_[i]);
}
@@ -1189,7 +1188,7 @@
BlocklistReason::kUserOptedOutOfHost,
BlocklistReason::kUserOptedOutOfType,
};
- EXPECT_EQ(base::size(expected_reasons), passed_reasons_.size());
+ EXPECT_EQ(std::size(expected_reasons), passed_reasons_.size());
for (size_t i = 0; i < passed_reasons_.size(); i++) {
EXPECT_EQ(expected_reasons[i], passed_reasons_[i]);
}
diff --git a/components/bookmarks/browser/bookmark_model_unittest.cc b/components/bookmarks/browser/bookmark_model_unittest.cc
index ac8477d..6d3c95c 100644
--- a/components/bookmarks/browser/bookmark_model_unittest.cc
+++ b/components/bookmarks/browser/bookmark_model_unittest.cc
@@ -573,7 +573,7 @@
}

TEST_F(BookmarkModelTest, AddURLWithWhitespaceTitle) {
- for (size_t i = 0; i < base::size(url_whitespace_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(url_whitespace_test_cases); ++i) {
const BookmarkNode* root = model_->bookmark_bar_node();
const std::u16string title(
ASCIIToUTF16(url_whitespace_test_cases[i].input_title));
@@ -700,7 +700,7 @@
}

TEST_F(BookmarkModelTest, AddFolderWithWhitespaceTitle) {
- for (size_t i = 0; i < base::size(title_whitespace_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(title_whitespace_test_cases); ++i) {
const BookmarkNode* root = model_->bookmark_bar_node();
const std::u16string title(
ASCIIToUTF16(title_whitespace_test_cases[i].input_title));
@@ -822,7 +822,7 @@
}

TEST_F(BookmarkModelTest, SetTitleWithWhitespace) {
- for (size_t i = 0; i < base::size(title_whitespace_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(title_whitespace_test_cases); ++i) {
const BookmarkNode* root = model_->bookmark_bar_node();
std::u16string title(u"dummy");
const GURL url("http://foo.com");
@@ -1612,7 +1612,7 @@
{ "a b c [ d e [ f ] ]", "g h i [ j k [ l ] ]"},
};
std::unique_ptr<BookmarkModel> model;
- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
model = TestBookmarkClient::CreateModel();

TestNode bbn;
diff --git a/components/bookmarks/browser/bookmark_utils_unittest.cc b/components/bookmarks/browser/bookmark_utils_unittest.cc
index c1f9d39..b23036be7 100644
--- a/components/bookmarks/browser/bookmark_utils_unittest.cc
+++ b/components/bookmarks/browser/bookmark_utils_unittest.cc
@@ -10,7 +10,6 @@
#include <utility>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
@@ -225,7 +224,7 @@
&query.url, &query.title};

// Test two fields matching.
- for (size_t i = 0; i < base::size(fields); i++) {
+ for (size_t i = 0; i < std::size(fields); i++) {
std::unique_ptr<std::u16string> original_value(fields[i]->release());
GetBookmarksMatchingProperties(model.get(), query, 100, &nodes);
ASSERT_EQ(1U, nodes.size());
@@ -235,7 +234,7 @@
}

// Test two fields matching with one non-matching field.
- for (size_t i = 0; i < base::size(fields); i++) {
+ for (size_t i = 0; i < std::size(fields); i++) {
std::unique_ptr<std::u16string> original_value(fields[i]->release());
*fields[i] = std::make_unique<std::u16string>(u"fjdkslafjkldsa");
GetBookmarksMatchingProperties(model.get(), query, 100, &nodes);
diff --git a/components/captive_portal/core/captive_portal_types.cc b/components/captive_portal/core/captive_portal_types.cc
index a1b9f10..87b9689 100644
--- a/components/captive_portal/core/captive_portal_types.cc
+++ b/components/captive_portal/core/captive_portal_types.cc
@@ -5,7 +5,6 @@
#include "components/captive_portal/core/captive_portal_types.h"

#include "base/check_op.h"
-#include "base/cxx17_backports.h"

namespace captive_portal {

@@ -17,7 +16,7 @@
"BehindCaptivePortal",
"NumCaptivePortalResults",
};
-static_assert(base::size(kCaptivePortalResultNames) == RESULT_COUNT + 1,
+static_assert(std::size(kCaptivePortalResultNames) == RESULT_COUNT + 1,
"kCaptivePortalResultNames should have "
"RESULT_COUNT + 1 elements");

@@ -26,7 +25,7 @@
std::string CaptivePortalResultToString(CaptivePortalResult result) {
DCHECK_GE(result, 0);
DCHECK_LT(static_cast<unsigned int>(result),
- base::size(kCaptivePortalResultNames));
+ std::size(kCaptivePortalResultNames));
return kCaptivePortalResultNames[result];
}

diff --git a/components/cbor/reader_unittest.cc b/components/cbor/reader_unittest.cc
index 926f803..d3a9995 100644
--- a/components/cbor/reader_unittest.cc
+++ b/components/cbor/reader_unittest.cc
@@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/cbor/reader.h"
+
#include <limits>
#include <utility>

-#include "components/cbor/reader.h"
-
#include "base/containers/span.h"
-#include "base/cxx17_backports.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

@@ -743,7 +742,7 @@
ASSERT_EQ(cbor->type(), Value::Type::MAP);
ASSERT_EQ(cbor->GetMap().size(), 6u);
EXPECT_EQ(error_code, Reader::DecoderError::CBOR_NO_ERROR);
- EXPECT_EQ(num_bytes_consumed, base::size(kMapTestCase));
+ EXPECT_EQ(num_bytes_consumed, std::size(kMapTestCase));
}

TEST(CBORReaderTest, TestReadNestedMap) {
diff --git a/components/cbor/writer_unittest.cc b/components/cbor/writer_unittest.cc
index ca6db6f3..1bfc2a0 100644
--- a/components/cbor/writer_unittest.cc
+++ b/components/cbor/writer_unittest.cc
@@ -7,7 +7,6 @@
#include <limits>
#include <string>

-#include "base/cxx17_backports.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

@@ -135,7 +134,7 @@
ASSERT_TRUE(cbor.has_value());
EXPECT_THAT(cbor.value(),
testing::ElementsAreArray(kArrayTestCaseCbor,
- base::size(kArrayTestCaseCbor)));
+ std::size(kArrayTestCaseCbor)));
}

TEST(CBORWriterTest, TestWriteMap) {
@@ -258,9 +257,8 @@
map[Value(std::numeric_limits<int64_t>::max())] = Value("j");
auto cbor = Writer::Write(Value(map));
ASSERT_TRUE(cbor.has_value());
- EXPECT_THAT(cbor.value(),
- testing::ElementsAreArray(kMapTestCaseCbor,
- base::size(kMapTestCaseCbor)));
+ EXPECT_THAT(cbor.value(), testing::ElementsAreArray(
+ kMapTestCaseCbor, std::size(kMapTestCaseCbor)));
}

TEST(CBORWriterTest, TestWriteMapWithArray) {
@@ -286,7 +284,7 @@
ASSERT_TRUE(cbor.has_value());
EXPECT_THAT(cbor.value(),
testing::ElementsAreArray(kMapArrayTestCaseCbor,
- base::size(kMapArrayTestCaseCbor)));
+ std::size(kMapArrayTestCaseCbor)));
}

TEST(CBORWriterTest, TestWriteNestedMap) {
@@ -315,7 +313,7 @@
ASSERT_TRUE(cbor.has_value());
EXPECT_THAT(cbor.value(),
testing::ElementsAreArray(kNestedMapTestCase,
- base::size(kNestedMapTestCase)));
+ std::size(kNestedMapTestCase)));
}

TEST(CBORWriterTest, TestSignedExchangeExample) {
@@ -362,7 +360,7 @@
ASSERT_TRUE(cbor.has_value());
EXPECT_THAT(cbor.value(),
testing::ElementsAreArray(kSignedExchangeExample,
- base::size(kSignedExchangeExample)));
+ std::size(kSignedExchangeExample)));
}

TEST(CBORWriterTest, TestWriteSimpleValue) {
diff --git a/components/cdm/common/widevine_drm_delegate_android.cc b/components/cdm/common/widevine_drm_delegate_android.cc
index 71c7df6..4f0963f 100644
--- a/components/cdm/common/widevine_drm_delegate_android.cc
+++ b/components/cdm/common/widevine_drm_delegate_android.cc
@@ -4,7 +4,6 @@

#include "components/cdm/common/widevine_drm_delegate_android.h"

-#include "base/cxx17_backports.h"
#include "media/cdm/cenc_utils.h"

namespace cdm {
@@ -23,7 +22,7 @@

const std::vector<uint8_t> WidevineDrmDelegateAndroid::GetUUID() const {
return std::vector<uint8_t>(kWidevineUuid,
- kWidevineUuid + base::size(kWidevineUuid));
+ kWidevineUuid + std::size(kWidevineUuid));
}

bool WidevineDrmDelegateAndroid::OnCreateSession(
diff --git a/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc b/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc
index e9525db..c2837c76 100644
--- a/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc
+++ b/components/certificate_transparency/chrome_ct_policy_enforcer_unittest.cc
@@ -9,7 +9,6 @@
#include <utility>

#include "base/build_time.h"
-#include "base/cxx17_backports.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
@@ -42,7 +41,7 @@
const char kGoogleAviatorLogID[] =
"\x68\xf6\x98\xf8\x1f\x64\x82\xbe\x3a\x8c\xee\xb9\x28\x1d\x4c\xfc\x71\x51"
"\x5d\x67\x93\xd4\x44\xd1\x0a\x67\xac\xbb\x4f\x4f\xfb\xc4";
-static_assert(base::size(kGoogleAviatorLogID) - 1 == crypto::kSHA256Length,
+static_assert(std::size(kGoogleAviatorLogID) - 1 == crypto::kSHA256Length,
"Incorrect log ID length.");

} // namespace
@@ -98,7 +97,7 @@
static const char kCertlyLogID[] =
"\xcd\xb5\x17\x9b\x7f\xc1\xc0\x46\xfe\xea\x31\x13\x6a\x3f\x8f\x00\x2e"
"\x61\x82\xfa\xf8\x89\x6f\xec\xc8\xb2\xf5\xb5\xab\x60\x49\x00";
- static_assert(base::size(kCertlyLogID) - 1 == crypto::kSHA256Length,
+ static_assert(std::size(kCertlyLogID) - 1 == crypto::kSHA256Length,
"Incorrect log ID length.");

scoped_refptr<SignedCertificateTimestamp> sct(
@@ -261,7 +260,7 @@
{// Cert valid for over 39 months, needs 5 SCTs.
time_2015_3_0_25_11_25_0_0, time_2018_6_0_27_11_25_0_0, 5}};

- for (size_t i = 0; i < base::size(kTestData); ++i) {
+ for (size_t i = 0; i < std::size(kTestData); ++i) {
SCOPED_TRACE(i);
const base::Time& start = kTestData[i].validity_start;
const base::Time& end = kTestData[i].validity_end;
@@ -869,7 +868,7 @@
{// Cert valid for over 180 days, needs 3 SCTs.
time_2015_3_0_25_11_25_0_0, time_2016_3_0_25_11_25_0_0, 3}};

- for (size_t i = 0; i < base::size(kTestData); ++i) {
+ for (size_t i = 0; i < std::size(kTestData); ++i) {
SCOPED_TRACE(i);
const base::Time& validity_start = kTestData[i].validity_start;
const base::Time& validity_end = kTestData[i].validity_end;
diff --git a/components/client_update_protocol/ecdsa.cc b/components/client_update_protocol/ecdsa.cc
index b2b80b3..af46d2f 100644
--- a/components/client_update_protocol/ecdsa.cc
+++ b/components/client_update_protocol/ecdsa.cc
@@ -7,7 +7,6 @@
#include <stdint.h>

#include "base/base64url.h"
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
@@ -52,7 +51,7 @@
// Remove the weak prefix, then remove the begin and the end quotes.
const char kWeakETagPrefix[] = "W/";
if (base::StartsWith(etag_header_value, kWeakETagPrefix))
- etag_header_value.remove_prefix(base::size(kWeakETagPrefix) - 1);
+ etag_header_value.remove_prefix(std::size(kWeakETagPrefix) - 1);
if (etag_header_value.size() >= 2 &&
base::StartsWith(etag_header_value, "\"") &&
base::EndsWith(etag_header_value, "\"")) {
diff --git a/components/cloud_devices/common/printer_description.cc b/components/cloud_devices/common/printer_description.cc
index 9ec1d88c..acd9d14 100644
--- a/components/cloud_devices/common/printer_description.cc
+++ b/components/cloud_devices/common/printer_description.cc
@@ -13,7 +13,6 @@
#include <vector>

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/notreached.h"
@@ -236,7 +235,7 @@
constexpr int32_t kMmToUm = 1000;
constexpr int32_t kSizeThresholdUm = 1000;

-constexpr size_t kEnumClassPrefixLen = base::size("MediaType::") - 1;
+constexpr size_t kEnumClassPrefixLen = std::size("MediaType::") - 1;

// Json name of media type is constructed by removing "MediaType::" enum class
// prefix from it.
@@ -439,7 +438,7 @@
#undef MAP_CLOUD_PRINT_MEDIA_TYPE

const MediaDefinition& FindMediaByType(MediaType type) {
- for (size_t i = 0; i < base::size(kMediaDefinitions); ++i) {
+ for (size_t i = 0; i < std::size(kMediaDefinitions); ++i) {
if (kMediaDefinitions[i].id == type)
return kMediaDefinitions[i];
}
@@ -449,7 +448,7 @@

const MediaDefinition* FindMediaBySize(int32_t width_um, int32_t height_um) {
const MediaDefinition* result = nullptr;
- for (size_t i = 0; i < base::size(kMediaDefinitions); ++i) {
+ for (size_t i = 0; i < std::size(kMediaDefinitions); ++i) {
int32_t diff =
std::max(std::abs(width_um - kMediaDefinitions[i].width_um),
std::abs(height_um - kMediaDefinitions[i].height_um));
@@ -461,7 +460,7 @@

template <class T, class IdType>
std::string TypeToString(const T& names, IdType id) {
- for (size_t i = 0; i < base::size(names); ++i) {
+ for (size_t i = 0; i < std::size(names); ++i) {
if (id == names[i].id)
return names[i].json_name;
}
@@ -471,7 +470,7 @@

template <class T, class IdType>
bool TypeFromString(const T& names, const std::string& type, IdType* id) {
- for (size_t i = 0; i < base::size(names); ++i) {
+ for (size_t i = 0; i < std::size(names); ++i) {
if (type == names[i].json_name) {
*id = names[i].id;
return true;
diff --git a/components/commerce/core/commerce_feature_list.h b/components/commerce/core/commerce_feature_list.h
index acd6de9..40042c268 100644
--- a/components/commerce/core/commerce_feature_list.h
+++ b/components/commerce/core/commerce_feature_list.h
@@ -5,7 +5,6 @@
#ifndef COMPONENTS_COMMERCE_CORE_COMMERCE_FEATURE_LIST_H_
#define COMPONENTS_COMMERCE_CORE_COMMERCE_FEATURE_LIST_H_

-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "components/flags_ui/feature_entry.h"
@@ -34,13 +33,13 @@
constexpr flags_ui::FeatureEntry::FeatureVariation
kCommercePriceTrackingAndroidVariations[] = {
{"Price alerts", kCommercePriceTracking_PriceAlerts,
- base::size(kCommercePriceTracking_PriceAlerts), nullptr},
+ std::size(kCommercePriceTracking_PriceAlerts), nullptr},
{"Price alerts with OptimizationGuide",
kCommercePriceTracking_PriceAlerts_WithOptimizationGuide,
- base::size(kCommercePriceTracking_PriceAlerts_WithOptimizationGuide),
+ std::size(kCommercePriceTracking_PriceAlerts_WithOptimizationGuide),
nullptr},
{"Price notifications", kCommercePriceTracking_PriceNotifications,
- base::size(kCommercePriceTracking_PriceNotifications), nullptr},
+ std::size(kCommercePriceTracking_PriceNotifications), nullptr},
};

// Price tracking variations for iOS.
@@ -58,10 +57,10 @@
kCommercePriceTrackingVariations[] = {
{"Price Tracking with Optimization Guide",
kCommercePriceTrackingWithOptimizationGuide,
- base::size(kCommercePriceTrackingWithOptimizationGuide), nullptr},
+ std::size(kCommercePriceTrackingWithOptimizationGuide), nullptr},
{"Price Tracking with Optimization Guide and Opt Out",
kCommercePriceTrackingWithOptimizationGuideAndOptOut,
- base::size(kCommercePriceTrackingWithOptimizationGuideAndOptOut),
+ std::size(kCommercePriceTrackingWithOptimizationGuideAndOptOut),
nullptr}};

extern const base::Feature kCommerceMerchantViewer;
diff --git a/components/component_updater/installer_policies/client_side_phishing_component_installer_policy.cc b/components/component_updater/installer_policies/client_side_phishing_component_installer_policy.cc
index 5171d06..09f45c6 100644
--- a/components/component_updater/installer_policies/client_side_phishing_component_installer_policy.cc
+++ b/components/component_updater/installer_policies/client_side_phishing_component_installer_policy.cc
@@ -64,7 +64,7 @@
std::vector<uint8_t>* hash) {
hash->assign(kClientSidePhishingPublicKeySHA256,
kClientSidePhishingPublicKeySHA256 +
- base::size(kClientSidePhishingPublicKeySHA256));
+ std::size(kClientSidePhishingPublicKeySHA256));
}

bool ClientSidePhishingComponentInstallerPolicy::
diff --git a/components/component_updater/installer_policies/safety_tips_component_installer.cc b/components/component_updater/installer_policies/safety_tips_component_installer.cc
index d6d3baa..65b2685 100644
--- a/components/component_updater/installer_policies/safety_tips_component_installer.cc
+++ b/components/component_updater/installer_policies/safety_tips_component_installer.cc
@@ -8,7 +8,6 @@
#include <utility>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
@@ -119,7 +118,7 @@
std::vector<uint8_t>* hash) const {
hash->assign(
kSafetyTipsPublicKeySHA256,
- kSafetyTipsPublicKeySHA256 + base::size(kSafetyTipsPublicKeySHA256));
+ kSafetyTipsPublicKeySHA256 + std::size(kSafetyTipsPublicKeySHA256));
}

std::string SafetyTipsComponentInstallerPolicy::GetName() const {
diff --git a/components/component_updater/installer_policies/trust_token_key_commitments_component_installer_policy.cc b/components/component_updater/installer_policies/trust_token_key_commitments_component_installer_policy.cc
index 96531c4..b10900ae 100644
--- a/components/component_updater/installer_policies/trust_token_key_commitments_component_installer_policy.cc
+++ b/components/component_updater/installer_policies/trust_token_key_commitments_component_installer_policy.cc
@@ -11,7 +11,6 @@

#include "base/bind.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -152,7 +151,7 @@
DCHECK(hash);
hash->assign(kTrustTokenKeyCommitmentsPublicKeySHA256,
kTrustTokenKeyCommitmentsPublicKeySHA256 +
- base::size(kTrustTokenKeyCommitmentsPublicKeySHA256));
+ std::size(kTrustTokenKeyCommitmentsPublicKeySHA256));
}

// static
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
index f6ae469..3673363 100644
--- a/components/content_settings/core/browser/content_settings_registry.cc
+++ b/components/content_settings/core/browser/content_settings_registry.cc
@@ -36,20 +36,20 @@

std::vector<std::string> AllowlistedSchemes(const char* scheme1) {
const char* schemes[] = {scheme1};
- return std::vector<std::string>(schemes, schemes + base::size(schemes));
+ return std::vector<std::string>(schemes, schemes + std::size(schemes));
}

std::vector<std::string> AllowlistedSchemes(const char* scheme1,
const char* scheme2) {
const char* schemes[] = {scheme1, scheme2};
- return std::vector<std::string>(schemes, schemes + base::size(schemes));
+ return std::vector<std::string>(schemes, schemes + std::size(schemes));
}

std::vector<std::string> AllowlistedSchemes(const char* scheme1,
const char* scheme2,
const char* scheme3) {
const char* schemes[] = {scheme1, scheme2, scheme3};
- return std::vector<std::string>(schemes, schemes + base::size(schemes));
+ return std::vector<std::string>(schemes, schemes + std::size(schemes));
}

std::set<ContentSetting> ValidSettings() {
@@ -59,14 +59,14 @@
std::set<ContentSetting> ValidSettings(ContentSetting setting1,
ContentSetting setting2) {
ContentSetting settings[] = {setting1, setting2};
- return std::set<ContentSetting>(settings, settings + base::size(settings));
+ return std::set<ContentSetting>(settings, settings + std::size(settings));
}

std::set<ContentSetting> ValidSettings(ContentSetting setting1,
ContentSetting setting2,
ContentSetting setting3) {
ContentSetting settings[] = {setting1, setting2, setting3};
- return std::set<ContentSetting>(settings, settings + base::size(settings));
+ return std::set<ContentSetting>(settings, settings + std::size(settings));
}

std::set<ContentSetting> ValidSettings(ContentSetting setting1,
@@ -74,7 +74,7 @@
ContentSetting setting3,
ContentSetting setting4) {
ContentSetting settings[] = {setting1, setting2, setting3, setting4};
- return std::set<ContentSetting>(settings, settings + base::size(settings));
+ return std::set<ContentSetting>(settings, settings + std::size(settings));
}

} // namespace
diff --git a/components/content_settings/core/browser/content_settings_utils.cc b/components/content_settings/core/browser/content_settings_utils.cc
index 6a37f72..011f3b4f 100644
--- a/components/content_settings/core/browser/content_settings_utils.cc
+++ b/components/content_settings/core/browser/content_settings_utils.cc
@@ -8,7 +8,6 @@

#include <vector>

-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "base/strings/string_split.h"
#include "base/values.h"
@@ -32,7 +31,7 @@
{CONTENT_SETTING_SESSION_ONLY, "session_only"},
{CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, "detect_important_content"},
};
-static_assert(base::size(kContentSettingsStringMapping) ==
+static_assert(std::size(kContentSettingsStringMapping) ==
CONTENT_SETTING_NUM_SETTINGS,
"kContentSettingsToFromString should have "
"CONTENT_SETTING_NUM_SETTINGS elements");
@@ -51,7 +50,7 @@
CONTENT_SETTING_BLOCK
};

-static_assert(base::size(kContentSettingOrder) ==
+static_assert(std::size(kContentSettingOrder) ==
CONTENT_SETTING_NUM_SETTINGS - 1,
"kContentSettingOrder should have CONTENT_SETTING_NUM_SETTINGS-1"
"entries");
diff --git a/components/content_settings/core/browser/content_settings_utils_unittest.cc b/components/content_settings/core/browser/content_settings_utils_unittest.cc
index d2d22f7..b9e7d50 100644
--- a/components/content_settings/core/browser/content_settings_utils_unittest.cc
+++ b/components/content_settings/core/browser/content_settings_utils_unittest.cc
@@ -8,7 +8,6 @@

#include <string>

-#include "base/cxx17_backports.h"
#include "components/content_settings/core/test/content_settings_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"

@@ -24,7 +23,7 @@
"session_only",
"detect_important_content",
};
-static_assert(base::size(kContentSettingNames) == CONTENT_SETTING_NUM_SETTINGS,
+static_assert(std::size(kContentSettingNames) == CONTENT_SETTING_NUM_SETTINGS,
"kContentSettingNames has an unexpected number of elements");

} // namespace
@@ -68,7 +67,7 @@
ContentSettingToString(CONTENT_SETTING_NUM_SETTINGS);
EXPECT_TRUE(setting_string.empty());

- for (size_t i = 0; i < base::size(kContentSettingNames); ++i) {
+ for (size_t i = 0; i < std::size(kContentSettingNames); ++i) {
ContentSetting setting = static_cast<ContentSetting>(i);
setting_string = ContentSettingToString(setting);
EXPECT_EQ(kContentSettingNames[i], setting_string);
diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc
index 05d3db09..b3b5daf 100644
--- a/components/content_settings/core/browser/host_content_settings_map.cc
+++ b/components/content_settings/core/browser/host_content_settings_map.cc
@@ -13,7 +13,6 @@
#include "base/check.h"
#include "base/command_line.h"
#include "base/containers/flat_map.h"
-#include "base/cxx17_backports.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/observer_list.h"
@@ -83,7 +82,7 @@
};

static_assert(
- base::size(kProviderNamesSourceMap) ==
+ std::size(kProviderNamesSourceMap) ==
HostContentSettingsMap::NUM_PROVIDER_TYPES,
"kProviderNamesSourceMap should have NUM_PROVIDER_TYPES elements");

@@ -862,7 +861,7 @@
// static
HostContentSettingsMap::ProviderType
HostContentSettingsMap::GetProviderTypeFromSource(const std::string& source) {
- for (size_t i = 0; i < base::size(kProviderNamesSourceMap); ++i) {
+ for (size_t i = 0; i < std::size(kProviderNamesSourceMap); ++i) {
if (source == kProviderNamesSourceMap[i].provider_name)
return static_cast<ProviderType>(i);
}
diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc
index 2c15251..2412212b 100644
--- a/components/content_settings/core/common/content_settings.cc
+++ b/components/content_settings/core/common/content_settings.cc
@@ -9,7 +9,6 @@
#include <utility>

#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "components/content_settings/core/common/content_settings_utils.h"
@@ -116,7 +115,7 @@

int ContentSettingTypeToHistogramValue(ContentSettingsType content_setting,
size_t* num_values) {
- *num_values = base::size(kHistogramValue);
+ *num_values = std::size(kHistogramValue);

// Verify the array is sorted by enum type and contains all values.
DCHECK(std::is_sorted(std::begin(kHistogramValue), std::end(kHistogramValue),
@@ -124,7 +123,7 @@
return a.type < b.type;
}));
static_assert(
- kHistogramValue[base::size(kHistogramValue) - 1].type ==
+ kHistogramValue[std::size(kHistogramValue) - 1].type ==
ContentSettingsType(
static_cast<int32_t>(ContentSettingsType::NUM_TYPES) - 1),
"Update content settings histogram lookup");
diff --git a/components/content_settings/core/common/content_settings_pattern.cc b/components/content_settings/core/common/content_settings_pattern.cc
index 5f2730f..5750c45 100644
--- a/components/content_settings/core/common/content_settings_pattern.cc
+++ b/components/content_settings/core/common/content_settings_pattern.cc
@@ -11,7 +11,6 @@
#include <utility>

#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/strings/string_piece.h"
@@ -38,7 +37,7 @@
"chrome-search", "chrome",
"chrome-untrusted", "devtools"};

-static_assert(base::size(kSchemeNames) == ContentSettingsPattern::SCHEME_MAX,
+static_assert(std::size(kSchemeNames) == ContentSettingsPattern::SCHEME_MAX,
"kSchemeNames should have SCHEME_MAX elements");

// Note: it is safe to return a base::StringPiece here as long as they are
@@ -555,7 +554,7 @@
if (parts_.is_scheme_wildcard)
return SCHEME_WILDCARD;

- for (size_t i = 2; i < base::size(kSchemeNames); ++i) {
+ for (size_t i = 2; i < std::size(kSchemeNames); ++i) {
if (parts_.scheme == kSchemeNames[i])
return static_cast<SchemeType>(i);
}
diff --git a/components/crash/android/crash_keys_android.cc b/components/crash/android/crash_keys_android.cc
index 53acc37..ad3c01d 100644
--- a/components/crash/android/crash_keys_android.cc
+++ b/components/crash/android/crash_keys_android.cc
@@ -6,7 +6,6 @@

#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
-#include "base/cxx17_backports.h"
#include "components/crash/android/jni_headers/CrashKeys_jni.h"
#include "components/crash/core/common/crash_key.h"

@@ -26,7 +25,7 @@
{"partner_customization_config", JavaCrashKey::Tag::kArray},
};
static_assert(
- base::size(crash_keys) == static_cast<size_t>(CrashKeyIndex::NUM_ENTRIES),
+ std::size(crash_keys) == static_cast<size_t>(CrashKeyIndex::NUM_ENTRIES),
"crash_keys out of sync with index enum");

return crash_keys[index];
diff --git a/components/crash/content/app/breakpad_win.cc b/components/crash/content/app/breakpad_win.cc
index 207b3de0..d0baff8 100644
--- a/components/crash/content/app/breakpad_win.cc
+++ b/components/crash/content/app/breakpad_win.cc
@@ -4,13 +4,14 @@

#include "components/crash/content/app/breakpad_win.h"

+#include <tchar.h>
+#include <windows.h>
+
#include <crtdbg.h>
#include <intrin.h>
#include <shellapi.h>
#include <stddef.h>
-#include <tchar.h>
#include <userenv.h>
-#include <windows.h>
#include <winnt.h>

#include <algorithm>
@@ -21,7 +22,6 @@

#include "base/base_switches.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/environment.h"
@@ -197,7 +197,7 @@
{ PT_ROAMING, L"roaming" },
{ PT_TEMPORARY, L"temporary" },
};
- for (size_t i = 0; i < base::size(kBitNames); ++i) {
+ for (size_t i = 0; i < std::size(kBitNames); ++i) {
const DWORD this_bit = kBitNames[i].bit;
if ((profile_bits & this_bit) != 0) {
profile_type.append(kBitNames[i].name);
diff --git a/components/crash/content/browser/crash_handler_host_linux.cc b/components/crash/content/browser/crash_handler_host_linux.cc
index d460d18..9026ab5 100644
--- a/components/crash/content/browser/crash_handler_host_linux.cc
+++ b/components/crash/content/browser/crash_handler_host_linux.cc
@@ -17,7 +17,6 @@

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
@@ -580,7 +579,7 @@
msg.msg_name = nullptr;
msg.msg_namelen = 0;
msg.msg_iov = iov;
- msg.msg_iovlen = base::size(iov);
+ msg.msg_iovlen = std::size(iov);

char cmsg_buf[CMSG_SPACE(sizeof(int)) + CMSG_SPACE(sizeof(ucred))];
msg.msg_control = cmsg_buf;
diff --git a/components/crash/core/app/crashpad_android.cc b/components/crash/core/app/crashpad_android.cc
index d977ff5..89df353 100644
--- a/components/crash/core/app/crashpad_android.cc
+++ b/components/crash/core/app/crashpad_android.cc
@@ -18,7 +18,6 @@
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/android/path_utils.h"
-#include "base/cxx17_backports.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
@@ -211,7 +210,7 @@
msg.msg_name = nullptr;
msg.msg_namelen = 0;
msg.msg_iov = iov;
- msg.msg_iovlen = base::size(iov);
+ msg.msg_iovlen = std::size(iov);

char cmsg_buf[CMSG_SPACE(sizeof(int))];
msg.msg_control = cmsg_buf;
diff --git a/components/crash/core/app/crashpad_win.cc b/components/crash/core/app/crashpad_win.cc
index 1a8f42c..d2354b8 100644
--- a/components/crash/core/app/crashpad_win.cc
+++ b/components/crash/core/app/crashpad_win.cc
@@ -7,7 +7,6 @@
#include <memory>
#include <string>

-#include "base/cxx17_backports.h"
#include "base/debug/crash_logging.h"
#include "base/environment.h"
#include "base/files/file_util.h"
@@ -32,7 +31,7 @@
std::map<std::string, std::string>* annotations) {
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
wchar_t exe_file[MAX_PATH] = {};
- CHECK(::GetModuleFileName(nullptr, exe_file, base::size(exe_file)));
+ CHECK(::GetModuleFileName(nullptr, exe_file, std::size(exe_file)));
std::wstring product_name, version, special_build, channel_name;
crash_reporter_client->GetProductNameAndVersion(
exe_file, &product_name, &version, &special_build, &channel_name);
@@ -100,7 +99,7 @@
if (exe_file.empty()) {
wchar_t exe_file_path[MAX_PATH] = {};
CHECK(::GetModuleFileName(nullptr, exe_file_path,
- base::size(exe_file_path)));
+ std::size(exe_file_path)));

exe_file = base::FilePath(exe_file_path);
}
diff --git a/components/crash/core/browser/crashes_ui_util.cc b/components/crash/core/browser/crashes_ui_util.cc
index cb3c2d6..454bfe3 100644
--- a/components/crash/core/browser/crashes_ui_util.cc
+++ b/components/crash/core/browser/crashes_ui_util.cc
@@ -8,7 +8,6 @@
#include <utility>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/i18n/time_formatting.h"
#include "base/notreached.h"
#include "base/strings/utf_string_conversions.h"
@@ -43,7 +42,7 @@
};

const size_t kCrashesUILocalizedStringsCount =
- base::size(kCrashesUILocalizedStrings);
+ std::size(kCrashesUILocalizedStrings);

const char kCrashesUICrashesJS[] = "crashes.js";
const char kCrashesUICrashesCSS[] = "crashes.css";
diff --git a/components/crash/core/common/crash_key_unittest.cc b/components/crash/core/common/crash_key_unittest.cc
index 92052c1..3629475 100644
--- a/components/crash/core/common/crash_key_unittest.cc
+++ b/components/crash/core/common/crash_key_unittest.cc
@@ -4,7 +4,6 @@

#include "components/crash/core/common/crash_key.h"

-#include "base/cxx17_backports.h"
#include "base/debug/crash_logging.h"
#include "base/debug/stack_trace.h"
#include "build/build_config.h"
@@ -38,7 +37,7 @@
0x0badbeef, 0x77778888, 0xabc, 0x000ddeeff, 0x12345678,
};
base::debug::StackTrace trace(reinterpret_cast<const void* const*>(addresses),
- base::size(addresses));
+ std::size(addresses));

std::string too_small = internal::FormatStackTrace(trace, 3);
EXPECT_EQ(0u, too_small.size());
@@ -59,7 +58,7 @@
0xbaaaabaaaaba, 0x1000000000000000,
};
base::debug::StackTrace trace(reinterpret_cast<const void* const*>(addresses),
- base::size(addresses));
+ std::size(addresses));

std::string too_small = internal::FormatStackTrace(trace, 8);
EXPECT_EQ(0u, too_small.size());
diff --git a/components/crash/core/common/crash_keys.cc b/components/crash/core/common/crash_keys.cc
index 50112e22..7ae9d39 100644
--- a/components/crash/core/common/crash_keys.cc
+++ b/components/crash/core/common/crash_keys.cc
@@ -8,7 +8,6 @@
#include <vector>

#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/format_macros.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
@@ -119,7 +118,7 @@
ScopedPrinterInfo::ScopedPrinterInfo(base::StringPiece data) {
std::vector<base::StringPiece> info = base::SplitStringPiece(
data, ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
- for (size_t i = 0; i < base::size(printer_info_keys); ++i) {
+ for (size_t i = 0; i < std::size(printer_info_keys); ++i) {
if (i < info.size())
printer_info_keys[i].Set(info[i]);
else
diff --git a/components/cronet/stale_host_resolver_unittest.cc b/components/cronet/stale_host_resolver_unittest.cc
index c7beace8..fe0657b 100644
--- a/components/cronet/stale_host_resolver_unittest.cc
+++ b/components/cronet/stale_host_resolver_unittest.cc
@@ -10,7 +10,6 @@

#include "base/bind.h"
#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
@@ -611,7 +610,7 @@

SetStaleDelay(kNoStaleDelaySec);

- for (size_t i = 0; i < base::size(kUsabilityTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kUsabilityTestCases); ++i) {
const auto& test_case = kUsabilityTestCases[i];

SetStaleUsability(test_case.max_expired_time_sec, test_case.max_stale_uses,
diff --git a/components/crx_file/crx_creator.cc b/components/crx_file/crx_creator.cc
index 2f7b3f4..e46697d 100644
--- a/components/crx_file/crx_creator.cc
+++ b/components/crx_file/crx_creator.cc
@@ -4,7 +4,6 @@

#include "components/crx_file/crx_creator.h"

-#include "base/cxx17_backports.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "components/crx_file/crx3.pb.h"
@@ -32,7 +31,7 @@
int read = 0;
static_assert(sizeof(char) == sizeof(uint8_t), "Unsupported char size.");
while ((read = file->ReadAtCurrentPos(reinterpret_cast<char*>(buffer),
- base::size(buffer))) > 0) {
+ std::size(buffer))) > 0) {
if (!signer->Update(buffer, read))
return CreatorResult::ERROR_SIGNING_FAILURE;
}
@@ -50,7 +49,7 @@
char buffer[1 << 12] = {};
int read = 0;
in->Seek(base::File::Whence::FROM_BEGIN, 0);
- while ((read = in->ReadAtCurrentPos(buffer, base::size(buffer))) > 0) {
+ while ((read = in->ReadAtCurrentPos(buffer, std::size(buffer))) > 0) {
if (out->WriteAtCurrentPos(buffer, read) != read)
return false;
}
@@ -82,9 +81,9 @@
// through, run ZIP through.
auto signer = crypto::SignatureCreator::Create(
signing_key, crypto::SignatureCreator::HashAlgorithm::SHA256);
- signer->Update(kSignatureContext, base::size(kSignatureContext));
+ signer->Update(kSignatureContext, std::size(kSignatureContext));
signer->Update(signed_header_size_octets,
- base::size(signed_header_size_octets));
+ std::size(signed_header_size_octets));
signer->Update(
reinterpret_cast<const uint8_t*>(signed_header_data_str.data()),
signed_header_data_str.size());
@@ -121,9 +120,9 @@
static_assert(sizeof(char) == sizeof(uint8_t), "Unsupported char size.");
if (!WriteBuffer(&crx, kCrxFileHeaderMagic, kCrxFileHeaderMagicSize) ||
!WriteBuffer(&crx, reinterpret_cast<const char*>(format_version_octets),
- base::size(format_version_octets)) ||
+ std::size(format_version_octets)) ||
!WriteBuffer(&crx, reinterpret_cast<const char*>(header_size_octets),
- base::size(header_size_octets)) ||
+ std::size(header_size_octets)) ||
!WriteBuffer(&crx, header_str.c_str(), header_str.length()) ||
!WriteArchive(&crx, file)) {
return CreatorResult::ERROR_FILE_WRITE_FAILURE;
diff --git a/components/crx_file/crx_verifier.cc b/components/crx_file/crx_verifier.cc
index e6e81b0..c7b80d7 100644
--- a/components/crx_file/crx_verifier.cc
+++ b/components/crx_file/crx_verifier.cc
@@ -14,7 +14,6 @@
#include "base/base64.h"
#include "base/bind.h"
#include "base/callback.h"
-#include "base/cxx17_backports.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/numerics/safe_conversions.h"
@@ -75,8 +74,7 @@
const VerifierCollection& verifiers) {
uint8_t buffer[1 << 12] = {};
size_t len = 0;
- while ((len = ReadAndHashBuffer(buffer, base::size(buffer), file, hash)) >
- 0) {
+ while ((len = ReadAndHashBuffer(buffer, std::size(buffer), file, hash)) > 0) {
for (auto& verifier : verifiers)
verifier->VerifyUpdate(base::make_span(buffer, len));
}
diff --git a/components/crx_file/id_util_unittest.cc b/components/crx_file/id_util_unittest.cc
index 03c7a2de..a1086ce 100644
--- a/components/crx_file/id_util_unittest.cc
+++ b/components/crx_file/id_util_unittest.cc
@@ -6,7 +6,6 @@

#include <stdint.h>

-#include "base/cxx17_backports.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace crx_file {
@@ -30,7 +29,7 @@
0x0f, 0x02, 0x03, 0x01, 0x00, 0x01};
std::string extension_id =
GenerateId(std::string(reinterpret_cast<const char*>(&public_key_info[0]),
- base::size(public_key_info)));
+ std::size(public_key_info)));
EXPECT_EQ("melddjfinppjdikinhbgehiennejpfhp", extension_id);

EXPECT_EQ("daibjpdaanagajckigeiigphanababab",
diff --git a/components/dbus/menu/menu.cc b/components/dbus/menu/menu.cc
index 2d3718b..aaff5c9 100644
--- a/components/dbus/menu/menu.cc
+++ b/components/dbus/menu/menu.cc
@@ -151,10 +151,10 @@
{kMethodGetProperty, &DbusMenu::OnGetProperty},
};

- // base::size(methods) calls for method export, 1 call for properties
+ // std::size(methods) calls for method export, 1 call for properties
// initialization.
barrier_ =
- SuccessBarrierCallback(base::size(methods) + 1, std::move(callback));
+ SuccessBarrierCallback(std::size(methods) + 1, std::move(callback));
for (const auto& method : methods) {
menu_->ExportMethod(
kInterfaceDbusMenu, method.name,
diff --git a/components/dbus/properties/dbus_properties.cc b/components/dbus/properties/dbus_properties.cc
index 06a3361..c533dc1 100644
--- a/components/dbus/properties/dbus_properties.cc
+++ b/components/dbus/properties/dbus_properties.cc
@@ -8,7 +8,6 @@

#include "base/bind.h"
#include "base/containers/contains.h"
-#include "base/cxx17_backports.h"
#include "components/dbus/properties/success_barrier_callback.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
@@ -38,7 +37,7 @@
{kMethodPropertiesSet, &DbusProperties::OnSetProperty},
};

- barrier_ = SuccessBarrierCallback(base::size(methods), std::move(callback));
+ barrier_ = SuccessBarrierCallback(std::size(methods), std::move(callback));
for (const auto& method : methods) {
exported_object_->ExportMethod(
DBUS_INTERFACE_PROPERTIES, method.name,
diff --git a/components/discardable_memory/common/discardable_shared_memory_heap.cc b/components/discardable_memory/common/discardable_shared_memory_heap.cc
index 9ab396a..9aacc660 100644
--- a/components/discardable_memory/common/discardable_shared_memory_heap.cc
+++ b/components/discardable_memory/common/discardable_shared_memory_heap.cc
@@ -10,7 +10,6 @@
#include <utility>

#include "base/bits.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/format_macros.h"
#include "base/memory/aligned_memory.h"
@@ -152,7 +151,7 @@
memory_segments_.clear();
DCHECK_EQ(num_blocks_, 0u);
DCHECK_EQ(num_free_blocks_, 0u);
- DCHECK_EQ(std::count_if(free_spans_, free_spans_ + base::size(free_spans_),
+ DCHECK_EQ(std::count_if(free_spans_, free_spans_ + std::size(free_spans_),
[](const base::LinkedList<Span>& free_spans) {
return !free_spans.empty();
}),
@@ -274,7 +273,7 @@
size_t max_length = blocks + slack;

// Search array of free lists for a suitable span.
- while (length - 1 < base::size(free_spans_) - 1) {
+ while (length - 1 < std::size(free_spans_) - 1) {
const base::LinkedList<Span>& free_spans = free_spans_[length - 1];
if (!free_spans.empty()) {
// Return the most recently used span located in tail.
@@ -287,7 +286,7 @@
}

const base::LinkedList<Span>& overflow_free_spans =
- free_spans_[base::size(free_spans_) - 1];
+ free_spans_[std::size(free_spans_) - 1];

// Search overflow free list for a suitable span. Starting with the most
// recently used span located in tail and moving towards head.
@@ -404,7 +403,7 @@
void DiscardableSharedMemoryHeap::InsertIntoFreeList(
std::unique_ptr<DiscardableSharedMemoryHeap::Span> span) {
DCHECK(!IsInFreeList(span.get()));
- size_t index = std::min(span->length_, base::size(free_spans_)) - 1;
+ size_t index = std::min(span->length_, std::size(free_spans_)) - 1;

free_spans_[index].Append(span.release());
}
diff --git a/components/domain_reliability/quic_error_mapping.cc b/components/domain_reliability/quic_error_mapping.cc
index 87aa93b..ab6afee 100644
--- a/components/domain_reliability/quic_error_mapping.cc
+++ b/components/domain_reliability/quic_error_mapping.cc
@@ -4,8 +4,6 @@

#include "components/domain_reliability/quic_error_mapping.h"

-#include "base/cxx17_backports.h"
-
namespace domain_reliability {

namespace {
@@ -475,7 +473,7 @@
const int kActiveQuicErrorCount =
quic::QUIC_LAST_ERROR - kDeprecatedQuicErrorCount;

-static_assert(base::size(kQuicErrorMap) == kActiveQuicErrorCount,
+static_assert(std::size(kQuicErrorMap) == kActiveQuicErrorCount,
"quic_error_map is not in sync with quic protocol!");

} // namespace
@@ -486,7 +484,7 @@
if (quic_error != quic::QUIC_NO_ERROR) {
// Convert a QUIC error.
// TODO(juliatuttle): Consider sorting and using binary search?
- for (size_t i = 0; i < base::size(kQuicErrorMap); i++) {
+ for (size_t i = 0; i < std::size(kQuicErrorMap); i++) {
if (kQuicErrorMap[i].quic_error == quic_error) {
*beacon_quic_error_out = kQuicErrorMap[i].beacon_quic_error;
return true;
diff --git a/components/domain_reliability/util.cc b/components/domain_reliability/util.cc
index 71e05ef..8d2c8754 100644
--- a/components/domain_reliability/util.cc
+++ b/components/domain_reliability/util.cc
@@ -7,7 +7,6 @@
#include <stddef.h>

#include "base/callback.h"
-#include "base/cxx17_backports.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/time/default_tick_clock.h"
@@ -92,7 +91,7 @@
}

// TODO(juliatuttle): Consider sorting and using binary search?
- for (size_t i = 0; i < base::size(net_error_map); i++) {
+ for (size_t i = 0; i < std::size(net_error_map); i++) {
if (net_error_map[i].net_error == net_error) {
*beacon_status_out = net_error_map[i].beacon_status;
return true;
diff --git a/components/download/internal/background_service/in_memory_download_unittest.cc b/components/download/internal/background_service/in_memory_download_unittest.cc
index c4f8018..607e8eb7 100644
--- a/components/download/internal/background_service/in_memory_download_unittest.cc
+++ b/components/download/internal/background_service/in_memory_download_unittest.cc
@@ -226,7 +226,7 @@

// The size must match for download as stream from SimpleUrlLoader.
network::URLLoaderCompletionStatus status;
- status.decoded_body_length = base::size(kTestDownloadData) - 1;
+ status.decoded_body_length = std::size(kTestDownloadData) - 1;

url_loader_factory()->AddResponse(request_params.url, response_head.Clone(),
kTestDownloadData, status,
diff --git a/components/download/internal/common/base_file_unittest.cc b/components/download/internal/common/base_file_unittest.cc
index 702554a..a0762e5 100644
--- a/components/download/internal/common/base_file_unittest.cc
+++ b/components/download/internal/common/base_file_unittest.cc
@@ -10,7 +10,6 @@
#include <memory>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -34,10 +33,10 @@
const char kTestData2[] = "Writing more data.\n";
const char kTestData3[] = "Final line.";
const char kTestData4[] = "supercalifragilisticexpialidocious";
-const int kTestDataLength1 = base::size(kTestData1) - 1;
-const int kTestDataLength2 = base::size(kTestData2) - 1;
-const int kTestDataLength3 = base::size(kTestData3) - 1;
-const int kTestDataLength4 = base::size(kTestData4) - 1;
+const int kTestDataLength1 = std::size(kTestData1) - 1;
+const int kTestDataLength2 = std::size(kTestData2) - 1;
+const int kTestDataLength3 = std::size(kTestData3) - 1;
+const int kTestDataLength4 = std::size(kTestData4) - 1;
int64_t kTestDataBytesWasted = 0;

// SHA-256 hash of kTestData1 (excluding terminating NUL).
@@ -749,7 +748,7 @@
ASSERT_FALSE(base::PathExists(full_path));

const char kData[] = "hello";
- const int kDataLength = static_cast<int>(base::size(kData) - 1);
+ const int kDataLength = static_cast<int>(std::size(kData) - 1);
ASSERT_EQ(kDataLength, base::WriteFile(full_path, kData, kDataLength));
// The file that we created here should stick around when the BaseFile is
// destroyed during TearDown.
diff --git a/components/drive/drive_api_util.cc b/components/drive/drive_api_util.cc
index ef2ca22..b614c85 100644
--- a/components/drive/drive_api_util.cc
+++ b/components/drive/drive_api_util.cc
@@ -6,7 +6,6 @@

#include <string>

-#include "base/cxx17_backports.h"
#include "base/files/file.h"
#include "base/hash/md5.h"
#include "base/strings/strcat.h"
@@ -166,7 +165,7 @@
}

bool IsKnownHostedDocumentMimeType(const std::string& mime_type) {
- for (size_t i = 0; i < base::size(kHostedDocumentKinds); ++i) {
+ for (size_t i = 0; i < std::size(kHostedDocumentKinds); ++i) {
if (mime_type == kHostedDocumentKinds[i].mime_type)
return true;
}
@@ -175,7 +174,7 @@

bool HasHostedDocumentExtension(const base::FilePath& path) {
const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe();
- for (size_t i = 0; i < base::size(kHostedDocumentKinds); ++i) {
+ for (size_t i = 0; i < std::size(kHostedDocumentKinds); ++i) {
if (extension == kHostedDocumentKinds[i].extension)
return true;
}
diff --git a/components/drive/resource_metadata_storage.cc b/components/drive/resource_metadata_storage.cc
index 94c70ee..4bea37a 100644
--- a/components/drive/resource_metadata_storage.cc
+++ b/components/drive/resource_metadata_storage.cc
@@ -12,7 +12,6 @@
#include <utility>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/logging.h"
@@ -100,7 +99,7 @@
bool IsCacheEntryKey(const leveldb::Slice& key) {
// A cache entry key should end with |kDBKeyDelimeter + kCacheEntryKeySuffix|.
const leveldb::Slice expected_suffix(kCacheEntryKeySuffix,
- base::size(kCacheEntryKeySuffix) - 1);
+ std::size(kCacheEntryKeySuffix) - 1);
if (key.size() < 1 + expected_suffix.size() ||
key[key.size() - expected_suffix.size() - 1] != kDBKeyDelimeter)
return false;
@@ -114,7 +113,7 @@
std::string GetIdFromCacheEntryKey(const leveldb::Slice& key) {
DCHECK(IsCacheEntryKey(key));
// Drop the suffix |kDBKeyDelimeter + kCacheEntryKeySuffix| from the key.
- const size_t kSuffixLength = base::size(kCacheEntryKeySuffix) - 1;
+ const size_t kSuffixLength = std::size(kCacheEntryKeySuffix) - 1;
const int id_length = key.size() - 1 - kSuffixLength;
return std::string(key.data(), id_length);
}
@@ -134,7 +133,7 @@
// A resource-ID-to-local-ID entry key should start with
// |kDBKeyDelimeter + kIdEntryKeyPrefix + kDBKeyDelimeter|.
const leveldb::Slice expected_prefix(kIdEntryKeyPrefix,
- base::size(kIdEntryKeyPrefix) - 1);
+ std::size(kIdEntryKeyPrefix) - 1);
if (key.size() < 2 + expected_prefix.size())
return false;
const leveldb::Slice key_substring(key.data() + 1, expected_prefix.size());
@@ -148,7 +147,7 @@
DCHECK(IsIdEntryKey(key));
// Drop the prefix |kDBKeyDelimeter + kIdEntryKeyPrefix + kDBKeyDelimeter|
// from the key.
- const size_t kPrefixLength = base::size(kIdEntryKeyPrefix) - 1;
+ const size_t kPrefixLength = std::size(kIdEntryKeyPrefix) - 1;
const int offset = kPrefixLength + 2;
return std::string(key.data() + offset, key.size() - offset);
}
diff --git a/components/drive/resource_metadata_storage_unittest.cc b/components/drive/resource_metadata_storage_unittest.cc
index fb40f5d..bca7949 100644
--- a/components/drive/resource_metadata_storage_unittest.cc
+++ b/components/drive/resource_metadata_storage_unittest.cc
@@ -244,7 +244,7 @@
TEST_F(ResourceMetadataStorageTest, GetChildren) {
const std::string parents_id[] = { "mercury", "venus", "mars", "jupiter",
"saturn" };
- std::vector<base::StringPairs> children_name_id(base::size(parents_id));
+ std::vector<base::StringPairs> children_name_id(std::size(parents_id));
// Skip children_name_id[0/1] here because Mercury and Venus have no moon.
children_name_id[2].push_back(std::make_pair("phobos", "mars_i"));
children_name_id[2].push_back(std::make_pair("deimos", "mars_ii"));
diff --git a/components/embedder_support/origin_trials/origin_trial_policy_impl_unittest.cc b/components/embedder_support/origin_trials/origin_trial_policy_impl_unittest.cc
index c2ef484..4adb336 100644
--- a/components/embedder_support/origin_trials/origin_trial_policy_impl_unittest.cc
+++ b/components/embedder_support/origin_trials/origin_trial_policy_impl_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>

#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -102,13 +101,13 @@
OriginTrialPolicyImplTest()
: token1_signature_(
std::string(reinterpret_cast<const char*>(kToken1Signature),
- base::size(kToken1Signature))),
+ std::size(kToken1Signature))),
token2_signature_(
std::string(reinterpret_cast<const char*>(kToken2Signature),
- base::size(kToken2Signature))),
+ std::size(kToken2Signature))),
token3_signature_(
std::string(reinterpret_cast<const char*>(kToken3Signature),
- base::size(kToken3Signature))),
+ std::size(kToken3Signature))),
two_disabled_tokens_(
base::JoinString({kToken1SignatureEncoded, kToken2SignatureEncoded},
kTokenSeparator)),
@@ -117,8 +116,7 @@
kToken3SignatureEncoded},
kTokenSeparator)),
manager_(base::WrapUnique(new OriginTrialPolicyImpl())),
- default_keys_(manager_->GetPublicKeys()) {
- }
+ default_keys_(manager_->GetPublicKeys()) {}

OriginTrialPolicyImpl* manager() { return manager_.get(); }
const std::vector<blink::OriginTrialPublicKey>& default_keys() {
diff --git a/components/error_page/common/localized_error.cc b/components/error_page/common/localized_error.cc
index de34d6e..e62128d 100644
--- a/components/error_page/common/localized_error.cc
+++ b/components/error_page/common/localized_error.cc
@@ -12,7 +12,6 @@

#include "base/check_op.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/i18n/rtl.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
@@ -492,11 +491,11 @@
net::IsHostnameResolutionError(error_code)) {
return &secure_dns_network_error;
}
- return FindErrorMapInArray(net_error_options, base::size(net_error_options),
+ return FindErrorMapInArray(net_error_options, std::size(net_error_options),
error_code);
} else if (error_domain == Error::kHttpErrorDomain) {
const LocalizedErrorMap* map = FindErrorMapInArray(
- http_error_options, base::size(http_error_options), error_code);
+ http_error_options, std::size(http_error_options), error_code);
// Handle miscellaneous 400/500 errors.
return !map && error_code >= 400 && error_code < 600
? &generic_4xx_5xx_error
@@ -504,7 +503,7 @@
} else if (error_domain == Error::kDnsProbeErrorDomain) {
const LocalizedErrorMap* map =
FindErrorMapInArray(dns_probe_error_options,
- base::size(dns_probe_error_options), error_code);
+ std::size(dns_probe_error_options), error_code);
DCHECK(map);
return map;
} else {
diff --git a/components/error_page/content/browser/net_error_auto_reloader.cc b/components/error_page/content/browser/net_error_auto_reloader.cc
index 5110106..872daad 100644
--- a/components/error_page/content/browser/net_error_auto_reloader.cc
+++ b/components/error_page/content/browser/net_error_auto_reloader.cc
@@ -61,7 +61,7 @@
static constexpr base::TimeDelta kDelays[] = {
base::Seconds(1), base::Seconds(5), base::Seconds(30), base::Minutes(1),
base::Minutes(5), base::Minutes(10), base::Minutes(30)};
- return kDelays[std::min(reload_count, base::size(kDelays) - 1)];
+ return kDelays[std::min(reload_count, std::size(kDelays) - 1)];
}

// Helper to block a navigation that would result in re-committing the same
diff --git a/components/exo/surface_unittest.cc b/components/exo/surface_unittest.cc
index 5782b25..7fdeb1f 100644
--- a/components/exo/surface_unittest.cc
+++ b/components/exo/surface_unittest.cc
@@ -840,11 +840,11 @@
gfx::RectF(10.5, 20, 30, 40.5), gfx::RectF(10.5, 20.5, 30, 40)};
bool kExpectedAligned[] = {true, true, false, false,
false, false, false, false};
- static_assert(base::size(kTestRects) == base::size(kExpectedAligned),
+ static_assert(std::size(kTestRects) == std::size(kExpectedAligned),
"Number of elements in each list should be the identical.");
for (int j = 0; j < 2; j++) {
const bool kTestCaseRotation = (j == 1);
- for (size_t i = 0; i < base::size(kTestRects); i++) {
+ for (size_t i = 0; i < std::size(kTestRects); i++) {
auto rect_in_dip = kTestRects[i];
device_scale_transform.TransformRect(&rect_in_dip);
sub_surface->SetPosition(rect_in_dip.origin());
@@ -1264,7 +1264,7 @@
constexpr SkColor4f kBuffColorExpected[] = {{1.f, 0.5f, 0.f, 1.f},
{0.f, 0.5f, 1.f, 0.f}};
constexpr bool kExpectedOpaque[] = {true, false};
- for (size_t i = 0; i < base::size(kBuffColorExpected); i++) {
+ for (size_t i = 0; i < std::size(kBuffColorExpected); i++) {
auto buffer =
std::make_unique<SolidColorBuffer>(kBuffColorExpected[i], buffer_size);
auto surface = std::make_unique<Surface>();
diff --git a/components/exo/wayland/clients/blur.cc b/components/exo/wayland/clients/blur.cc
index e153f10..8782b0e 100644
--- a/components/exo/wayland/clients/blur.cc
+++ b/components/exo/wayland/clients/blur.cc
@@ -8,7 +8,6 @@
#include <vector>

#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "components/exo/wayland/clients/client_helper.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImage.h"
@@ -89,7 +88,7 @@
SK_ColorRED, SK_ColorYELLOW,
SK_ColorCYAN, SK_ColorMAGENTA};
SkPaint paint;
- paint.setColor(kColors[(y * kGridSize + x) % base::size(kColors)]);
+ paint.setColor(kColors[(y * kGridSize + x) % std::size(kColors)]);
canvas->save();
canvas->translate(
x * cell_size.width() + SkScalarHalf(cell_size.width()),
diff --git a/components/exo/wayland/clients/rects.cc b/components/exo/wayland/clients/rects.cc
index 81cfd88..0c6c1d9 100644
--- a/components/exo/wayland/clients/rects.cc
+++ b/components/exo/wayland/clients/rects.cc
@@ -20,7 +20,6 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/containers/circular_deque.h"
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/message_loop/message_pump_type.h"
#include "base/scoped_generic.h"
@@ -423,7 +422,7 @@
SK_ColorRED, SK_ColorYELLOW,
SK_ColorCYAN, SK_ColorMAGENTA};
SkPaint paint;
- paint.setColor(SkColorSetA(kColors[i % base::size(kColors)], 0xA0));
+ paint.setColor(SkColorSetA(kColors[i % std::size(kColors)], 0xA0));
canvas->rotate(rotation / num_rects);
canvas->drawIRect(rect, paint);
}
diff --git a/components/exo/wayland/clients/simple.cc b/components/exo/wayland/clients/simple.cc
index ab67352..542f421 100644
--- a/components/exo/wayland/clients/simple.cc
+++ b/components/exo/wayland/clients/simple.cc
@@ -5,11 +5,11 @@
#include "components/exo/wayland/clients/simple.h"

#include <presentation-time-client-protocol.h>
+
#include <iostream>

#include "base/command_line.h"
#include "base/containers/circular_deque.h"
-#include "base/cxx17_backports.h"
#include "base/time/time.h"
#include "components/exo/wayland/clients/client_helper.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -141,7 +141,7 @@
SkCanvas* canvas = buffer->sk_surface->getCanvas();

static const SkColor kColors[] = {SK_ColorRED, SK_ColorBLACK};
- canvas->clear(kColors[++frame_count % base::size(kColors)]);
+ canvas->clear(kColors[++frame_count % std::size(kColors)]);

if (gr_context_) {
gr_context_->flushAndSubmit();
diff --git a/components/exo/wayland/clients/subsurface.cc b/components/exo/wayland/clients/subsurface.cc
index d92ded6..0e7f8eb 100644
--- a/components/exo/wayland/clients/subsurface.cc
+++ b/components/exo/wayland/clients/subsurface.cc
@@ -4,7 +4,6 @@

#include "base/at_exit.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/message_loop/message_pump_type.h"
#include "base/task/single_thread_task_executor.h"
#include "components/exo/wayland/clients/client_base.h"
@@ -115,7 +114,7 @@
Buffer* buffer = buffers_.front().get();
SkCanvas* canvas = buffer->sk_surface->getCanvas();
static const SkColor kColors[] = {SK_ColorRED, SK_ColorBLACK};
- canvas->clear(kColors[frame_count % base::size(kColors)]);
+ canvas->clear(kColors[frame_count % std::size(kColors)]);
if (gr_context_) {
gr_context_->flushAndSubmit();
glFinish();
diff --git a/components/exo/wayland/clients/vulkan.cc b/components/exo/wayland/clients/vulkan.cc
index 6345372..1ca935c 100644
--- a/components/exo/wayland/clients/vulkan.cc
+++ b/components/exo/wayland/clients/vulkan.cc
@@ -4,7 +4,6 @@

#include "base/at_exit.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/message_loop/message_pump_type.h"
#include "base/task/single_thread_task_executor.h"
#include "components/exo/wayland/clients/client_base.h"
@@ -146,7 +145,7 @@

ScopedVulkanRenderFrame vulkan_frame(
this, buffer->vk_framebuffer->get(),
- kColors[++frame_count % base::size(kColors)]);
+ kColors[++frame_count % std::size(kColors)]);

// This is where the drawing code would go.
// This client is not drawing anything. Just clearing the fb.
diff --git a/components/exo/wayland/wl_shm.cc b/components/exo/wayland/wl_shm.cc
index 9ed934b..5fdc93e 100644
--- a/components/exo/wayland/wl_shm.cc
+++ b/components/exo/wayland/wl_shm.cc
@@ -46,12 +46,12 @@
uint32_t format) {
const auto* supported_format =
std::find_if(shm_supported_formats,
- shm_supported_formats + base::size(shm_supported_formats),
+ shm_supported_formats + std::size(shm_supported_formats),
[format](const shm_supported_format& supported_format) {
return supported_format.shm_format == format;
});
if (supported_format ==
- (shm_supported_formats + base::size(shm_supported_formats))) {
+ (shm_supported_formats + std::size(shm_supported_formats))) {
wl_resource_post_error(resource, WL_SHM_ERROR_INVALID_FORMAT,
"invalid format 0x%x", format);
return;
diff --git a/components/favicon/core/fallback_url_util_unittest.cc b/components/favicon/core/fallback_url_util_unittest.cc
index 75af5a2..1bc835f 100644
--- a/components/favicon/core/fallback_url_util_unittest.cc
+++ b/components/favicon/core/fallback_url_util_unittest.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -44,7 +43,7 @@
{"http://xn--oogle-60a/", "X"},
{"http://xn-oogle-60a/", "X"},
};
- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
std::u16string expected = base::ASCIIToUTF16(test_cases[i].expected);
GURL url(test_cases[i].url_str);
EXPECT_EQ(expected, GetFallbackIconText(url)) << " for test_cases[" << i
diff --git a/components/favicon_base/select_favicon_frames_unittest.cc b/components/favicon_base/select_favicon_frames_unittest.cc
index a45614e..4ad3986 100644
--- a/components/favicon_base/select_favicon_frames_unittest.cc
+++ b/components/favicon_base/select_favicon_frames_unittest.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -31,7 +30,7 @@

#define SCOPED_FAVICON_SCALE_FACTOR(list) \
ui::test::ScopedSetSupportedResourceScaleFactors scoped( \
- std::vector<ui::ResourceScaleFactor>(list, list + base::size(list)))
+ std::vector<ui::ResourceScaleFactor>(list, list + std::size(list)))

#define SCOPED_FAVICON_SCALE_FACTOR_1X \
SCOPED_FAVICON_SCALE_FACTOR(FaviconScaleFactor1x)
diff --git a/components/feature_engagement/public/feature_list.cc b/components/feature_engagement/public/feature_list.cc
index 35c9729..1274231 100644
--- a/components/feature_engagement/public/feature_list.cc
+++ b/components/feature_engagement/public/feature_list.cc
@@ -4,7 +4,6 @@

#include "components/feature_engagement/public/feature_list.h"

-#include "base/cxx17_backports.h"
#include "build/build_config.h"
#include "components/feature_engagement/public/feature_constants.h"

@@ -155,7 +154,7 @@

std::vector<const base::Feature*> GetAllFeatures() {
return std::vector<const base::Feature*>(
- kAllFeatures, kAllFeatures + base::size(kAllFeatures));
+ kAllFeatures, kAllFeatures + std::size(kAllFeatures));
}

} // namespace feature_engagement
diff --git a/components/feature_engagement/public/feature_list.h b/components/feature_engagement/public/feature_list.h
index fc20716..b4fd160 100644
--- a/components/feature_engagement/public/feature_list.h
+++ b/components/feature_engagement/public/feature_list.h
@@ -7,7 +7,6 @@

#include <vector>

-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "build/build_config.h"
#include "components/feature_engagement/public/feature_constants.h"
@@ -40,7 +39,7 @@
#define VARIATION_ENTRY(base_feature) \
{ \
base_feature##Variation[0].param_value, base_feature##Variation, \
- base::size(base_feature##Variation), nullptr \
+ std::size(base_feature##Variation), nullptr \
}

// Defines a flags_ui::FeatureEntry::FeatureParam for each feature.
diff --git a/components/feedback/redaction_tool.cc b/components/feedback/redaction_tool.cc
index 824e21e..c26504b 100644
--- a/components/feedback/redaction_tool.cc
+++ b/components/feedback/redaction_tool.cc
@@ -433,7 +433,7 @@
Arg*... match_groups) {
re2::StringPiece* args[] = {match_groups...};
return FindAndConsumeAndGetSkippedN(input, pattern, skipped_input, args,
- base::size(args));
+ std::size(args));
}

// The following MAC addresses will not be redacted as they are not specific
@@ -442,7 +442,7 @@
"00:00:00:00:00:00", // ARP failure result MAC.
"ff:ff:ff:ff:ff:ff", // Broadcast MAC.
};
-constexpr size_t kNumUnredactedMacs = base::size(kUnredactedMacAddresses);
+constexpr size_t kNumUnredactedMacs = std::size(kUnredactedMacAddresses);

} // namespace

diff --git a/components/feedback/redaction_tool_unittest.cc b/components/feedback/redaction_tool_unittest.cc
index 0c8a747..ede2365 100644
--- a/components/feedback/redaction_tool_unittest.cc
+++ b/components/feedback/redaction_tool_unittest.cc
@@ -452,7 +452,7 @@
"file:///var/log/messages",
"file:///usr/local/home/iby/web%20page%20test.html",
};
- for (size_t i = 0; i < base::size(kURLs); ++i) {
+ for (size_t i = 0; i < std::size(kURLs); ++i) {
SCOPED_TRACE(kURLs[i]);
std::string got = RedactCustomPatterns(kURLs[i]);
EXPECT_TRUE(
diff --git a/components/filename_generation/filename_generation_unittest.cc b/components/filename_generation/filename_generation_unittest.cc
index 1aeda89..f8979d4 100644
--- a/components/filename_generation/filename_generation_unittest.cc
+++ b/components/filename_generation/filename_generation_unittest.cc
@@ -4,7 +4,6 @@

#include "components/filename_generation/filename_generation.h"

-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -64,7 +63,7 @@
#define MAYBE_TestEnsureHtmlExtension TestEnsureHtmlExtension
#endif
TEST(FilenameGenerationTest, MAYBE_TestEnsureHtmlExtension) {
- for (size_t i = 0; i < base::size(kExtensionTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kExtensionTestCases); ++i) {
base::FilePath original = base::FilePath(kExtensionTestCases[i].page_title);
base::FilePath expected =
base::FilePath(kExtensionTestCases[i].expected_name);
@@ -111,7 +110,7 @@
{FPL("filename.abc"), FPL("filename.abc"), "unknown/unknown"},
{FPL("filename"), FPL("filename"), "unknown/unknown"},
};
- for (uint32_t i = 0; i < base::size(kExtensionTests); ++i) {
+ for (uint32_t i = 0; i < std::size(kExtensionTests); ++i) {
base::FilePath original = base::FilePath(kExtensionTests[i].page_title);
base::FilePath expected = base::FilePath(kExtensionTests[i].expected_name);
std::string mime_type(kExtensionTests[i].contents_mime_type);
@@ -166,7 +165,7 @@
#define MAYBE_TestGenerateFilename TestGenerateFilename
#endif
TEST(FilenameGenerationTest, MAYBE_TestGenerateFilename) {
- for (size_t i = 0; i < base::size(kGenerateFilenameCases); ++i) {
+ for (size_t i = 0; i < std::size(kGenerateFilenameCases); ++i) {
base::FilePath save_name = GenerateFilename(
kGenerateFilenameCases[i].page_title,
GURL(kGenerateFilenameCases[i].page_url),
diff --git a/components/flags_ui/flags_state_unittest.cc b/components/flags_ui/flags_state_unittest.cc
index 6331fdf..0dd72c1 100644
--- a/components/flags_ui/flags_state_unittest.cc
+++ b/components/flags_ui/flags_state_unittest.cc
@@ -174,7 +174,7 @@
prefs_.registry()->RegisterListPref(prefs::kAboutFlagsEntries);
prefs_.registry()->RegisterDictionaryPref(prefs::kAboutFlagsOriginLists);

- for (size_t i = 0; i < base::size(kEntries); ++i)
+ for (size_t i = 0; i < std::size(kEntries); ++i)
kEntries[i].supported_platforms = FlagsState::GetCurrentPlatform();

int os_other_than_current = 1;
@@ -496,7 +496,7 @@
{2, "A,B", "C", "A,B", "C,FeatureName1"},
};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
SCOPED_TRACE(base::StringPrintf(
"Test[%" PRIuS "]: %d [%s] [%s]", i, cases[i].enabled_choice,
cases[i].existing_enable_features ? cases[i].existing_enable_features
@@ -799,7 +799,7 @@
{2, nullptr, "Foo,Bar", "", "Foo,Bar,FeatureName1"},
};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
SCOPED_TRACE(base::StringPrintf(
"Test[%" PRIuS "]: %d [%s] [%s]", i, cases[i].enabled_choice,
cases[i].existing_enable_features ? cases[i].existing_enable_features
@@ -843,7 +843,7 @@
auto unsupported_count = unsupported_entries.size();
EXPECT_EQ(11u, supported_count);
EXPECT_EQ(1u, unsupported_count);
- EXPECT_EQ(base::size(kEntries), supported_count + unsupported_count);
+ EXPECT_EQ(std::size(kEntries), supported_count + unsupported_count);
}

} // namespace flags_ui
diff --git a/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
index 3fd7026..dc53fa3 100644
--- a/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
+++ b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
@@ -7,8 +7,6 @@
#include <stddef.h>
#include <stdint.h>

-
-#include "base/cxx17_backports.h"
#include "base/strings/string_number_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"

@@ -42,7 +40,7 @@
{ "keyid=foo;someothervalue=1;rs=42", "foo", "", 42 },
};

- for (size_t i = 0; i < base::size(expected_results); i++) {
+ for (size_t i = 0; i < std::size(expected_results); i++) {
SCOPED_TRACE(i);

std::string header(expected_results[i].header);
@@ -84,7 +82,7 @@
{ "", "sixteencoolbytes", kDefaultRecordSize } } },
};

- for (size_t i = 0; i < base::size(expected_results); i++) {
+ for (size_t i = 0; i < std::size(expected_results); i++) {
SCOPED_TRACE(i);

std::string header(expected_results[i].header);
@@ -145,7 +143,7 @@
"rs=2,rs=0",
};

- for (size_t i = 0; i < base::size(expected_failures); i++) {
+ for (size_t i = 0; i < std::size(expected_failures); i++) {
SCOPED_TRACE(i);

std::string header(expected_failures[i]);
@@ -154,7 +152,7 @@
EXPECT_FALSE(iterator.GetNext());
}

- for (size_t i = 0; i < base::size(expected_failures_second_iter); i++) {
+ for (size_t i = 0; i < std::size(expected_failures_second_iter); i++) {
SCOPED_TRACE(i);

std::string header(expected_failures_second_iter[i]);
@@ -189,7 +187,7 @@
"foo", "twelvecoolbytes", "" },
};

- for (size_t i = 0; i < base::size(expected_results); i++) {
+ for (size_t i = 0; i < std::size(expected_results); i++) {
SCOPED_TRACE(i);

std::string header(expected_results[i].header);
@@ -231,7 +229,7 @@
{ "", "sixteencoolbytes", "" } } },
};

- for (size_t i = 0; i < base::size(expected_results); i++) {
+ for (size_t i = 0; i < std::size(expected_results); i++) {
SCOPED_TRACE(i);

std::string header(expected_results[i].header);
@@ -283,7 +281,7 @@
"dh=dHdlbHZlY29vbGJ5dGVz,aesgcm128=123$xyz",
};

- for (size_t i = 0; i < base::size(expected_failures); i++) {
+ for (size_t i = 0; i < std::size(expected_failures); i++) {
SCOPED_TRACE(i);

std::string header(expected_failures[i]);
@@ -292,7 +290,7 @@
EXPECT_FALSE(iterator.GetNext());
}

- for (size_t i = 0; i < base::size(expected_failures_second_iter); i++) {
+ for (size_t i = 0; i < std::size(expected_failures_second_iter); i++) {
SCOPED_TRACE(i);

std::string header(expected_failures_second_iter[i]);
diff --git a/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc b/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc
index 380e166..529c48d848 100644
--- a/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc
+++ b/components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc
@@ -8,7 +8,6 @@

#include "base/base64url.h"
#include "base/big_endian.h"
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -39,7 +38,7 @@
0x9A, 0xA1, 0x1A, 0x04, 0xF1, 0x98, 0x25, 0xF2, 0xC2, 0x13, 0x5D,
0xD9, 0x72, 0x35, 0x75, 0x24, 0xF9, 0xFF, 0x25, 0xD1, 0xBC, 0x84,
0x46, 0x4E, 0x88, 0x08, 0x55, 0x70, 0x9F, 0xA7, 0x07, 0xD9};
-static_assert(base::size(kCommonSenderPublicKey) == 65,
+static_assert(std::size(kCommonSenderPublicKey) == 65,
"Raw P-256 public keys must be 65 bytes in size.");

const unsigned char kCommonRecipientPublicKey[] = {
@@ -49,7 +48,7 @@
0x9A, 0x9F, 0xB8, 0x19, 0xD8, 0x21, 0x6F, 0x66, 0xE3, 0xF6, 0x0B,
0x74, 0xB2, 0x28, 0x38, 0xDC, 0xA7, 0x8A, 0x58, 0x0D, 0x56, 0x47,
0x3E, 0xD0, 0x5B, 0x5C, 0x93, 0x4E, 0xB3, 0x89, 0x87, 0x64};
-static_assert(base::size(kCommonRecipientPublicKey) == 65,
+static_assert(std::size(kCommonRecipientPublicKey) == 65,
"Raw P-256 public keys must be 65 bytes in size.");

const unsigned char kCommonRecipientPrivateKey[] = {
@@ -69,7 +68,7 @@
const unsigned char kCommonAuthSecret[] = {0x25, 0xF2, 0xC2, 0xB8, 0x19, 0xD8,
0xFD, 0x35, 0x97, 0xDF, 0xFB, 0x5E,
0xF6, 0x0B, 0xD7, 0xA4};
-static_assert(base::size(kCommonAuthSecret) == 16,
+static_assert(std::size(kCommonAuthSecret) == 16,
"Auth secrets must be 16 bytes in size.");

// Test vectors containing reference input for draft-ietf-webpush-encryption
@@ -278,14 +277,14 @@
void SetUp() override {
recipient_public_key_.assign(
kCommonRecipientPublicKey,
- kCommonRecipientPublicKey + base::size(kCommonRecipientPublicKey));
+ kCommonRecipientPublicKey + std::size(kCommonRecipientPublicKey));
sender_public_key_.assign(
kCommonSenderPublicKey,
- kCommonSenderPublicKey + base::size(kCommonSenderPublicKey));
+ kCommonSenderPublicKey + std::size(kCommonSenderPublicKey));

std::string recipient_private_key(
kCommonRecipientPrivateKey,
- kCommonRecipientPrivateKey + base::size(kCommonRecipientPrivateKey));
+ kCommonRecipientPrivateKey + std::size(kCommonRecipientPrivateKey));
std::vector<uint8_t> recipient_private_key_vec(
recipient_private_key.begin(), recipient_private_key.end());
std::unique_ptr<crypto::ECPrivateKey> recipient_key =
@@ -295,7 +294,7 @@
*recipient_key, sender_public_key_, &ecdh_shared_secret_));

auth_secret_.assign(kCommonAuthSecret,
- kCommonAuthSecret + base::size(kCommonAuthSecret));
+ kCommonAuthSecret + std::size(kCommonAuthSecret));
}

protected:
@@ -583,7 +582,7 @@
std::string ecdh_shared_secret, auth_secret, salt, ciphertext, output;
size_t record_size = 0;

- for (size_t i = 0; i < base::size(kEncryptionTestVectorsDraft03); ++i) {
+ for (size_t i = 0; i < std::size(kEncryptionTestVectorsDraft03); ++i) {
SCOPED_TRACE(i);

ecdh_shared_secret.assign(
@@ -616,7 +615,7 @@
GCMMessageCryptographer::Version::DRAFT_03);

std::string input, ecdh_shared_secret, auth_secret, salt, plaintext;
- for (size_t i = 0; i < base::size(kDecryptionTestVectorsDraft03); ++i) {
+ for (size_t i = 0; i < std::size(kDecryptionTestVectorsDraft03); ++i) {
SCOPED_TRACE(i);

ASSERT_TRUE(base::Base64UrlDecode(
@@ -658,7 +657,7 @@
std::string ecdh_shared_secret, auth_secret, salt, ciphertext, output;
size_t record_size = 0;

- for (size_t i = 0; i < base::size(kEncryptionTestVectorsDraft08); ++i) {
+ for (size_t i = 0; i < std::size(kEncryptionTestVectorsDraft08); ++i) {
SCOPED_TRACE(i);

ecdh_shared_secret.assign(
@@ -692,7 +691,7 @@

std::string input, ecdh_shared_secret, auth_secret, salt, plaintext;

- for (size_t i = 0; i < base::size(kDecryptionTestVectorsDraft08); ++i) {
+ for (size_t i = 0; i < std::size(kDecryptionTestVectorsDraft08); ++i) {
SCOPED_TRACE(i);

ASSERT_TRUE(base::Base64UrlDecode(
diff --git a/components/gcm_driver/crypto/message_payload_parser_unittest.cc b/components/gcm_driver/crypto/message_payload_parser_unittest.cc
index f9d7203..a90b129 100644
--- a/components/gcm_driver/crypto/message_payload_parser_unittest.cc
+++ b/components/gcm_driver/crypto/message_payload_parser_unittest.cc
@@ -5,7 +5,6 @@
#include "components/gcm_driver/crypto/message_payload_parser.h"

#include "base/big_endian.h"
-#include "base/cxx17_backports.h"
#include "components/gcm_driver/crypto/gcm_decryption_result.h"
#include "testing/gtest/include/gtest/gtest.h"

@@ -36,13 +35,13 @@
0x3F, 0xD8, 0x95, 0x2C, 0xA2, 0x11, 0xBD, 0x7B, 0x57, 0xB2, 0x00, 0xBD,
0x57, 0x68, 0x3F, 0xF0, 0x14, 0x57};

-static_assert(base::size(kValidMessage) == 104,
+static_assert(std::size(kValidMessage) == 104,
"The smallest valid message is 104 bytes in size.");

// Creates an std::string for the |kValidMessage| constant.
std::string CreateMessageString() {
return std::string(reinterpret_cast<const char*>(kValidMessage),
- base::size(kValidMessage));
+ std::size(kValidMessage));
}

TEST(MessagePayloadParserTest, ValidMessage) {
@@ -73,7 +72,7 @@

TEST(MessagePayloadParserTest, MinimumMessageSize) {
std::string message = CreateMessageString();
- message.resize(base::size(kValidMessage) / 2);
+ message.resize(std::size(kValidMessage) / 2);

MessagePayloadParser parser(message);
EXPECT_FALSE(parser.IsValid());
diff --git a/components/google/core/common/google_util.cc b/components/google/core/common/google_util.cc
index 42eed7b..7ce2a5e 100644
--- a/components/google/core/common/google_util.cc
+++ b/components/google/core/common/google_util.cc
@@ -11,7 +11,6 @@

#include "base/command_line.h"
#include "base/containers/fixed_flat_set.h"
-#include "base/cxx17_backports.h"
#include "base/no_destructor.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
@@ -300,7 +299,7 @@
".ytimg.com",
};
const std::string host = url.host();
- for (size_t i = 0; i < base::size(kSuffixesToSetHeadersFor); ++i) {
+ for (size_t i = 0; i < std::size(kSuffixesToSetHeadersFor); ++i) {
if (base::EndsWith(host, kSuffixesToSetHeadersFor[i],
base::CompareCase::INSENSITIVE_ASCII)) {
return true;
@@ -311,7 +310,7 @@
static const char* kHostsToSetHeadersFor[] = {
"googleweblight.com",
};
- for (size_t i = 0; i < base::size(kHostsToSetHeadersFor); ++i) {
+ for (size_t i = 0; i < std::size(kHostsToSetHeadersFor); ++i) {
if (base::LowerCaseEqualsASCII(host, kHostsToSetHeadersFor[i]))
return true;
}
diff --git a/components/history/content/browser/content_history_backend_db_unittest.cc b/components/history/content/browser/content_history_backend_db_unittest.cc
index 77192d0..64ecc9e 100644
--- a/components/history/content/browser/content_history_backend_db_unittest.cc
+++ b/components/history/content/browser/content_history_backend_db_unittest.cc
@@ -17,11 +17,9 @@
// has no logic in the getter except threading stuff, which we don't want
// to run.

-#include "components/history/core/browser/history_backend.h"
-
#include <stddef.h>

-#include "base/cxx17_backports.h"
+#include "components/history/core/browser/history_backend.h"
#include "components/history/core/test/history_backend_db_base_test.h"

namespace history {
@@ -89,11 +87,11 @@
ConfirmDownloadInterruptReasonBackwardsCompatible) {
// Are there any cases in which a historical number has been repurposed
// for an error other than it's original?
- for (size_t i = 0; i < base::size(current_reasons); i++) {
+ for (size_t i = 0; i < std::size(current_reasons); i++) {
const InterruptReasonAssociation& cur_reason(current_reasons[i]);
bool found = false;

- for (size_t j = 0; j < base::size(historical_reasons); ++j) {
+ for (size_t j = 0; j < std::size(historical_reasons); ++j) {
const InterruptReasonAssociation& hist_reason(historical_reasons[j]);

if (hist_reason.value == cur_reason.value) {
diff --git a/components/history/core/browser/android/android_history_types.cc b/components/history/core/browser/android/android_history_types.cc
index 7d50aba..948dd9e 100644
--- a/components/history/core/browser/android/android_history_types.cc
+++ b/components/history/core/browser/android/android_history_types.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "sql/statement.h"

namespace history {
@@ -37,9 +36,9 @@
public:
BookmarkIDMapping() {
static_assert(
- base::size(kAndroidBookmarkColumn) <= HistoryAndBookmarkRow::COLUMN_END,
+ std::size(kAndroidBookmarkColumn) <= HistoryAndBookmarkRow::COLUMN_END,
"kAndroidBookmarkColumn should not have more than COLUMN_END elements");
- for (size_t i = 0; i < base::size(kAndroidBookmarkColumn); ++i) {
+ for (size_t i = 0; i < std::size(kAndroidBookmarkColumn); ++i) {
(*this)[kAndroidBookmarkColumn[i]] =
static_cast<HistoryAndBookmarkRow::ColumnID>(i);
}
@@ -53,10 +52,10 @@
class SearchIDMapping : public std::map<std::string, SearchRow::ColumnID> {
public:
SearchIDMapping() {
- static_assert(base::size(kAndroidSearchColumn) <= SearchRow::COLUMN_END,
+ static_assert(std::size(kAndroidSearchColumn) <= SearchRow::COLUMN_END,
"kAndroidSearchColumn should not have more than "
"COLUMN_END elements");
- for (size_t i = 0; i < base::size(kAndroidSearchColumn); ++i) {
+ for (size_t i = 0; i < std::size(kAndroidSearchColumn); ++i) {
(*this)[kAndroidSearchColumn[i]] = static_cast<SearchRow::ColumnID>(i);
}
}
diff --git a/components/history/core/browser/android/android_urls_sql_handler.cc b/components/history/core/browser/android/android_urls_sql_handler.cc
index 0703011b..04b9bb1 100644
--- a/components/history/core/browser/android/android_urls_sql_handler.cc
+++ b/components/history/core/browser/android/android_urls_sql_handler.cc
@@ -5,7 +5,6 @@
#include "components/history/core/browser/android/android_urls_sql_handler.h"

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "components/history/core/browser/android/android_urls_database.h"

namespace history {
@@ -20,7 +19,7 @@

AndroidURLsSQLHandler::AndroidURLsSQLHandler(
AndroidURLsDatabase* android_urls_db)
- : SQLHandler(kInterestingColumns, base::size(kInterestingColumns)),
+ : SQLHandler(kInterestingColumns, std::size(kInterestingColumns)),
android_urls_db_(android_urls_db) {}

AndroidURLsSQLHandler::~AndroidURLsSQLHandler() {
diff --git a/components/history/core/browser/android/favicon_sql_handler.cc b/components/history/core/browser/android/favicon_sql_handler.cc
index 9b7473dc..02c4189 100644
--- a/components/history/core/browser/android/favicon_sql_handler.cc
+++ b/components/history/core/browser/android/favicon_sql_handler.cc
@@ -5,7 +5,6 @@
#include "components/history/core/browser/android/favicon_sql_handler.h"

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "components/favicon/core/favicon_database.h"
@@ -23,7 +22,7 @@
} // namespace

FaviconSQLHandler::FaviconSQLHandler(favicon::FaviconDatabase* favicon_db)
- : SQLHandler(kInterestingColumns, base::size(kInterestingColumns)),
+ : SQLHandler(kInterestingColumns, std::size(kInterestingColumns)),
favicon_db_(favicon_db) {}

FaviconSQLHandler::~FaviconSQLHandler() {
diff --git a/components/history/core/browser/android/urls_sql_handler.cc b/components/history/core/browser/android/urls_sql_handler.cc
index 182da4c6..0002bad 100644
--- a/components/history/core/browser/android/urls_sql_handler.cc
+++ b/components/history/core/browser/android/urls_sql_handler.cc
@@ -4,7 +4,6 @@

#include "components/history/core/browser/android/urls_sql_handler.h"

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "components/history/core/browser/url_database.h"

@@ -21,7 +20,7 @@
} // namespace

UrlsSQLHandler::UrlsSQLHandler(URLDatabase* url_db)
- : SQLHandler(kInterestingColumns, base::size(kInterestingColumns)),
+ : SQLHandler(kInterestingColumns, std::size(kInterestingColumns)),
url_db_(url_db) {}

UrlsSQLHandler:: ~UrlsSQLHandler() {
diff --git a/components/history/core/browser/android/visit_sql_handler.cc b/components/history/core/browser/android/visit_sql_handler.cc
index ccb0e73..6af11f8 100644
--- a/components/history/core/browser/android/visit_sql_handler.cc
+++ b/components/history/core/browser/android/visit_sql_handler.cc
@@ -7,7 +7,6 @@
#include <stdint.h>

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "components/history/core/browser/url_database.h"
#include "components/history/core/browser/visit_database.h"

@@ -25,7 +24,7 @@
} // namespace

VisitSQLHandler::VisitSQLHandler(URLDatabase* url_db, VisitDatabase* visit_db)
- : SQLHandler(kInterestingColumns, base::size(kInterestingColumns)),
+ : SQLHandler(kInterestingColumns, std::size(kInterestingColumns)),
url_db_(url_db),
visit_db_(visit_db) {}

diff --git a/components/history/core/browser/expire_history_backend_unittest.cc b/components/history/core/browser/expire_history_backend_unittest.cc
index b6ab918..89baee1 100644
--- a/components/history/core/browser/expire_history_backend_unittest.cc
+++ b/components/history/core/browser/expire_history_backend_unittest.cc
@@ -13,7 +13,6 @@

#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -607,7 +606,7 @@
std::vector<GURL> urls;
// Push back a bogus URL (which shouldn't change anything).
urls.push_back(GURL());
- for (size_t i = 0; i < base::size(rows); ++i) {
+ for (size_t i = 0; i < std::size(rows); ++i) {
ASSERT_TRUE(main_db_->GetURLRow(url_ids[i], &rows[i]));
favicon_ids[i] =
GetFavicon(rows[i].url(), favicon_base::IconType::kFavicon);
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc
index b1ce43d..1766c6d 100644
--- a/components/history/core/browser/history_backend_unittest.cc
+++ b/components/history/core/browser/history_backend_unittest.cc
@@ -17,7 +17,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -2840,7 +2839,7 @@
ASSERT_TRUE(backend_.get());

HistoryAddPageArgs args[10];
- for (size_t i = 0; i < base::size(args); ++i) {
+ for (size_t i = 0; i < std::size(args); ++i) {
args[i].url =
GURL("http://example" + std::string((i % 2 == 0 ? ".com" : ".net")));
args[i].time = base::Time::FromInternalValue(i);
@@ -2896,14 +2895,14 @@

// Insert 4 entries into the database.
HistoryAddPageArgs args[4];
- for (size_t i = 0; i < base::size(args); ++i) {
+ for (size_t i = 0; i < std::size(args); ++i) {
args[i].url = GURL("http://example" + base::NumberToString(i) + ".com");
args[i].time = reference_time + base::Days(i);
backend_->AddPage(args[i]);
}

URLRow url_rows[4];
- for (unsigned int i = 0; i < base::size(args); ++i)
+ for (unsigned int i = 0; i < std::size(args); ++i)
ASSERT_TRUE(backend_->GetURL(args[i].url, &url_rows[i]));

std::vector<ExpireHistoryArgs> expire_list;
@@ -2937,7 +2936,7 @@
EXPECT_EQ(backend_->GetFirstRecordedTimeForTest(), args[1].time);

// Now delete the rest of the visits in one call.
- for (unsigned int i = 1; i < base::size(args); ++i) {
+ for (unsigned int i = 1; i < std::size(args); ++i) {
expire_list.resize(expire_list.size() + 1);
expire_list[i].SetTimeRangeForOneDay(args[i].time);
expire_list[i].urls.insert(args[i].url);
diff --git a/components/history/core/browser/history_querying_unittest.cc b/components/history/core/browser/history_querying_unittest.cc
index bdd0e4e..50e820e91 100644
--- a/components/history/core/browser/history_querying_unittest.cc
+++ b/components/history/core/browser/history_querying_unittest.cc
@@ -8,7 +8,6 @@

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -197,7 +196,7 @@

// Fill the test data.
base_ = base::Time::Now().LocalMidnight();
- for (size_t i = 0; i < base::size(test_entries); i++) {
+ for (size_t i = 0; i < std::size(test_entries); i++) {
test_entries[i].time = GetTimeFromDaysAgo(test_entries[i].days_ago);
AddEntryToHistory(test_entries[i]);
}
@@ -458,7 +457,7 @@
L"\u0438\u0434\u0435\u043d\u0442.\u0440\u0444"), 1, },
};

- for (size_t i = 0; i < base::size(queries); ++i) {
+ for (size_t i = 0; i < std::size(queries); ++i) {
QueryHistory(queries[i].query, options, &results);
EXPECT_EQ(queries[i].results_size, results.size());
}
@@ -469,7 +468,7 @@
// Since results are fetched 1 and 2 at a time, entry #0 and #6 will not
// be de-duplicated.
int expected_results[] = {4, 2, 3, 1, 7, 6, 5, 8, 9, 10, 11, 12, 13, 14, 0};
- TestPaging(std::string(), expected_results, base::size(expected_results));
+ TestPaging(std::string(), expected_results, std::size(expected_results));
}

TEST_F(HistoryQueryTest, TextSearchPaging) {
@@ -477,7 +476,7 @@
// be de-duplicated. Entry #4 does not contain the text "title", so it
// shouldn't appear.
int expected_results[] = { 2, 3, 1, 7, 6, 5 };
- TestPaging("title", expected_results, base::size(expected_results));
+ TestPaging("title", expected_results, std::size(expected_results));
}

} // namespace history
diff --git a/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc b/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc
index 84ecac18..4a9b5fd 100644
--- a/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc
+++ b/components/history/core/browser/sync/typed_url_sync_bridge_unittest.cc
@@ -9,7 +9,6 @@

#include "base/big_endian.h"
#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
@@ -1542,8 +1541,8 @@

DiffVisits(old_visits, new_url, &new_visits, &removed_visits);
EXPECT_TRUE(new_visits.empty());
- ASSERT_EQ(removed_visits.size(), base::size(visits_removed));
- for (size_t i = 0; i < base::size(visits_removed); ++i) {
+ ASSERT_EQ(removed_visits.size(), std::size(visits_removed));
+ for (size_t i = 0; i < std::size(visits_removed); ++i) {
EXPECT_EQ(removed_visits[i].visit_time.ToInternalValue(),
visits_removed[i]);
}
@@ -1576,8 +1575,8 @@

DiffVisits(old_visits, new_url, &new_visits, &removed_visits);
EXPECT_TRUE(removed_visits.empty());
- ASSERT_TRUE(new_visits.size() == base::size(visits_added));
- for (size_t i = 0; i < base::size(visits_added); ++i) {
+ ASSERT_TRUE(new_visits.size() == std::size(visits_added));
+ for (size_t i = 0; i < std::size(visits_added); ++i) {
EXPECT_EQ(new_visits[i].first.ToInternalValue(), visits_added[i]);
EXPECT_TRUE(ui::PageTransitionTypeIncludingQualifiersIs(
new_visits[i].second, ui::PAGE_TRANSITION_TYPED));
diff --git a/components/history/core/browser/url_utils_unittest.cc b/components/history/core/browser/url_utils_unittest.cc
index a824922..0a3e4d99 100644
--- a/components/history/core/browser/url_utils_unittest.cc
+++ b/components/history/core/browser/url_utils_unittest.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

@@ -36,11 +35,11 @@
"http://www.google.com:80/",
"https://www.google.com",
};
- for (size_t i = 0; i < base::size(sorted_list); ++i) {
+ for (size_t i = 0; i < std::size(sorted_list); ++i) {
EXPECT_FALSE(CanonicalURLStringCompare(sorted_list[i], sorted_list[i]))
<< " for \"" << sorted_list[i] << "\" < \"" << sorted_list[i] << "\"";
// Every disjoint pair-wise comparison.
- for (size_t j = i + 1; j < base::size(sorted_list); ++j) {
+ for (size_t j = i + 1; j < std::size(sorted_list); ++j) {
EXPECT_TRUE(CanonicalURLStringCompare(sorted_list[i], sorted_list[j]))
<< " for \"" << sorted_list[i] << "\" < \"" << sorted_list[j] << "\"";
EXPECT_FALSE(CanonicalURLStringCompare(sorted_list[j], sorted_list[i]))
@@ -64,7 +63,7 @@
{"http://www.google.com/test", "http://www.google.com/test/with/dir/"},
{"http://www.google.com/test?", "http://www.google.com/test/with/dir/"},
};
- for (size_t i = 0; i < base::size(true_cases); ++i) {
+ for (size_t i = 0; i < std::size(true_cases); ++i) {
EXPECT_TRUE(HaveSameSchemeHostAndPort(GURL(true_cases[i].s1),
GURL(true_cases[i].s2)))
<< " for true_cases[" << i << "]";
@@ -79,7 +78,7 @@
{"http://www.google.com/path", "http://www.google.com:137/path"},
{"http://www.google.com/same/dir", "http://www.youtube.com/same/dir"},
};
- for (size_t i = 0; i < base::size(false_cases); ++i) {
+ for (size_t i = 0; i < std::size(false_cases); ++i) {
EXPECT_FALSE(HaveSameSchemeHostAndPort(GURL(false_cases[i].s1),
GURL(false_cases[i].s2)))
<< " for false_cases[" << i << "]";
@@ -99,7 +98,7 @@
{"/test", "/test/with/dir/"},
{"/test/", "/test/with/dir"},
};
- for (size_t i = 0; i < base::size(true_cases); ++i) {
+ for (size_t i = 0; i < std::size(true_cases); ++i) {
EXPECT_TRUE(IsPathPrefix(true_cases[i].p1, true_cases[i].p2))
<< " for true_cases[" << i << "]";
}
@@ -114,7 +113,7 @@
{"/test", "/test-bed"},
{"/test-", "/test"},
};
- for (size_t i = 0; i < base::size(false_cases); ++i) {
+ for (size_t i = 0; i < std::size(false_cases); ++i) {
EXPECT_FALSE(IsPathPrefix(false_cases[i].p1, false_cases[i].p2))
<< " for false_cases[" << i << "]";
}
diff --git a/components/history/core/browser/visit_annotations_database_unittest.cc b/components/history/core/browser/visit_annotations_database_unittest.cc
index 9a1c5c39..dac5f32 100644
--- a/components/history/core/browser/visit_annotations_database_unittest.cc
+++ b/components/history/core/browser/visit_annotations_database_unittest.cc
@@ -4,7 +4,6 @@

#include "components/history/core/browser/visit_annotations_database.h"

-#include "base/cxx17_backports.h"
#include "base/test/gtest_util.h"
#include "base/time/time.h"
#include "components/history/core/browser/history_types.h"
@@ -147,7 +146,7 @@
AddContextAnnotationsForVisit(2, visit_context_annotations_list[1]);
AddContextAnnotationsForVisit(3, visit_context_annotations_list[2]);

- for (size_t i = 0; i < base::size(visit_context_annotations_list); ++i) {
+ for (size_t i = 0; i < std::size(visit_context_annotations_list); ++i) {
SCOPED_TRACE(testing::Message() << "i: " << i);
VisitContextAnnotations actual;
VisitID visit_id = i + 1; // VisitIDs are start at 1.
diff --git a/components/history/core/browser/visit_tracker_unittest.cc b/components/history/core/browser/visit_tracker_unittest.cc
index d493387..3007924d 100644
--- a/components/history/core/browser/visit_tracker_unittest.cc
+++ b/components/history/core/browser/visit_tracker_unittest.cc
@@ -4,7 +4,6 @@

#include "components/history/core/browser/visit_tracker.h"

-#include "base/cxx17_backports.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace history {
@@ -61,7 +60,7 @@
};

VisitTracker tracker;
- RunTest(&tracker, test_simple, base::size(test_simple));
+ RunTest(&tracker, test_simple, std::size(test_simple));
}

// Test that referrer is properly computed when there are different frame
@@ -83,7 +82,7 @@
};

VisitTracker tracker;
- RunTest(&tracker, test_frames, base::size(test_frames));
+ RunTest(&tracker, test_frames, std::size(test_frames));
}

// Test frame navigation to make sure that the referrer is properly computed
@@ -105,7 +104,7 @@
};

VisitTracker tracker;
- RunTest(&tracker, test_processes, base::size(test_processes));
+ RunTest(&tracker, test_processes, std::size(test_processes));
}

// Test that processes get removed properly.
@@ -117,7 +116,7 @@
};

VisitTracker tracker;
- RunTest(&tracker, part1, base::size(part1));
+ RunTest(&tracker, part1, std::size(part1));

// Say that context has been invalidated.
tracker.ClearCachedDataForContextID(reinterpret_cast<ContextID>(1));
@@ -127,7 +126,7 @@
VisitToTest part2[] = {
{1, 1, "http://images.google.com/", 2, "http://www.google.com/", 0},
};
- RunTest(&tracker, part2, base::size(part2));
+ RunTest(&tracker, part2, std::size(part2));
}

TEST(VisitTracker, RemoveVisitById) {
@@ -138,7 +137,7 @@
};

VisitTracker tracker;
- RunTest(&tracker, test_simple, base::size(test_simple));
+ RunTest(&tracker, test_simple, std::size(test_simple));

// Remove the first visit.
const VisitToTest& removed = test_simple[0];
@@ -188,7 +187,7 @@
};

VisitTracker tracker;
- RunTest(&tracker, test_simple, base::size(test_simple));
+ RunTest(&tracker, test_simple, std::size(test_simple));
EXPECT_FALSE(tracker.IsEmpty());
tracker.Clear();
EXPECT_TRUE(tracker.IsEmpty());
diff --git a/components/history_clusters/core/history_clusters_db_tasks_unittest.cc b/components/history_clusters/core/history_clusters_db_tasks_unittest.cc
index a48de27..55bd57b 100644
--- a/components/history_clusters/core/history_clusters_db_tasks_unittest.cc
+++ b/components/history_clusters/core/history_clusters_db_tasks_unittest.cc
@@ -39,7 +39,7 @@
},
};

- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
SCOPED_TRACE(base::StringPrintf("Testing case i=%d", int(i)));

auto& test_case = test_data[i];
diff --git a/components/history_clusters/core/history_clusters_util_unittest.cc b/components/history_clusters/core/history_clusters_util_unittest.cc
index 68e74a8..d03776b 100644
--- a/components/history_clusters/core/history_clusters_util_unittest.cc
+++ b/components/history_clusters/core/history_clusters_util_unittest.cc
@@ -86,7 +86,7 @@
{"goog red", false, false},
};

- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
SCOPED_TRACE(base::StringPrintf("Testing case i=%d, query=%s",
static_cast<int>(i),
test_data[i].query.c_str()));
diff --git a/components/history_clusters/core/on_device_clustering_backend_unittest.cc b/components/history_clusters/core/on_device_clustering_backend_unittest.cc
index 21698b3c..693b017 100644
--- a/components/history_clusters/core/on_device_clustering_backend_unittest.cc
+++ b/components/history_clusters/core/on_device_clustering_backend_unittest.cc
@@ -524,7 +524,7 @@
void SetUp() override {
// Set up a simple template URL service with a default search engine.
template_url_service_ = std::make_unique<TemplateURLService>(
- kTemplateURLData, base::size(kTemplateURLData));
+ kTemplateURLData, std::size(kTemplateURLData));
TemplateURL* template_url = template_url_service_->GetTemplateURLForKeyword(
kDefaultTemplateURLKeyword);
template_url_service_->SetUserSelectedDefaultSearchProvider(template_url);
diff --git a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm
index 1987778..4cccaf0d 100644
--- a/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm
+++ b/components/image_fetcher/ios/ios_image_data_fetcher_wrapper_unittest.mm
@@ -8,7 +8,6 @@

#include <memory>

-#include "base/cxx17_backports.h"
#import "base/ios/ios_util.h"
#include "base/memory/ref_counted.h"
#include "base/test/task_environment.h"
@@ -179,7 +178,7 @@
network::mojom::URLResponseHeadPtr head =
network::mojom::URLResponseHead::New();
head->headers = new net::HttpResponseHeaders(
- std::string(kWEBPHeaderResponse, base::size(kWEBPHeaderResponse)));
+ std::string(kWEBPHeaderResponse, std::size(kWEBPHeaderResponse)));
head->mime_type = "image/webp";
network::URLLoaderCompletionStatus status;
status.decoded_body_length = content.size();
@@ -215,7 +214,7 @@
network::mojom::URLResponseHeadPtr head =
network::mojom::URLResponseHead::New();
head->headers = new net::HttpResponseHeaders(
- std::string(kWEBPHeaderResponse, base::size(kWEBPHeaderResponse)));
+ std::string(kWEBPHeaderResponse, std::size(kWEBPHeaderResponse)));
head->mime_type = "image/webp";
network::URLLoaderCompletionStatus status;
status.decoded_body_length = content.size();
diff --git a/components/image_fetcher/ios/webp_decoder_unittest.mm b/components/image_fetcher/ios/webp_decoder_unittest.mm
index 3a5774d..d12cce8 100644
--- a/components/image_fetcher/ios/webp_decoder_unittest.mm
+++ b/components/image_fetcher/ios/webp_decoder_unittest.mm
@@ -6,14 +6,12 @@

#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
-
#include <stddef.h>
#include <stdint.h>

#include <memory>

#include "base/base_paths.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/mac/scoped_cftyperef.h"
@@ -249,7 +247,7 @@
EXPECT_CALL(*delegate_, OnFinishedDecoding(false)).Times(1);
const char dummy_image[] = "(>'-')> <('-'<) ^('-')^ <('-'<) (>'-')>";
NSData* data = [[NSData alloc] initWithBytes:dummy_image
- length:base::size(dummy_image)];
+ length:std::size(dummy_image)];
decoder_->OnDataReceived(data);
EXPECT_EQ(0u, [delegate_->GetImage() length]);
}
diff --git a/components/metrics/field_trials_provider_unittest.cc b/components/metrics/field_trials_provider_unittest.cc
index 00b2a1e..e7d934f 100644
--- a/components/metrics/field_trials_provider_unittest.cc
+++ b/components/metrics/field_trials_provider_unittest.cc
@@ -4,7 +4,6 @@

#include "components/metrics/field_trials_provider.h"

-#include "base/cxx17_backports.h"
#include "base/threading/platform_thread.h"
#include "components/variations/active_field_trials.h"
#include "components/variations/synthetic_trial_registry.h"
@@ -103,7 +102,7 @@
provider.ProvideSystemProfileMetricsWithLogCreationTime(log_creation_time,
&proto);

- EXPECT_EQ(base::size(kAllTrialIds),
+ EXPECT_EQ(std::size(kAllTrialIds),
static_cast<size_t>(proto.field_trial_size()));
CheckFieldTrialsInSystemProfile(proto, kAllTrialIds);
}
@@ -115,7 +114,7 @@
provider.ProvideSystemProfileMetricsWithLogCreationTime(base::TimeTicks(),
&proto);

- EXPECT_EQ(base::size(kFieldTrialIds),
+ EXPECT_EQ(std::size(kFieldTrialIds),
static_cast<size_t>(proto.field_trial_size()));
CheckFieldTrialsInSystemProfile(proto, kFieldTrialIds);
}
@@ -139,7 +138,7 @@

provider.ProvideCurrentSessionData(&uma_log);

- EXPECT_EQ(base::size(kAllTrialIds),
+ EXPECT_EQ(std::size(kAllTrialIds),
static_cast<size_t>(uma_log.system_profile().field_trial_size()));
CheckFieldTrialsInSystemProfile(uma_log.system_profile(), kAllTrialIds);
}
diff --git a/components/metrics/file_metrics_provider.cc b/components/metrics/file_metrics_provider.cc
index 0112c8c..59b5bc9 100644
--- a/components/metrics/file_metrics_provider.cc
+++ b/components/metrics/file_metrics_provider.cc
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/containers/flat_map.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/files/file.h"
#include "base/files/file_enumerator.h"
@@ -212,7 +211,7 @@
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

// Ensure that kSourceOptions has been filled for this type.
- DCHECK_GT(base::size(kSourceOptions), static_cast<size_t>(params.type));
+ DCHECK_GT(std::size(kSourceOptions), static_cast<size_t>(params.type));

std::unique_ptr<SourceInfo> source(new SourceInfo(params));

diff --git a/components/metrics/file_metrics_provider_unittest.cc b/components/metrics/file_metrics_provider_unittest.cc
index fb2a174..6f9c54d 100644
--- a/components/metrics/file_metrics_provider_unittest.cc
+++ b/components/metrics/file_metrics_provider_unittest.cc
@@ -8,7 +8,6 @@

#include "base/bind.h"
#include "base/callback.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/files/scoped_temp_dir.h"
@@ -371,7 +370,7 @@
const FileMetricsProvider::FilterAction actions[] = {
FileMetricsProvider::FILTER_TRY_LATER,
FileMetricsProvider::FILTER_PROCESS_FILE};
- SetFilterActions(&params, actions, base::size(actions));
+ SetFilterActions(&params, actions, std::size(actions));
provider()->RegisterSource(params);

// Processing the file should touch it but yield no results. File timestamp
@@ -410,7 +409,7 @@
FileMetricsProvider::ASSOCIATE_CURRENT_RUN, kMetricsName);
const FileMetricsProvider::FilterAction actions[] = {
FileMetricsProvider::FILTER_SKIP_FILE};
- SetFilterActions(&params, actions, base::size(actions));
+ SetFilterActions(&params, actions, std::size(actions));
provider()->RegisterSource(params);

// Processing the file should delete it.
@@ -481,7 +480,7 @@
// Files could come out in the order: a1, c2, d4, b3. They are recognizeable
// by the number of histograms contained within each.
const uint32_t expect_order[] = {1, 2, 4, 3, 0};
- for (size_t i = 0; i < base::size(expect_order); ++i) {
+ for (size_t i = 0; i < std::size(expect_order); ++i) {
// Record embedded snapshots via snapshot-manager.
OnDidCreateMetricsLog();
RunTasks();
@@ -782,13 +781,13 @@
FileMetricsProvider::FILTER_SKIP_FILE, // d4
FileMetricsProvider::FILTER_PROCESS_FILE, // b3
FileMetricsProvider::FILTER_PROCESS_FILE}; // c2 (again)
- SetFilterActions(&params, actions, base::size(actions));
+ SetFilterActions(&params, actions, std::size(actions));
provider()->RegisterSource(params);

// Files could come out in the order: a1, b3, c2. They are recognizeable
// by the number of histograms contained within each.
const uint32_t expect_order[] = {1, 3, 2, 0};
- for (size_t i = 0; i < base::size(expect_order); ++i) {
+ for (size_t i = 0; i < std::size(expect_order); ++i) {
// Record embedded snapshots via snapshot-manager.
OnDidCreateMetricsLog();
RunTasks();
diff --git a/components/metrics/system_session_analyzer/system_session_analyzer_win.cc b/components/metrics/system_session_analyzer/system_session_analyzer_win.cc
index 2c782a6..7b41b7dc 100644
--- a/components/metrics/system_session_analyzer/system_session_analyzer_win.cc
+++ b/components/metrics/system_session_analyzer/system_session_analyzer_win.cc
@@ -4,7 +4,6 @@

#include "components/metrics/system_session_analyzer/system_session_analyzer_win.h"

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/time/time.h"

@@ -300,7 +299,7 @@

SystemSessionAnalyzer::EvtHandle SystemSessionAnalyzer::CreateRenderContext() {
LPCWSTR value_paths[] = {kEventIdPath, kEventTimePath};
- const DWORD kValueCnt = base::size(value_paths);
+ const DWORD kValueCnt = std::size(value_paths);

EVT_HANDLE context = nullptr;
context =
diff --git a/components/mirroring/service/remoting_sender.cc b/components/mirroring/service/remoting_sender.cc
index 7338039..c07b042 100644
--- a/components/mirroring/service/remoting_sender.cc
+++ b/components/mirroring/service/remoting_sender.cc
@@ -105,7 +105,7 @@
} else {
next_frame_data_.resize(size);
data_pipe_reader_->Read(
- reinterpret_cast<uint8_t*>(base::data(next_frame_data_)), size,
+ reinterpret_cast<uint8_t*>(std::data(next_frame_data_)), size,
base::BindOnce(&RemotingSender::OnFrameRead, base::Unretained(this)));
}
}
diff --git a/components/mirroring/service/session.cc b/components/mirroring/service/session.cc
index cf749ac..ccd24b4 100644
--- a/components/mirroring/service/session.cc
+++ b/components/mirroring/service/session.cc
@@ -129,7 +129,7 @@
// Generates a string with cryptographically secure random bytes.
std::string MakeRandomString(size_t length) {
std::string result(length, ' ');
- crypto::RandBytes(base::data(result), length);
+ crypto::RandBytes(std::data(result), length);
return result;
}

diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index f6b5b42..00d3c9c 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -5,6 +5,7 @@
#include "components/nacl/browser/nacl_process_host.h"

#include <string.h>
+
#include <algorithm>
#include <memory>
#include <string>
@@ -14,7 +15,6 @@
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/location.h"
@@ -832,7 +832,7 @@
switches::kV,
switches::kVModule,
};
- for (size_t i = 0; i < base::size(flag_allowlist); ++i) {
+ for (size_t i = 0; i < std::size(flag_allowlist); ++i) {
std::string value = cmdline->GetSwitchValueASCII(flag_allowlist[i]);
if (!value.empty()) {
args.switch_names.push_back(flag_allowlist[i]);
diff --git a/components/nacl/common/nacl_cmd_line.cc b/components/nacl/common/nacl_cmd_line.cc
index 0db43ef..a589ff8 100644
--- a/components/nacl/common/nacl_cmd_line.cc
+++ b/components/nacl/common/nacl_cmd_line.cc
@@ -4,7 +4,6 @@

#include "base/base_switches.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "build/build_config.h"
#include "components/nacl/common/nacl_switches.h"
#include "content/public/common/content_switches.h"
@@ -37,7 +36,7 @@
#endif
};
cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
- base::size(kSwitchNames));
+ std::size(kSwitchNames));
}

} // namespace nacl
diff --git a/components/nacl/renderer/json_manifest.cc b/components/nacl/renderer/json_manifest.cc
index 5ce39f1..bd6f2c2 100644
--- a/components/nacl/renderer/json_manifest.cc
+++ b/components/nacl/renderer/json_manifest.cc
@@ -9,7 +9,6 @@

#include <set>

-#include "base/cxx17_backports.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "components/nacl/common/nacl_types.h"
@@ -165,7 +164,7 @@
kUrlKey, kOptLevelKey,
};
url_spec_plus_optional = kPnaclUrlSpecPlusOptional;
- url_spec_plus_optional_length = base::size(kPnaclUrlSpecPlusOptional);
+ url_spec_plus_optional_length = std::size(kPnaclUrlSpecPlusOptional);
} else {
// URL specifications must not contain "pnacl-translate" keys.
// This prohibits NaCl clients from invoking PNaCl.
@@ -177,12 +176,12 @@
return false;
}
url_spec_plus_optional = kManifestUrlSpecRequired;
- url_spec_plus_optional_length = base::size(kManifestUrlSpecRequired);
+ url_spec_plus_optional_length = std::size(kManifestUrlSpecRequired);
}
if (!IsValidDictionary(*url_dict, container_key, parent_key,
url_spec_plus_optional, url_spec_plus_optional_length,
kManifestUrlSpecRequired,
- base::size(kManifestUrlSpecRequired), error_string)) {
+ std::size(kManifestUrlSpecRequired), error_string)) {
return false;
}
// Verify the correct types of the fields if they exist.
@@ -234,8 +233,8 @@

if (!IsValidDictionary(
*pnacl_dict, container_key, parent_key, kManifestPnaclSpecValid,
- base::size(kManifestPnaclSpecValid), kManifestPnaclSpecRequired,
- base::size(kManifestPnaclSpecRequired), error_string)) {
+ std::size(kManifestPnaclSpecValid), kManifestPnaclSpecRequired,
+ std::size(kManifestPnaclSpecRequired), error_string)) {
return false;
}
// kPnaclTranslateKey checked to be required above.
@@ -274,7 +273,7 @@
kPortableKey
};
isaProperties = kPnaclManifestISAProperties;
- isaPropertiesLength = base::size(kPnaclManifestISAProperties);
+ isaPropertiesLength = std::size(kPnaclManifestISAProperties);
} else {
// The known values for NaCl ISA dictionaries in the manifest.
static const char* kNaClManifestISAProperties[] = {
@@ -284,7 +283,7 @@
// "pnacl-translate", which would cause the creation of a nexe.
kPortableKey};
isaProperties = kNaClManifestISAProperties;
- isaPropertiesLength = base::size(kNaClManifestISAProperties);
+ isaPropertiesLength = std::size(kNaClManifestISAProperties);
}
// Check that entries in the dictionary are structurally correct.
for (base::DictionaryValue::Iterator it(*dictionary); !it.IsAtEnd();
@@ -493,7 +492,7 @@
it.Advance()) {
const std::string& property_name = it.key();
if (!FindMatchingProperty(property_name, kManifestTopLevelProperties,
- base::size(kManifestTopLevelProperties))) {
+ std::size(kManifestTopLevelProperties))) {
VLOG(1) << "JsonManifest::MatchesSchema: WARNING: unknown top-level "
<< "section '" << property_name << "' in manifest.";
}
diff --git a/components/nacl/zygote/nacl_fork_delegate_linux.cc b/components/nacl/zygote/nacl_fork_delegate_linux.cc
index 29074ee..65d9da6 100644
--- a/components/nacl/zygote/nacl_fork_delegate_linux.cc
+++ b/components/nacl/zygote/nacl_fork_delegate_linux.cc
@@ -15,7 +15,6 @@

#include "base/command_line.h"
#include "base/cpu.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/scoped_file.h"
#include "base/logging.h"
@@ -220,7 +219,7 @@
const base::CommandLine& current_cmd_line =
*base::CommandLine::ForCurrentProcess();
cmd_line.CopySwitchesFrom(current_cmd_line, kForwardSwitches,
- base::size(kForwardSwitches));
+ std::size(kForwardSwitches));

// The command line needs to be tightly controlled to use
// |helper_bootstrap_exe|. So from now on, argv_to_launch should be
diff --git a/components/navigation_metrics/navigation_metrics.cc b/components/navigation_metrics/navigation_metrics.cc
index ddb3258..3d44987e 100644
--- a/components/navigation_metrics/navigation_metrics.cc
+++ b/components/navigation_metrics/navigation_metrics.cc
@@ -4,7 +4,6 @@

#include "components/navigation_metrics/navigation_metrics.h"

-#include "base/cxx17_backports.h"
#include "base/i18n/rtl.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
@@ -49,7 +48,7 @@
"externalfile",
};

-static_assert(base::size(kSchemeNames) == static_cast<int>(Scheme::COUNT),
+static_assert(std::size(kSchemeNames) == static_cast<int>(Scheme::COUNT),
"kSchemeNames should have Scheme::COUNT elements");

} // namespace
diff --git a/components/network_session_configurator/common/network_switches.cc b/components/network_session_configurator/common/network_switches.cc
index 5bb1a3b..78aacfc 100644
--- a/components/network_session_configurator/common/network_switches.cc
+++ b/components/network_session_configurator/common/network_switches.cc
@@ -5,7 +5,6 @@
#include "components/network_session_configurator/common/network_switches.h"

#include "base/command_line.h"
-#include "base/cxx17_backports.h"

namespace switches {

@@ -33,7 +32,7 @@
};

dest_command_line->CopySwitchesFrom(src_command_line, kSwitchNames,
- base::size(kSwitchNames));
+ std::size(kSwitchNames));
}

} // namespace network_session_configurator
diff --git a/components/network_time/network_time_tracker_unittest.cc b/components/network_time/network_time_tracker_unittest.cc
index c4e0feb..5858911 100644
--- a/components/network_time/network_time_tracker_unittest.cc
+++ b/components/network_time/network_time_tracker_unittest.cc
@@ -10,7 +10,6 @@

#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
@@ -855,7 +854,7 @@
net::test_server::BasicHttpResponse* response =
new net::test_server::BasicHttpResponse();

- if (next_time_index_ >= base::size(kGoodTimeResponseBody)) {
+ if (next_time_index_ >= std::size(kGoodTimeResponseBody)) {
response->set_code(net::HTTP_BAD_REQUEST);
return std::unique_ptr<net::test_server::HttpResponse>(response);
}
@@ -870,7 +869,7 @@
}

base::Time MultipleGoodTimeResponseHandler::GetTimeAtIndex(unsigned int i) {
- if (i >= base::size(kGoodTimeResponseHandlerJsTime))
+ if (i >= std::size(kGoodTimeResponseHandlerJsTime))
return base::Time();
return base::Time::FromJsTime(kGoodTimeResponseHandlerJsTime[i]);
}
diff --git a/components/no_state_prefetch/common/no_state_prefetch_final_status.cc b/components/no_state_prefetch/common/no_state_prefetch_final_status.cc
index bb4f8a6..22c5c22 100644
--- a/components/no_state_prefetch/common/no_state_prefetch_final_status.cc
+++ b/components/no_state_prefetch/common/no_state_prefetch_final_status.cc
@@ -5,7 +5,6 @@
#include "components/no_state_prefetch/common/no_state_prefetch_final_status.h"

#include "base/check_op.h"
-#include "base/cxx17_backports.h"

namespace prerender {

@@ -78,14 +77,14 @@
"Link Rel Next Not Allowed",
"Max",
};
-static_assert(base::size(kFinalStatusNames) == FINAL_STATUS_MAX + 1,
+static_assert(std::size(kFinalStatusNames) == FINAL_STATUS_MAX + 1,
"status name count mismatch");

} // namespace

const char* NameFromFinalStatus(FinalStatus final_status) {
DCHECK_LT(static_cast<unsigned int>(final_status),
- base::size(kFinalStatusNames));
+ std::size(kFinalStatusNames));
return kFinalStatusNames[final_status];
}

diff --git a/components/no_state_prefetch/common/prerender_origin.cc b/components/no_state_prefetch/common/prerender_origin.cc
index 60ede91..2d0cff0 100644
--- a/components/no_state_prefetch/common/prerender_origin.cc
+++ b/components/no_state_prefetch/common/prerender_origin.cc
@@ -4,7 +4,6 @@

#include "components/no_state_prefetch/common/prerender_origin.h"

-#include "base/cxx17_backports.h"
#include "base/metrics/histogram_macros.h"

namespace prerender {
@@ -32,7 +31,7 @@
"Speculation Rules Same Origin Prerender",
"Max",
};
-static_assert(base::size(kOriginNames) == ORIGIN_MAX + 1,
+static_assert(std::size(kOriginNames) == ORIGIN_MAX + 1,
"prerender origin name count mismatch");

} // namespace
diff --git a/components/ntp_snippets/features.cc b/components/ntp_snippets/features.cc
index afd3971..5bb7995b 100644
--- a/components/ntp_snippets/features.cc
+++ b/components/ntp_snippets/features.cc
@@ -4,7 +4,6 @@

#include "components/ntp_snippets/features.h"

-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/time/clock.h"
@@ -77,7 +76,7 @@
std::vector<const base::Feature*> GetAllFeatures() {
// Skip the last feature as it's a nullptr.
return std::vector<const base::Feature*>(
- kAllFeatures, kAllFeatures + base::size(kAllFeatures));
+ kAllFeatures, kAllFeatures + std::size(kAllFeatures));
}

// Default referrer for the content suggestions.
diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc
index 407e398..8df20e92 100644
--- a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc
@@ -11,7 +11,6 @@
#include <vector>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/location.h"
#include "base/metrics/field_trial_params.h"
@@ -112,24 +111,23 @@

static_assert(
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kDefaultFetchingIntervalHoursRareNtpUser) &&
+ std::size(kDefaultFetchingIntervalHoursRareNtpUser) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kDefaultFetchingIntervalHoursActiveNtpUser) &&
+ std::size(kDefaultFetchingIntervalHoursActiveNtpUser) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(
- kDefaultFetchingIntervalHoursActiveSuggestionsConsumer) &&
+ std::size(kDefaultFetchingIntervalHoursActiveSuggestionsConsumer) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kM58FetchingIntervalHoursRareNtpUser) &&
+ std::size(kM58FetchingIntervalHoursRareNtpUser) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kM58FetchingIntervalHoursActiveNtpUser) &&
+ std::size(kM58FetchingIntervalHoursActiveNtpUser) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kM58FetchingIntervalHoursActiveSuggestionsConsumer) &&
+ std::size(kM58FetchingIntervalHoursActiveSuggestionsConsumer) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kFetchingIntervalParamNameRareNtpUser) &&
+ std::size(kFetchingIntervalParamNameRareNtpUser) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kFetchingIntervalParamNameActiveNtpUser) &&
+ std::size(kFetchingIntervalParamNameActiveNtpUser) &&
static_cast<unsigned int>(FetchingInterval::COUNT) ==
- base::size(kFetchingIntervalParamNameActiveSuggestionsConsumer),
+ std::size(kFetchingIntervalParamNameActiveSuggestionsConsumer),
"Fill in all the info for fetching intervals.");

// For backward compatibility "ntp_opened" value is kept and denotes the
@@ -154,7 +152,7 @@
UserClassifier::UserClass user_class) {
DCHECK(interval != FetchingInterval::COUNT);
const unsigned int index = static_cast<unsigned int>(interval);
- DCHECK(index < base::size(kDefaultFetchingIntervalHoursRareNtpUser));
+ DCHECK(index < std::size(kDefaultFetchingIntervalHoursRareNtpUser));

bool emulateM58 = base::FeatureList::IsEnabled(
kRemoteSuggestionsEmulateM58FetchingSchedule);
@@ -857,7 +855,7 @@
std::set<RemoteSuggestionsSchedulerImpl::TriggerType>
RemoteSuggestionsSchedulerImpl::GetEnabledTriggerTypes() {
static_assert(static_cast<unsigned int>(TriggerType::COUNT) ==
- base::size(kTriggerTypeNames),
+ std::size(kTriggerTypeNames),
"Fill in names for trigger types.");

std::string param_value = base::GetFieldTrialParamValueByFeature(
diff --git a/components/ntp_snippets/user_classifier.cc b/components/ntp_snippets/user_classifier.cc
index 78e590e..b8c2c59 100644
--- a/components/ntp_snippets/user_classifier.cc
+++ b/components/ntp_snippets/user_classifier.cc
@@ -84,15 +84,15 @@
"user_classifier_default_interval_suggestions_shown",
"user_classifier_default_interval_suggestions_used"};

-static_assert(base::size(kMetrics) ==
+static_assert(std::size(kMetrics) ==
static_cast<int>(UserClassifier::Metric::COUNT) &&
- base::size(kMetricKeys) ==
+ std::size(kMetricKeys) ==
static_cast<int>(UserClassifier::Metric::COUNT) &&
- base::size(kLastTimeKeys) ==
+ std::size(kLastTimeKeys) ==
static_cast<int>(UserClassifier::Metric::COUNT) &&
- base::size(kInitialHoursBetweenEvents) ==
+ std::size(kInitialHoursBetweenEvents) ==
static_cast<int>(UserClassifier::Metric::COUNT) &&
- base::size(kInitialHoursBetweenEventsParams) ==
+ std::size(kInitialHoursBetweenEventsParams) ==
static_cast<int>(UserClassifier::Metric::COUNT),
"Fill in info for all metrics.");

diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc
index 3e31d023..bf123c4 100644
--- a/components/omnibox/browser/autocomplete_input.cc
+++ b/components/omnibox/browser/autocomplete_input.cc
@@ -6,7 +6,6 @@

#include <vector>

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -82,7 +81,7 @@
&parts->username, &parts->password, &parts->host, &parts->port,
&parts->path, &parts->query, &parts->ref,
};
- for (size_t i = 0; i < base::size(components); ++i) {
+ for (size_t i = 0; i < std::size(components); ++i) {
url_formatter::OffsetComponent(offset, components[i]);
}
}
diff --git a/components/omnibox/browser/autocomplete_input_unittest.cc b/components/omnibox/browser/autocomplete_input_unittest.cc
index b57f6be..c8ff7e24 100644
--- a/components/omnibox/browser/autocomplete_input_unittest.cc
+++ b/components/omnibox/browser/autocomplete_input_unittest.cc
@@ -8,7 +8,6 @@

#include <string>

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -216,7 +215,7 @@
{u"test:80/", metrics::OmniboxInputType::URL},
};

- for (size_t i = 0; i < base::size(input_cases); ++i) {
+ for (size_t i = 0; i < std::size(input_cases); ++i) {
SCOPED_TRACE(input_cases[i].input);
AutocompleteInput input(input_cases[i].input,
metrics::OmniboxEventProto::OTHER,
@@ -256,7 +255,7 @@
{u"foo bar", metrics::OmniboxInputType::QUERY, std::string()},
};

- for (size_t i = 0; i < base::size(input_cases); ++i) {
+ for (size_t i = 0; i < std::size(input_cases); ++i) {
SCOPED_TRACE(input_cases[i].input);
AutocompleteInput input(input_cases[i].input, std::u16string::npos, "com",
metrics::OmniboxEventProto::OTHER,
@@ -309,7 +308,7 @@
{u"blob:garbage", kInvalidComponent, Component(5, 7)},
};

- for (size_t i = 0; i < base::size(input_cases); ++i) {
+ for (size_t i = 0; i < std::size(input_cases); ++i) {
SCOPED_TRACE(input_cases[i].input);
Component scheme, host;
AutocompleteInput::ParseForEmphasizeComponents(input_cases[i].input,
@@ -350,7 +349,7 @@
{u" ? foo bar", 6, u"? foo bar", 4},
};

- for (size_t i = 0; i < base::size(input_cases); ++i) {
+ for (size_t i = 0; i < std::size(input_cases); ++i) {
SCOPED_TRACE(input_cases[i].input);
AutocompleteInput input(
input_cases[i].input, input_cases[i].cursor_position,
diff --git a/components/omnibox/browser/autocomplete_match.cc b/components/omnibox/browser/autocomplete_match.cc
index e255d11..9772e4bd 100644
--- a/components/omnibox/browser/autocomplete_match.cc
+++ b/components/omnibox/browser/autocomplete_match.cc
@@ -7,7 +7,6 @@
#include <algorithm>

#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/debug/crash_logging.h"
#include "base/feature_list.h"
#include "base/i18n/case_conversion.h"
@@ -130,7 +129,7 @@
"drive_image", "drive_pdf", "drive_video", "drive_folder", "drive_other"};

static_assert(
- base::size(AutocompleteMatch::kDocumentTypeStrings) ==
+ std::size(AutocompleteMatch::kDocumentTypeStrings) ==
static_cast<int>(AutocompleteMatch::DocumentType::DOCUMENT_TYPE_SIZE),
"Sizes of AutocompleteMatch::kDocumentTypeStrings and "
"AutocompleteMatch::DocumentType don't match.");
@@ -814,7 +813,7 @@

// Remove the www. prefix from the host.
static const char prefix[] = "www.";
- static const size_t prefix_len = base::size(prefix) - 1;
+ static const size_t prefix_len = std::size(prefix) - 1;
std::string host = stripped_destination_url.host();
if (host.compare(0, prefix_len, prefix) == 0 && host.length() > prefix_len) {
replacements.SetHostStr(base::StringPiece(host).substr(prefix_len));
diff --git a/components/omnibox/browser/autocomplete_match_type.cc b/components/omnibox/browser/autocomplete_match_type.cc
index b30e39a..07d8128 100644
--- a/components/omnibox/browser/autocomplete_match_type.cc
+++ b/components/omnibox/browser/autocomplete_match_type.cc
@@ -5,7 +5,6 @@
#include "components/omnibox/browser/autocomplete_match_type.h"

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -53,7 +52,7 @@
"open-tab",
};
// clang-format on
- static_assert(base::size(strings) == AutocompleteMatchType::NUM_TYPES,
+ static_assert(std::size(strings) == AutocompleteMatchType::NUM_TYPES,
"strings array must have NUM_TYPES elements");
return strings[type];
}
@@ -141,7 +140,7 @@
0, // TILE_NAVSUGGEST
0, // OPEN_TAB
};
- static_assert(base::size(message_ids) == AutocompleteMatchType::NUM_TYPES,
+ static_assert(std::size(message_ids) == AutocompleteMatchType::NUM_TYPES,
"message_ids must have NUM_TYPES elements");

// Document provider should use its full display text; description has
diff --git a/components/omnibox/browser/autocomplete_match_unittest.cc b/components/omnibox/browser/autocomplete_match_unittest.cc
index 45e9ad1..e38d1a1 100644
--- a/components/omnibox/browser/autocomplete_match_unittest.cc
+++ b/components/omnibox/browser/autocomplete_match_unittest.cc
@@ -9,7 +9,6 @@
#include <utility>

#include "autocomplete_match.h"
-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "components/omnibox/browser/test_scheme_classifier.h"
@@ -76,7 +75,7 @@
AutocompleteMatch m2(nullptr, 0, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
m1.relevance = cases[i].r1;
m2.relevance = cases[i].r2;
EXPECT_EQ(cases[i].expected_result,
@@ -400,7 +399,7 @@
{ L"http://www./", "http://www./", "http://google.com/", false },
};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
CheckDuplicateCase(cases[i]);
}
}
@@ -420,7 +419,7 @@
"https://drive.google.com/open?id=another-doc-id", false},
};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
CheckDuplicateCase(cases[i]);
}
}
diff --git a/components/omnibox/browser/autocomplete_provider_unittest.cc b/components/omnibox/browser/autocomplete_provider_unittest.cc
index 2b10b08..29f24082 100644
--- a/components/omnibox/browser/autocomplete_provider_unittest.cc
+++ b/components/omnibox/browser/autocomplete_provider_unittest.cc
@@ -11,7 +11,6 @@

#include "base/bind.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
@@ -790,7 +789,7 @@
{u"foo.com", std::u16string(), std::u16string()}};

SCOPED_TRACE("Duplicate url");
- RunKeywordTest(u"fo", duplicate_url, base::size(duplicate_url));
+ RunKeywordTest(u"fo", duplicate_url, std::size(duplicate_url));
}

{
@@ -799,7 +798,7 @@
{u"foo.com", std::u16string(), std::u16string()}};

SCOPED_TRACE("Duplicate url with keyword match");
- RunKeywordTest(u"fo", keyword_match, base::size(keyword_match));
+ RunKeywordTest(u"fo", keyword_match, std::size(keyword_match));
}

{
@@ -811,7 +810,7 @@
};

SCOPED_TRACE("Duplicate url with multiple keywords");
- RunKeywordTest(u"fo", multiple_keyword, base::size(multiple_keyword));
+ RunKeywordTest(u"fo", multiple_keyword, std::size(multiple_keyword));
}
}

@@ -825,7 +824,7 @@
{u"foo.com", std::u16string(), u"foo.com"}};

SCOPED_TRACE("keyword match as usual");
- RunKeywordTest(u"fo", keyword_match, base::size(keyword_match));
+ RunKeywordTest(u"fo", keyword_match, std::size(keyword_match));
}

// The same result set with an input of "f" (versus "fo") should get
@@ -836,7 +835,7 @@
KeywordTestData keyword_match[] = {{u"foo.com", std::u16string(), u"f"}};

SCOPED_TRACE("keyword exact match");
- RunKeywordTest(u"f", keyword_match, base::size(keyword_match));
+ RunKeywordTest(u"f", keyword_match, std::size(keyword_match));
}
}

@@ -939,7 +938,7 @@
AssistedQueryStatsTestData test_data[] = {
{AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, "chrome..69i57"}};
SCOPED_TRACE("One match");
- RunAssistedQueryStatsTest(test_data, base::size(test_data));
+ RunAssistedQueryStatsTest(test_data, std::size(test_data));
}

{
@@ -948,7 +947,7 @@
"chrome.0.46i131",
{131}}};
SCOPED_TRACE("One match with provider populated subtypes");
- RunAssistedQueryStatsTest(test_data, base::size(test_data));
+ RunAssistedQueryStatsTest(test_data, std::size(test_data));
}

{
@@ -978,7 +977,7 @@
{27, 31}},
};
SCOPED_TRACE("Complex set of matches with repetitive subtypes");
- RunAssistedQueryStatsTest(test_data, base::size(test_data));
+ RunAssistedQueryStatsTest(test_data, std::size(test_data));
}

{
@@ -1001,7 +1000,7 @@
"chrome.7.69i57j69i58j5l2j0l3j69i59"},
};
SCOPED_TRACE("Multiple matches");
- RunAssistedQueryStatsTest(test_data, base::size(test_data));
+ RunAssistedQueryStatsTest(test_data, std::size(test_data));
}
}

diff --git a/components/omnibox/browser/autocomplete_result_unittest.cc b/components/omnibox/browser/autocomplete_result_unittest.cc
index 385bc4c..1f0b547 100644
--- a/components/omnibox/browser/autocomplete_result_unittest.cc
+++ b/components/omnibox/browser/autocomplete_result_unittest.cc
@@ -10,7 +10,6 @@
#include <string>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
@@ -433,9 +432,9 @@
{ 1, 1, 399, true },
};

- ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result)));
+ ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(last, std::size(last),
+ current, std::size(current),
+ result, std::size(result)));
}

// Tests that if the new results have a lower max relevance score than last,
@@ -459,9 +458,9 @@
{ 2, 1, 899, true },
};

- ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result)));
+ ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(last, std::size(last),
+ current, std::size(current),
+ result, std::size(result)));
}

// Tests |TransferOldMatches()| with an |AutocompleteInput| with
@@ -504,8 +503,8 @@
// clang-format on

ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result), input));
+ last, std::size(last), current, std::size(current), result,
+ std::size(result), input));
}

{
@@ -534,8 +533,8 @@
// clang-format on

ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result), input));
+ last, std::size(last), current, std::size(current), result,
+ std::size(result), input));
}

{
@@ -561,8 +560,8 @@
// clang-format on

ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result), input));
+ last, std::size(last), current, std::size(current), result,
+ std::size(result), input));
}

{
@@ -593,8 +592,8 @@
// clang-format on

ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result), input));
+ last, std::size(last), current, std::size(current), result,
+ std::size(result), input));
}
}

@@ -622,9 +621,9 @@
{ 4, 1, 499, false },
};

- ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result)));
+ ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(last, std::size(last),
+ current, std::size(current),
+ result, std::size(result)));
}

// Tests that matches are copied correctly from two distinct providers when
@@ -651,9 +650,9 @@
{ 7, 1, 500, true },
};

- ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result)));
+ ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(last, std::size(last),
+ current, std::size(current),
+ result, std::size(result)));
}

// Tests that transferred matches do not include the specialized match types.
@@ -671,9 +670,9 @@
{2, 2, 500, true},
};

- ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(
- last, base::size(last), current, base::size(current), result,
- base::size(result)));
+ ASSERT_NO_FATAL_FAILURE(RunTransferOldMatchesTest(last, std::size(last),
+ current, std::size(current),
+ result, std::size(result)));
}

// Tests that matches with empty destination URLs aren't treated as duplicates
@@ -688,7 +687,7 @@
};

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
matches[1].destination_url = GURL();
matches[3].destination_url = GURL();
matches[4].destination_url = GURL();
@@ -728,7 +727,7 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
// These will get sorted up, but still removed.
matches[3].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
matches[4].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
@@ -760,7 +759,7 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
// Make sure that even bad tail suggestions, if the only default match,
// are kept.
matches[0].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
@@ -794,7 +793,7 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
// Make sure that even a bad non-tail default suggestion is kept.
for (size_t i = 1; i < 5; ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
@@ -829,8 +828,8 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
- for (size_t i = 2; i < base::size(data); ++i)
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
+ for (size_t i = 2; i < std::size(data); ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;

AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
@@ -862,8 +861,8 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
- for (size_t i = 1; i < base::size(data); ++i)
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
+ for (size_t i = 1; i < std::size(data); ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;

AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
@@ -898,7 +897,7 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
// These will not be removed.
for (size_t i = 1; i < 5; ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
@@ -927,7 +926,7 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);

AutocompleteInput input(std::u16string(), metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -960,7 +959,7 @@
};

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
matches[0].destination_url = GURL("http://www.foo.com/s?q=foo");
matches[1].destination_url = GURL("http://www.foo.com/s?q=foo2");
matches[2].destination_url = GURL("http://www.foo.com/s?q=foo&oq=f");
@@ -1009,7 +1008,7 @@
};

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
matches[0].destination_url = GURL("http://www.foo.com/s?q=foo");
matches[1].destination_url = GURL("http://www.foo.com/s?q=foo2");
matches[2].destination_url = GURL("http://www.foo.com/s?q=foo&oq=f");
@@ -1053,7 +1052,7 @@
{ "http://history-title/", AutocompleteMatchType::HISTORY_TITLE },
{ "http://search-history/", AutocompleteMatchType::SEARCH_HISTORY },
};
- PopulateAutocompleteMatchesFromTestData(data, base::size(data), &matches);
+ PopulateAutocompleteMatchesFromTestData(data, std::size(data), &matches);

// Demote the search history match relevance score.
matches.back().relevance = 500;
@@ -1080,8 +1079,8 @@
// the top match.
size_t expected_order[] = {0, 1, 3};

- ASSERT_EQ(base::size(expected_order), result.size());
- for (size_t i = 0; i < base::size(expected_order); ++i) {
+ ASSERT_EQ(std::size(expected_order), result.size());
+ for (size_t i = 0; i < std::size(expected_order); ++i) {
EXPECT_EQ(data[expected_order[i]].destination_url,
result.match_at(i)->destination_url.spec());
}
@@ -1104,13 +1103,13 @@
TestSchemeClassifier());

ACMatches last_matches;
- PopulateAutocompleteMatches(last, base::size(last), &last_matches);
+ PopulateAutocompleteMatches(last, std::size(last), &last_matches);
AutocompleteResult last_result;
last_result.AppendMatches(input, last_matches);
last_result.SortAndCull(input, template_url_service_.get());

ACMatches current_matches;
- PopulateAutocompleteMatches(current, base::size(current), &current_matches);
+ PopulateAutocompleteMatches(current, std::size(current), &current_matches);
AutocompleteResult current_result;
current_result.AppendMatches(input, current_matches);

@@ -1124,7 +1123,7 @@
{0, 1, 400, true},
{1, 1, 500, true},
};
- AssertResultMatches(current_result, result, base::size(result));
+ AssertResultMatches(current_result, result, std::size(result));
}

// Verify metrics logged for asynchronous result updates.
@@ -1147,7 +1146,7 @@
TestSchemeClassifier());

ACMatches last_matches;
- PopulateAutocompleteMatches(last, base::size(last), &last_matches);
+ PopulateAutocompleteMatches(last, std::size(last), &last_matches);
AutocompleteResult last_result;
last_result.AppendMatches(input, last_matches);
for (auto& match : last_result)
@@ -1155,7 +1154,7 @@
const auto last_comparators = last_result.GetMatchDedupComparators();

ACMatches current_matches;
- PopulateAutocompleteMatches(current, base::size(current), &current_matches);
+ PopulateAutocompleteMatches(current, std::size(current), &current_matches);
AutocompleteResult current_result;
current_result.AppendMatches(input, current_matches);
for (auto& match : current_result)
@@ -1193,7 +1192,7 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
matches[0].type = AutocompleteMatchType::SEARCH_SUGGEST;
matches[1].type = AutocompleteMatchType::SEARCH_SUGGEST;
matches[2].type = AutocompleteMatchType::SEARCH_SUGGEST;
@@ -1299,7 +1298,7 @@
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED},
{"http://search-history/", AutocompleteMatchType::SEARCH_HISTORY},
};
- PopulateAutocompleteMatchesFromTestData(data, base::size(data), &matches);
+ PopulateAutocompleteMatchesFromTestData(data, std::size(data), &matches);

// Make history-title and search-history the only default matches, so that
// they compete.
@@ -1376,7 +1375,7 @@
// is already a legal default match (which is the default from
// PopulateAutocompleteMatches()).
ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
test_scheme_classifier);
AutocompleteResult result;
@@ -1388,7 +1387,7 @@
{
// Check that reorder swaps up a result appropriately.
ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
matches[0].allowed_to_be_default_match = false;
matches[1].allowed_to_be_default_match = false;
AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
@@ -1417,7 +1416,7 @@
// Check that reorder swaps up a result, and promotes relevance,
// appropriately.
ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
test_scheme_classifier);
AutocompleteResult result;
@@ -1449,7 +1448,7 @@
// Check that reorder swaps up a result, and promotes relevance,
// even for a default match that isn't the best.
ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
test_scheme_classifier);
AutocompleteResult result;
@@ -1642,7 +1641,7 @@
};

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
// Note that 0, 2 and 3 will compare equal after stripping.
matches[0].destination_url = GURL("http://www.foo.com/s?q=foo");
matches[1].destination_url = GURL("http://www.foo.com/s?q=foo2");
@@ -1686,7 +1685,7 @@
{6, 3, 1100, false, {}, AutocompleteMatchType::BOOKMARK_TITLE},
};
ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);

AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -1727,7 +1726,7 @@
{6, 3, 1100, false, {}, AutocompleteMatchType::BOOKMARK_TITLE},
};
ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);

AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -1776,7 +1775,7 @@
};

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);

AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -1828,7 +1827,7 @@
{"http://clipboard-url/", AutocompleteMatchType::CLIPBOARD_URL},
{"http://search-suggest/", AutocompleteMatchType::SEARCH_SUGGEST},
};
- PopulateAutocompleteMatchesFromTestData(data, base::size(data), &matches);
+ PopulateAutocompleteMatchesFromTestData(data, std::size(data), &matches);

AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -1866,7 +1865,7 @@
{"http://clipboard-url/", AutocompleteMatchType::CLIPBOARD_URL},
{"http://bookmark-title/", AutocompleteMatchType::BOOKMARK_TITLE},
};
- PopulateAutocompleteMatchesFromTestData(data, base::size(data), &matches);
+ PopulateAutocompleteMatchesFromTestData(data, std::size(data), &matches);

AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -1942,7 +1941,7 @@
AutocompleteResult result;
result.AppendMatches(AutocompleteInput(), matches);
result.SetTailSuggestContentPrefixes();
- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
EXPECT_EQ(result.match_at(i)->contents,
base::UTF8ToUTF16(cases[i].after_contents));
EXPECT_TRUE(EqualClassifications(result.match_at(i)->contents_class,
@@ -1950,7 +1949,7 @@
}
// Run twice and make sure that it doesn't re-prepend ellipsis.
result.SetTailSuggestContentPrefixes();
- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
EXPECT_EQ(result.match_at(i)->contents,
base::UTF8ToUTF16(cases[i].after_contents));
EXPECT_TRUE(EqualClassifications(result.match_at(i)->contents_class,
@@ -2029,8 +2028,8 @@
{"http://clear-history/", AutocompleteMatchType::SEARCH_SUGGEST,
"clear history"},
};
- PopulateAutocompleteMatchesFromTestData(data, base::size(data), &matches);
- for (size_t i = 0; i < base::size(data); i++) {
+ PopulateAutocompleteMatchesFromTestData(data, std::size(data), &matches);
+ for (size_t i = 0; i < std::size(data); i++) {
matches[i].contents = base::UTF8ToUTF16(data[i].contents);
}
result.AppendMatches(input, matches);
@@ -2060,7 +2059,7 @@
{3, 1, 400, false}, // HISTORY result for url [3].
};
ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
matches[0].type = AutocompleteMatchType::DOCUMENT_SUGGESTION;
static_cast<FakeAutocompleteProvider*>(matches[0].provider)
->SetType(AutocompleteProvider::Type::TYPE_DOCUMENT);
@@ -2162,7 +2161,7 @@
// clang-format on

ACMatches matches;
- PopulateAutocompleteMatches(data, base::size(data), &matches);
+ PopulateAutocompleteMatches(data, std::size(data), &matches);
matches[0].type = AutocompleteMatchType::SEARCH_SUGGEST;
static_cast<FakeAutocompleteProvider*>(matches[0].provider)
->SetType(AutocompleteProvider::Type::TYPE_ZERO_SUGGEST_LOCAL_HISTORY);
diff --git a/components/omnibox/browser/bookmark_provider.cc b/components/omnibox/browser/bookmark_provider.cc
index 7a5f2f9..739557b 100644
--- a/components/omnibox/browser/bookmark_provider.cc
+++ b/components/omnibox/browser/bookmark_provider.cc
@@ -9,7 +9,6 @@
#include <vector>

#include "base/containers/cxx20_erase.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/string_util.h"
@@ -300,9 +299,9 @@
const int kURLCountBoost[4] = { 0, 75, 125, 150 };
std::vector<const BookmarkNode*> nodes;
bookmark_model_->GetNodesByURL(url, &nodes);
- DCHECK_GE(std::min(base::size(kURLCountBoost), nodes.size()), 1U);
+ DCHECK_GE(std::min(std::size(kURLCountBoost), nodes.size()), 1U);
relevance +=
- kURLCountBoost[std::min(base::size(kURLCountBoost), nodes.size()) - 1];
+ kURLCountBoost[std::min(std::size(kURLCountBoost), nodes.size()) - 1];
relevance = std::min(kMaxBookmarkScore, relevance);
return relevance;
}
diff --git a/components/omnibox/browser/bookmark_provider_unittest.cc b/components/omnibox/browser/bookmark_provider_unittest.cc
index 43ffff8..ce880693 100644
--- a/components/omnibox/browser/bookmark_provider_unittest.cc
+++ b/components/omnibox/browser/bookmark_provider_unittest.cc
@@ -11,7 +11,6 @@
#include <string>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/guid.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_number_conversions.h"
@@ -207,7 +206,7 @@

provider_ = new BookmarkProvider(provider_client_.get());
const BookmarkNode* other_node = model_->other_node();
- for (size_t i = 0; i < base::size(bookmark_provider_test_data); ++i) {
+ for (size_t i = 0; i < std::size(bookmark_provider_test_data); ++i) {
const BookmarksTestInfo& cur(bookmark_provider_test_data[i]);
const GURL url(cur.url);
model_->AddURL(other_node, other_node->children().size(),
@@ -306,7 +305,7 @@
{"emptytitle", 1, {}},
};

- for (size_t i = 0; i < base::size(query_data); ++i) {
+ for (size_t i = 0; i < std::size(query_data); ++i) {
AutocompleteInput input(base::ASCIIToUTF16(query_data[i].query),
metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -384,7 +383,7 @@
"burning worms #2"}}, // not boosted
};

- for (size_t i = 0; i < base::size(query_data); ++i) {
+ for (size_t i = 0; i < std::size(query_data); ++i) {
AutocompleteInput input(base::ASCIIToUTF16(query_data[i].query),
metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -438,7 +437,7 @@
// actually bookmarked.
};

- for (size_t i = 0; i < base::size(query_data); ++i) {
+ for (size_t i = 0; i < std::size(query_data); ++i) {
const std::string description =
"for query=" + query_data[i].query + " and url=" + query_data[i].url;
AutocompleteInput input(base::ASCIIToUTF16(query_data[i].query),
@@ -486,7 +485,7 @@
// clang-format on
};

- for (size_t i = 0; i < base::size(query_data); ++i) {
+ for (size_t i = 0; i < std::size(query_data); ++i) {
std::string description = "for query=" + query_data[i].query;
AutocompleteInput input(base::ASCIIToUTF16(query_data[i].query),
metrics::OmniboxEventProto::OTHER,
diff --git a/components/omnibox/browser/builtin_provider_unittest.cc b/components/omnibox/browser/builtin_provider_unittest.cc
index fa6b4bc..6f0e4e9 100644
--- a/components/omnibox/browser/builtin_provider_unittest.cc
+++ b/components/omnibox/browser/builtin_provider_unittest.cc
@@ -10,7 +10,6 @@
#include <string>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/format_macros.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
@@ -172,7 +171,7 @@
{u"ChRoMe://", {kURL1, kURL2, kURL3}},
};

- RunTest(typing_scheme_cases, base::size(typing_scheme_cases));
+ RunTest(typing_scheme_cases, std::size(typing_scheme_cases));
}

TEST_F(BuiltinProviderTest, NonEmbedderURLs) {
@@ -190,7 +189,7 @@
{u"scheme://host/path?query#ref", {}},
};

- RunTest(test_cases, base::size(test_cases));
+ RunTest(test_cases, std::size(test_cases));
}

TEST_F(BuiltinProviderTest, EmbedderProvidedURLs) {
@@ -239,7 +238,7 @@
{kEmbedder + kSep2 + kHostM3, {kURLM2, kURLM3}},
};

- RunTest(test_cases, base::size(test_cases));
+ RunTest(test_cases, std::size(test_cases));
}

TEST_F(BuiltinProviderTest, AboutBlank) {
@@ -297,7 +296,7 @@
{kAboutBlank.substr(0, 9) + u"#r", {}},
};

- RunTest(about_blank_cases, base::size(about_blank_cases));
+ RunTest(about_blank_cases, std::size(about_blank_cases));
}

TEST_F(BuiltinProviderTest, DoesNotSupportMatchesOnFocus) {
@@ -330,7 +329,7 @@
{kSubpage + kPageTwo, {kURLTwo}},
};

- RunTest(settings_subpage_cases, base::size(settings_subpage_cases));
+ RunTest(settings_subpage_cases, std::size(settings_subpage_cases));
}

TEST_F(BuiltinProviderTest, Inlining) {
@@ -428,7 +427,7 @@
};

ACMatches matches;
- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
SCOPED_TRACE(base::StringPrintf(
"case %" PRIuS ": %s", i, base::UTF16ToUTF8(cases[i].input).c_str()));
AutocompleteInput input(cases[i].input, metrics::OmniboxEventProto::OTHER,
diff --git a/components/omnibox/browser/history_quick_provider_performance_unittest.cc b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
index de24eaf..bdab81d 100644
--- a/components/omnibox/browser/history_quick_provider_performance_unittest.cc
+++ b/components/omnibox/browser/history_quick_provider_performance_unittest.cc
@@ -2,13 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

-#include "components/omnibox/browser/history_quick_provider.h"
-
#include <memory>
#include <random>
#include <string>

-#include "base/cxx17_backports.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -18,6 +15,7 @@
#include "components/history/core/browser/history_service.h"
#include "components/history/core/test/history_service_test_util.h"
#include "components/omnibox/browser/fake_autocomplete_provider_client.h"
+#include "components/omnibox/browser/history_quick_provider.h"
#include "components/omnibox/browser/history_test_util.h"
#include "components/omnibox/browser/in_memory_url_index_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -33,7 +31,7 @@
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,/=+?#";
static std::mt19937 engine;
std::uniform_int_distribution<size_t> index_distribution(
- 0, base::size(kSyms) - 2 /* trailing \0 */);
+ 0, std::size(kSyms) - 2 /* trailing \0 */);

std::string res;
res.reserve(sym_count);
diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc
index b37fb7f..35a6b23 100644
--- a/components/omnibox/browser/history_quick_provider_unittest.cc
+++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -13,7 +13,6 @@
#include <string>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/format_macros.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
@@ -581,7 +580,7 @@
// increase that number in the future. Regardless, we require the first
// five offsets to be correct--in this example these cover at least one
// occurrence of each term.
- EXPECT_LE(contents_class.size(), base::size(expected_offsets));
+ EXPECT_LE(contents_class.size(), std::size(expected_offsets));
EXPECT_GE(contents_class.size(), 5u);
for (size_t i = 0; i < contents_class.size(); ++i)
EXPECT_EQ(expected_offsets[i], contents_class[i].offset);
diff --git a/components/omnibox/browser/history_url_provider_unittest.cc b/components/omnibox/browser/history_url_provider_unittest.cc
index 1180e83..2789b4c5 100644
--- a/components/omnibox/browser/history_url_provider_unittest.cc
+++ b/components/omnibox/browser/history_url_provider_unittest.cc
@@ -10,7 +10,6 @@
#include <memory>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -298,7 +297,7 @@
// case the time would be specifed in the test_db structure.
const Time now = Time::Now();

- for (size_t i = 0; i < base::size(test_db); ++i) {
+ for (size_t i = 0; i < std::size(test_db); ++i) {
const TestURLInfo& cur = test_db[i];
const GURL current_url(cur.url);
client_->GetHistoryService()->AddPageWithDetails(
@@ -399,7 +398,7 @@
{ "http://slashdot.org/", false }
};
RunTest(u"slash", std::string(), true, expected_nonsynth,
- base::size(expected_nonsynth));
+ std::size(expected_nonsynth));

// Test that hosts get synthesized above less popular pages.
const UrlAndLegalDefault expected_synth[] = {
@@ -407,7 +406,7 @@
{ "http://kerneltrap.org/not_very_popular.html", false }
};
RunTest(u"kernel", std::string(), true, expected_synth,
- base::size(expected_synth));
+ std::size(expected_synth));

// Test that unpopular pages are ignored completely.
RunTest(u"fresh", std::string(), true, nullptr, 0);
@@ -421,14 +420,14 @@
{ "http://synthesisatest.com/foo/", true }
};
RunTest(u"synthesisa", std::string(), false, expected_synthesisa,
- base::size(expected_synthesisa));
+ std::size(expected_synthesisa));
EXPECT_LT(matches_.front().relevance, 1200);
const UrlAndLegalDefault expected_synthesisb[] = {
{ "http://synthesisbtest.com/foo/", true },
{ "http://synthesisbtest.com/foo/bar.html", true }
};
RunTest(u"synthesisb", std::string(), false, expected_synthesisb,
- base::size(expected_synthesisb));
+ std::size(expected_synthesisb));
EXPECT_GE(matches_.front().relevance, 1410);

// Test that if we have a synthesized host that matches a suggestion, they
@@ -439,7 +438,7 @@
};
ASSERT_NO_FATAL_FAILURE(RunTest(u"news", std::string(), true,
expected_combine,
- base::size(expected_combine)));
+ std::size(expected_combine)));
// The title should also have gotten set properly on the host for the
// synthesized one, since it was also in the results.
EXPECT_EQ(u"Google News", matches_.front().description);
@@ -452,7 +451,7 @@
{ "http://foo.com/dir/another/again/myfile.html", false },
{ "http://foo.com/dir/", false }
};
- RunTest(u"foo", std::string(), true, short_1, base::size(short_1));
+ RunTest(u"foo", std::string(), true, short_1, std::size(short_1));

// When the user types the whole host, make sure we don't get two results for
// it.
@@ -462,8 +461,8 @@
{ "http://foo.com/dir/", false },
{ "http://foo.com/dir/another/", false }
};
- RunTest(u"foo.com", std::string(), true, short_2, base::size(short_2));
- RunTest(u"foo.com/", std::string(), true, short_2, base::size(short_2));
+ RunTest(u"foo.com", std::string(), true, short_2, std::size(short_2));
+ RunTest(u"foo.com/", std::string(), true, short_2, std::size(short_2));

// The filename is the second best of the foo.com* entries, but there is a
// shorter URL that's "good enough". The host doesn't match the user input
@@ -474,7 +473,7 @@
{ "http://foo.com/dir/another/again/myfile.html", false },
{ "http://foo.com/dir/", false }
};
- RunTest(u"foo.com/d", std::string(), true, short_3, base::size(short_3));
+ RunTest(u"foo.com/d", std::string(), true, short_3, std::size(short_3));
// If prevent_inline_autocomplete is false, we won't bother creating the
// URL-what-you-typed match because we have promoted inline autocompletions.
const UrlAndLegalDefault short_3_allow_inline[] = {
@@ -483,7 +482,7 @@
{ "http://foo.com/dir/", true }
};
RunTest(u"foo.com/d", std::string(), false, short_3_allow_inline,
- base::size(short_3_allow_inline));
+ std::size(short_3_allow_inline));

// We shouldn't promote shorter URLs than the best if they're not good
// enough.
@@ -493,7 +492,7 @@
{ "http://foo.com/dir/another/again/", false }
};
RunTest(u"foo.com/dir/another/a", std::string(), true, short_4,
- base::size(short_4));
+ std::size(short_4));
// If prevent_inline_autocomplete is false, we won't bother creating the
// URL-what-you-typed match because we have promoted inline autocompletions.
const UrlAndLegalDefault short_4_allow_inline[] = {
@@ -501,7 +500,7 @@
{ "http://foo.com/dir/another/again/", true }
};
RunTest(u"foo.com/dir/another/a", std::string(), false, short_4_allow_inline,
- base::size(short_4_allow_inline));
+ std::size(short_4_allow_inline));

// Exact matches should always be best no matter how much more another match
// has been typed.
@@ -517,8 +516,8 @@
};
// Note that there is an http://g/ URL that is marked as hidden. It shouldn't
// show up at all. This test implicitly tests this fact too.
- RunTest(u"g", std::string(), false, short_5a, base::size(short_5a));
- RunTest(u"go", std::string(), false, short_5b, base::size(short_5b));
+ RunTest(u"g", std::string(), false, short_5a, std::size(short_5a));
+ RunTest(u"go", std::string(), false, short_5b, std::size(short_5b));
}

TEST_F(HistoryURLProviderTest, CullRedirects) {
@@ -534,7 +533,7 @@
{"http://redirects/B", 20},
{"http://redirects/C", 10}
};
- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
client_->GetHistoryService()->AddPageWithDetails(
GURL(test_cases[i].url), u"Title", test_cases[i].count,
test_cases[i].count, Time::Now(), false, history::SOURCE_BROWSED);
@@ -561,7 +560,7 @@
{ base::UTF16ToUTF8(typing), true }
};
RunTest(typing, std::string(), true, expected_results,
- base::size(expected_results));
+ std::size(expected_results));

// If prevent_inline_autocomplete is false, we won't bother creating the
// URL-what-you-typed match because we have promoted inline autocompletions.
@@ -571,7 +570,7 @@
{ test_cases[0].url, true }
};
RunTest(typing, std::string(), false, expected_results_allow_inlining,
- base::size(expected_results_allow_inlining));
+ std::size(expected_results_allow_inlining));
}

TEST_F(HistoryURLProviderTestNoSearchProvider, WhatYouTypedNoSearchProvider) {
@@ -581,7 +580,7 @@
const UrlAndLegalDefault results_1[] = {
{ "http://wytmatch/", true }
};
- RunTest(u"wytmatch", std::string(), false, results_1, base::size(results_1));
+ RunTest(u"wytmatch", std::string(), false, results_1, std::size(results_1));

RunTest(u"wytmatch foo bar", std::string(), false, nullptr, 0);
RunTest(u"wytmatch+foo+bar", std::string(), false, nullptr, 0);
@@ -590,7 +589,7 @@
{ "http://wytmatch+foo+bar.com/", true }
};
RunTest(u"wytmatch+foo+bar.com", std::string(), false, results_2,
- base::size(results_2));
+ std::size(results_2));
}

TEST_F(HistoryURLProviderTest, WhatYouTyped) {
@@ -603,35 +602,34 @@
const UrlAndLegalDefault results_1[] = {
{ "http://www.wytmatch.com/", true }
};
- RunTest(u"wytmatch", "com", false, results_1, base::size(results_1));
+ RunTest(u"wytmatch", "com", false, results_1, std::size(results_1));

const UrlAndLegalDefault results_2[] = {
{ "http://wytmatch%20foo%20bar/", false }
};
RunTest(u"http://wytmatch foo bar", std::string(), false, results_2,
- base::size(results_2));
+ std::size(results_2));

const UrlAndLegalDefault results_3[] = {
{ "https://wytmatch%20foo%20bar/", false }
};
RunTest(u"https://wytmatch foo bar", std::string(), false, results_3,
- base::size(results_3));
+ std::size(results_3));

const UrlAndLegalDefault results_4[] = {{"https://wytih/", true},
{"https://www.wytih/file", true},
{"ftp://wytih/file", true},
{"https://www.wytih/page", true}};
- RunTest(u"wytih", std::string(), false, results_4, base::size(results_4));
+ RunTest(u"wytih", std::string(), false, results_4, std::size(results_4));

const UrlAndLegalDefault results_5[] = {{"https://www.wytih/", true},
{"https://www.wytih/file", true},
{"https://www.wytih/page", true}};
- RunTest(u"www.wytih", std::string(), false, results_5, base::size(results_5));
+ RunTest(u"www.wytih", std::string(), false, results_5, std::size(results_5));

const UrlAndLegalDefault results_6[] = {{"ftp://wytih/file", true},
{"https://www.wytih/file", true}};
- RunTest(u"wytih/file", std::string(), false, results_6,
- base::size(results_6));
+ RunTest(u"wytih/file", std::string(), false, results_6, std::size(results_6));
}

// Test that the exact history match does not lose username/password
@@ -639,12 +637,12 @@
TEST_F(HistoryURLProviderTest, WhatYouTyped_Exact_URLPreservesUsernameAndPassword) {
const UrlAndLegalDefault results_1[] = {{"https://user@wytih/", true}};
RunTest(u"https://user@wytih", std::string(), false, results_1,
- base::size(results_1));
+ std::size(results_1));

const UrlAndLegalDefault results_2[] = {
{"https://user:pa...@www.wytih/file", true}};
RunTest(u"https://user:pa...@www.wytih/file", std::string(), false, results_2,
- base::size(results_2));
+ std::size(results_2));
}

// Test that file: URLs are handled appropriately on each platform.
@@ -668,7 +666,7 @@
const std::u16string input_1(u"file:");
const UrlAndLegalDefault fixup_1[] = {{"file:///C:/foo.txt", true}};
ASSERT_NO_FATAL_FAILURE(
- RunTest(input_1, std::string(), false, fixup_1, base::size(fixup_1)));
+ RunTest(input_1, std::string(), false, fixup_1, std::size(fixup_1)));
EXPECT_EQ(u"///C:/foo.txt", matches_.front().inline_autocompletion);
#endif // !BUILDFLAG(IS_IOS)

@@ -678,7 +676,7 @@
const std::u16string input_2(u"/foo");
const UrlAndLegalDefault fixup_2[] = {{"file:///foo", true}};
ASSERT_NO_FATAL_FAILURE(
- RunTest(input_2, std::string(), false, fixup_2, base::size(fixup_2)));
+ RunTest(input_2, std::string(), false, fixup_2, std::size(fixup_2)));
EXPECT_TRUE(matches_[0].destination_url.SchemeIsFile());
#elif BUILDFLAG(IS_IOS)
// However, AutocompleteInput ignores the URL fixup on iOS because it
@@ -702,7 +700,7 @@
{ "http://%EF%BD%A5@s/", false }
};
RunTest(u"\uff65@s", std::string(), false, fixup_crash,
- base::size(fixup_crash));
+ std::size(fixup_crash));
RunTest(u"\u2015\u2015@ \uff7c", std::string(), false, nullptr, 0);

// Fixing up "http:/" should result in an inline autocomplete offset of just
@@ -714,7 +712,7 @@
{ "http://bogussite.com/c", true }
};
ASSERT_NO_FATAL_FAILURE(
- RunTest(input_2, std::string(), false, fixup_2, base::size(fixup_2)));
+ RunTest(input_2, std::string(), false, fixup_2, std::size(fixup_2)));
EXPECT_EQ(u"/bogussite.com/a", matches_.front().inline_autocompletion);

// Adding a TLD to a small number like "56" should result in "www.56.com"
@@ -722,20 +720,20 @@
const UrlAndLegalDefault fixup_3[] = {
{ "http://www.56.com/", true }
};
- RunTest(u"56", "com", true, fixup_3, base::size(fixup_3));
+ RunTest(u"56", "com", true, fixup_3, std::size(fixup_3));

// An input looks like a IP address like "127.0.0.1" should result in
// "http://127.0.0.1/".
const UrlAndLegalDefault fixup_4[] = {
{ "http://127.0.0.1/", true }
};
- RunTest(u"127.0.0.1", std::string(), false, fixup_4, base::size(fixup_4));
+ RunTest(u"127.0.0.1", std::string(), false, fixup_4, std::size(fixup_4));

// An number "17173" should result in "http://www.17173.com/" in db.
const UrlAndLegalDefault fixup_5[] = {
{ "http://www.17173.com/", true }
};
- RunTest(u"17173", std::string(), false, fixup_5, base::size(fixup_5));
+ RunTest(u"17173", std::string(), false, fixup_5, std::size(fixup_5));
}

// Make sure the results for the input 'p' don't change between the first and
@@ -773,13 +771,13 @@
{ "http://test.com/", true }
};
RunTest(u"test.com", std::string(), false, navigation_1,
- base::size(navigation_1));
+ std::size(navigation_1));

UrlAndLegalDefault navigation_2[] = {
{ "http://slash/", false }
};
RunTest(u"slash", std::string(), false, navigation_2,
- base::size(navigation_2));
+ std::size(navigation_2));

RunTest(u"this is a query", std::string(), false, nullptr, 0);
}
@@ -875,7 +873,7 @@
{ "http://us...@foo.com/", false }
};
ASSERT_NO_FATAL_FAILURE(RunTest(u"us...@foo.com", std::string(), false,
- expected, base::size(expected)));
+ expected, std::size(expected)));
EXPECT_LE(1200, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1210);
}
@@ -895,7 +893,7 @@
{ "gooey/a", 1400, true },
{ "gooey/a b", 1400, true },
};
- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
SCOPED_TRACE(test_cases[i].input);
if (test_cases[i].relevance == 0) {
RunTest(ASCIIToUTF16(test_cases[i].input), std::string(), false, nullptr,
@@ -906,7 +904,7 @@
test_cases[i].allowed_to_be_default_match}};
ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input),
std::string(), false, output,
- base::size(output)));
+ std::size(output)));
// Actual relevance should be at least what test_cases expects and
// and no more than 10 more.
EXPECT_LE(test_cases[i].relevance, matches_[0].relevance);
@@ -925,7 +923,7 @@
{ "http://intra/two", true }
};
ASSERT_NO_FATAL_FAILURE(RunTest(u"intra/t", std::string(), false, expected1,
- base::size(expected1)));
+ std::size(expected1)));
EXPECT_LE(1410, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1420);
// It uses the default scoring.
@@ -935,8 +933,8 @@
{ "http://moo/b", true },
{ "http://moo/bar", true }
};
- ASSERT_NO_FATAL_FAILURE(RunTest(u"moo/b", std::string(), false, expected2,
- base::size(expected2)));
+ ASSERT_NO_FATAL_FAILURE(
+ RunTest(u"moo/b", std::string(), false, expected2, std::size(expected2)));
// The url what you typed match should be around 1400, otherwise the
// search what you typed match is going to be first.
EXPECT_LE(1400, matches_[0].relevance);
@@ -945,18 +943,18 @@
const UrlAndLegalDefault expected3[] = {{"http://intra/three", true},
{"http://intra/one", true},
{"http://intra/two", true}};
- RunTest(u"intra", std::string(), false, expected3, base::size(expected3));
+ RunTest(u"intra", std::string(), false, expected3, std::size(expected3));

const UrlAndLegalDefault expected4[] = {{"http://intra/three", true},
{"http://intra/one", true},
{"http://intra/two", true}};
- RunTest(u"intra/", std::string(), false, expected4, base::size(expected4));
+ RunTest(u"intra/", std::string(), false, expected4, std::size(expected4));

const UrlAndLegalDefault expected5[] = {
{ "http://intra/one", true }
};
ASSERT_NO_FATAL_FAILURE(RunTest(u"intra/o", std::string(), false, expected5,
- base::size(expected5)));
+ std::size(expected5)));
EXPECT_LE(1410, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1420);

@@ -964,7 +962,7 @@
{ "http://intra/x", true }
};
ASSERT_NO_FATAL_FAILURE(RunTest(u"intra/x", std::string(), false, expected6,
- base::size(expected6)));
+ std::size(expected6)));
EXPECT_LE(1400, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1410);

@@ -972,13 +970,13 @@
{ "http://typedhost/untypedpath", true }
};
ASSERT_NO_FATAL_FAILURE(RunTest(u"typedhost/untypedpath", std::string(),
- false, expected7, base::size(expected7)));
+ false, expected7, std::size(expected7)));
EXPECT_LE(1400, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1410);

const UrlAndLegalDefault expected8[] = {{"https://www.prefixintra/x", true}};
ASSERT_NO_FATAL_FAILURE(RunTest(u"prefixintra/x", std::string(), false,
- expected8, base::size(expected8)));
+ expected8, std::size(expected8)));
}

TEST_F(HistoryURLProviderTest, CrashDueToFixup) {
@@ -988,7 +986,7 @@
"\\@st",
"view-source:x",
};
- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
AutocompleteInput input(ASCIIToUTF16(test_cases[i]),
metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
@@ -1013,21 +1011,21 @@
{ "http://puny.xn--h2by8byc123p.in/", true },
};
RunTest(u"pun", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));
RunTest(u"puny.", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));
RunTest(u"puny.x", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));
RunTest(u"puny.xn", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));
RunTest(u"puny.xn--", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));
RunTest(u"puny.xn--h2", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));
RunTest(u"puny.xn--h2by8byc123p", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));
RunTest(u"puny.xn--h2by8byc123p.", std::string(), false, expected1_true,
- base::size(expected1_true));
+ std::size(expected1_true));

// When the punycode part of the URL is rendered as international characters,
// this match should not be allowed to be the default match if the inline
@@ -1039,21 +1037,21 @@
{ "http://two_puny.xn--1lq90ic7f1rc.cn/", false },
};
RunTest(u"two", std::string(), false, expected2_true,
- base::size(expected2_true));
+ std::size(expected2_true));
RunTest(u"two_puny.", std::string(), false, expected2_true,
- base::size(expected2_true));
+ std::size(expected2_true));
RunTest(u"two_puny.x", std::string(), false, expected2_false,
- base::size(expected2_false));
+ std::size(expected2_false));
RunTest(u"two_puny.xn", std::string(), false, expected2_false,
- base::size(expected2_false));
+ std::size(expected2_false));
RunTest(u"two_puny.xn--", std::string(), false, expected2_false,
- base::size(expected2_false));
+ std::size(expected2_false));
RunTest(u"two_puny.xn--1l", std::string(), false, expected2_false,
- base::size(expected2_false));
+ std::size(expected2_false));
RunTest(u"two_puny.xn--1lq90ic7f1rc", std::string(), false, expected2_true,
- base::size(expected2_true));
+ std::size(expected2_true));
RunTest(u"two_puny.xn--1lq90ic7f1rc.", std::string(), false, expected2_true,
- base::size(expected2_true));
+ std::size(expected2_true));
}

TEST_F(HistoryURLProviderTest, CullSearchResults) {
@@ -1080,7 +1078,7 @@
{"https://testsearch.com/?q=foobar", 20},
{"http://foobar.com/", 10}
};
- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
client_->GetHistoryService()->AddPageWithDetails(
GURL(test_cases[i].url), u"Title", test_cases[i].count,
test_cases[i].count, Time::Now(), false, history::SOURCE_BROWSED);
@@ -1091,14 +1089,14 @@
{ test_cases[2].url, false }
};
RunTest(u"foobar", std::string(), true, expected_when_searching_query,
- base::size(expected_when_searching_query));
+ std::size(expected_when_searching_query));

// We should not see search URLs when typing the search engine name.
const UrlAndLegalDefault expected_when_searching_site[] = {
{ test_cases[0].url, false }
};
RunTest(u"testsearch", std::string(), true, expected_when_searching_site,
- base::size(expected_when_searching_site));
+ std::size(expected_when_searching_site));
}

TEST_F(HistoryURLProviderTest, SuggestExactInput) {
@@ -1166,7 +1164,7 @@
"view-source:http://x%20y/a b", {0, npos, npos}, 0 },
// clang-format on
};
- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
SCOPED_TRACE(testing::Message() << "Index " << i << " input: "
<< test_cases[i].input << ", trim_http: "
<< test_cases[i].trim_http);
@@ -1272,7 +1270,7 @@
max_1100_visit_typed_decays,
{{"7.com/5", 1203, 1203}, {"7.com/5a", 1202, 50}, {nullptr, 0, 0}}},
};
- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
SCOPED_TRACE(test_cases[i].input);
UrlAndLegalDefault output[kProviderMaxMatches];
int max_matches;
diff --git a/components/omnibox/browser/in_memory_url_index_types_unittest.cc b/components/omnibox/browser/in_memory_url_index_types_unittest.cc
index ec8ca05c..5b79cc0 100644
--- a/components/omnibox/browser/in_memory_url_index_types_unittest.cc
+++ b/components/omnibox/browser/in_memory_url_index_types_unittest.cc
@@ -9,7 +9,6 @@
#include <algorithm>
#include <string>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"

@@ -49,7 +48,7 @@
EXPECT_EQ(u"brammy", string_vec[6]);
// Verify the word starts.
size_t expected_starts_a[] = {0, 7, 11, 18, 23, 31, 35};
- EXPECT_TRUE(IntArraysEqual(expected_starts_a, base::size(expected_starts_a),
+ EXPECT_TRUE(IntArraysEqual(expected_starts_a, std::size(expected_starts_a),
actual_starts_a));

WordStarts actual_starts_b;
@@ -61,7 +60,7 @@
EXPECT_EQ(u"the", string_vec[3]);
EXPECT_EQ(u"brammy", string_vec[4]);
size_t expected_starts_b[] = {0, 7, 23, 31, 35};
- EXPECT_TRUE(IntArraysEqual(expected_starts_b, base::size(expected_starts_b),
+ EXPECT_TRUE(IntArraysEqual(expected_starts_b, std::size(expected_starts_b),
actual_starts_b));

std::u16string string_c(
@@ -71,7 +70,7 @@
ASSERT_EQ(8U, string_vec.size());
// Note that we stop collecting words and word starts at kMaxSignificantChars.
size_t expected_starts_c[] = {1, 7, 16, 22, 32, 43, 52, 55};
- EXPECT_TRUE(IntArraysEqual(expected_starts_c, base::size(expected_starts_c),
+ EXPECT_TRUE(IntArraysEqual(expected_starts_c, std::size(expected_starts_c),
actual_starts_c));

std::u16string string_d(u"http://www.google.com/frammy_the_brammy");
@@ -86,7 +85,7 @@
EXPECT_EQ(u"the", string_vec[5]);
EXPECT_EQ(u"brammy", string_vec[6]);
size_t expected_starts_d[] = {0, 7, 11, 18, 22, 29, 33};
- EXPECT_TRUE(IntArraysEqual(expected_starts_d, base::size(expected_starts_d),
+ EXPECT_TRUE(IntArraysEqual(expected_starts_d, std::size(expected_starts_d),
actual_starts_d));

// Test String16SetFromString16
@@ -101,7 +100,7 @@
EXPECT_TRUE(string_set.find(u"search") != string_set.end());
EXPECT_TRUE(string_set.find(u"web") != string_set.end());
size_t expected_starts_e[] = {0, 7, 11, 18, 22, 29, 36, 40};
- EXPECT_TRUE(IntArraysEqual(expected_starts_e, base::size(expected_starts_e),
+ EXPECT_TRUE(IntArraysEqual(expected_starts_e, std::size(expected_starts_e),
actual_starts_e));

// Test SortMatches and DeoverlapMatches.
@@ -133,8 +132,8 @@
TermMatches matches_g =
MatchTermInString(u"x", u"axbxcxdxex fxgx/hxixjx.kx", 123);
const size_t expected_offsets[] = { 1, 3, 5, 7, 9, 12, 14, 17, 19, 21, 24 };
- ASSERT_EQ(base::size(expected_offsets), matches_g.size());
- for (size_t i = 0; i < base::size(expected_offsets); ++i)
+ ASSERT_EQ(std::size(expected_offsets), matches_g.size());
+ for (size_t i = 0; i < std::size(expected_offsets); ++i)
EXPECT_EQ(expected_offsets[i], matches_g[i].offset);
}

@@ -148,7 +147,7 @@
matches_a.push_back(TermMatch(4, 14, 5));
std::vector<size_t> offsets = OffsetsFromTermMatches(matches_a);
const size_t expected_offsets_a[] = {1, 3, 4, 7, 9, 10, 10, 11, 14, 19};
- ASSERT_EQ(offsets.size(), base::size(expected_offsets_a));
+ ASSERT_EQ(offsets.size(), std::size(expected_offsets_a));
for (size_t i = 0; i < offsets.size(); ++i)
EXPECT_EQ(expected_offsets_a[i], offsets[i]);

@@ -156,7 +155,7 @@
offsets[4] = std::u16string::npos; // offset of third term
TermMatches matches_b = ReplaceOffsetsInTermMatches(matches_a, offsets);
const size_t expected_offsets_b[] = {1, 4, 10, 14};
- ASSERT_EQ(base::size(expected_offsets_b), matches_b.size());
+ ASSERT_EQ(std::size(expected_offsets_b), matches_b.size());
for (size_t i = 0; i < matches_b.size(); ++i)
EXPECT_EQ(expected_offsets_b[i], matches_b[i].offset);
}
diff --git a/components/omnibox/browser/in_memory_url_index_unittest.cc b/components/omnibox/browser/in_memory_url_index_unittest.cc
index 3dbe395..a1b8044 100644
--- a/components/omnibox/browser/in_memory_url_index_unittest.cc
+++ b/components/omnibox/browser/in_memory_url_index_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/omnibox/browser/in_memory_url_index.h"
+
#include <stddef.h>
#include <stdint.h>

@@ -13,7 +15,6 @@
#include <utility>

#include "base/auto_reset.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -32,7 +33,6 @@
#include "components/history/core/browser/history_service.h"
#include "components/history/core/test/history_service_test_util.h"
#include "components/omnibox/browser/history_index_restore_observer.h"
-#include "components/omnibox/browser/in_memory_url_index.h"
#include "components/omnibox/browser/in_memory_url_index_test_util.h"
#include "components/omnibox/browser/in_memory_url_index_types.h"
#include "components/omnibox/browser/url_index_private_data.h"
@@ -278,7 +278,7 @@

// Set up a simple template URL service with a default search engine.
template_url_service_ = std::make_unique<TemplateURLService>(
- kTemplateURLData, base::size(kTemplateURLData));
+ kTemplateURLData, std::size(kTemplateURLData));
TemplateURL* template_url = template_url_service_->GetTemplateURLForKeyword(
kDefaultTemplateURLKeyword);
template_url_service_->SetUserSelectedDefaultSearchProvider(template_url);
@@ -1097,7 +1097,7 @@
};

const SchemeSet& allowlist(scheme_allowlist());
- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
GURL url(data[i].url_spec);
EXPECT_EQ(data[i].expected_is_allowlisted,
URLIndexPrivateData::URLSchemeIsAllowlisted(url, allowlist));
@@ -1357,7 +1357,7 @@
{"abcd :", 5, 2, {0, 1, kInvalid}},
{"abcd :", 2, 3, {0, 0, 1}}};

- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
SCOPED_TRACE(testing::Message()
<< "search_string = " << test_cases[i].search_string
<< ", cursor_position = " << test_cases[i].cursor_position);
@@ -1397,7 +1397,7 @@
{"abcd_", 4, 2, {0, 1, kInvalid}},
{"ab_cd", 5, 1, {0, kInvalid, kInvalid}}};

- for (size_t i = 0; i < base::size(test_cases); ++i) {
+ for (size_t i = 0; i < std::size(test_cases); ++i) {
SCOPED_TRACE(testing::Message()
<< "search_string = " << test_cases[i].search_string
<< ", cursor_position = " << test_cases[i].cursor_position);
diff --git a/components/omnibox/browser/keyword_provider_unittest.cc b/components/omnibox/browser/keyword_provider_unittest.cc
index e4a7f2d..ccf802b 100644
--- a/components/omnibox/browser/keyword_provider_unittest.cc
+++ b/components/omnibox/browser/keyword_provider_unittest.cc
@@ -11,7 +11,6 @@
#include <utility>

#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -129,7 +128,7 @@
void KeywordProviderTest::SetUpClientAndKeywordProvider() {
client_ = std::make_unique<MockAutocompleteProviderClient>();
client_->set_template_url_service(
- std::make_unique<TemplateURLService>(kTestData, base::size(kTestData)));
+ std::make_unique<TemplateURLService>(kTestData, std::size(kTestData)));
kw_provider_ = new KeywordProvider(client_.get(), nullptr);
}

@@ -233,7 +232,7 @@
};

SetUpClientAndKeywordProvider();
- RunTest<std::u16string>(edit_cases, base::size(edit_cases),
+ RunTest<std::u16string>(edit_cases, std::size(edit_cases),
&AutocompleteMatch::fill_into_edit);
}

@@ -272,7 +271,7 @@
OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");

SetUpClientAndKeywordProvider();
- RunTest<std::u16string>(edit_cases, base::size(edit_cases),
+ RunTest<std::u16string>(edit_cases, std::size(edit_cases),
&AutocompleteMatch::fill_into_edit);
}

@@ -310,7 +309,7 @@
};

SetUpClientAndKeywordProvider();
- RunTest<GURL>(url_cases, base::size(url_cases),
+ RunTest<GURL>(url_cases, std::size(url_cases),
&AutocompleteMatch::destination_url);
}

@@ -351,7 +350,7 @@
};

SetUpClientAndKeywordProvider();
- RunTest<std::u16string>(contents_cases, base::size(contents_cases),
+ RunTest<std::u16string>(contents_cases, std::size(contents_cases),
&AutocompleteMatch::contents);
}

@@ -460,7 +459,7 @@
std::u16string::npos},
};
SetUpClientAndKeywordProvider();
- for (size_t i = 0; i < base::size(cases); i++) {
+ for (size_t i = 0; i < std::size(cases); i++) {
AutocompleteInput input(
ASCIIToUTF16(cases[i].text), cases[i].cursor_position,
metrics::OmniboxEventProto::OTHER, TestingSchemeClassifier());
@@ -492,7 +491,7 @@
};

SetUpClientAndKeywordProvider();
- RunTest<GURL>(url_cases, base::size(url_cases),
+ RunTest<GURL>(url_cases, std::size(url_cases),
&AutocompleteMatch::destination_url);
}

diff --git a/components/omnibox/browser/omnibox_edit_model_unittest.cc b/components/omnibox/browser/omnibox_edit_model_unittest.cc
index 33a48a0..0f07985 100644
--- a/components/omnibox/browser/omnibox_edit_model_unittest.cc
+++ b/components/omnibox/browser/omnibox_edit_model_unittest.cc
@@ -9,7 +9,6 @@
#include <memory>
#include <string>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@@ -185,7 +184,7 @@
false, ""},
};

- for (size_t i = 0; i < base::size(input); ++i) {
+ for (size_t i = 0; i < std::size(input); ++i) {
location_bar_model()->set_formatted_full_url(
base::UTF8ToUTF16(input[i].url_for_editing));
location_bar_model()->set_url_for_display(
diff --git a/components/omnibox/browser/omnibox_view_unittest.cc b/components/omnibox/browser/omnibox_view_unittest.cc
index 924b83b2..37e97a65 100644
--- a/components/omnibox/browser/omnibox_view_unittest.cc
+++ b/components/omnibox/browser/omnibox_view_unittest.cc
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/omnibox/browser/omnibox_view.h"
+
#include <stddef.h>
+
#include <string>
#include <utility>

#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
@@ -16,7 +18,6 @@
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/test/test_bookmark_client.h"
#include "components/omnibox/browser/autocomplete_match.h"
-#include "components/omnibox/browser/omnibox_view.h"
#include "components/omnibox/browser/test_omnibox_client.h"
#include "components/omnibox/browser/test_omnibox_edit_controller.h"
#include "components/omnibox/browser/test_omnibox_edit_model.h"
@@ -97,7 +98,7 @@
"alert(5)" // Embedded control characters unsafe.
};

- for (size_t i = 0; i < base::size(urls); i++) {
+ for (size_t i = 0; i < std::size(urls); i++) {
EXPECT_EQ(ASCIIToUTF16(expecteds[i]),
OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(urls[i])));
}
diff --git a/components/omnibox/browser/shortcuts_backend_unittest.cc b/components/omnibox/browser/shortcuts_backend_unittest.cc
index 71bd1ed..26722d7 100644
--- a/components/omnibox/browser/shortcuts_backend_unittest.cc
+++ b/components/omnibox/browser/shortcuts_backend_unittest.cc
@@ -8,7 +8,6 @@

#include <memory>

-#include "base/cxx17_backports.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
@@ -229,7 +228,7 @@
"", "", AutocompleteMatchType::SEARCH_HISTORY },
};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
ShortcutsDatabase::Shortcut::MatchCore match_core(MatchCoreForTesting(
std::string(), cases[i].input_contents_class,
cases[i].input_description_class, cases[i].input_type));
diff --git a/components/omnibox/browser/shortcuts_database_unittest.cc b/components/omnibox/browser/shortcuts_database_unittest.cc
index 4f0bd32..c0815cc4 100644
--- a/components/omnibox/browser/shortcuts_database_unittest.cc
+++ b/components/omnibox/browser/shortcuts_database_unittest.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
#include "base/path_service.h"
@@ -185,9 +184,9 @@

void ShortcutsDatabaseTest::AddAll() {
ClearDB();
- for (size_t i = 0; i < base::size(shortcut_test_db); ++i)
+ for (size_t i = 0; i < std::size(shortcut_test_db); ++i)
db_->AddShortcut(ShortcutFromTestInfo(shortcut_test_db[i]));
- EXPECT_EQ(base::size(shortcut_test_db), CountRecords());
+ EXPECT_EQ(std::size(shortcut_test_db), CountRecords());
}

// Actual tests ---------------------------------------------------------------
@@ -223,7 +222,7 @@
shortcut_ids.push_back(shortcut_test_db[0].guid);
shortcut_ids.push_back(shortcut_test_db[2].guid);
EXPECT_TRUE(db_->DeleteShortcutsWithIDs(shortcut_ids));
- EXPECT_EQ(base::size(shortcut_test_db) - 2, CountRecords());
+ EXPECT_EQ(std::size(shortcut_test_db) - 2, CountRecords());

ShortcutsDatabase::GuidToShortcutMap shortcuts;
db_->LoadShortcuts(&shortcuts);
@@ -242,7 +241,7 @@
AddAll();

EXPECT_TRUE(db_->DeleteShortcutsWithURL("http://slashdot.org/"));
- EXPECT_EQ(base::size(shortcut_test_db) - 2, CountRecords());
+ EXPECT_EQ(std::size(shortcut_test_db) - 2, CountRecords());

ShortcutsDatabase::GuidToShortcutMap shortcuts;
db_->LoadShortcuts(&shortcuts);
@@ -261,7 +260,7 @@
AddAll();
ShortcutsDatabase::GuidToShortcutMap shortcuts;
db_->LoadShortcuts(&shortcuts);
- EXPECT_EQ(base::size(shortcut_test_db), shortcuts.size());
+ EXPECT_EQ(std::size(shortcut_test_db), shortcuts.size());
EXPECT_TRUE(db_->DeleteAllShortcuts());
db_->LoadShortcuts(&shortcuts);
EXPECT_EQ(0U, shortcuts.size());
diff --git a/components/omnibox/browser/shortcuts_provider_unittest.cc b/components/omnibox/browser/shortcuts_provider_unittest.cc
index f57aad2..873f6c1 100644
--- a/components/omnibox/browser/shortcuts_provider_unittest.cc
+++ b/components/omnibox/browser/shortcuts_provider_unittest.cc
@@ -14,7 +14,6 @@
#include <string>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
@@ -289,7 +288,7 @@
provider_ = base::MakeRefCounted<ShortcutsProvider>(client_.get());
PopulateShortcutsBackendWithTestData(client_->GetShortcutsBackend(),
shortcut_test_db,
- base::size(shortcut_test_db));
+ std::size(shortcut_test_db));
}

void ShortcutsProviderTest::TearDown() {
@@ -636,7 +635,7 @@
size_t original_shortcuts_count = backend->shortcuts_map().size();

PopulateShortcutsBackendWithTestData(backend, shortcuts_to_test_delete,
- base::size(shortcuts_to_test_delete));
+ std::size(shortcuts_to_test_delete));

EXPECT_EQ(original_shortcuts_count + 4, backend->shortcuts_map().size());
EXPECT_FALSE(backend->shortcuts_map().end() ==
diff --git a/components/open_from_clipboard/clipboard_recent_content_generic_unittest.cc b/components/open_from_clipboard/clipboard_recent_content_generic_unittest.cc
index ad59ef4..a05a309 100644
--- a/components/open_from_clipboard/clipboard_recent_content_generic_unittest.cc
+++ b/components/open_from_clipboard/clipboard_recent_content_generic_unittest.cc
@@ -8,7 +8,6 @@
#include <string>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
@@ -123,7 +122,7 @@

ClipboardRecentContentGeneric recent_content;
base::Time now = base::Time::Now();
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
test_clipboard_->WriteText(test_data[i].clipboard.data(),
test_data[i].clipboard.length());
test_clipboard_->SetLastModifiedTime(now - base::Seconds(10));
diff --git a/components/open_from_clipboard/clipboard_recent_content_ios.mm b/components/open_from_clipboard/clipboard_recent_content_ios.mm
index c4f8252..f26c56fb6 100644
--- a/components/open_from_clipboard/clipboard_recent_content_ios.mm
+++ b/components/open_from_clipboard/clipboard_recent_content_ios.mm
@@ -5,11 +5,10 @@
#import "components/open_from_clipboard/clipboard_recent_content_ios.h"

#import <CommonCrypto/CommonDigest.h>
+#import <UIKit/UIKit.h>
#include <stddef.h>
#include <stdint.h>
-#import <UIKit/UIKit.h>

-#include "base/cxx17_backports.h"
#include "base/metrics/user_metrics.h"
#include "base/notreached.h"
#include "base/strings/sys_string_conversions.h"
@@ -35,7 +34,7 @@
NSSet<NSString*>* getAuthorizedSchemeList(
const std::string& application_scheme) {
NSMutableSet<NSString*>* schemes = [NSMutableSet set];
- for (size_t i = 0; i < base::size(kAuthorizedSchemes); ++i) {
+ for (size_t i = 0; i < std::size(kAuthorizedSchemes); ++i) {
[schemes addObject:base::SysUTF8ToNSString(kAuthorizedSchemes[i])];
}
if (!application_scheme.empty()) {
diff --git a/components/optimization_guide/content/browser/page_content_annotations_web_contents_observer_unittest.cc b/components/optimization_guide/content/browser/page_content_annotations_web_contents_observer_unittest.cc
index 49397fc..ea9af5c 100644
--- a/components/optimization_guide/content/browser/page_content_annotations_web_contents_observer_unittest.cc
+++ b/components/optimization_guide/content/browser/page_content_annotations_web_contents_observer_unittest.cc
@@ -208,7 +208,7 @@

// Set up a simple template URL service with a default search engine.
template_url_service_ = std::make_unique<TemplateURLService>(
- kTemplateURLData, base::size(kTemplateURLData));
+ kTemplateURLData, std::size(kTemplateURLData));
template_url_ = template_url_service_->GetTemplateURLForKeyword(
kDefaultTemplateURLKeyword);
template_url_service_->SetUserSelectedDefaultSearchProvider(template_url_);
diff --git a/components/os_crypt/keyring_util_linux.cc b/components/os_crypt/keyring_util_linux.cc
index ddd948d..b7b5065 100644
--- a/components/os_crypt/keyring_util_linux.cc
+++ b/components/os_crypt/keyring_util_linux.cc
@@ -6,7 +6,6 @@

#include <dlfcn.h>

-#include "base/cxx17_backports.h"
#include "base/logging.h"

decltype(&::gnome_keyring_is_available)
@@ -78,7 +77,7 @@
return false;
}

- for (size_t i = 0; i < base::size(functions); ++i) {
+ for (size_t i = 0; i < std::size(functions); ++i) {
dlerror();
*functions[i].pointer = dlsym(handle, functions[i].name);
const char* error = dlerror();
diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc
index dc41aa1..505602f6 100644
--- a/components/page_info/page_info_ui.cc
+++ b/components/page_info/page_info_ui.cc
@@ -8,7 +8,6 @@

#include "base/command_line.h"
#include "base/containers/span.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -54,7 +53,7 @@
IDS_PAGE_INFO_PERMISSION_ASK_BY_POLICY,
kInvalidResourceID,
kInvalidResourceID};
-static_assert(base::size(kPermissionButtonTextIDPolicyManaged) ==
+static_assert(std::size(kPermissionButtonTextIDPolicyManaged) ==
CONTENT_SETTING_NUM_SETTINGS,
"kPermissionButtonTextIDPolicyManaged array size is incorrect");

@@ -67,7 +66,7 @@
IDS_PAGE_INFO_PERMISSION_ASK_BY_EXTENSION,
kInvalidResourceID,
kInvalidResourceID};
-static_assert(base::size(kPermissionButtonTextIDExtensionManaged) ==
+static_assert(std::size(kPermissionButtonTextIDExtensionManaged) ==
CONTENT_SETTING_NUM_SETTINGS,
"kPermissionButtonTextIDExtensionManaged array size is "
"incorrect");
@@ -81,7 +80,7 @@
IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_USER,
kInvalidResourceID,
IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER};
-static_assert(base::size(kPermissionButtonTextIDUserManaged) ==
+static_assert(std::size(kPermissionButtonTextIDUserManaged) ==
CONTENT_SETTING_NUM_SETTINGS,
"kPermissionButtonTextIDUserManaged array size is incorrect");

@@ -94,7 +93,7 @@
IDS_PAGE_INFO_BUTTON_TEXT_ASK_BY_DEFAULT,
kInvalidResourceID,
IDS_PAGE_INFO_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT};
-static_assert(base::size(kPermissionButtonTextIDDefaultSetting) ==
+static_assert(std::size(kPermissionButtonTextIDDefaultSetting) ==
CONTENT_SETTING_NUM_SETTINGS,
"kPermissionButtonTextIDDefaultSetting array size is incorrect");

@@ -109,7 +108,7 @@
kInvalidResourceID,
kInvalidResourceID};
static_assert(
- base::size(kSoundPermissionButtonTextIDUserManaged) ==
+ std::size(kSoundPermissionButtonTextIDUserManaged) ==
CONTENT_SETTING_NUM_SETTINGS,
"kSoundPermissionButtonTextIDUserManaged array size is incorrect");

@@ -124,7 +123,7 @@
kInvalidResourceID,
kInvalidResourceID};
static_assert(
- base::size(kSoundPermissionButtonTextIDDefaultSetting) ==
+ std::size(kSoundPermissionButtonTextIDDefaultSetting) ==
CONTENT_SETTING_NUM_SETTINGS,
"kSoundPermissionButtonTextIDDefaultSetting array size is incorrect");
#endif
diff --git a/components/password_manager/core/browser/android_affiliation/facet_manager_unittest.cc b/components/password_manager/core/browser/android_affiliation/facet_manager_unittest.cc
index 740302d6..4343bb6 100644
--- a/components/password_manager/core/browser/android_affiliation/facet_manager_unittest.cc
+++ b/components/password_manager/core/browser/android_affiliation/facet_manager_unittest.cc
@@ -11,7 +11,6 @@

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
@@ -597,7 +596,7 @@
const base::TimeDelta kMaximumTestDuration = 2 * GetCacheHardExpiryPeriod();

for (const bool cache_initially_stale : kFalseTrue) {
- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "Test case: #" << i);
SCOPED_TRACE(cache_initially_stale ? "Cache initially stale"
: "Cache initially empty");
@@ -733,7 +732,7 @@

const base::TimeDelta kMaximumTestDuration = 2 * GetCacheHardExpiryPeriod();

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "Test case: #" << i);

fake_facet_manager_host()->set_fake_database_content(
@@ -798,7 +797,7 @@

const base::TimeDelta kMaximumTestDuration = 2 * GetCacheHardExpiryPeriod();

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "Test case: #" << i);

fake_facet_manager_host()->set_fake_database_content(
@@ -924,8 +923,8 @@
const base::TimeDelta kTestDuration =
GetCacheSoftExpiryPeriod() + GetCacheHardExpiryPeriod();

- for (size_t j = 0; j < base::size(kFirstPrefetchParams); ++j) {
- for (size_t i = 0; i < base::size(kSecondPrefetchParams); ++i) {
+ for (size_t j = 0; j < std::size(kFirstPrefetchParams); ++j) {
+ for (size_t i = 0; i < std::size(kSecondPrefetchParams); ++i) {
SCOPED_TRACE(testing::Message() << "Test case: #" << j << "." << i);

fake_facet_manager_host()->clear_fake_database_content();
@@ -989,7 +988,7 @@
const base::TimeDelta kTestDuration =
GetCacheSoftExpiryPeriod() + GetCacheHardExpiryPeriod();

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "Test case: #" << i);

fake_facet_manager_host()->clear_fake_database_content();
@@ -1114,7 +1113,7 @@
GetCacheHardExpiryPeriod() +
2 * GetShortTestPeriod();

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "Test case: #" << i);

fake_facet_manager_host()->clear_fake_database_content();
@@ -1194,7 +1193,7 @@
GetCacheSoftExpiryPeriod(),
2 * GetCacheSoftExpiryPeriod()};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "Test case: #" << i);

fake_facet_manager_host()->clear_fake_database_content();
diff --git a/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc b/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc
index 95eeb19..b33438a 100644
--- a/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc
+++ b/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc
@@ -50,7 +50,7 @@
return false;
prediction->may_use_prefilled_placeholder = accessor->ConsumeBit();
const size_t prediction_idx = accessor->ConsumeNumber(3);
- if (prediction_idx < base::size(kPasswordRelatedServerTypes)) {
+ if (prediction_idx < std::size(kPasswordRelatedServerTypes)) {
prediction->type = kPasswordRelatedServerTypes[prediction_idx];
} else {
// Set random type, probably even invalid. FormParser should gracefully
diff --git a/components/password_manager/core/browser/form_parsing/password_field_prediction_unittest.cc b/components/password_manager/core/browser/form_parsing/password_field_prediction_unittest.cc
index 651ba7cb..c7d005c 100644
--- a/components/password_manager/core/browser/form_parsing/password_field_prediction_unittest.cc
+++ b/components/password_manager/core/browser/form_parsing/password_field_prediction_unittest.cc
@@ -6,7 +6,6 @@

#include <vector>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "components/autofill/core/browser/form_structure.h"
@@ -94,7 +93,7 @@
};

FormData form_data;
- for (size_t i = 0; i < base::size(test_fields); ++i) {
+ for (size_t i = 0; i < std::size(test_fields); ++i) {
FormFieldData field;
field.unique_renderer_id = autofill::FieldRendererId(i + 1000);
field.name = ASCIIToUTF16(test_fields[i].name);
@@ -104,7 +103,7 @@

FormStructure form_structure(form_data);
// Set server predictions and create expected votes.
- for (size_t i = 0; i < base::size(test_fields); ++i) {
+ for (size_t i = 0; i < std::size(test_fields); ++i) {
AutofillField* field = form_structure.field(i);

std::vector<FieldPrediction> predictions;
@@ -129,9 +128,9 @@
// Check whether actual predictions are equal to expected ones.
EXPECT_EQ(driver_id, actual_predictions.driver_id);
EXPECT_EQ(form_structure.form_signature(), actual_predictions.form_signature);
- EXPECT_EQ(base::size(test_fields), actual_predictions.fields.size());
+ EXPECT_EQ(std::size(test_fields), actual_predictions.fields.size());

- for (size_t i = 0; i < base::size(test_fields); ++i) {
+ for (size_t i = 0; i < std::size(test_fields); ++i) {
const PasswordFieldPrediction& actual_prediction =
actual_predictions.fields[i];
EXPECT_EQ(test_fields[i].expected_type, actual_prediction.type);
diff --git a/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc b/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc
index edd3687..be748be 100644
--- a/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc
+++ b/components/password_manager/core/browser/import/csv_password_iterator_unittest.cc
@@ -7,7 +7,6 @@
#include <string>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/task_environment.h"
#include "components/password_manager/core/browser/import/csv_password.h"
@@ -88,7 +87,7 @@
CSVPasswordIterator iter(kColMap, kCSVBlob);

CSVPasswordIterator check = iter;
- for (size_t i = 0; i < base::size(kExpectedUsernames); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedUsernames); ++i) {
EXPECT_EQ(CSVPassword::Status::kOK, (check++)->TryParse())
<< "on line " << i;
}
diff --git a/components/password_manager/core/browser/import/csv_password_sequence_unittest.cc b/components/password_manager/core/browser/import/csv_password_sequence_unittest.cc
index 0c95d77..350ab84 100644
--- a/components/password_manager/core/browser/import/csv_password_sequence_unittest.cc
+++ b/components/password_manager/core/browser/import/csv_password_sequence_unittest.cc
@@ -107,7 +107,7 @@

size_t order = 0;
for (const CSVPassword& pwd : seq) {
- ASSERT_LT(order, base::size(kExpectedCredentials));
+ ASSERT_LT(order, std::size(kExpectedCredentials));
PasswordForm parsed = pwd.ParseValid();
const auto& expected = kExpectedCredentials[order];
EXPECT_EQ(GURL(expected.url), parsed.url);
diff --git a/components/password_manager/core/browser/leak_detection/encryption_utils.cc b/components/password_manager/core/browser/leak_detection/encryption_utils.cc
index e0ab2b6..e5bd106 100644
--- a/components/password_manager/core/browser/leak_detection/encryption_utils.cc
+++ b/components/password_manager/core/browser/leak_detection/encryption_utils.cc
@@ -7,7 +7,6 @@
#include <climits>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/strings/strcat.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -60,7 +59,7 @@
return crypto::SHA256HashString(base::StrCat(
{canonicalized_username,
base::StringPiece(reinterpret_cast<const char*>(kUsernameSalt),
- base::size(kUsernameSalt))}));
+ std::size(kUsernameSalt))}));
}

std::string BucketizeUsername(base::StringPiece canonicalized_username) {
@@ -110,7 +109,7 @@
std::string salt = base::StrCat(
{canonicalized_username,
base::StringPiece(reinterpret_cast<const char*>(kPasswordHashSalt),
- base::size(kPasswordHashSalt))});
+ std::size(kPasswordHashSalt))});

std::string result;
uint8_t* key_data =
diff --git a/components/password_manager/core/browser/leak_detection/encryption_utils_unittest.cc b/components/password_manager/core/browser/leak_detection/encryption_utils_unittest.cc
index e198998..391c5f7 100644
--- a/components/password_manager/core/browser/leak_detection/encryption_utils_unittest.cc
+++ b/components/password_manager/core/browser/leak_detection/encryption_utils_unittest.cc
@@ -6,7 +6,6 @@

#include <vector>

-#include "base/cxx17_backports.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -64,7 +63,7 @@
0x0C, 0x9F, 0x61, 0x9A, 0xA3, 0xC9, 0x96, 0xEC, 0x4C, 0xB3};
EXPECT_THAT(HashUsername("jonsnow"),
ElementsAreArray(reinterpret_cast<const char*>(kExpected),
- base::size(kExpected)));
+ std::size(kExpected)));
}

TEST(EncryptionUtils, BucketizeUsername) {
@@ -82,7 +81,7 @@
0x6B, 0x4D, 0x76, 0x7B, 0xF2, 0x83, 0x85, 0x55, 0x73, 0xFD};
std::string result = *ScryptHashUsernameAndPassword("user", "password123");
EXPECT_THAT(result, ElementsAreArray(reinterpret_cast<const char*>(kExpected),
- base::size(kExpected)));
+ std::size(kExpected)));
}

TEST(EncryptionUtils, EncryptAndDecrypt) {
@@ -105,7 +104,7 @@
0x9B, 0x0B, 0xAF, 0x66, 0x97, 0xF2, 0x08, 0x85,
0x01, 0x24, 0xB6, 0xED, 0x58, 0x6D, 0xE8, 0x9A};
const std::string kKeyStr(reinterpret_cast<const char*>(kKey),
- base::size(kKey));
+ std::size(kKey));
SCOPED_TRACE(testing::Message()
<< "key=" << testing::PrintToString(StringAsArray(kKeyStr)));
// The expected result was obtained by running the Java implementation of the
@@ -118,7 +117,7 @@
std::string cipher = *CipherEncryptWithKey(kRandomString, kKeyStr);
EXPECT_THAT(cipher,
ElementsAreArray(reinterpret_cast<const char*>(kEncrypted),
- base::size(kEncrypted)));
+ std::size(kEncrypted)));
EXPECT_THAT(CalculateECCurveHash(kRandomString),
ElementsAreArray(*CipherDecrypt(cipher, kKeyStr)));
}
diff --git a/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc b/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc
index 022dfc8..3db5a59e 100644
--- a/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc
+++ b/components/password_manager/core/browser/leak_detection_dialog_utils_unittest.cc
@@ -157,7 +157,7 @@
};

TEST_F(CredentialLeakDialogUtilsTest, GetAcceptButtonLabel) {
- for (size_t i = 0; i < base::size(kLeakTypesTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kLeakTypesTestCases); ++i) {
SCOPED_TRACE(testing::Message() << i);
EXPECT_EQ(
l10n_util::GetStringUTF16(kLeakTypesTestCases[i].accept_button_id),
@@ -166,7 +166,7 @@
}

TEST_F(CredentialLeakDialogUtilsTest, GetCancelButtonLabel) {
- for (size_t i = 0; i < base::size(kLeakTypesTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kLeakTypesTestCases); ++i) {
SCOPED_TRACE(testing::Message() << i);
EXPECT_EQ(
l10n_util::GetStringUTF16(kLeakTypesTestCases[i].cancel_button_id),
@@ -175,7 +175,7 @@
}

TEST_F(CredentialLeakDialogUtilsTest, GetDescription) {
- for (size_t i = 0; i < base::size(kLeakTypesTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kLeakTypesTestCases); ++i) {
SCOPED_TRACE(testing::Message() << i);
std::u16string expected_message =
l10n_util::GetStringUTF16(kLeakTypesTestCases[i].leak_message_id);
@@ -185,7 +185,7 @@
}

TEST_F(CredentialLeakDialogUtilsTest, GetTitle) {
- for (size_t i = 0; i < base::size(kLeakTypesTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kLeakTypesTestCases); ++i) {
SCOPED_TRACE(testing::Message() << i);
EXPECT_EQ(l10n_util::GetStringUTF16(kLeakTypesTestCases[i].leak_title_id),
GetTitle(kLeakTypesTestCases[i].leak_type));
@@ -193,7 +193,7 @@
}

TEST_F(CredentialLeakDialogUtilsTest, ShouldCheckPasswords) {
- for (size_t i = 0; i < base::size(kLeakTypesTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kLeakTypesTestCases); ++i) {
SCOPED_TRACE(testing::Message() << i);
EXPECT_EQ(kLeakTypesTestCases[i].should_check_passwords,
ShouldCheckPasswords(kLeakTypesTestCases[i].leak_type));
@@ -201,7 +201,7 @@
}

TEST_F(CredentialLeakDialogUtilsTest, ShouldShowCancelButton) {
- for (size_t i = 0; i < base::size(kLeakTypesTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kLeakTypesTestCases); ++i) {
SCOPED_TRACE(testing::Message() << i);
EXPECT_EQ(kLeakTypesTestCases[i].should_show_cancel_button,
ShouldShowCancelButton(kLeakTypesTestCases[i].leak_type));
diff --git a/components/password_manager/core/browser/login_database_ios_unittest.cc b/components/password_manager/core/browser/login_database_ios_unittest.cc
index 0305aa5..9ad8ff84 100644
--- a/components/password_manager/core/browser/login_database_ios_unittest.cc
+++ b/components/password_manager/core/browser/login_database_ios_unittest.cc
@@ -9,7 +9,6 @@

#include <tuple>

-#include "base/cxx17_backports.h"
#include "base/files/scoped_temp_dir.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/strings/utf_string_conversions.h"
@@ -56,7 +55,7 @@
const void* queryKeys[] = {kSecClass};
const void* queryValues[] = {kSecClassGenericPassword};
ScopedCFTypeRef<CFDictionaryRef> query(CFDictionaryCreate(
- NULL, queryKeys, queryValues, base::size(queryKeys),
+ NULL, queryKeys, queryValues, std::size(queryKeys),
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
OSStatus status = SecItemDelete(query);
// iOS7 returns an error of |errSecItemNotFound| if you try to clear an empty
@@ -94,7 +93,7 @@
std::u16string(),
};

- for (unsigned int i = 0; i < base::size(test_passwords); i++) {
+ for (unsigned int i = 0; i < std::size(test_passwords); i++) {
std::string encrypted;
EXPECT_EQ(LoginDatabase::ENCRYPTION_RESULT_SUCCESS,
login_db_->EncryptedString(test_passwords[i], &encrypted));
@@ -199,7 +198,7 @@
forms[2].date_created = base::Time::FromDoubleT(300);
forms[2].password_value = u"pass2";

- for (size_t i = 0; i < base::size(forms); i++) {
+ for (size_t i = 0; i < std::size(forms); i++) {
std::ignore = login_db_->AddLogin(forms[i]);
}

diff --git a/components/password_manager/core/browser/password_hash_data_unittest.cc b/components/password_manager/core/browser/password_hash_data_unittest.cc
index 928697e..5e7bb995 100644
--- a/components/password_manager/core/browser/password_hash_data_unittest.cc
+++ b/components/password_manager/core/browser/password_hash_data_unittest.cc
@@ -4,7 +4,6 @@

#include "components/password_manager/core/browser/password_hash_data.h"

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"

@@ -20,12 +19,12 @@
UINT64_C(0x3645af77f),
};

- static_assert(base::size(kPlainText) == base::size(kSalt),
+ static_assert(std::size(kPlainText) == std::size(kSalt),
"Arrays must have the same size");
- static_assert(base::size(kPlainText) == base::size(kExpectedHash),
+ static_assert(std::size(kPlainText) == std::size(kExpectedHash),
"Arrays must have the same size");

- for (size_t i = 0; i < base::size(kPlainText); ++i) {
+ for (size_t i = 0; i < std::size(kPlainText); ++i) {
SCOPED_TRACE(i);
std::u16string text = base::UTF8ToUTF16(kPlainText[i]);
EXPECT_EQ(kExpectedHash[i], CalculatePasswordHash(text, kSalt[i]));
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
index 816c836..7078aca 100644
--- a/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_reuse_detection_manager_unittest.cc
@@ -4,7 +4,6 @@

#include "components/password_manager/core/browser/password_reuse_detection_manager.h"

-#include "base/cxx17_backports.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/simple_test_clock.h"
@@ -78,7 +77,7 @@
.WillRepeatedly(testing::Return(&reuse_manager_));
PasswordReuseDetectionManager manager(&client_);

- for (size_t test = 0; test < base::size(gurls); ++test) {
+ for (size_t test = 0; test < std::size(gurls); ++test) {
manager.DidNavigateMainFrame(gurls[test]);
for (size_t i = 0; i < input[test].size(); ++i) {
std::u16string expected_input = input[test].substr(0, i + 1);
@@ -190,7 +189,7 @@
.WillRepeatedly(testing::Return(&reuse_manager_));
PasswordReuseDetectionManager manager(&client_);

- for (size_t test = 0; test < base::size(gurls); ++test) {
+ for (size_t test = 0; test < std::size(gurls); ++test) {
manager.DidNavigateMainFrame(gurls[test]);
std::u16string expected_input = input[test];
if (expected_input.size() > kMaxNumberOfCharactersToStore)
diff --git a/components/password_manager/core/browser/password_sync_util_unittest.cc b/components/password_manager/core/browser/password_sync_util_unittest.cc
index 03fa0dc..db4f31b 100644
--- a/components/password_manager/core/browser/password_sync_util_unittest.cc
+++ b/components/password_manager/core/browser/password_sync_util_unittest.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
@@ -62,7 +61,7 @@
nullptr},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "i=" << i);
SetSyncingPasswords(kTestCases[i].password_sync ==
TestCase::SYNCING_PASSWORDS);
@@ -93,7 +92,7 @@
true},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "i=" << i);
SetSyncingPasswords(true);
FakeSigninAs(kTestCases[i].fake_sync_username);
@@ -117,7 +116,7 @@
{"sync...@example.org", "non_sy...@example.org", false},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(testing::Message() << "i=" << i);
if (kTestCases[i].fake_sync_email.empty()) {
EXPECT_EQ(kTestCases[i].expected_result,
diff --git a/components/password_manager/core/browser/votes_uploader.cc b/components/password_manager/core/browser/votes_uploader.cc
index e945749..39b9fa7 100644
--- a/components/password_manager/core/browser/votes_uploader.cc
+++ b/components/password_manager/core/browser/votes_uploader.cc
@@ -189,7 +189,7 @@
// Returns a uniformly distributed random symbol from the set of random symbols
// defined by the string |kSpecialSymbols|.
int GetRandomSpecialSymbol() {
- return kSpecialSymbols[base::RandGenerator(base::size(kSpecialSymbols))];
+ return kSpecialSymbols[base::RandGenerator(std::size(kSpecialSymbols))];
}

// Returns a random special symbol used in |password|.
diff --git a/components/password_manager/ios/account_select_fill_data_unittest.cc b/components/password_manager/ios/account_select_fill_data_unittest.cc
index 4f70b91..746fde8 100644
--- a/components/password_manager/ios/account_select_fill_data_unittest.cc
+++ b/components/password_manager/ios/account_select_fill_data_unittest.cc
@@ -4,7 +4,6 @@

#include "components/password_manager/ios/account_select_fill_data.h"

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/password_form_fill_data.h"
#include "components/password_manager/ios/test_helpers.h"
@@ -37,7 +36,7 @@
class AccountSelectFillDataTest : public PlatformTest {
public:
AccountSelectFillDataTest() {
- for (size_t i = 0; i < base::size(form_data_); ++i) {
+ for (size_t i = 0; i < std::size(form_data_); ++i) {
SetPasswordFormFillData(
kUrl, kFormNames[i], kFormUniqueIDs[i], kUsernameElements[i],
kUsernameUniqueIDs[i], kUsernames[i], kPasswordElements[i],
@@ -176,7 +175,7 @@
account_select_fill_data.Add(form_data_[1]);

for (bool is_password_field : {false, true}) {
- for (size_t form_i = 0; form_i < base::size(form_data_); ++form_i) {
+ for (size_t form_i = 0; form_i < std::size(form_data_); ++form_i) {
const auto& form_data = form_data_[form_i];
// Suggestions should be shown on any password field on the form. So in
// case of clicking on a password field it is taken an id different from
diff --git a/components/payments/core/strings_util.cc b/components/payments/core/strings_util.cc
index e6d9389..e8c4321 100644
--- a/components/payments/core/strings_util.cc
+++ b/components/payments/core/strings_util.cc
@@ -4,8 +4,6 @@

#include "components/payments/core/strings_util.h"

-
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "components/autofill/core/browser/data_model/autofill_profile.h"
#include "components/autofill/core/browser/field_types.h"
@@ -29,8 +27,8 @@
autofill::ADDRESS_HOME_SORTING_CODE,
};

- return profile.ConstructInferredLabel(kLabelFields, base::size(kLabelFields),
- base::size(kLabelFields), locale);
+ return profile.ConstructInferredLabel(kLabelFields, std::size(kLabelFields),
+ std::size(kLabelFields), locale);
}

std::u16string GetShippingAddressSelectorInfoMessage(
diff --git a/components/pdf/renderer/pdf_accessibility_tree_browsertest.cc b/components/pdf/renderer/pdf_accessibility_tree_browsertest.cc
index 51d8a99..92adf23 100644
--- a/components/pdf/renderer/pdf_accessibility_tree_browsertest.cc
+++ b/components/pdf/renderer/pdf_accessibility_tree_browsertest.cc
@@ -985,7 +985,7 @@
EXPECT_TRUE(listbox_node->HasState(ax::mojom::State::kMultiselectable));
EXPECT_TRUE(listbox_node->HasState(ax::mojom::State::kFocusable));
EXPECT_EQ(kExpectedBounds[0], listbox_node->data().relative_bounds.bounds);
- ASSERT_EQ(base::size(kExpectedOptions[0]), listbox_node->children().size());
+ ASSERT_EQ(std::size(kExpectedOptions[0]), listbox_node->children().size());
const std::vector<ui::AXNode*>& listbox_child_nodes =
listbox_node->children();
for (size_t i = 0; i < listbox_child_nodes.size(); i++) {
@@ -1017,7 +1017,7 @@
EXPECT_FALSE(listbox_node->HasState(ax::mojom::State::kMultiselectable));
EXPECT_TRUE(listbox_node->HasState(ax::mojom::State::kFocusable));
EXPECT_EQ(kExpectedBounds[1], listbox_node->data().relative_bounds.bounds);
- ASSERT_EQ(base::size(kExpectedOptions[1]), listbox_node->children().size());
+ ASSERT_EQ(std::size(kExpectedOptions[1]), listbox_node->children().size());
const std::vector<ui::AXNode*>& listbox_child_nodes =
listbox_node->children();
for (size_t i = 0; i < listbox_child_nodes.size(); i++) {
@@ -1200,7 +1200,7 @@
combobox_popup_node->HasState(ax::mojom::State::kMultiselectable));
EXPECT_EQ(kExpectedBounds[0],
combobox_popup_node->data().relative_bounds.bounds);
- ASSERT_EQ(base::size(kExpectedOptions[0]),
+ ASSERT_EQ(std::size(kExpectedOptions[0]),
combobox_popup_node->children().size());
const std::vector<ui::AXNode*>& popup_child_nodes =
combobox_popup_node->children();
@@ -1259,7 +1259,7 @@
combobox_popup_node->data().GetRestriction());
EXPECT_EQ(kExpectedBounds[1],
combobox_popup_node->data().relative_bounds.bounds);
- ASSERT_EQ(base::size(kExpectedOptions[1]),
+ ASSERT_EQ(std::size(kExpectedOptions[1]),
combobox_popup_node->children().size());
const std::vector<ui::AXNode*>& popup_child_nodes =
combobox_popup_node->children();
diff --git a/components/permissions/permission_auditing_database_unittest.cc b/components/permissions/permission_auditing_database_unittest.cc
index e24eb28c..63a8c41 100644
--- a/components/permissions/permission_auditing_database_unittest.cc
+++ b/components/permissions/permission_auditing_database_unittest.cc
@@ -8,7 +8,6 @@

#include "base/bind.h"
#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/strings/stringprintf.h"
@@ -118,14 +117,14 @@
private:
std::vector<PermissionUsageSession> GeneratePermissionSessions() {
std::vector<PermissionUsageSession> sessions;
- for (size_t i = 0; i < base::size(test_times_); ++i) {
- for (size_t j = i + 1; j <= base::size(test_times_); ++j) {
+ for (size_t i = 0; i < std::size(test_times_); ++i) {
+ for (size_t j = i + 1; j <= std::size(test_times_); ++j) {
for (bool had_user_activation : {false, true}) {
for (bool was_foreground : {false, true}) {
for (bool had_focus : {false, true}) {
base::Time start = test_times_[i];
- base::Time end = (j == base::size(test_times_)) ? test_times_[i]
- : test_times_[j];
+ base::Time end = (j == std::size(test_times_)) ? test_times_[i]
+ : test_times_[j];
sessions.push_back({.usage_start = start,
.usage_end = end,
.had_user_activation = had_user_activation,
@@ -199,12 +198,12 @@
.had_focus = false}));
}
EXPECT_EQ(GetPermissionUsageHistory(kTestTypes[0], kTestUrl1).size(),
- base::size(test_times_));
- for (size_t i = 0; i < base::size(test_times_); ++i) {
+ std::size(test_times_));
+ for (size_t i = 0; i < std::size(test_times_); ++i) {
EXPECT_EQ(GetPermissionUsageHistory(kTestTypes[0], kTestUrl1,
test_times_[i] + base::Microseconds(2))
.size(),
- base::size(test_times_) - i - 1);
+ std::size(test_times_) - i - 1);
}
}

@@ -241,7 +240,7 @@
}

TEST_F(PermissionAuditingDatabaseTest, DeleteSessionsBetween) {
- size_t current_size = base::size(test_times_);
+ size_t current_size = std::size(test_times_);
StoreSessionForEachTime();
for (const auto& time : test_times_) {
ASSERT_TRUE(db().DeleteSessionsBetween(time, time));
@@ -263,10 +262,10 @@
DeleteSessionsBetweenWithUnspecifiedStartTime) {
StoreSessionForEachTime();
ASSERT_TRUE(db().DeleteSessionsBetween(
- base::Time(), test_times_[base::size(test_times_) - 2]));
+ base::Time(), test_times_[std::size(test_times_) - 2]));
ASSERT_EQ(GetPermissionUsageHistory(kTestTypes[0], kTestUrl1).size(), 1u);
ASSERT_TRUE(db().DeleteSessionsBetween(
- base::Time(), test_times_[base::size(test_times_) - 1]));
+ base::Time(), test_times_[std::size(test_times_) - 1]));
EXPECT_THAT(GetPermissionUsageHistory(kTestTypes[0], kTestUrl1), IsEmpty());
}

@@ -274,7 +273,7 @@
DeleteSessionsBetweenWithUnspecifiedStartAndEndTime) {
StoreSessionForEachTime();
ASSERT_EQ(GetPermissionUsageHistory(kTestTypes[0], kTestUrl1).size(),
- base::size(test_times_));
+ std::size(test_times_));
ASSERT_TRUE(db().DeleteSessionsBetween(base::Time(), base::Time()));
EXPECT_THAT(GetPermissionUsageHistory(kTestTypes[0], kTestUrl1), IsEmpty());
}
diff --git a/components/permissions/permission_auditing_service_unittest.cc b/components/permissions/permission_auditing_service_unittest.cc
index 5f8ea91..b009f3e 100644
--- a/components/permissions/permission_auditing_service_unittest.cc
+++ b/components/permissions/permission_auditing_service_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
@@ -136,14 +135,14 @@
};

TEST_F(PermissionAuditingServiceTest, StorePermissionUsage) {
- std::vector<url::Origin> origins(base::size(kTestOrigins));
- std::vector<PermissionUsageSession> sessions(base::size(kTestOrigins));
- for (size_t i = 0; i < base::size(kTestOrigins); ++i) {
+ std::vector<url::Origin> origins(std::size(kTestOrigins));
+ std::vector<PermissionUsageSession> sessions(std::size(kTestOrigins));
+ for (size_t i = 0; i < std::size(kTestOrigins); ++i) {
origins[i] = url::Origin::Create(GURL(kTestOrigins[i]));
sessions[i] = BuildUsageSession(kTestTypes[i % 2], origins[i]);
service().StorePermissionUsage(sessions[i]);
}
- for (size_t i = 0; i < base::size(kTestOrigins); ++i) {
+ for (size_t i = 0; i < std::size(kTestOrigins); ++i) {
EXPECT_THAT(
GetPermissionUsageHistory(kTestTypes[i % 2], origins[i], base::Time()),
ElementsAre(sessions[i]));
@@ -151,8 +150,8 @@
}

TEST_F(PermissionAuditingServiceTest, GetLastPermissionUsageTime) {
- std::vector<url::Origin> origins(base::size(kTestOrigins));
- for (size_t i = 0; i < base::size(kTestOrigins); ++i) {
+ std::vector<url::Origin> origins(std::size(kTestOrigins));
+ for (size_t i = 0; i < std::size(kTestOrigins); ++i) {
origins[i] = url::Origin::Create(GURL(kTestOrigins[i]));
service().StorePermissionUsage(
BuildUsageSession(kTestTypes[0], origins[i]));
@@ -163,8 +162,8 @@
}

TEST_F(PermissionAuditingServiceTest, UpdateEndTime) {
- std::vector<url::Origin> origins(base::size(kTestOrigins));
- for (size_t i = 0; i < base::size(kTestOrigins); ++i) {
+ std::vector<url::Origin> origins(std::size(kTestOrigins));
+ for (size_t i = 0; i < std::size(kTestOrigins); ++i) {
origins[i] = url::Origin::Create(GURL(kTestOrigins[i]));
service().StorePermissionUsage(
BuildUsageSession(kTestTypes[1], origins[i]));
diff --git a/components/policy/core/browser/browser_policy_connector.cc b/components/policy/core/browser/browser_policy_connector.cc
index 00ed00f..56f8f7f 100644
--- a/components/policy/core/browser/browser_policy_connector.cc
+++ b/components/policy/core/browser/browser_policy_connector.cc
@@ -5,6 +5,7 @@
#include "components/policy/core/browser/browser_policy_connector.h"

#include <stddef.h>
+
#include <algorithm>
#include <memory>
#include <string>
@@ -12,7 +13,6 @@

#include "base/bind.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -179,7 +179,7 @@
}
const std::u16string domain = base::UTF8ToUTF16(
gaia::ExtractDomainName(gaia::CanonicalizeEmail(username)));
- for (size_t i = 0; i < base::size(kNonManagedDomainPatterns); i++) {
+ for (size_t i = 0; i < std::size(kNonManagedDomainPatterns); i++) {
std::u16string pattern = base::WideToUTF16(kNonManagedDomainPatterns[i]);
if (MatchDomain(domain, pattern, i))
return true;
diff --git a/components/policy/core/browser/browser_policy_connector_unittest.cc b/components/policy/core/browser/browser_policy_connector_unittest.cc
index 2f50ae0b..672685a 100644
--- a/components/policy/core/browser/browser_policy_connector_unittest.cc
+++ b/components/policy/core/browser/browser_policy_connector_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.

#include "components/policy/core/browser/browser_policy_connector.h"
-#include "base/cxx17_backports.h"
+
#include "testing/gtest/include/gtest/gtest.h"

namespace policy {
@@ -34,12 +34,12 @@
"us...@hotmail.enterprise.com",
};

- for (unsigned int i = 0; i < base::size(kNonEnterpriseUsers); ++i) {
+ for (unsigned int i = 0; i < std::size(kNonEnterpriseUsers); ++i) {
std::string username(kNonEnterpriseUsers[i]);
EXPECT_TRUE(BrowserPolicyConnector::IsNonEnterpriseUser(username)) <<
"IsNonEnterpriseUser returned false for " << username;
}
- for (unsigned int i = 0; i < base::size(kEnterpriseUsers); ++i) {
+ for (unsigned int i = 0; i < std::size(kEnterpriseUsers); ++i) {
std::string username(kEnterpriseUsers[i]);
EXPECT_FALSE(BrowserPolicyConnector::IsNonEnterpriseUser(username)) <<
"IsNonEnterpriseUser returned true for " << username;
diff --git a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
index d362336..4e6382d 100644
--- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
+++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
@@ -17,7 +17,6 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/compiler_specific.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/json/json_reader.h"
#include "base/memory/ref_counted.h"
@@ -1293,7 +1292,7 @@
expected_namespaces.insert(key);
key.first = dm_protocol::kChromeExtensionPolicyType;
expected_namespaces.insert(key);
- for (size_t i = 0; i < base::size(kExtensions); ++i) {
+ for (size_t i = 0; i < std::size(kExtensions); ++i) {
key.second = kExtensions[i];
em::PolicyData policy_data;
policy_data.set_policy_type(key.first);
diff --git a/components/policy/core/common/cloud/cloud_policy_util.cc b/components/policy/core/common/cloud/cloud_policy_util.cc
index 376f7ca4..79683a6 100644
--- a/components/policy/core/common/cloud/cloud_policy_util.cc
+++ b/components/policy/core/common/cloud/cloud_policy_util.cc
@@ -115,7 +115,7 @@
return std::string();
#elif BUILDFLAG(IS_WIN)
wchar_t computer_name[MAX_COMPUTERNAME_LENGTH + 1] = {0};
- DWORD size = base::size(computer_name);
+ DWORD size = std::size(computer_name);
if (::GetComputerNameW(computer_name, &size)) {
std::string result;
bool conversion_successful = base::WideToUTF8(computer_name, size, &result);
diff --git a/components/policy/core/common/cloud/cloud_policy_validator.cc b/components/policy/core/common/cloud/cloud_policy_validator.cc
index 61fe8cf..874f0a8 100644
--- a/components/policy/core/common/cloud/cloud_policy_validator.cc
+++ b/components/policy/core/common/cloud/cloud_policy_validator.cc
@@ -10,7 +10,6 @@
#include <utility>

#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
@@ -381,7 +380,7 @@
{VALIDATE_VALUES, &CloudPolicyValidatorBase::CheckValues},
};

- for (size_t i = 0; i < base::size(kCheckFunctions); ++i) {
+ for (size_t i = 0; i < std::size(kCheckFunctions); ++i) {
if (validation_flags_ & kCheckFunctions[i].flag) {
status_ = (this->*(kCheckFunctions[i].checkFunction))();
if (status_ != VALIDATION_OK)
diff --git a/components/policy/core/common/cloud/device_management_service_unittest.cc b/components/policy/core/common/cloud/device_management_service_unittest.cc
index e39ce57..fb72500 100644
--- a/components/policy/core/common/cloud/device_management_service_unittest.cc
+++ b/components/policy/core/common/cloud/device_management_service_unittest.cc
@@ -11,7 +11,6 @@

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/metrics/statistics_recorder.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
@@ -50,7 +49,7 @@
// Encoded empty response messages for testing the error code paths.
const char kResponseEmpty[] = "\x08\x00";

-#define PROTO_STRING(name) (std::string(name, base::size(name) - 1))
+#define PROTO_STRING(name) (std::string(name, std::size(name) - 1))

// Some helper constants.
const char kOAuthToken[] = "oauth-token";
diff --git a/components/policy/core/common/cloud/test/policy_builder.cc b/components/policy/core/common/cloud/test/policy_builder.cc
index b35f81b..eb9dcba 100644
--- a/components/policy/core/common/cloud/test/policy_builder.cc
+++ b/components/policy/core/common/cloud/test/policy_builder.cc
@@ -4,7 +4,6 @@

#include "components/policy/core/common/cloud/test/policy_builder.h"

-#include "base/cxx17_backports.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
@@ -206,7 +205,7 @@
}

void PolicyBuilder::SetDefaultSigningKey() {
- raw_signing_key_.assign(kSigningKey, kSigningKey + base::size(kSigningKey));
+ raw_signing_key_.assign(kSigningKey, kSigningKey + std::size(kSigningKey));
}

void PolicyBuilder::UnsetSigningKey() {
@@ -221,7 +220,7 @@

void PolicyBuilder::SetDefaultNewSigningKey() {
raw_new_signing_key_.assign(kNewSigningKey,
- kNewSigningKey + base::size(kNewSigningKey));
+ kNewSigningKey + std::size(kNewSigningKey));
raw_new_signing_key_signature_ = GetTestOtherSigningKeySignature();
}

@@ -232,7 +231,7 @@

void PolicyBuilder::SetDefaultInitialSigningKey() {
raw_new_signing_key_.assign(kSigningKey,
- kSigningKey + base::size(kSigningKey));
+ kSigningKey + std::size(kSigningKey));
raw_new_signing_key_signature_ = GetTestSigningKeySignature();
UnsetSigningKey();
}
@@ -293,7 +292,7 @@
// static
std::unique_ptr<crypto::RSAPrivateKey> PolicyBuilder::CreateTestSigningKey() {
std::vector<uint8_t> raw_signing_key(kSigningKey,
- kSigningKey + base::size(kSigningKey));
+ kSigningKey + std::size(kSigningKey));
return crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(raw_signing_key);
}

@@ -301,7 +300,7 @@
std::unique_ptr<crypto::RSAPrivateKey>
PolicyBuilder::CreateTestOtherSigningKey() {
std::vector<uint8_t> raw_new_signing_key(
- kNewSigningKey, kNewSigningKey + base::size(kNewSigningKey));
+ kNewSigningKey, kNewSigningKey + std::size(kNewSigningKey));
return crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(raw_new_signing_key);
}

diff --git a/components/policy/core/common/config_dir_policy_loader.cc b/components/policy/core/common/config_dir_policy_loader.cc
index e7123ffc..4bf685c 100644
--- a/components/policy/core/common/config_dir_policy_loader.cc
+++ b/components/policy/core/common/config_dir_policy_loader.cc
@@ -95,7 +95,7 @@
base::Time last_modification = base::Time();
base::File::Info info;

- for (size_t i = 0; i < base::size(kConfigDirSuffixes); ++i) {
+ for (size_t i = 0; i < std::size(kConfigDirSuffixes); ++i) {
base::FilePath path(config_dir_.Append(kConfigDirSuffixes[i]));

// Skip if the file doesn't exist, or it isn't a directory.
diff --git a/components/policy/core/common/policy_loader_mac_unittest.cc b/components/policy/core/common/policy_loader_mac_unittest.cc
index a33b682..c8f0ca8 100644
--- a/components/policy/core/common/policy_loader_mac_unittest.cc
+++ b/components/policy/core/common/policy_loader_mac_unittest.cc
@@ -3,14 +3,13 @@
// found in the LICENSE file.

#include "components/policy/core/common/policy_loader_mac.h"
-#include <memory>

#include <CoreFoundation/CoreFoundation.h>

+#include <memory>
#include <utility>

#include "base/callback.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/run_loop.h"
@@ -168,7 +167,7 @@
const char buffer[] = "binary \xde\xad\xbe\xef data";
ScopedCFTypeRef<CFDataRef> invalid_data(
CFDataCreate(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(buffer),
- base::size(buffer)));
+ std::size(buffer)));
ASSERT_TRUE(invalid_data);
prefs_->AddTestItem(name, invalid_data.get(), true);
prefs_->AddTestItem(name, invalid_data.get(), false);
diff --git a/components/policy/core/common/policy_loader_win.cc b/components/policy/core/common/policy_loader_win.cc
index 614c811..856ac6b 100644
--- a/components/policy/core/common/policy_loader_win.cc
+++ b/components/policy/core/common/policy_loader_win.cc
@@ -294,7 +294,7 @@
std::unique_ptr<PolicyBundle> bundle(new PolicyBundle());
PolicyMap* chrome_policy =
&bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
- for (size_t i = 0; i < base::size(kScopes); ++i) {
+ for (size_t i = 0; i < std::size(kScopes); ++i) {
PolicyScope scope = kScopes[i].scope;
PolicyLoadStatusUmaReporter status;
RegistryDict gpo_dict;
@@ -353,7 +353,7 @@
{POLICY_LEVEL_RECOMMENDED, kKeyRecommended},
};

- for (size_t i = 0; i < base::size(k3rdPartyDomains); i++) {
+ for (size_t i = 0; i < std::size(k3rdPartyDomains); i++) {
const char* name = k3rdPartyDomains[i].name;
const PolicyDomain domain = k3rdPartyDomains[i].domain;
const RegistryDict* domain_dict = gpo_dict->GetKey(name);
@@ -373,7 +373,7 @@
Schema schema = *schema_from_map;

// Parse policy.
- for (size_t j = 0; j < base::size(kLevels); j++) {
+ for (size_t j = 0; j < std::size(kLevels); j++) {
const RegistryDict* policy_dict =
component->second->GetKey(kLevels[j].path);
if (!policy_dict)
diff --git a/components/policy/core/common/preg_parser.cc b/components/policy/core/common/preg_parser.cc
index 70a68a7..13bef21 100644
--- a/components/policy/core/common/preg_parser.cc
+++ b/components/policy/core/common/preg_parser.cc
@@ -15,7 +15,6 @@
#include <utility>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
@@ -258,7 +257,7 @@

std::string data_utf8;
std::string action_trigger(base::ToLowerASCII(
- value_name.substr(base::size(kActionTriggerPrefix) - 1)));
+ value_name.substr(std::size(kActionTriggerPrefix) - 1)));
if (action_trigger == kActionTriggerDeleteValues) {
if (DecodePRegStringValue(data, &data_utf8)) {
for (const std::string& value_str :
@@ -276,8 +275,8 @@
}
} else if (base::StartsWith(action_trigger, kActionTriggerDel,
base::CompareCase::SENSITIVE)) {
- dict->RemoveValue(value_name.substr(base::size(kActionTriggerPrefix) - 1 +
- base::size(kActionTriggerDel) - 1));
+ dict->RemoveValue(value_name.substr(std::size(kActionTriggerPrefix) - 1 +
+ std::size(kActionTriggerDel) - 1));
} else if (base::StartsWith(action_trigger, kActionTriggerDelVals,
base::CompareCase::SENSITIVE)) {
// Delete all values.
@@ -333,7 +332,7 @@
}

// Check the header.
- const int kHeaderSize = base::size(kPRegFileHeader);
+ const int kHeaderSize = std::size(kPRegFileHeader);
if (!preg_data || preg_data_size < kHeaderSize ||
memcmp(kPRegFileHeader, preg_data, kHeaderSize) != 0) {
LOG(ERROR) << "Bad PReg " << debug_name;
diff --git a/components/policy/core/common/schema.cc b/components/policy/core/common/schema.cc
index 8eeafe4..32f578a 100644
--- a/components/policy/core/common/schema.cc
+++ b/components/policy/core/common/schema.cc
@@ -99,7 +99,7 @@
{schema::kString, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kSchemaTypesToValueTypesEnd =
- kSchemaTypesToValueTypes + base::size(kSchemaTypesToValueTypes);
+ kSchemaTypesToValueTypes + std::size(kSchemaTypesToValueTypes);

// Allowed attributes and types for type 'array'. These are ordered
// alphabetically to perform binary search.
@@ -112,7 +112,7 @@
{schema::kType, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kAttributesAndTypesForArrayEnd =
- kAttributesAndTypesForArray + base::size(kAttributesAndTypesForArray);
+ kAttributesAndTypesForArray + std::size(kAttributesAndTypesForArray);

// Allowed attributes and types for type 'boolean'. These are ordered
// alphabetically to perform binary search.
@@ -124,7 +124,7 @@
{schema::kType, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kAttributesAndTypesForBooleanEnd =
- kAttributesAndTypesForBoolean + base::size(kAttributesAndTypesForBoolean);
+ kAttributesAndTypesForBoolean + std::size(kAttributesAndTypesForBoolean);

// Allowed attributes and types for type 'integer'. These are ordered
// alphabetically to perform binary search.
@@ -139,7 +139,7 @@
{schema::kType, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kAttributesAndTypesForIntegerEnd =
- kAttributesAndTypesForInteger + base::size(kAttributesAndTypesForInteger);
+ kAttributesAndTypesForInteger + std::size(kAttributesAndTypesForInteger);

// Allowed attributes and types for type 'number'. These are ordered
// alphabetically to perform binary search.
@@ -151,7 +151,7 @@
{schema::kType, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kAttributesAndTypesForNumberEnd =
- kAttributesAndTypesForNumber + base::size(kAttributesAndTypesForNumber);
+ kAttributesAndTypesForNumber + std::size(kAttributesAndTypesForNumber);

// Allowed attributes and types for type 'object'. These are ordered
// alphabetically to perform binary search.
@@ -167,7 +167,7 @@
{schema::kType, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kAttributesAndTypesForObjectEnd =
- kAttributesAndTypesForObject + base::size(kAttributesAndTypesForObject);
+ kAttributesAndTypesForObject + std::size(kAttributesAndTypesForObject);

// Allowed attributes and types for $ref. These are ordered alphabetically to
// perform binary search.
@@ -177,7 +177,7 @@
{schema::kTitle, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kAttributesAndTypesForRefEnd =
- kAttributesAndTypesForRef + base::size(kAttributesAndTypesForRef);
+ kAttributesAndTypesForRef + std::size(kAttributesAndTypesForRef);

// Allowed attributes and types for type 'string'. These are ordered
// alphabetically to perform binary search.
@@ -191,7 +191,7 @@
{schema::kType, base::Value::Type::STRING},
};
const SchemaKeyToValueType* kAttributesAndTypesForStringEnd =
- kAttributesAndTypesForString + base::size(kAttributesAndTypesForString);
+ kAttributesAndTypesForString + std::size(kAttributesAndTypesForString);

// Helper for std::lower_bound.
bool CompareToString(const SchemaKeyToValueType& entry,
diff --git a/components/policy/core/common/schema_unittest.cc b/components/policy/core/common/schema_unittest.cc
index 42185502..ff5bf4b 100644
--- a/components/policy/core/common/schema_unittest.cc
+++ b/components/policy/core/common/schema_unittest.cc
@@ -9,7 +9,6 @@
#include <memory>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/policy/core/common/schema_internal.h"
@@ -424,7 +423,7 @@
{ "StringWithPattern", base::Value::Type::STRING },
};
Schema::Iterator it = schema.GetPropertiesIterator();
- for (size_t i = 0; i < base::size(kExpectedProperties); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedProperties); ++i) {
ASSERT_FALSE(it.IsAtEnd());
EXPECT_STREQ(kExpectedProperties[i].expected_key, it.key());
ASSERT_TRUE(it.schema().valid());
@@ -488,7 +487,7 @@
{ "aba", base::Value::Type::INTEGER },
{ "abab", base::Value::Type::STRING },
};
- for (size_t i = 0; i < base::size(kExpectedKeys); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedKeys); ++i) {
Schema sub = schema.GetKnownProperty(kExpectedKeys[i].expected_key);
ASSERT_TRUE(sub.valid());
EXPECT_EQ(kExpectedKeys[i].expected_type, sub.type());
@@ -614,7 +613,7 @@
};

Schema::Iterator it = schema.GetPropertiesIterator();
- for (size_t i = 0; i < base::size(kExpectedProperties); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedProperties); ++i) {
ASSERT_FALSE(it.IsAtEnd());
EXPECT_STREQ(kExpectedProperties[i].key, it.key());
Schema sub = it.schema();
diff --git a/components/prefs/json_pref_store_unittest.cc b/components/prefs/json_pref_store_unittest.cc
index 6deeb68..d1c432c 100644
--- a/components/prefs/json_pref_store_unittest.cc
+++ b/components/prefs/json_pref_store_unittest.cc
@@ -11,7 +11,6 @@

#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
@@ -211,7 +210,7 @@
TEST_P(JsonPrefStoreTest, InvalidFile) {
base::FilePath invalid_file = temp_dir_.GetPath().AppendASCII("invalid.json");
ASSERT_LT(0, base::WriteFile(invalid_file, kInvalidJson,
- base::size(kInvalidJson) - 1));
+ std::size(kInvalidJson) - 1));

auto pref_store = base::MakeRefCounted<JsonPrefStore>(invalid_file);
EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_JSON_PARSE,
@@ -302,7 +301,7 @@
TEST_P(JsonPrefStoreTest, Basic) {
base::FilePath input_file = temp_dir_.GetPath().AppendASCII("write.json");
ASSERT_LT(0,
- base::WriteFile(input_file, kReadJson, base::size(kReadJson) - 1));
+ base::WriteFile(input_file, kReadJson, std::size(kReadJson) - 1));

// Test that the persistent value can be loaded.
ASSERT_TRUE(PathExists(input_file));
@@ -329,7 +328,7 @@
TEST_P(JsonPrefStoreTest, BasicAsync) {
base::FilePath input_file = temp_dir_.GetPath().AppendASCII("write.json");
ASSERT_LT(0,
- base::WriteFile(input_file, kReadJson, base::size(kReadJson) - 1));
+ base::WriteFile(input_file, kReadJson, std::size(kReadJson) - 1));

// Test that the persistent value can be loaded.
auto pref_store = base::MakeRefCounted<JsonPrefStore>(input_file);
@@ -436,7 +435,7 @@
TEST_P(JsonPrefStoreTest, ReadWithInterceptor) {
base::FilePath input_file = temp_dir_.GetPath().AppendASCII("write.json");
ASSERT_LT(0,
- base::WriteFile(input_file, kReadJson, base::size(kReadJson) - 1));
+ base::WriteFile(input_file, kReadJson, std::size(kReadJson) - 1));

std::unique_ptr<InterceptingPrefFilter> intercepting_pref_filter(
new InterceptingPrefFilter());
@@ -478,7 +477,7 @@
TEST_P(JsonPrefStoreTest, ReadAsyncWithInterceptor) {
base::FilePath input_file = temp_dir_.GetPath().AppendASCII("write.json");
ASSERT_LT(0,
- base::WriteFile(input_file, kReadJson, base::size(kReadJson) - 1));
+ base::WriteFile(input_file, kReadJson, std::size(kReadJson) - 1));

std::unique_ptr<InterceptingPrefFilter> intercepting_pref_filter(
new InterceptingPrefFilter());
@@ -880,7 +879,7 @@
TEST_F(JsonPrefStoreCallbackTest, TestSerializeDataCallbacks) {
base::FilePath input_file = temp_dir_.GetPath().AppendASCII("write.json");
ASSERT_LT(0,
- base::WriteFile(input_file, kReadJson, base::size(kReadJson) - 1));
+ base::WriteFile(input_file, kReadJson, std::size(kReadJson) - 1));

std::unique_ptr<InterceptingPrefFilter> intercepting_pref_filter(
new InterceptingPrefFilter(write_callback_observer_.GetCallbackPair()));
diff --git a/components/prefs/pref_service_unittest.cc b/components/prefs/pref_service_unittest.cc
index 8ba3c88..47c223c 100644
--- a/components/prefs/pref_service_unittest.cc
+++ b/components/prefs/pref_service_unittest.cc
@@ -8,7 +8,6 @@
#include <string>

#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/prefs/json_pref_store.h"
@@ -371,7 +370,7 @@
PrefRegistry::LOSSY_PREF | kCustomRegistrationFlag,
WriteablePrefStore::LOSSY_PREF_WRITE_FLAG}};

- for (size_t i = 0; i < base::size(kRegistrationToWriteFlags); ++i) {
+ for (size_t i = 0; i < std::size(kRegistrationToWriteFlags); ++i) {
RegistrationToWriteFlags entry = kRegistrationToWriteFlags[i];
registry->RegisterDictionaryPref(entry.pref_name,
entry.registration_flags);
diff --git a/components/printing/test/print_render_frame_helper_browsertest.cc b/components/printing/test/print_render_frame_helper_browsertest.cc
index 8dfd56e..9c4ca57 100644
--- a/components/printing/test/print_render_frame_helper_browsertest.cc
+++ b/components/printing/test/print_render_frame_helper_browsertest.cc
@@ -11,7 +11,6 @@
#include <utility>

#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_piece.h"
@@ -884,7 +883,7 @@
bool baseline = false;

EXPECT_TRUE(printer());
- for (size_t i = 0; i < base::size(kTestPages); ++i) {
+ for (size_t i = 0; i < std::size(kTestPages); ++i) {
// Load an HTML page and print it.
LoadHTML(kTestPages[i].page);
OnPrintPages();
diff --git a/components/proxy_config/proxy_policy_handler.cc b/components/proxy_config/proxy_policy_handler.cc
index 233a89c5..c31cbad 100644
--- a/components/proxy_config/proxy_policy_handler.cc
+++ b/components/proxy_config/proxy_policy_handler.cc
@@ -7,7 +7,6 @@
#include <stddef.h>

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
@@ -77,7 +76,7 @@
policy::PolicySource inherited_source =
policy::POLICY_SOURCE_ENTERPRISE_DEFAULT;
base::Value proxy_settings(base::Value::Type::DICTIONARY);
- for (size_t i = 0; i < base::size(kDeprecatedProxyPolicies); ++i) {
+ for (size_t i = 0; i < std::size(kDeprecatedProxyPolicies); ++i) {
const PolicyMap::Entry* entry = policies.Get(kDeprecatedProxyPolicies[i]);
if (!entry)
continue;
@@ -150,7 +149,7 @@
return true;

bool is_valid_mode = false;
- for (size_t i = 0; i != base::size(kProxyModeValidationMap); ++i) {
+ for (size_t i = 0; i != std::size(kProxyModeValidationMap); ++i) {
const ProxyModeValidationEntry& entry = kProxyModeValidationMap[i];
if (entry.mode_value != mode_value)
continue;
diff --git a/components/proxy_config/proxy_prefs.cc b/components/proxy_config/proxy_prefs.cc
index 3bd430d..4659b64 100644
--- a/components/proxy_config/proxy_prefs.cc
+++ b/components/proxy_config/proxy_prefs.cc
@@ -5,7 +5,6 @@
#include "components/proxy_config/proxy_prefs.h"

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"

namespace ProxyPrefs {
@@ -20,7 +19,7 @@
kFixedServersProxyModeName,
kSystemProxyModeName };

-static_assert(base::size(kProxyModeNames) == kModeCount,
+static_assert(std::size(kProxyModeNames) == kModeCount,
"kProxyModeNames must have kModeCount elements");

} // namespace
diff --git a/components/query_parser/query_parser_unittest.cc b/components/query_parser/query_parser_unittest.cc
index f82ab75..8eb82d97 100644
--- a/components/query_parser/query_parser_unittest.cc
+++ b/components/query_parser/query_parser_unittest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/query_parser/query_parser.h"
+
#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"
-#include "components/query_parser/query_parser.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace query_parser {
@@ -80,7 +80,7 @@
{ "foo \"bar baz\" blah", 4 },
};

- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
std::u16string query_string;
EXPECT_EQ(
data[i].expected_word_count,
@@ -116,7 +116,7 @@
{ "\"foo blah\"", "\"foo blah\"", true, 1, 9, 0, 0 },
{ "foo blah", "\"foo bar blah\"", true, 1, 4, 9, 13 },
};
- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
query_parser::QueryNodeVector query_nodes;
QueryParser::ParseQueryNodes(base::UTF8ToUTF16(data[i].query),
MatchingAlgorithm::DEFAULT, &query_nodes);
@@ -152,7 +152,7 @@
{ "\"foo bar\"", "foo", "bar", "", 2 },
{ "\"foo bar\" a", "foo", "bar", "a", 3 },
};
- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
std::vector<std::u16string> results;
QueryParser::ParseQueryWords(base::UTF8ToUTF16(data[i].text),
MatchingAlgorithm::DEFAULT, &results);
@@ -194,7 +194,7 @@
{"\"foo blah\"", "\"foo blah\"", true},
{"foo blah", "\"foo bar blah\"", true},
};
- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
SCOPED_TRACE(::testing::Message()
<< " Testing case i=" << i << " query=" << data[i].query
<< " find_in_text=" << data[i].find_in_text);
diff --git a/components/query_parser/snippet_unittest.cc b/components/query_parser/snippet_unittest.cc
index 67efdbb..74fa7f6 100644
--- a/components/query_parser/snippet_unittest.cc
+++ b/components/query_parser/snippet_unittest.cc
@@ -8,7 +8,6 @@

#include <algorithm>

-#include "base/cxx17_backports.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -242,7 +241,7 @@
{ "0 0 1 2 0 0 1 1", 1, { 1, 3 } },
{ "0 0 1 1 0 0 5 2 0 0 10 1 0 0 3 10", 2, { 1, 2, 3, 13 } },
};
- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
Snippet::MatchPositions matches;
Snippet::ExtractMatchPositions(data[i].offsets_string, "0", &matches);
EXPECT_EQ(data[i].expected_match_count, matches.size());
diff --git a/components/rlz/rlz_tracker_unittest.cc b/components/rlz/rlz_tracker_unittest.cc
index 34df405..8bf912a 100644
--- a/components/rlz/rlz_tracker_unittest.cc
+++ b/components/rlz/rlz_tracker_unittest.cc
@@ -6,7 +6,6 @@

#include <memory>

-#include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
@@ -332,7 +331,7 @@

void RlzLibTest::ExpectEventRecorded(const char* event_name, bool expected) {
char cgi[rlz_lib::kMaxCgiLength];
- GetProductEventsAsCgi(rlz_lib::CHROME, cgi, base::size(cgi));
+ GetProductEventsAsCgi(rlz_lib::CHROME, cgi, std::size(cgi));
if (expected) {
EXPECT_STR_CONTAINS(cgi, event_name);
} else {
diff --git a/components/safe_browsing/core/browser/db/v4_protocol_manager_util_unittest.cc b/components/safe_browsing/core/browser/db/v4_protocol_manager_util_unittest.cc
index 3ca282e7..a36e312 100644
--- a/components/safe_browsing/core/browser/db/v4_protocol_manager_util_unittest.cc
+++ b/components/safe_browsing/core/browser/db/v4_protocol_manager_util_unittest.cc
@@ -212,7 +212,7 @@
{"javascript:alert()", "", "", ""},
{"mailto:a...@example.com", "", "", ""},
};
- for (size_t i = 0; i < base::size(tests); ++i) {
+ for (size_t i = 0; i < std::size(tests); ++i) {
SCOPED_TRACE(base::StringPrintf("Test: %s", tests[i].input_url));
GURL url(tests[i].input_url);

diff --git a/components/safe_browsing/core/browser/db/v4_store.cc b/components/safe_browsing/core/browser/db/v4_store.cc
index 939dc1a..9dd657e 100644
--- a/components/safe_browsing/core/browser/db/v4_store.cc
+++ b/components/safe_browsing/core/browser/db/v4_store.cc
@@ -9,7 +9,6 @@

#include "base/base64.h"
#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
@@ -659,7 +658,7 @@
if (checksum[i] != expected_checksum[i]) {
#if DCHECK_IS_ON()
std::string checksum_b64, expected_checksum_b64;
- base::Base64Encode(base::StringPiece(checksum, base::size(checksum)),
+ base::Base64Encode(base::StringPiece(checksum, std::size(checksum)),
&checksum_b64);
base::Base64Encode(expected_checksum, &expected_checksum_b64);
DVLOG(1) << "Failure: Checksum mismatch: calculated: " << checksum_b64
@@ -838,7 +837,7 @@
store_path_);
#if DCHECK_IS_ON()
std::string checksum_b64, expected_checksum_b64;
- base::Base64Encode(base::StringPiece(checksum, base::size(checksum)),
+ base::Base64Encode(base::StringPiece(checksum, std::size(checksum)),
&checksum_b64);
base::Base64Encode(expected_checksum_, &expected_checksum_b64);
DVLOG(1) << "Failure: Checksum mismatch: calculated: " << checksum_b64
diff --git a/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc b/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc
index 5617781..4a84d60 100644
--- a/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc
+++ b/components/safe_browsing/core/browser/realtime/url_lookup_service_unittest.cc
@@ -318,7 +318,7 @@
{"http://user:pa...@example.com/", "http://example.com/"},
{"http://%123:b...@example.com/", "http://example.com/"},
{"http://example.com/abc#123", "http://example.com/abc#123"}};
- for (size_t i = 0; i < base::size(sanitize_url_cases); i++) {
+ for (size_t i = 0; i < std::size(sanitize_url_cases); i++) {
GURL url(sanitize_url_cases[i].url);
auto result = FillRequestProto(url, last_committed_url_, is_mainframe_,
/*is_sampled_report=*/i % 2 == 0);
diff --git a/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc b/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc
index bb94f7da..22d06b3 100644
--- a/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc
+++ b/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc
@@ -70,7 +70,7 @@

protected:
GURL GetNewURL() {
- CHECK(next_url_ < base::size(kURLs));
+ CHECK(next_url_ < std::size(kURLs));
return GURL(kURLs[next_url_++]);
}

diff --git a/components/safe_search_api/url_checker_unittest.cc b/components/safe_search_api/url_checker_unittest.cc
index c0549a3..6b0a99f 100644
--- a/components/safe_search_api/url_checker_unittest.cc
+++ b/components/safe_search_api/url_checker_unittest.cc
@@ -12,7 +12,6 @@

#include "base/bind.h"
#include "base/callback.h"
-#include "base/cxx17_backports.h"
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
@@ -68,7 +67,7 @@

protected:
GURL GetNewURL() {
- CHECK(next_url_ < base::size(kURLs));
+ CHECK(next_url_ < std::size(kURLs));
return GURL(kURLs[next_url_++]);
}

diff --git a/components/search_engines/default_search_policy_handler.cc b/components/search_engines/default_search_policy_handler.cc
index 8f82e27..bcb6d75 100644
--- a/components/search_engines/default_search_policy_handler.cc
+++ b/components/search_engines/default_search_policy_handler.cc
@@ -201,7 +201,7 @@
prefs::kDefaultSearchProviderContextMenuAccessAllowed, dict.get());

size_t policyCount = 14;
- CHECK_EQ(policyCount, base::size(kDefaultSearchPolicyDataMap));
+ CHECK_EQ(policyCount, std::size(kDefaultSearchPolicyDataMap));

// Set the fields which are not specified by the policy to default values.
dict->SetString(DefaultSearchManager::kID,
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc
index 2fc0c05..e38343c 100644
--- a/components/search_engines/template_url_prepopulate_data.cc
+++ b/components/search_engines/template_url_prepopulate_data.cc
@@ -4,7 +4,6 @@

#include "components/search_engines/template_url_prepopulate_data.h"

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "components/country_codes/country_codes.h"
@@ -1011,9 +1010,9 @@
switch (country_id) {
#define UNHANDLED_COUNTRY(code1, code2) \
case country_codes::CountryCharsToCountryID((#code1)[0], (#code2)[0]):
-#define END_UNHANDLED_COUNTRIES(code1, code2) \
- engines = engines_##code1##code2; \
- num_engines = base::size(engines_##code1##code2); \
+#define END_UNHANDLED_COUNTRIES(code1, code2) \
+ engines = engines_##code1##code2; \
+ num_engines = std::size(engines_##code1##code2); \
break;
#define DECLARE_COUNTRY(code1, code2)\
UNHANDLED_COUNTRY(code1, code2)\
diff --git a/components/search_engines/template_url_prepopulate_data_unittest.cc b/components/search_engines/template_url_prepopulate_data_unittest.cc
index 7bdeed4..06231ada 100644
--- a/components/search_engines/template_url_prepopulate_data_unittest.cc
+++ b/components/search_engines/template_url_prepopulate_data_unittest.cc
@@ -106,7 +106,7 @@
'V'<<8|'N', 'V'<<8|'U', 'W'<<8|'F', 'W'<<8|'S', 'Y'<<8|'E',
'Y'<<8|'T', 'Z'<<8|'A', 'Z'<<8|'M', 'Z'<<8|'W', -1 };

- for (size_t i = 0; i < base::size(kCountryIds); ++i) {
+ for (size_t i = 0; i < std::size(kCountryIds); ++i) {
prefs_.SetInteger(country_codes::kCountryIDAtInstall, kCountryIds[i]);
std::vector<std::unique_ptr<TemplateURLData>> urls =
TemplateURLPrepopulateData::GetPrepopulatedEngines(&prefs_, nullptr);
@@ -314,7 +314,7 @@
// Custom with a country TLD and almost no query params:
"http://www.google.ru/search?q={searchTerms}"
};
- for (size_t i = 0; i < base::size(kGoogleURLs); ++i) {
+ for (size_t i = 0; i < std::size(kGoogleURLs); ++i) {
EXPECT_EQ(SEARCH_ENGINE_GOOGLE, GetEngineType(kGoogleURLs[i]));
}

@@ -326,7 +326,7 @@
// Aggressively match types by checking just TLD+1.
"http://someothersite.yahoo.com/",
};
- for (size_t i = 0; i < base::size(kYahooURLs); ++i) {
+ for (size_t i = 0; i < std::size(kYahooURLs); ++i) {
EXPECT_EQ(SEARCH_ENGINE_YAHOO, GetEngineType(kYahooURLs[i]));
}

diff --git a/components/search_engines/template_url_unittest.cc b/components/search_engines/template_url_unittest.cc
index 89f6425..01205588 100644
--- a/components/search_engines/template_url_unittest.cc
+++ b/components/search_engines/template_url_unittest.cc
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/search_engines/template_url.h"
+
#include <stddef.h>

#include "base/base64.h"
#include "base/base_paths.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/i18n/case_conversion.h"
#include "base/strings/string_number_conversions.h"
@@ -17,7 +18,6 @@
#include "components/omnibox/common/omnibox_features.h"
#include "components/search_engines/search_engines_switches.h"
#include "components/search_engines/search_terms_data.h"
-#include "components/search_engines/template_url.h"
#include "components/search_engines/testing_search_terms_data.h"
#include "net/base/url_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -90,7 +90,7 @@
"http://foo/?boo=sea+rch%2Fbar"},
{"http://en.wikipedia.org/{searchTerms}", u"wiki/?",
"http://en.wikipedia.org/wiki/%3F"}};
- for (size_t i = 0; i < base::size(search_term_cases); ++i) {
+ for (size_t i = 0; i < std::size(search_term_cases); ++i) {
const SearchTermsCase& value = search_term_cases[i];
TemplateURLData data;
data.SetURL(value.url);
@@ -395,7 +395,7 @@

TestingSearchTermsData search_terms_data("http://example.com/e/");
TemplateURLData data;
- for (size_t i = 0; i < base::size(search_term_cases); ++i) {
+ for (size_t i = 0; i < std::size(search_term_cases); ++i) {
const SearchTermsCase& value = search_term_cases[i];
data.SetURL(value.url);
TemplateURL url(data);
@@ -436,7 +436,7 @@
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_));
- for (size_t i = 0; i < base::size(to_wide_cases); i++) {
+ for (size_t i = 0; i < std::size(to_wide_cases); i++) {
EXPECT_EQ(to_wide_cases[i].expected_decoded_term,
url.url_ref().SearchTermToString16(
to_wide_cases[i].encoded_search_term));
@@ -455,7 +455,7 @@
{"http://foo{searchTerms}{language}", u"http://foo%s{language}"},
};
TemplateURLData data;
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_EQ(test_data[i].expected_result,
@@ -498,7 +498,7 @@
};
TemplateURLData data;
data.input_encodings.push_back("UTF-8");
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
@@ -534,7 +534,7 @@
"http://foo/%82%A0%20%82%A2/bar"},
};
TemplateURLData data;
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
data.input_encodings.clear();
data.input_encodings.push_back(test_data[i].encoding);
@@ -586,7 +586,7 @@
};

TemplateURLData data;
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
data.input_encodings = test_data[i].encodings;
TemplateURL url(data);
@@ -632,7 +632,7 @@
};
TemplateURLData data;
data.input_encodings.push_back("UTF-8");
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
@@ -665,7 +665,7 @@
};
TemplateURLData data;
data.input_encodings.push_back("UTF-8");
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
@@ -696,7 +696,7 @@
};
TemplateURLData data;
data.input_encodings.push_back("UTF-8");
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
@@ -730,7 +730,7 @@
};
TemplateURLData data;
data.input_encodings.push_back("UTF-8");
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
@@ -759,7 +759,7 @@
};
TemplateURLData data;
data.input_encodings.push_back("UTF-8");
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
@@ -792,7 +792,7 @@
};
TemplateURLData data;
data.input_encodings.push_back("UTF-8");
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
@@ -819,7 +819,7 @@
{"http://foo/?q={searchTerms}", u"bar", true,
"http://foo/?q=bar&chrome_dse_attribution=1"}};
TemplateURLData data;
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
data.SetURL(test_data[i].url);
data.created_from_play_api = test_data[i].created_from_play_api;
TemplateURL url(data);
@@ -856,7 +856,7 @@
TemplateURL url(data);
EXPECT_TRUE(url.url_ref().IsValid(search_terms_data_));
ASSERT_TRUE(url.url_ref().SupportsReplacement(search_terms_data_));
- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
TemplateURLRef::SearchTermsArgs search_terms_args(u"foobar");
search_terms_args.accepted_suggestion = test_data[i].accepted_suggestion;
search_terms_args.original_query =
@@ -925,7 +925,7 @@
{"http://blah/?q=stock:{searchTerms}", "blah", "/", "q"},
};

- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
TemplateURLData data;
data.SetURL(test_data[i].url);
TemplateURL url(data);
@@ -970,7 +970,7 @@
"", "", ""},
};

- for (size_t i = 0; i < base::size(test_data); ++i) {
+ for (size_t i = 0; i < std::size(test_data); ++i) {
TemplateURLData data;
data.SetURL(test_data[i].url);
TemplateURL url(data);
@@ -999,7 +999,7 @@
{ "http://google.com/intl/xx/", "http://google.com/complete/", },
};

- for (size_t i = 0; i < base::size(data); ++i)
+ for (size_t i = 0; i < std::size(data); ++i)
CheckSuggestBaseURL(data[i].base_url, data[i].base_suggest_url);
}

@@ -1763,7 +1763,7 @@
{ "http://bar/newtab", false, },
};

- for (size_t i = 0; i < base::size(url_data); ++i) {
+ for (size_t i = 0; i < std::size(url_data); ++i) {
EXPECT_EQ(url_data[i].result,
search_provider.IsSearchURL(GURL(url_data[i].url),
search_terms_data_));
@@ -1926,7 +1926,7 @@
"http://foo/blah.blah.blah.blah.blah" }
};

- for (size_t i = 0; i < base::size(generate_url_cases); ++i) {
+ for (size_t i = 0; i < std::size(generate_url_cases); ++i) {
TemplateURLData data;
data.SetURL(generate_url_cases[i].url);
TemplateURL t_url(data);
diff --git a/components/services/filesystem/directory_impl_unittest.cc b/components/services/filesystem/directory_impl_unittest.cc
index c134cb2..c64c77d 100644
--- a/components/services/filesystem/directory_impl_unittest.cc
+++ b/components/services/filesystem/directory_impl_unittest.cc
@@ -8,7 +8,6 @@
#include <map>
#include <string>

-#include "base/cxx17_backports.h"
#include "base/test/task_environment.h"
#include "components/services/filesystem/directory_test_helper.h"
#include "components/services/filesystem/public/mojom/directory.mojom.h"
@@ -51,7 +50,7 @@
{"my_file1", mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate},
{"my_file2", mojom::kFlagWrite | mojom::kFlagCreate},
{"my_file3", mojom::kFlagAppend | mojom::kFlagCreate}};
- for (size_t i = 0; i < base::size(files_to_create); i++) {
+ for (size_t i = 0; i < std::size(files_to_create); i++) {
error = base::File::Error::FILE_ERROR_FAILED;
bool handled =
directory->OpenFile(files_to_create[i].name, mojo::NullReceiver(),
diff --git a/components/services/quarantine/quarantine_service_unittest.cc b/components/services/quarantine/quarantine_service_unittest.cc
index cee5c87..5ea8133 100644
--- a/components/services/quarantine/quarantine_service_unittest.cc
+++ b/components/services/quarantine/quarantine_service_unittest.cc
@@ -55,8 +55,8 @@
ASSERT_TRUE(test_dir.CreateUniqueTempDir());

base::FilePath test_file = test_dir.GetPath().AppendASCII("foo.class");
- ASSERT_EQ(static_cast<int>(base::size(kTestData)),
- base::WriteFile(test_file, kTestData, base::size(kTestData)));
+ ASSERT_EQ(static_cast<int>(std::size(kTestData)),
+ base::WriteFile(test_file, kTestData, std::size(kTestData)));

base::RunLoop run_loop;
quarantine_->QuarantineFile(
diff --git a/components/services/quarantine/quarantine_unittest.cc b/components/services/quarantine/quarantine_unittest.cc
index 4701858..e43e6fa 100644
--- a/components/services/quarantine/quarantine_unittest.cc
+++ b/components/services/quarantine/quarantine_unittest.cc
@@ -8,7 +8,6 @@
#include <string>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -44,8 +43,8 @@
#endif
ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
ASSERT_EQ(
- static_cast<int>(base::size(kTestData)),
- base::WriteFile(GetTestFilePath(), kTestData, base::size(kTestData)));
+ static_cast<int>(std::size(kTestData)),
+ base::WriteFile(GetTestFilePath(), kTestData, std::size(kTestData)));
}

protected:
diff --git a/components/services/quarantine/quarantine_win_unittest.cc b/components/services/quarantine/quarantine_win_unittest.cc
index 12540ae..3854cc1 100644
--- a/components/services/quarantine/quarantine_win_unittest.cc
+++ b/components/services/quarantine/quarantine_win_unittest.cc
@@ -47,8 +47,8 @@
bool CreateFile(const base::FilePath& file_path) {
constexpr char kTestData[] = "Hello world!";

- return base::WriteFile(file_path, kTestData, base::size(kTestData)) ==
- static_cast<int>(base::size(kTestData));
+ return base::WriteFile(file_path, kTestData, std::size(kTestData)) ==
+ static_cast<int>(std::size(kTestData));
}

base::FilePath GetZoneIdentifierStreamPath(const base::FilePath& file_path) {
@@ -122,8 +122,8 @@
static const char kMotwForInternetZone[] = "[ZoneTransfer]\r\nZoneId=3\r\n";
return base::WriteFile(GetZoneIdentifierStreamPath(file_path),
kMotwForInternetZone,
- base::size(kMotwForInternetZone)) ==
- static_cast<int>(base::size(kMotwForInternetZone));
+ std::size(kMotwForInternetZone)) ==
+ static_cast<int>(std::size(kMotwForInternetZone));
}

void CheckQuarantineResult(QuarantineFileResult result,
diff --git a/components/services/storage/dom_storage/local_storage_impl.cc b/components/services/storage/dom_storage/local_storage_impl.cc
index 82a90a6..3d24a6d5 100644
--- a/components/services/storage/dom_storage/local_storage_impl.cc
+++ b/components/services/storage/dom_storage/local_storage_impl.cc
@@ -93,8 +93,8 @@
std::vector<uint8_t> serialized_storage_key(storage_key_str.begin(),
storage_key_str.end());
DomStorageDatabase::Key key;
- key.reserve(base::size(kMetaPrefix) + serialized_storage_key.size());
- key.insert(key.end(), kMetaPrefix, kMetaPrefix + base::size(kMetaPrefix));
+ key.reserve(std::size(kMetaPrefix) + serialized_storage_key.size());
+ key.insert(key.end(), kMetaPrefix, kMetaPrefix + std::size(kMetaPrefix));
key.insert(key.end(), serialized_storage_key.begin(),
serialized_storage_key.end());
return key;
@@ -102,11 +102,11 @@

absl::optional<blink::StorageKey> ExtractStorageKeyFromMetaDataKey(
const DomStorageDatabase::Key& key) {
- DCHECK_GT(key.size(), base::size(kMetaPrefix));
+ DCHECK_GT(key.size(), std::size(kMetaPrefix));
const base::StringPiece key_string(reinterpret_cast<const char*>(key.data()),
key.size());
return blink::StorageKey::Deserialize(
- key_string.substr(base::size(kMetaPrefix)));
+ key_string.substr(std::size(kMetaPrefix)));
}

void SuccessResponse(base::OnceClosure callback, bool success) {
diff --git a/components/services/storage/dom_storage/session_storage_metadata.cc b/components/services/storage/dom_storage/session_storage_metadata.cc
index 7653539..769a905 100644
--- a/components/services/storage/dom_storage/session_storage_metadata.cc
+++ b/components/services/storage/dom_storage/session_storage_metadata.cc
@@ -4,7 +4,6 @@

#include "components/services/storage/dom_storage/session_storage_metadata.h"

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
@@ -40,7 +39,7 @@
constexpr const uint8_t kMapIdPrefixBytes[] = {'m', 'a', 'p', '-'};

constexpr const size_t kNamespacePrefixLength =
- base::size(SessionStorageMetadata::kNamespacePrefixBytes);
+ std::size(SessionStorageMetadata::kNamespacePrefixBytes);
constexpr const uint8_t kNamespaceStorageKeySeperatorByte = '-';
constexpr const size_t kNamespaceStorageKeySeperatorLength = 1;
constexpr const size_t kPrefixBeforeStorageKeyLength =
diff --git a/components/services/storage/public/cpp/filesystem/filesystem_proxy_unittest.cc b/components/services/storage/public/cpp/filesystem/filesystem_proxy_unittest.cc
index be7a234..1e169b91 100644
--- a/components/services/storage/public/cpp/filesystem/filesystem_proxy_unittest.cc
+++ b/components/services/storage/public/cpp/filesystem/filesystem_proxy_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_error_or.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -67,15 +66,15 @@
CHECK(base::CreateDirectory(root.Append(kDir1).Append(kDir1Dir1)));
CHECK(base::CreateDirectory(root.Append(kDir2)));
CHECK(base::WriteFile(root.Append(kFile1), kFile1Contents,
- base::size(kFile1Contents) - 1));
+ std::size(kFile1Contents) - 1));
CHECK(base::WriteFile(root.Append(kFile2), kFile2Contents,
- base::size(kFile2Contents) - 1));
+ std::size(kFile2Contents) - 1));
CHECK(base::WriteFile(root.Append(kDir1).Append(kDir1File1),
kDir1File1Contents,
- base::size(kDir1File1Contents) - 1));
+ std::size(kDir1File1Contents) - 1));
CHECK(base::WriteFile(root.Append(kDir1).Append(kDir1File2),
kDir1File2Contents,
- base::size(kDir1File2Contents) - 1));
+ std::size(kDir1File2Contents) - 1));

if (UseRestrictedFilesystem()) {
// Run a remote FilesystemImpl on a background thread to exercise
@@ -371,7 +370,7 @@
absl::optional<base::File::Info> file1_info = proxy().GetFileInfo(kFile1);
ASSERT_TRUE(file1_info.has_value());
EXPECT_FALSE(file1_info->is_directory);
- EXPECT_EQ(static_cast<int>(base::size(kFile1Contents) - 1), file1_info->size);
+ EXPECT_EQ(static_cast<int>(std::size(kFile1Contents) - 1), file1_info->size);

absl::optional<base::File::Info> dir1_info = proxy().GetFileInfo(kDir1);
ASSERT_TRUE(dir1_info.has_value());
@@ -381,7 +380,7 @@
proxy().GetFileInfo(kDir1.Append(kDir1File1));
ASSERT_TRUE(dir1_file1_info.has_value());
EXPECT_FALSE(dir1_file1_info->is_directory);
- EXPECT_EQ(static_cast<int>(base::size(kDir1File1Contents) - 1),
+ EXPECT_EQ(static_cast<int>(std::size(kDir1File1Contents) - 1),
dir1_file1_info->size);

const base::FilePath kBadFilename{FILE_PATH_LITERAL("bad_file")};
@@ -445,7 +444,7 @@
TEST_P(FilesystemProxyTest, ComputeDirectorySize) {
// The file size does not include the null terminator, so subtract 1 per file.
int64_t expected_size =
- base::size(kDir1File1Contents) + base::size(kDir1File2Contents) - 2;
+ std::size(kDir1File1Contents) + std::size(kDir1File2Contents) - 2;
EXPECT_EQ(proxy().ComputeDirectorySize(kDir1), expected_size);
}

diff --git a/components/services/storage/service_worker/service_worker_storage_unittest.cc b/components/services/storage/service_worker/service_worker_storage_unittest.cc
index 8b32572..2e4c6e5 100644
--- a/components/services/storage/service_worker/service_worker_storage_unittest.cc
+++ b/components/services/storage/service_worker/service_worker_storage_unittest.cc
@@ -5,13 +5,13 @@
#include "components/services/storage/service_worker/service_worker_storage.h"

#include <stdint.h>
+
#include <memory>
#include <string>
#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
@@ -438,7 +438,7 @@
"HTTP/1.0 200 HONKYDORY\0Content-Length: 5\0\0";
const std::string kHttpBody = "Hello";

- std::string headers(kHttpHeaders, base::size(kHttpHeaders));
+ std::string headers(kHttpHeaders, std::size(kHttpHeaders));
mojo_base::BigBuffer body(
base::as_bytes(base::make_span(kHttpBody.data(), kHttpBody.length())));

diff --git a/components/sessions/core/command_storage_backend_unittest.cc b/components/sessions/core/command_storage_backend_unittest.cc
index c9c00b9e..f3a13d6b 100644
--- a/components/sessions/core/command_storage_backend_unittest.cc
+++ b/components/sessions/core/command_storage_backend_unittest.cc
@@ -5,12 +5,12 @@
#include "components/sessions/core/command_storage_backend.h"

#include <stddef.h>
+
#include <limits>
#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_refptr.h"
@@ -211,7 +211,7 @@
};

const std::vector<uint8_t> key = CommandStorageManager::CreateCryptoKey();
- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
scoped_refptr<CommandStorageBackend> backend = CreateBackend(key);
SessionCommands commands;
if (i != 0) {
@@ -430,7 +430,7 @@
{13, "abcdefghijklm"},
};

- for (size_t i = 0; i < base::size(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
scoped_refptr<CommandStorageBackend> backend =
CreateBackendWithRestoreType();
SessionCommands commands;
@@ -737,7 +737,7 @@
ASSERT_TRUE(base::CopyFile(
test_data_path, restore_path().Append(kLegacyCurrentSessionFileName)));
scoped_refptr<CommandStorageBackend> backend = CreateBackendWithRestoreType();
- AssertCommandsEqualsData(data, base::size(data),
+ AssertCommandsEqualsData(data, std::size(data),
backend->ReadLastSessionCommands().commands);
}

diff --git a/components/signin/core/browser/signin_error_controller_unittest.cc b/components/signin/core/browser/signin_error_controller_unittest.cc
index 529fc20..f7885d8 100644
--- a/components/signin/core/browser/signin_error_controller_unittest.cc
+++ b/components/signin/core/browser/signin_error_controller_unittest.cc
@@ -9,7 +9,6 @@
#include <functional>
#include <memory>

-#include "base/cxx17_backports.h"
#include "base/scoped_observation.h"
#include "base/test/task_environment.h"
#include "build/chromeos_buildflags.h"
@@ -160,8 +159,8 @@
GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE,
GoogleServiceAuthError::SERVICE_ERROR};
static_assert(
- base::size(table) == GoogleServiceAuthError::NUM_STATES -
- GoogleServiceAuthError::kDeprecatedStateCount,
+ std::size(table) == GoogleServiceAuthError::NUM_STATES -
+ GoogleServiceAuthError::kDeprecatedStateCount,
"table array does not match the number of auth error types");

for (GoogleServiceAuthError::State state : table) {
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc b/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc
index 1d2898b7..91cb7d1 100644
--- a/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc
+++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_unittest.cc
@@ -701,8 +701,8 @@
OAuth2AccessTokenManager::RequestParameters("1", account_id1, set_1),
};

- for (size_t i = 0; i < base::size(params); i++) {
- for (size_t j = 0; j < base::size(params); j++) {
+ for (size_t i = 0; i < std::size(params); i++) {
+ for (size_t j = 0; j < std::size(params); j++) {
if (i == j) {
EXPECT_FALSE(params[i] < params[j]) << " i=" << i << ", j=" << j;
EXPECT_FALSE(params[j] < params[i]) << " i=" << i << ", j=" << j;
diff --git a/components/site_engagement/content/site_engagement_metrics.cc b/components/site_engagement/content/site_engagement_metrics.cc
index 7439d8bf..bb4d5ad 100644
--- a/components/site_engagement/content/site_engagement_metrics.cc
+++ b/components/site_engagement/content/site_engagement_metrics.cc
@@ -4,7 +4,6 @@

#include "components/site_engagement/content/site_engagement_metrics.h"

-#include "base/cxx17_backports.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "components/site_engagement/content/engagement_type.h"
@@ -75,7 +74,7 @@
return;

std::map<int, int> score_buckets;
- for (size_t i = 0; i < base::size(kEngagementBucketHistogramBuckets); ++i)
+ for (size_t i = 0; i < std::size(kEngagementBucketHistogramBuckets); ++i)
score_buckets[kEngagementBucketHistogramBuckets[i]] = 0;

for (const auto& detail : details) {
@@ -123,7 +122,7 @@
std::vector<std::string>
SiteEngagementMetrics::GetEngagementBucketHistogramNames() {
std::vector<std::string> histogram_names;
- for (size_t i = 0; i < base::size(kEngagementBucketHistogramBuckets); ++i) {
+ for (size_t i = 0; i < std::size(kEngagementBucketHistogramBuckets); ++i) {
histogram_names.push_back(
kEngagementBucketHistogramBase +
base::NumberToString(kEngagementBucketHistogramBuckets[i]));
diff --git a/components/spellcheck/browser/android/component_jni_registrar.cc b/components/spellcheck/browser/android/component_jni_registrar.cc
index a897331..2ecaddc 100644
--- a/components/spellcheck/browser/android/component_jni_registrar.cc
+++ b/components/spellcheck/browser/android/component_jni_registrar.cc
@@ -6,7 +6,6 @@

#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
-#include "base/cxx17_backports.h"
#include "components/spellcheck/browser/spellchecker_session_bridge_android.h"

namespace spellcheck {
@@ -20,7 +19,7 @@
bool RegisterSpellcheckJni(JNIEnv* env) {
return base::android::RegisterNativeMethods(
env, kSpellcheckRegisteredMethods,
- base::size(kSpellcheckRegisteredMethods));
+ std::size(kSpellcheckRegisteredMethods));
}

} // namespace android
diff --git a/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc b/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc
index 2a9fb53..b48e0fb8 100644
--- a/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc
+++ b/components/spellcheck/browser/spellcheck_host_metrics_unittest.cc
@@ -8,7 +8,6 @@

#include <memory>

-#include "base/cxx17_backports.h"
#include "base/metrics/histogram_samples.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
@@ -85,7 +84,7 @@
RecordWordCountsForTesting();

// Get samples for all affected histograms.
- for (size_t i = 0; i < base::size(histogram_names); ++i)
+ for (size_t i = 0; i < std::size(histogram_names); ++i)
histogram_tester.ExpectTotalCount(histogram_names[i], 0);
}

@@ -119,7 +118,7 @@
expected_counts[2],
expected_counts[3]});

- for (size_t i = 0; i < base::size(histogram_names); ++i) {
+ for (size_t i = 0; i < std::size(histogram_names); ++i) {
histogram_tester.ExpectTotalCount(histogram_names[i], 1);
histogram_tester.ExpectBucketCount(histogram_names[i],
static_cast<int>(expected_counts[i]), 1);
@@ -137,7 +136,7 @@
metrics()->RecordSpellcheckLanguageStats(
{expected_counts[0], expected_counts[1], expected_counts[2], 0});

- for (size_t i = 0; i < base::size(histogram_names); ++i) {
+ for (size_t i = 0; i < std::size(histogram_names); ++i) {
histogram_tester.ExpectTotalCount(histogram_names[i], 1);
histogram_tester.ExpectBucketCount(histogram_names[i],
static_cast<int>(expected_counts[i]), 1);
diff --git a/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc b/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc
index 165b2e8..5925820f 100644
--- a/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc
+++ b/components/spellcheck/browser/spellcheck_platform_mac_unittest.cc
@@ -7,7 +7,6 @@
#include <stddef.h>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -66,7 +65,7 @@
"noooen",
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
const std::u16string word(base::ASCIIToUTF16(kTestCases[i]));
const int doc_tag = spellcheck_platform::GetDocumentTag();

@@ -364,7 +363,7 @@
{"writting", "writing"},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
const std::u16string word(base::ASCIIToUTF16(kTestCases[i].input));
EXPECT_FALSE(spellcheck_platform::CheckSpelling(word, 0)) << word;

diff --git a/components/spellcheck/common/spellcheck_common.cc b/components/spellcheck/common/spellcheck_common.cc
index f3e9dff..3ea09e9 100644
--- a/components/spellcheck/common/spellcheck_common.cc
+++ b/components/spellcheck/common/spellcheck_common.cc
@@ -199,9 +199,9 @@
if (!locale.empty()) {
UErrorCode error = U_ZERO_ERROR;
char id[ULOC_LANG_CAPACITY + ULOC_SCRIPT_CAPACITY + ULOC_COUNTRY_CAPACITY];
- uloc_addLikelySubtags(locale.c_str(), id, base::size(id), &error);
+ uloc_addLikelySubtags(locale.c_str(), id, std::size(id), &error);
error = U_ZERO_ERROR;
- uloc_getLanguage(id, language, base::size(language), &error);
+ uloc_getLanguage(id, language, std::size(language), &error);
country = uloc_getISO3Country(id);
}
*language_code = std::string(language);
diff --git a/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc b/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc
index fe430763..5ff53f4 100644
--- a/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc
+++ b/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc
@@ -8,7 +8,6 @@
#include <memory>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/path_service.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
@@ -150,7 +149,7 @@
do {
std::string reordered_languages = base::JoinString(permuted_languages, ",");
ExpectSpellCheckWordResults(reordered_languages, kTestCases,
- base::size(kTestCases));
+ std::size(kTestCases));
} while (std::next_permutation(permuted_languages.begin(),
permuted_languages.end()));
}
@@ -181,8 +180,7 @@
{L"hola sand hola sand hola sand", 0, 0},
{L"hola:legs", 0, 9},
{L"legs:hola", 0, 9}};
- ExpectSpellCheckWordResults("en-US,es-ES", kTestCases,
- base::size(kTestCases));
+ ExpectSpellCheckWordResults("en-US,es-ES", kTestCases, std::size(kTestCases));
}

// If there are no spellcheck languages, no text should be marked as misspelled.
@@ -237,7 +235,7 @@
{L"asdne", 0, 5, L"sadness,desasne"},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
blink::WebVector<blink::WebString> suggestions;
size_t misspelling_start;
size_t misspelling_length;
diff --git a/components/spellcheck/renderer/spellcheck_unittest.cc b/components/spellcheck/renderer/spellcheck_unittest.cc
index 7f5af68..e2fe814c 100644
--- a/components/spellcheck/renderer/spellcheck_unittest.cc
+++ b/components/spellcheck/renderer/spellcheck_unittest.cc
@@ -542,7 +542,7 @@
{L"3.141592653", true},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
size_t input_length = 0;
if (kTestCases[i].input)
input_length = wcslen(kTestCases[i].input);
@@ -948,7 +948,7 @@
L"\x043e\x043d\x04b3\x043e \x0430\x0441\x0442."},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
ReinitializeSpellCheck(kTestCases[i].language);
size_t input_length = 0;
if (kTestCases[i].input)
@@ -1006,7 +1006,7 @@
},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
ReinitializeSpellCheck(kTestCases[i].language);

std::u16string word(base::WideToUTF16(kTestCases[i].input));
@@ -1396,9 +1396,9 @@

static const char* const kLocales[] = { "en-GB", "en-US", "en-CA", "en-AU" };

- for (size_t j = 0; j < base::size(kLocales); ++j) {
+ for (size_t j = 0; j < std::size(kLocales); ++j) {
ReinitializeSpellCheck(kLocales[j]);
- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
size_t input_length = 0;
if (kTestCases[i].input)
input_length = strlen(kTestCases[i].input);
@@ -1513,7 +1513,7 @@
InitializeIfNeeded();
ASSERT_FALSE(InitializeIfNeeded());

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
bool result = CheckSpelling(kTestCases[i].word, 0);
EXPECT_EQ(kTestCases[i].expected_result, result) <<
"Failed test for " << kTestCases[i].word;
@@ -1531,7 +1531,7 @@
{ "accidently", "accidentally" }
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
size_t misspelling_start = 0;
size_t misspelling_length = 0;
std::vector<std::u16string> suggestions;
@@ -1559,9 +1559,9 @@
L"in’n’out",
};

- for (size_t i = 0; i < base::size(kLanguages); ++i) {
+ for (size_t i = 0; i < std::size(kLanguages); ++i) {
ReinitializeSpellCheck(kLanguages[i]);
- for (size_t j = 0; j < base::size(kWords); ++j)
+ for (size_t j = 0; j < std::size(kWords); ++j)
EXPECT_TRUE(IsValidContraction(base::WideToUTF16(kWords[j]), 0));
}
}
diff --git a/components/spellcheck/renderer/spellcheck_worditerator.cc b/components/spellcheck/renderer/spellcheck_worditerator.cc
index 059dae0..3fbac6d 100644
--- a/components/spellcheck/renderer/spellcheck_worditerator.cc
+++ b/components/spellcheck/renderer/spellcheck_worditerator.cc
@@ -11,7 +11,6 @@
#include <string>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/i18n/break_iterator.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
@@ -159,7 +158,7 @@
UErrorCode error = U_ZERO_ERROR;
UScriptCode script_code[8];
int scripts = uscript_getCode(language.c_str(), script_code,
- base::size(script_code), &error);
+ std::size(script_code), &error);
if (U_SUCCESS(error) && scripts >= 1)
script_code_ = script_code[0];

diff --git a/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc b/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc
index 04f53af..8a9ebc0 100644
--- a/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc
+++ b/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/spellcheck/renderer/spellcheck_worditerator.h"
+
#include <stddef.h>

#include <string>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/format_macros.h"
#include "base/i18n/break_iterator.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
-#include "components/spellcheck/renderer/spellcheck_worditerator.h"
#include "testing/gtest/include/gtest/gtest.h"

using base::i18n::BreakIterator;
@@ -156,7 +156,7 @@
},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(base::StringPrintf("kTestCases[%" PRIuS "]: language=%s", i,
kTestCases[i].language));

@@ -261,7 +261,7 @@
},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SCOPED_TRACE(base::StringPrintf("kTestCases[%" PRIuS "]: language=%s", i,
kTestCases[i].language));

@@ -308,7 +308,7 @@
{"en-US", L"....you\x2019re", L"you\x2019re"},
};

- for (size_t i = 0; i < base::size(kTestCases); ++i) {
+ for (size_t i = 0; i < std::size(kTestCases); ++i) {
SpellcheckCharAttribute attributes;
attributes.SetDefaultLanguage(kTestCases[i].language);

diff --git a/components/ssl_errors/error_info.cc b/components/ssl_errors/error_info.cc
index 79dda76..a1c6651 100644
--- a/components/ssl_errors/error_info.cc
+++ b/components/ssl_errors/error_info.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "base/i18n/message_formatter.h"
#include "base/notreached.h"
#include "base/strings/utf_string_conversions.h"
@@ -270,9 +269,9 @@
CERT_SYMANTEC_LEGACY,
CERT_KNOWN_INTERCEPTION_BLOCKED,
};
- DCHECK(base::size(kErrorFlags) == base::size(kErrorTypes));
+ DCHECK(std::size(kErrorFlags) == std::size(kErrorTypes));

- for (size_t i = 0; i < base::size(kErrorFlags); ++i) {
+ for (size_t i = 0; i < std::size(kErrorFlags); ++i) {
if ((cert_status & kErrorFlags[i]) && errors) {
errors->push_back(
ErrorInfo::CreateError(kErrorTypes[i], cert.get(), url));
diff --git a/components/storage_monitor/mtab_watcher_linux.cc b/components/storage_monitor/mtab_watcher_linux.cc
index ab5714e9..45042ce 100644
--- a/components/storage_monitor/mtab_watcher_linux.cc
+++ b/components/storage_monitor/mtab_watcher_linux.cc
@@ -11,7 +11,6 @@
#include <stdio.h>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/threading/scoped_blocking_call.h"

@@ -73,7 +72,7 @@
// devices that have been mounted over.
while (getmntent_r(fp, &entry, buf, sizeof(buf))) {
// We only care about real file systems.
- for (size_t i = 0; i < base::size(kKnownFileSystems); ++i) {
+ for (size_t i = 0; i < std::size(kKnownFileSystems); ++i) {
if (strcmp(kKnownFileSystems[i], entry.mnt_type) == 0) {
device_map[base::FilePath(entry.mnt_dir)] =
base::FilePath(entry.mnt_fsname);
diff --git a/components/storage_monitor/storage_monitor_linux_unittest.cc b/components/storage_monitor/storage_monitor_linux_unittest.cc
index 8d0f2ef..069bddb 100644
--- a/components/storage_monitor/storage_monitor_linux_unittest.cc
+++ b/components/storage_monitor/storage_monitor_linux_unittest.cc
@@ -16,7 +16,6 @@

#include "base/bind.h"
#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
@@ -77,7 +76,7 @@
const base::FilePath& mount_point) {
bool device_found = false;
size_t i = 0;
- for (; i < base::size(kTestDeviceData); i++) {
+ for (; i < std::size(kTestDeviceData); i++) {
if (device_path.value() == kTestDeviceData[i].device_path) {
device_found = true;
break;
@@ -175,7 +174,7 @@
MtabTestData initial_test_data[] = {
MtabTestData("dummydevice", "dummydir", kInvalidFS),
};
- WriteToMtab(initial_test_data, base::size(initial_test_data),
+ WriteToMtab(initial_test_data, std::size(initial_test_data),
/*overwrite=*/true);

monitor_ = std::make_unique<TestStorageMonitorLinux>(mtab_file_);
@@ -340,7 +339,7 @@
};
// Only |kDeviceDCIM2| should be attached, since |kDeviceFixed| has a bad
// path.
- AppendToMtabAndRunLoop(test_data, base::size(test_data));
+ AppendToMtabAndRunLoop(test_data, std::size(test_data));

EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
@@ -363,7 +362,7 @@
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
};
// |kDeviceDCIM1| should be attached as expected.
- AppendToMtabAndRunLoop(test_data1, base::size(test_data1));
+ AppendToMtabAndRunLoop(test_data1, std::size(test_data1));

EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());
@@ -376,7 +375,7 @@
MtabTestData test_data2[] = {
MtabTestData(kDeviceFixed, test_path_b.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data2, base::size(test_data2));
+ AppendToMtabAndRunLoop(test_data2, std::size(test_data2));
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());

@@ -390,7 +389,7 @@
MtabTestData test_data3[] = {
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data3, base::size(test_data3));
+ AppendToMtabAndRunLoop(test_data3, std::size(test_data3));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());
EXPECT_EQ(GetDeviceId(kDeviceNoDCIM), observer().last_attached().device_id());
@@ -418,7 +417,7 @@
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
MtabTestData(kDeviceDCIM2, test_path_b.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data1, base::size(test_data1));
+ AppendToMtabAndRunLoop(test_data1, std::size(test_data1));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());

@@ -430,7 +429,7 @@
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
MtabTestData(kDeviceDCIM2, test_path_a.value(), kValidFS),
};
- OverwriteMtabAndRunLoop(test_data2, base::size(test_data2));
+ OverwriteMtabAndRunLoop(test_data2, std::size(test_data2));
EXPECT_EQ(4, observer().attach_calls());
EXPECT_EQ(2, observer().detach_calls());

@@ -455,7 +454,7 @@
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
MtabTestData(kDeviceDCIM2, test_path_b.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data1, base::size(test_data1));
+ AppendToMtabAndRunLoop(test_data1, std::size(test_data1));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());

@@ -468,7 +467,7 @@
MtabTestData test_data2[] = {
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data2, base::size(test_data2));
+ AppendToMtabAndRunLoop(test_data2, std::size(test_data2));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());

@@ -480,7 +479,7 @@
MtabTestData(kDeviceDCIM2, test_path_b.value(), kValidFS),
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- OverwriteMtabAndRunLoop(test_data3, base::size(test_data3));
+ OverwriteMtabAndRunLoop(test_data3, std::size(test_data3));
EXPECT_EQ(3, observer().attach_calls());
EXPECT_EQ(2, observer().detach_calls());

@@ -491,14 +490,14 @@
MtabTestData test_data4[] = {
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data4, base::size(test_data4));
+ AppendToMtabAndRunLoop(test_data4, std::size(test_data4));
EXPECT_EQ(3, observer().attach_calls());
EXPECT_EQ(2, observer().detach_calls());

// Detach |kDeviceDCIM1| from |kMountPointB|.
// kDeviceDCIM1 -> kMountPointA *
// kDeviceDCIM2 -> kMountPointB *
- OverwriteMtabAndRunLoop(test_data1, base::size(test_data1));
+ OverwriteMtabAndRunLoop(test_data1, std::size(test_data1));
EXPECT_EQ(5, observer().attach_calls());
EXPECT_EQ(3, observer().detach_calls());

@@ -520,7 +519,7 @@
MtabTestData test_data1[] = {
MtabTestData(kDeviceDCIM1, test_path_a.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data1, base::size(test_data1));
+ AppendToMtabAndRunLoop(test_data1, std::size(test_data1));
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());

@@ -530,7 +529,7 @@
MtabTestData test_data2[] = {
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data2, base::size(test_data2));
+ AppendToMtabAndRunLoop(test_data2, std::size(test_data2));
EXPECT_EQ(1, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());

@@ -542,7 +541,7 @@
MtabTestData(kDeviceFixed, test_path_a.value(), kValidFS),
};
RemoveDCIMDirFromMountPoint(kMountPointA);
- AppendToMtabAndRunLoop(test_data3, base::size(test_data3));
+ AppendToMtabAndRunLoop(test_data3, std::size(test_data3));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());

@@ -554,7 +553,7 @@
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
CreateMountPointWithDCIMDir(kMountPointA);
- OverwriteMtabAndRunLoop(test_data4, base::size(test_data4));
+ OverwriteMtabAndRunLoop(test_data4, std::size(test_data4));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(1, observer().detach_calls());

@@ -566,7 +565,7 @@
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
};
base::DeleteFile(test_path_b.Append(kDCIMDirectoryName));
- AppendToMtabAndRunLoop(test_data5, base::size(test_data5));
+ AppendToMtabAndRunLoop(test_data5, std::size(test_data5));
EXPECT_EQ(4, observer().attach_calls());
EXPECT_EQ(2, observer().detach_calls());

@@ -578,13 +577,13 @@
MtabTestData(kDeviceDCIM1, test_path_b.value(), kValidFS),
};
CreateMountPointWithDCIMDir(kMountPointB);
- OverwriteMtabAndRunLoop(test_data6, base::size(test_data6));
+ OverwriteMtabAndRunLoop(test_data6, std::size(test_data6));
EXPECT_EQ(4, observer().attach_calls());
EXPECT_EQ(3, observer().detach_calls());

// Detach |kDeviceDCIM1| from |kMountPointB|.
// kDeviceDCIM1 -> kMountPointA *
- OverwriteMtabAndRunLoop(test_data1, base::size(test_data1));
+ OverwriteMtabAndRunLoop(test_data1, std::size(test_data1));
EXPECT_EQ(4, observer().attach_calls());
EXPECT_EQ(3, observer().detach_calls());

@@ -612,7 +611,7 @@
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
MtabTestData(kDeviceFixed, test_path_c.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data1, base::size(test_data1));
+ AppendToMtabAndRunLoop(test_data1, std::size(test_data1));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());

@@ -653,7 +652,7 @@
MtabTestData(kDeviceFixed, test_path_b.value(), kValidFS),
MtabTestData(kDeviceFixed, test_path_c.value(), kValidFS),
};
- AppendToMtabAndRunLoop(test_data2, base::size(test_data2));
+ AppendToMtabAndRunLoop(test_data2, std::size(test_data2));

EXPECT_TRUE(notifier()->GetStorageInfoForPath(test_path_a, &device_info));
EXPECT_EQ(GetDeviceId(kDeviceDCIM1), device_info.device_id());
@@ -679,7 +678,7 @@
MtabTestData(kDeviceNoDCIM, test_path_b.value(), kValidFS),
MtabTestData(kDeviceFixed, kInvalidPath, kInvalidFS),
};
- AppendToMtabAndRunLoop(test_data1, base::size(test_data1));
+ AppendToMtabAndRunLoop(test_data1, std::size(test_data1));
EXPECT_EQ(2, observer().attach_calls());
EXPECT_EQ(0, observer().detach_calls());

diff --git a/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc b/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc
index 8e00329..ab26c07 100644
--- a/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc
+++ b/components/subresource_filter/content/browser/async_document_subresource_filter_unittest.cc
@@ -9,7 +9,6 @@

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/test/test_simple_task_runner.h"
@@ -620,7 +619,7 @@
MakeState(true, true)},
};

- for (size_t i = 0, size = base::size(kTestCases); i != size; ++i) {
+ for (size_t i = 0, size = std::size(kTestCases); i != size; ++i) {
SCOPED_TRACE(::testing::Message() << "Test number: " << i);
const auto& test_case = kTestCases[i];

diff --git a/components/sync/base/model_type.cc b/components/sync/base/model_type.cc
index eb679699..a74c1c6f 100644
--- a/components/sync/base/model_type.cc
+++ b/components/sync/base/model_type.cc
@@ -8,7 +8,6 @@

#include <ostream>

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
@@ -168,7 +167,7 @@
ModelTypeForHistograms::kNigori},
};

-static_assert(base::size(kModelTypeInfoMap) == GetNumModelTypes(),
+static_assert(std::size(kModelTypeInfoMap) == GetNumModelTypes(),
"kModelTypeInfoMap should have GetNumModelTypes() elements");

static_assert(38 == syncer::GetNumModelTypes(),
diff --git a/components/sync/base/unique_position.cc b/components/sync/base/unique_position.cc
index b270de0..1d03579 100644
--- a/components/sync/base/unique_position.cc
+++ b/components/sync/base/unique_position.cc
@@ -56,7 +56,7 @@

un_gzipped.resize(uncompressed_len);
int result = uncompress(
- reinterpret_cast<Bytef*>(base::data(un_gzipped)), &uncompressed_len,
+ reinterpret_cast<Bytef*>(std::data(un_gzipped)), &uncompressed_len,
reinterpret_cast<const Bytef*>(proto.compressed_value().data()),
proto.compressed_value().size());
if (result != Z_OK) {
diff --git a/components/sync/base/unique_position_unittest.cc b/components/sync/base/unique_position_unittest.cc
index 53d3886..760a060 100644
--- a/components/sync/base/unique_position_unittest.cc
+++ b/components/sync/base/unique_position_unittest.cc
@@ -10,7 +10,6 @@
#include <vector>

#include "base/base64.h"
-#include "base/cxx17_backports.h"
#include "base/hash/sha1.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
@@ -81,8 +80,8 @@
kBiggerPosition,
};

- const size_t kNumPositions = base::size(kPositionArray);
- const size_t kNumSortedPositions = base::size(kSortedPositionArray);
+ const size_t kNumPositions = std::size(kPositionArray);
+ const size_t kNumSortedPositions = std::size(kSortedPositionArray);
};

static constexpr char kMinSuffix[] = {
@@ -90,7 +89,7 @@
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x01'};
-static_assert(base::size(kMinSuffix) == UniquePosition::kSuffixLength,
+static_assert(std::size(kMinSuffix) == UniquePosition::kSuffixLength,
"Wrong size of kMinSuffix.");

static constexpr char kMaxSuffix[] = {
@@ -98,7 +97,7 @@
'\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF',
'\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF',
'\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF', '\xFF'};
-static_assert(base::size(kMaxSuffix) == UniquePosition::kSuffixLength,
+static_assert(std::size(kMaxSuffix) == UniquePosition::kSuffixLength,
"Wrong size of kMaxSuffix.");

static constexpr char kNormalSuffix[] = {
@@ -106,7 +105,7 @@
'\x34', '\x69', '\x70', '\x46', '\x34', '\x79', '\x49',
'\x44', '\x4F', '\x66', '\x4C', '\x58', '\x41', '\x31',
'\x34', '\x68', '\x59', '\x56', '\x43', '\x6F', '\x3D'};
-static_assert(base::size(kNormalSuffix) == UniquePosition::kSuffixLength,
+static_assert(std::size(kNormalSuffix) == UniquePosition::kSuffixLength,
"Wrong size of kNormalSuffix.");

::testing::AssertionResult LessThan(const char* m_expr,
@@ -217,7 +216,7 @@
// Exercise comparision functions by sorting and re-sorting the list.
TEST_F(RelativePositioningTest, SortPositions) {
ASSERT_EQ(kNumPositions, kNumSortedPositions);
- UniquePosition positions[base::size(kPositionArray)];
+ UniquePosition positions[std::size(kPositionArray)];
for (size_t i = 0; i < kNumPositions; ++i) {
positions[i] = kPositionArray[i];
}
@@ -233,7 +232,7 @@
// Some more exercise for the comparison function.
TEST_F(RelativePositioningTest, ReverseSortPositions) {
ASSERT_EQ(kNumPositions, kNumSortedPositions);
- UniquePosition positions[base::size(kPositionArray)];
+ UniquePosition positions[std::size(kPositionArray)];
for (size_t i = 0; i < kNumPositions; ++i) {
positions[i] = kPositionArray[i];
}
@@ -412,10 +411,9 @@
class PositionScenariosTest : public UniquePositionTest {
public:
PositionScenariosTest()
- : generator1_(
- std::string(kCacheGuidStr1, base::size(kCacheGuidStr1) - 1)),
+ : generator1_(std::string(kCacheGuidStr1, std::size(kCacheGuidStr1) - 1)),
generator2_(
- std::string(kCacheGuidStr2, base::size(kCacheGuidStr2) - 1)) {}
+ std::string(kCacheGuidStr2, std::size(kCacheGuidStr2) - 1)) {}

std::string NextClient1Suffix() { return generator1_.NextSuffix(); }

@@ -485,24 +483,24 @@
EXPECT_LT(GetLength(pos), 500U);
}

-INSTANTIATE_TEST_SUITE_P(
- MinSuffix,
- PositionInsertTest,
- ::testing::Values(std::string(kMinSuffix, base::size(kMinSuffix))));
-INSTANTIATE_TEST_SUITE_P(
- MaxSuffix,
- PositionInsertTest,
- ::testing::Values(std::string(kMaxSuffix, base::size(kMaxSuffix))));
+INSTANTIATE_TEST_SUITE_P(MinSuffix,
+ PositionInsertTest,
+ ::testing::Values(std::string(kMinSuffix,
+ std::size(kMinSuffix))));
+INSTANTIATE_TEST_SUITE_P(MaxSuffix,
+ PositionInsertTest,
+ ::testing::Values(std::string(kMaxSuffix,
+ std::size(kMaxSuffix))));
INSTANTIATE_TEST_SUITE_P(
NormalSuffix,
PositionInsertTest,
- ::testing::Values(std::string(kNormalSuffix, base::size(kNormalSuffix))));
+ ::testing::Values(std::string(kNormalSuffix, std::size(kNormalSuffix))));

class PositionFromIntTest : public UniquePositionTest {
public:
PositionFromIntTest()
- : generator_(
- std::string(kCacheGuidStr1, base::size(kCacheGuidStr1) - 1)) {}
+ : generator_(std::string(kCacheGuidStr1, std::size(kCacheGuidStr1) - 1)) {
+ }

protected:
static const int64_t kTestValues[];
@@ -557,7 +555,7 @@
INT64_MAX - 1};

const size_t PositionFromIntTest::kNumTestValues =
- base::size(PositionFromIntTest::kTestValues);
+ std::size(PositionFromIntTest::kTestValues);

TEST_F(PositionFromIntTest, IsValid) {
for (size_t i = 0; i < kNumTestValues; ++i) {
diff --git a/components/sync/engine/nigori/nigori.cc b/components/sync/engine/nigori/nigori.cc
index 118953e..ed7a27b 100644
--- a/components/sync/engine/nigori/nigori.cc
+++ b/components/sync/engine/nigori/nigori.cc
@@ -324,7 +324,7 @@
static const size_t kSaltSizeInBytes = 32;
std::string salt;
salt.resize(kSaltSizeInBytes);
- crypto::RandBytes(base::data(salt), salt.size());
+ crypto::RandBytes(std::data(salt), salt.size());
return salt;
}

diff --git a/components/sync_device_info/local_device_info_util_win.cc b/components/sync_device_info/local_device_info_util_win.cc
index bd33e95..bb838b8 100644
--- a/components/sync_device_info/local_device_info_util_win.cc
+++ b/components/sync_device_info/local_device_info_util_win.cc
@@ -7,14 +7,13 @@
#include <string>

#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/strings/utf_string_conversions.h"

namespace syncer {

std::string GetPersonalizableDeviceNameInternal() {
wchar_t computer_name[MAX_COMPUTERNAME_LENGTH + 1] = {0};
- DWORD size = base::size(computer_name);
+ DWORD size = std::size(computer_name);
if (::GetComputerNameW(computer_name, &size)) {
std::string result;
bool conversion_successful = base::WideToUTF8(computer_name, size, &result);
diff --git a/components/tab_count_metrics/tab_count_metrics.cc b/components/tab_count_metrics/tab_count_metrics.cc
index 836a72e..b772037 100644
--- a/components/tab_count_metrics/tab_count_metrics.cc
+++ b/components/tab_count_metrics/tab_count_metrics.cc
@@ -7,7 +7,6 @@
#include <limits>

#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"

namespace tab_count_metrics {
@@ -41,9 +40,9 @@
std::string HistogramName(const std::string prefix,
bool live_tabs_only,
size_t bucket) {
- static_assert(base::size(kTabCountBucketMins) == kNumTabCountBuckets,
+ static_assert(std::size(kTabCountBucketMins) == kNumTabCountBuckets,
"kTabCountBucketMins must have kNumTabCountBuckets elements.");
- static_assert(base::size(kTabCountBucketNames) == kNumTabCountBuckets,
+ static_assert(std::size(kTabCountBucketNames) == kNumTabCountBuckets,
"kTabCountBucketNames must have kNumTabCountBuckets elements.");
DCHECK_LT(bucket, kNumTabCountBuckets);
DCHECK(prefix.length());
diff --git a/components/test/components_test_suite.cc b/components/test/components_test_suite.cc
index 4aa520a..5211cb9 100644
--- a/components/test/components_test_suite.cc
+++ b/components/test/components_test_suite.cc
@@ -9,7 +9,6 @@

#include "base/bind.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/test/launcher/unit_test_launcher.h"
@@ -99,7 +98,7 @@

ContentSettingsPattern::SetNonWildcardDomainNonPortSchemes(
kNonWildcardDomainNonPortSchemes,
- base::size(kNonWildcardDomainNonPortSchemes));
+ std::size(kNonWildcardDomainNonPortSchemes));
}

void Shutdown() override {
diff --git a/components/translate/core/language_detection/language_detection_model.cc b/components/translate/core/language_detection/language_detection_model.cc
index 4435e064..82b9d19 100644
--- a/components/translate/core/language_detection/language_detection_model.cc
+++ b/components/translate/core/language_detection/language_detection_model.cc
@@ -4,7 +4,6 @@

#include "components/translate/core/language_detection/language_detection_model.h"

-#include "base/cxx17_backports.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/histogram_macros_local.h"
#include "base/strings/utf_string_conversions.h"
@@ -83,7 +82,7 @@

std::string file_content(model_file.GetLength(), '\0');
int bytes_read =
- model_file.Read(0, base::data(file_content), model_file.GetLength());
+ model_file.Read(0, std::data(file_content), model_file.GetLength());
if (bytes_read != model_file.GetLength()) {
return;
}
diff --git a/components/translate/core/language_detection/language_detection_util.cc b/components/translate/core/language_detection/language_detection_util.cc
index 727d1dd2..3c9c735 100644
--- a/components/translate/core/language_detection/language_detection_util.cc
+++ b/components/translate/core/language_detection/language_detection_util.cc
@@ -6,7 +6,6 @@

#include <stddef.h>

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_functions.h"
@@ -39,7 +38,7 @@

// Checks |kSimilarLanguageCodes| and returns group code.
int GetSimilarLanguageGroupCode(const std::string& language) {
- for (size_t i = 0; i < base::size(kSimilarLanguageCodes); ++i) {
+ for (size_t i = 0; i < std::size(kSimilarLanguageCodes); ++i) {
if (language.find(kSimilarLanguageCodes[i].code) != 0)
continue;
return kSimilarLanguageCodes[i].group;
@@ -335,7 +334,7 @@
}

bool IsServerWrongConfigurationLanguage(const std::string& language_code) {
- for (size_t i = 0; i < base::size(kWellKnownCodesOnWrongConfiguration); ++i) {
+ for (size_t i = 0; i < std::size(kWellKnownCodesOnWrongConfiguration); ++i) {
if (language_code == kWellKnownCodesOnWrongConfiguration[i])
return true;
}
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc
index 8e7d4bb8..4b59962 100644
--- a/components/update_client/update_checker_unittest.cc
+++ b/components/update_client/update_checker_unittest.cc
@@ -13,7 +13,6 @@
#include <vector>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/memory/ref_counted.h"
@@ -194,7 +193,7 @@
crx_component.app_id = "jebgalgnebhfojomionfpkfelancnnkf";
crx_component.brand = brand;
crx_component.name = "test_jebg";
- crx_component.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx_component.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx_component.installer = nullptr;
crx_component.version = base::Version("0.9");
crx_component.fingerprint = "fp1";
diff --git a/components/update_client/update_client_unittest.cc b/components/update_client/update_client_unittest.cc
index c299941..f1ede7d 100644
--- a/components/update_client/update_client_unittest.cc
+++ b/components/update_client/update_client_unittest.cc
@@ -8,7 +8,6 @@

#include "base/bind.h"
#include "base/containers/flat_map.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/location.h"
@@ -277,7 +276,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -399,14 +398,14 @@
const std::vector<std::string>& ids) {
CrxComponent crx1;
crx1.name = "test_jebg";
- crx1.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx1.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx1.version = base::Version("0.9");
crx1.installer = base::MakeRefCounted<TestInstaller>();
crx1.crx_format_requirement = crx_file::VerifierFormat::CRX3;

CrxComponent crx2;
crx2.name = "test_abag";
- crx2.pk_hash.assign(abag_hash, abag_hash + base::size(abag_hash));
+ crx2.pk_hash.assign(abag_hash, abag_hash + std::size(abag_hash));
crx2.version = base::Version("2.2");
crx2.installer = base::MakeRefCounted<TestInstaller>();
crx2.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -653,14 +652,14 @@
const std::vector<std::string>& ids) {
CrxComponent crx1;
crx1.name = "test_jebg";
- crx1.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx1.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx1.version = base::Version("0.9");
crx1.installer = base::MakeRefCounted<TestInstaller>();
crx1.crx_format_requirement = crx_file::VerifierFormat::CRX3;

CrxComponent crx2;
crx2.name = "test_abag";
- crx2.pk_hash.assign(abag_hash, abag_hash + base::size(abag_hash));
+ crx2.pk_hash.assign(abag_hash, abag_hash + std::size(abag_hash));
crx2.version = base::Version("2.2");
crx2.installer = base::MakeRefCounted<TestInstaller>();
crx2.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -889,7 +888,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -1202,14 +1201,14 @@
const std::vector<std::string>& ids) {
CrxComponent crx1;
crx1.name = "test_jebg";
- crx1.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx1.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx1.version = base::Version("0.9");
crx1.installer = base::MakeRefCounted<TestInstaller>();
crx1.crx_format_requirement = crx_file::VerifierFormat::CRX3;

CrxComponent crx2;
crx2.name = "test_ihfo";
- crx2.pk_hash.assign(ihfo_hash, ihfo_hash + base::size(ihfo_hash));
+ crx2.pk_hash.assign(ihfo_hash, ihfo_hash + std::size(ihfo_hash));
crx2.version = base::Version("0.8");
crx2.installer = base::MakeRefCounted<TestInstaller>();
crx2.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -1505,7 +1504,7 @@

CrxComponent crx;
crx.name = "test_ihfo";
- crx.pk_hash.assign(ihfo_hash, ihfo_hash + base::size(ihfo_hash));
+ crx.pk_hash.assign(ihfo_hash, ihfo_hash + std::size(ihfo_hash));
crx.installer = installer;
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
if (num_calls == 1) {
@@ -1919,7 +1918,7 @@

CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = installer;
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -2121,7 +2120,7 @@

CrxComponent crx;
crx.name = "test_ihfo";
- crx.pk_hash.assign(ihfo_hash, ihfo_hash + base::size(ihfo_hash));
+ crx.pk_hash.assign(ihfo_hash, ihfo_hash + std::size(ihfo_hash));
crx.installer = installer;
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
if (num_calls == 1) {
@@ -2469,7 +2468,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -2617,7 +2616,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.0");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -2961,7 +2960,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.0");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3307,7 +3306,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3497,7 +3496,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx1;
crx1.name = "test_jebg";
- crx1.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx1.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx1.version = base::Version("0.9");
crx1.installer = base::MakeRefCounted<TestInstaller>();
crx1.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3505,7 +3504,7 @@

CrxComponent crx2;
crx2.name = "test_ihfo";
- crx2.pk_hash.assign(ihfo_hash, ihfo_hash + base::size(ihfo_hash));
+ crx2.pk_hash.assign(ihfo_hash, ihfo_hash + std::size(ihfo_hash));
crx2.version = base::Version("0.8");
crx2.installer = base::MakeRefCounted<TestInstaller>();
crx2.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3770,7 +3769,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3890,7 +3889,7 @@
{
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3899,7 +3898,7 @@
{
CrxComponent crx;
crx.name = "test_abag";
- crx.pk_hash.assign(abag_hash, abag_hash + base::size(abag_hash));
+ crx.pk_hash.assign(abag_hash, abag_hash + std::size(abag_hash));
crx.version = base::Version("0.1");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3908,7 +3907,7 @@
{
CrxComponent crx;
crx.name = "test_ihfo";
- crx.pk_hash.assign(ihfo_hash, ihfo_hash + base::size(ihfo_hash));
+ crx.pk_hash.assign(ihfo_hash, ihfo_hash + std::size(ihfo_hash));
crx.version = base::Version("0.2");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -3917,7 +3916,7 @@
{
CrxComponent crx;
crx.name = "test_gjpm";
- crx.pk_hash.assign(gjpm_hash, gjpm_hash + base::size(gjpm_hash));
+ crx.pk_hash.assign(gjpm_hash, gjpm_hash + std::size(gjpm_hash));
crx.version = base::Version("0.3");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
@@ -4256,7 +4255,7 @@

CrxComponent crx;
crx.name = "test_niea";
- crx.pk_hash.assign(gjpm_hash, gjpm_hash + base::size(gjpm_hash));
+ crx.pk_hash.assign(gjpm_hash, gjpm_hash + std::size(gjpm_hash));
crx.version = base::Version("0.0");
crx.installer = base::MakeRefCounted<VersionedTestInstaller>();
crx.action_handler = action_handler;
@@ -4414,7 +4413,7 @@

CrxComponent crx;
crx.name = "test_niea";
- crx.pk_hash.assign(gjpm_hash, gjpm_hash + base::size(gjpm_hash));
+ crx.pk_hash.assign(gjpm_hash, gjpm_hash + std::size(gjpm_hash));
crx.version = base::Version("1.0");
crx.installer =
base::MakeRefCounted<ReadOnlyTestInstaller>(unpack_path);
@@ -4442,7 +4441,7 @@
const std::vector<std::string>& ids) {
CrxComponent crx;
crx.name = "test_jebg";
- crx.pk_hash.assign(jebg_hash, jebg_hash + base::size(jebg_hash));
+ crx.pk_hash.assign(jebg_hash, jebg_hash + std::size(jebg_hash));
crx.version = base::Version("0.9");
crx.installer = base::MakeRefCounted<TestInstaller>();
crx.crx_format_requirement = crx_file::VerifierFormat::CRX3;
diff --git a/components/upload_list/combining_upload_list_unittest.cc b/components/upload_list/combining_upload_list_unittest.cc
index c8321e9..8938ed1 100644
--- a/components/upload_list/combining_upload_list_unittest.cc
+++ b/components/upload_list/combining_upload_list_unittest.cc
@@ -105,9 +105,9 @@

std::vector<UploadList::UploadInfo> actual;
combined_upload_list->GetUploads(20, &actual);
- ASSERT_EQ(actual.size(), base::size(kExpectedUploadTimes));
+ ASSERT_EQ(actual.size(), std::size(kExpectedUploadTimes));

- for (size_t i = 0; i < base::size(kExpectedUploadTimes); i++) {
+ for (size_t i = 0; i < std::size(kExpectedUploadTimes); i++) {
EXPECT_EQ(actual[i].upload_time, kExpectedUploadTimes[i])
<< " for index " << i;
EXPECT_EQ(actual[i].state, UploadList::UploadInfo::State::Uploaded)
@@ -205,9 +205,9 @@

std::vector<UploadList::UploadInfo> actual;
combined_upload_list->GetUploads(20, &actual);
- ASSERT_EQ(actual.size(), base::size(kExpectedUploadTimes));
+ ASSERT_EQ(actual.size(), std::size(kExpectedUploadTimes));

- for (size_t i = 0; i < base::size(kExpectedUploadTimes); i++) {
+ for (size_t i = 0; i < std::size(kExpectedUploadTimes); i++) {
EXPECT_EQ(actual[i].upload_time, kExpectedUploadTimes[i])
<< " for index " << i;
EXPECT_EQ(actual[i].capture_time, kExpectedCaptureTimes[i])
diff --git a/components/url_formatter/spoof_checks/idn_spoof_checker_unittest.cc b/components/url_formatter/spoof_checks/idn_spoof_checker_unittest.cc
index e6a4791..e365201 100644
--- a/components/url_formatter/spoof_checks/idn_spoof_checker_unittest.cc
+++ b/components/url_formatter/spoof_checks/idn_spoof_checker_unittest.cc
@@ -2,17 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

-#include "components/url_formatter/url_formatter.h"
+#include "components/url_formatter/spoof_checks/idn_spoof_checker.h"

#include <stddef.h>
#include <string.h>

-#include "base/cxx17_backports.h"
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
-#include "components/url_formatter/spoof_checks/idn_spoof_checker.h"
+#include "components/url_formatter/url_formatter.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

@@ -1124,7 +1123,7 @@
// E.g. Mathematical Monospace Small A (U+1D68A) is canonicalized to "a" when
// used in a domain name.
TEST_F(IDNSpoofCheckerTest, IDNToUnicode) {
- for (size_t i = 0; i < base::size(kIdnCases); i++) {
+ for (size_t i = 0; i < std::size(kIdnCases); i++) {
SCOPED_TRACE(
base::StringPrintf("input #%zu: \"%s\"", i, kIdnCases[i].input));

diff --git a/components/url_formatter/url_fixer_unittest.cc b/components/url_formatter/url_fixer_unittest.cc
index 8cb0f76..f1048ee 100644
--- a/components/url_formatter/url_fixer_unittest.cc
+++ b/components/url_formatter/url_fixer_unittest.cc
@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

+#include "components/url_formatter/url_fixer.h"
+
#include <stddef.h>
#include <stdlib.h>

#include <string>

#include "base/base_paths.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
-#include "components/url_formatter/url_fixer.h"
#include "net/base/filename_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -268,7 +268,7 @@
std::string result;
url::Parsed parts;

- for (size_t i = 0; i < base::size(segment_cases); ++i) {
+ for (size_t i = 0; i < std::size(segment_cases); ++i) {
SegmentCase value = segment_cases[i];
SCOPED_TRACE(testing::Message() << "test #" << i << ": " << value.input);

diff --git a/components/url_formatter/url_formatter_unittest.cc b/components/url_formatter/url_formatter_unittest.cc
index d50fe213..2d3ef3a 100644
--- a/components/url_formatter/url_formatter_unittest.cc
+++ b/components/url_formatter/url_formatter_unittest.cc
@@ -9,7 +9,6 @@

#include <vector>

-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
@@ -383,7 +382,7 @@
};
// clang-format on

- for (size_t i = 0; i < base::size(tests); ++i) {
+ for (size_t i = 0; i < std::size(tests); ++i) {
size_t prefix_len;
std::u16string formatted =
FormatUrl(GURL(tests[i].input), tests[i].format_types,
diff --git a/components/url_matcher/url_matcher_factory_unittest.cc b/components/url_matcher/url_matcher_factory_unittest.cc
index cbe90f8..aa5c8fe 100644
--- a/components/url_matcher/url_matcher_factory_unittest.cc
+++ b/components/url_matcher/url_matcher_factory_unittest.cc
@@ -9,7 +9,6 @@
#include <memory>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/format_macros.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -155,7 +154,7 @@
&invalid_condition5
};

- for (size_t i = 0; i < base::size(invalid_conditions); ++i) {
+ for (size_t i = 0; i < std::size(invalid_conditions); ++i) {
error.clear();
result = URLMatcherFactory::CreateFromURLFilterDictionary(
matcher.condition_factory(), invalid_conditions[i], 1, &error);
@@ -337,7 +336,7 @@
kIsUrlCaseSensitive, kIsUrlLowerCaseEnforced, url),
};

- for (size_t i = 0; i < base::size(case_tests); ++i) {
+ for (size_t i = 0; i < std::size(case_tests); ++i) {
SCOPED_TRACE(base::StringPrintf("Iteration: %" PRIuS, i));
case_tests[i].Test();
}
diff --git a/components/url_matcher/url_matcher_unittest.cc b/components/url_matcher/url_matcher_unittest.cc
index 2d0e0a0..698c501 100644
--- a/components/url_matcher/url_matcher_unittest.cc
+++ b/components/url_matcher/url_matcher_unittest.cc
@@ -9,7 +9,6 @@
#include <memory>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/strings/string_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -127,7 +126,7 @@
{URLMatcherCondition(URLMatcherCondition::HOST_PREFIX, &p1),
URLMatcherCondition(URLMatcherCondition::HOST_SUFFIX, nullptr)},
};
- for (size_t i = 0; i < base::size(test_smaller); ++i) {
+ for (size_t i = 0; i < std::size(test_smaller); ++i) {
EXPECT_TRUE(test_smaller[i][0] < test_smaller[i][1])
<< "Test " << i << " of test_smaller failed";
EXPECT_FALSE(test_smaller[i][1] < test_smaller[i][0])
@@ -139,7 +138,7 @@
{URLMatcherCondition(URLMatcherCondition::HOST_PREFIX, nullptr),
URLMatcherCondition(URLMatcherCondition::HOST_PREFIX, nullptr)},
};
- for (size_t i = 0; i < base::size(test_equal); ++i) {
+ for (size_t i = 0; i < std::size(test_equal); ++i) {
EXPECT_FALSE(test_equal[i][0] < test_equal[i][1])
<< "Test " << i << " of test_equal failed";
EXPECT_FALSE(test_equal[i][1] < test_equal[i][0])
diff --git a/components/url_pattern_index/url_pattern_index_unittest.cc b/components/url_pattern_index/url_pattern_index_unittest.cc
index 5f74e4b..0e0cac0 100644
--- a/components/url_pattern_index/url_pattern_index_unittest.cc
+++ b/components/url_pattern_index/url_pattern_index_unittest.cc
@@ -1083,7 +1083,7 @@

Finish();

- for (size_t i = 0; i < base::size(request_methods); i++) {
+ for (size_t i = 0; i < std::size(request_methods); i++) {
SCOPED_TRACE(::testing::Message()
<< "RequestMethod: " << request_methods[i].name);
std::string url = origin + "/" + request_methods[i].name;
@@ -1091,7 +1091,7 @@
flat::RequestMethod_ANY, false));
EXPECT_TRUE(FindMatch(url, origin, other_element, no_activation,
flat::RequestMethod_NONE, false));
- for (size_t j = 0; j < base::size(request_methods); j++) {
+ for (size_t j = 0; j < std::size(request_methods); j++) {
EXPECT_EQ(i == j, !!FindMatch(url, origin, other_element, no_activation,
request_methods[j].request_method, false));
}
@@ -1140,7 +1140,7 @@
{url_2, match_first_element_three, false},
{"http://abc.com", match_first_element_one, false}};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
SCOPED_TRACE(::testing::Message() << "Testing case " << i);
bool disable_generic_rules = false;
const flat::UrlRule* rule = FindMatch(
diff --git a/components/variations/entropy_provider_unittest.cc b/components/variations/entropy_provider_unittest.cc
index 56d202c..d5b07db 100644
--- a/components/variations/entropy_provider_unittest.cc
+++ b/components/variations/entropy_provider_unittest.cc
@@ -12,7 +12,6 @@
#include <memory>
#include <numeric>

-#include "base/cxx17_backports.h"
#include "base/guid.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
@@ -199,7 +198,7 @@
nullptr),
};

- for (size_t i = 0; i < base::size(trials); ++i) {
+ for (size_t i = 0; i < std::size(trials); ++i) {
for (int j = 0; j < 100; ++j)
trials[i]->AppendGroup(std::string(), 1);
}
@@ -230,7 +229,7 @@
nullptr),
};

- for (size_t i = 0; i < base::size(trials); ++i) {
+ for (size_t i = 0; i < std::size(trials); ++i) {
for (int j = 0; j < 100; ++j)
trials[i]->AppendGroup(std::string(), 1);
}
@@ -257,7 +256,7 @@
kCustomSeed, nullptr, nullptr),
};

- for (size_t i = 0; i < base::size(trials); ++i) {
+ for (size_t i = 0; i < std::size(trials); ++i) {
for (int j = 0; j < 100; ++j)
trials[i]->AppendGroup(std::string(), 1);
}
@@ -286,7 +285,7 @@
kCustomSeed, nullptr, nullptr),
};

- for (size_t i = 0; i < base::size(trials); ++i) {
+ for (size_t i = 0; i < std::size(trials); ++i) {
for (int j = 0; j < 100; ++j)
trials[i]->AppendGroup(std::string(), 1);
}
@@ -302,7 +301,7 @@
GenerateSHA1Entropy("there", "1") };

EXPECT_NE(results[0], results[1]);
- for (size_t i = 0; i < base::size(results); ++i) {
+ for (size_t i = 0; i < std::size(results); ++i) {
EXPECT_LE(0.0, results[i]);
EXPECT_GT(1.0, results[i]);
}
@@ -319,7 +318,7 @@
GenerateNormalizedMurmurHashEntropy(4321, kMaxLowEntropySize, "1")};

EXPECT_NE(results[0], results[1]);
- for (size_t i = 0; i < base::size(results); ++i) {
+ for (size_t i = 0; i < std::size(results); ++i) {
EXPECT_LE(0.0, results[i]);
EXPECT_GT(1.0, results[i]);
}
@@ -350,14 +349,14 @@
}

TEST(EntropyProviderTest, SHA1EntropyIsUniform) {
- for (size_t i = 0; i < base::size(kTestTrialNames); ++i) {
+ for (size_t i = 0; i < std::size(kTestTrialNames); ++i) {
SHA1EntropyGenerator entropy_generator(kTestTrialNames[i]);
PerformEntropyUniformityTest(kTestTrialNames[i], entropy_generator);
}
}

TEST(EntropyProviderTest, NormalizedMurmurHashEntropyIsUniform) {
- for (size_t i = 0; i < base::size(kTestTrialNames); ++i) {
+ for (size_t i = 0; i < std::size(kTestTrialNames); ++i) {
NormalizedMurmurHashEntropyGenerator entropy_generator(kTestTrialNames[i]);
PerformEntropyUniformityTest(kTestTrialNames[i], entropy_generator);
}
diff --git a/components/variations/field_trial_config/field_trial_util_unittest.cc b/components/variations/field_trial_config/field_trial_util_unittest.cc
index 6040e41..c1886fc6 100644
--- a/components/variations/field_trial_config/field_trial_util_unittest.cc
+++ b/components/variations/field_trial_config/field_trial_util_unittest.cc
@@ -9,7 +9,6 @@
#include <utility>

#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/utf_string_conversions.h"
@@ -369,13 +368,13 @@
};

// Break if platforms are added without updating |all_platforms|.
- static_assert(base::size(all_platforms) == Study::Platform_ARRAYSIZE,
+ static_assert(std::size(all_platforms) == Study::Platform_ARRAYSIZE,
"|all_platforms| must include all platforms.");

const FieldTrialTestingExperimentParams array_kFieldTrialConfig_params[] =
{{"x", "1"}, {"y", "2"}};

- for (size_t i = 0; i < base::size(all_platforms); ++i) {
+ for (size_t i = 0; i < std::size(all_platforms); ++i) {
const Study::Platform platform = all_platforms[i];
const FieldTrialTestingExperiment array_kFieldTrialConfig_experiments[] = {
{"TestGroup",
diff --git a/components/variations/hashing_unittest.cc b/components/variations/hashing_unittest.cc
index 1c5e7ad..35d83d8 100644
--- a/components/variations/hashing_unittest.cc
+++ b/components/variations/hashing_unittest.cc
@@ -7,7 +7,6 @@
#include <stddef.h>
#include <stdint.h>

-#include "base/cxx17_backports.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace variations {
@@ -26,7 +25,7 @@
{"abcdefghijklmonpqrstuvwxyz", 787728696u},
{"0123456789ABCDEF", 348858318U}};

- for (size_t i = 0; i < base::size(known_hashes); ++i) {
+ for (size_t i = 0; i < std::size(known_hashes); ++i) {
EXPECT_EQ(known_hashes[i].hash_value, HashName(known_hashes[i].name));
}
}
diff --git a/components/variations/net/variations_http_headers_unittest.cc b/components/variations/net/variations_http_headers_unittest.cc
index dc073e0..19bd989 100644
--- a/components/variations/net/variations_http_headers_unittest.cc
+++ b/components/variations/net/variations_http_headers_unittest.cc
@@ -7,7 +7,6 @@
#include <string>

#include "base/containers/flat_map.h"
-#include "base/cxx17_backports.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/variations/variations.mojom.h"
@@ -204,7 +203,7 @@
{"https://a.b.litepages.googlezip.net", true},
};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
const GURL url(cases[i].url);
EXPECT_EQ(cases[i].should_append_headers,
ShouldAppendVariationsHeaderForTesting(url, "Append"))
diff --git a/components/variations/service/variations_service_unittest.cc b/components/variations/service/variations_service_unittest.cc
index 220e52a..4f2eb10 100644
--- a/components/variations/service/variations_service_unittest.cc
+++ b/components/variations/service/variations_service_unittest.cc
@@ -13,7 +13,6 @@

#include "base/base64.h"
#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/json/json_string_value_serializer.h"
@@ -524,7 +523,7 @@
&prefs_, network_tracker_),
&prefs_, GetMetricsStateManager(), true);
service.set_intercepts_fetch(false);
- for (size_t i = 0; i < base::size(non_ok_status_codes); ++i) {
+ for (size_t i = 0; i < std::size(non_ok_status_codes); ++i) {
EXPECT_TRUE(prefs_.FindPreference(prefs::kVariationsCompressedSeed)
->IsDefaultValue());
service.test_url_loader_factory()->ClearResponses();
@@ -623,7 +622,7 @@

std::string serialized_seed = SerializeSeed(CreateTestSeed());
VariationsService::EnableFetchForTesting();
- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
TestVariationsService service(
std::make_unique<web_resource::TestRequestAllowedNotifier>(
&prefs_, network_tracker_),
@@ -695,7 +694,7 @@
{1, 0, 1, 0, 1},
};

- for (size_t i = 0; i < base::size(cases); ++i) {
+ for (size_t i = 0; i < std::size(cases); ++i) {
TestVariationsServiceObserver observer;
service.AddObserver(&observer);

diff --git a/components/variations/study_filtering_unittest.cc b/components/variations/study_filtering_unittest.cc
index 0028f25a..391c543 100644
--- a/components/variations/study_filtering_unittest.cc
+++ b/components/variations/study_filtering_unittest.cc
@@ -12,7 +12,6 @@

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
@@ -52,20 +51,20 @@
const Study::Channel channels[] = {
Study::CANARY, Study::DEV, Study::BETA, Study::STABLE,
};
- bool channel_added[base::size(channels)] = {false};
+ bool channel_added[std::size(channels)] = {false};

Study::Filter filter;

- // Check in the forwarded order. The loop cond is <= base::size(channels)
+ // Check in the forwarded order. The loop cond is <= std::size(channels)
// instead of < so that the result of adding the last channel gets checked.
- for (size_t i = 0; i <= base::size(channels); ++i) {
- for (size_t j = 0; j < base::size(channels); ++j) {
+ for (size_t i = 0; i <= std::size(channels); ++i) {
+ for (size_t j = 0; j < std::size(channels); ++j) {
const bool expected = channel_added[j] || filter.channel_size() == 0;
const bool result = internal::CheckStudyChannel(filter, channels[j]);
EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!";
}

- if (i < base::size(channels)) {
+ if (i < std::size(channels)) {
filter.add_channel(channels[i]);
channel_added[i] = true;
}
@@ -74,15 +73,15 @@
// Do the same check in the reverse order.
filter.clear_channel();
memset(&channel_added, 0, sizeof(channel_added));
- for (size_t i = 0; i <= base::size(channels); ++i) {
- for (size_t j = 0; j < base::size(channels); ++j) {
+ for (size_t i = 0; i <= std::size(channels); ++i) {
+ for (size_t j = 0; j < std::size(channels); ++j) {
const bool expected = channel_added[j] || filter.channel_size() == 0;
const bool result = internal::CheckStudyChannel(filter, channels[j]);
EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!";
}

- if (i < base::size(channels)) {
- const int index = base::size(channels) - i - 1;
+ if (i < std::size(channels)) {
+ const int index = std::size(channels) - i - 1;
filter.add_channel(channels[index]);
channel_added[index] = true;
}
@@ -95,13 +94,13 @@
Study::MEET_DEVICE};

ASSERT_EQ(Study::FormFactor_ARRAYSIZE,
- static_cast<int>(base::size(form_factors)));
+ static_cast<int>(std::size(form_factors)));

- bool form_factor_added[base::size(form_factors)] = {false};
+ bool form_factor_added[std::size(form_factors)] = {false};
Study::Filter filter;

- for (size_t i = 0; i <= base::size(form_factors); ++i) {
- for (size_t j = 0; j < base::size(form_factors); ++j) {
+ for (size_t i = 0; i <= std::size(form_factors); ++i) {
+ for (size_t j = 0; j < std::size(form_factors); ++j) {
const bool expected = form_factor_added[j] ||
filter.form_factor_size() == 0;
const bool result = internal::CheckStudyFormFactor(filter,
@@ -110,7 +109,7 @@
<< " failed!";
}

- if (i < base::size(form_factors)) {
+ if (i < std::size(form_factors)) {
filter.add_form_factor(form_factors[i]);
form_factor_added[i] = true;
}
@@ -119,8 +118,8 @@
// Do the same check in the reverse order.
filter.clear_form_factor();
memset(&form_factor_added, 0, sizeof(form_factor_added));
- for (size_t i = 0; i <= base::size(form_factors); ++i) {
- for (size_t j = 0; j < base::size(form_factors); ++j) {
+ for (size_t i = 0; i <= std::size(form_factors); ++i) {
+ for (size_t j = 0; j < std::size(form_factors); ++j) {
const bool expected = form_factor_added[j] ||
filter.form_factor_size() == 0;
const bool result = internal::CheckStudyFormFactor(filter,
@@ -129,8 +128,8 @@
<< " failed!";
}

- if (i < base::size(form_factors)) {
- const int index = base::size(form_factors) - i - 1;
+ if (i < std::size(form_factors)) {
+ const int index = std::size(form_factors) - i - 1;
filter.add_form_factor(form_factors[index]);
form_factor_added[index] = true;
}
@@ -138,9 +137,9 @@

// Test exclude_form_factors, forward order.
filter.clear_form_factor();
- bool form_factor_excluded[base::size(form_factors)] = {false};
- for (size_t i = 0; i <= base::size(form_factors); ++i) {
- for (size_t j = 0; j < base::size(form_factors); ++j) {
+ bool form_factor_excluded[std::size(form_factors)] = {false};
+ for (size_t i = 0; i <= std::size(form_factors); ++i) {
+ for (size_t j = 0; j < std::size(form_factors); ++j) {
const bool expected = filter.exclude_form_factor_size() == 0 ||
!form_factor_excluded[j];
const bool result = internal::CheckStudyFormFactor(filter,
@@ -149,7 +148,7 @@
<< j << " failed!";
}

- if (i < base::size(form_factors)) {
+ if (i < std::size(form_factors)) {
filter.add_exclude_form_factor(form_factors[i]);
form_factor_excluded[i] = true;
}
@@ -158,8 +157,8 @@
// Test exclude_form_factors, reverse order.
filter.clear_exclude_form_factor();
memset(&form_factor_excluded, 0, sizeof(form_factor_excluded));
- for (size_t i = 0; i <= base::size(form_factors); ++i) {
- for (size_t j = 0; j < base::size(form_factors); ++j) {
+ for (size_t i = 0; i <= std::size(form_factors); ++i) {
+ for (size_t j = 0; j < std::size(form_factors); ++j) {
const bool expected = filter.exclude_form_factor_size() == 0 ||
!form_factor_excluded[j];
const bool result = internal::CheckStudyFormFactor(filter,
@@ -168,8 +167,8 @@
<< j << " failed!";
}

- if (i < base::size(form_factors)) {
- const int index = base::size(form_factors) - i - 1;
+ if (i < std::size(form_factors)) {
+ const int index = std::size(form_factors) - i - 1;
filter.add_exclude_form_factor(form_factors[index]);
form_factor_excluded[index] = true;
}
@@ -226,22 +225,22 @@
Study::PLATFORM_ANDROID_WEBLAYER,
Study::PLATFORM_FUCHSIA,
Study::PLATFORM_ANDROID_WEBVIEW};
- static_assert(base::size(platforms) == Study::Platform_ARRAYSIZE,
+ static_assert(std::size(platforms) == Study::Platform_ARRAYSIZE,
"|platforms| must include all platforms.");
- bool platform_added[base::size(platforms)] = {false};
+ bool platform_added[std::size(platforms)] = {false};

Study::Filter filter;

- // Check in the forwarded order. The loop cond is <= base::size(platforms)
+ // Check in the forwarded order. The loop cond is <= std::size(platforms)
// instead of < so that the result of adding the last platform gets checked.
- for (size_t i = 0; i <= base::size(platforms); ++i) {
- for (size_t j = 0; j < base::size(platforms); ++j) {
+ for (size_t i = 0; i <= std::size(platforms); ++i) {
+ for (size_t j = 0; j < std::size(platforms); ++j) {
const bool expected = platform_added[j];
const bool result = internal::CheckStudyPlatform(filter, platforms[j]);
EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!";
}

- if (i < base::size(platforms)) {
+ if (i < std::size(platforms)) {
filter.add_platform(platforms[i]);
platform_added[i] = true;
}
@@ -250,15 +249,15 @@
// Do the same check in the reverse order.
filter.clear_platform();
memset(&platform_added, 0, sizeof(platform_added));
- for (size_t i = 0; i <= base::size(platforms); ++i) {
- for (size_t j = 0; j < base::size(platforms); ++j) {
+ for (size_t i = 0; i <= std::size(platforms); ++i) {
+ for (size_t j = 0; j < std::size(platforms); ++j) {
const bool expected = platform_added[j];
const bool result = internal::CheckStudyPlatform(filter, platforms[j]);
EXPECT_EQ(expected, result) << "Case " << i << "," << j << " failed!";
}

- if (i < base::size(platforms)) {
- const int index = base::size(platforms) - i - 1;
+ if (i < std::size(platforms)) {
+ const int index = std::size(platforms) - i - 1;
filter.add_platform(platforms[index]);
platform_added[index] = true;
}
@@ -363,7 +362,7 @@
// Start date not set should result in true.
EXPECT_TRUE(internal::CheckStudyStartDate(filter, now));

- for (size_t i = 0; i < base::size(start_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(start_test_cases); ++i) {
filter.set_start_date(TimeToProtoTime(start_test_cases[i].start_date));
const bool result = internal::CheckStudyStartDate(filter, now);
EXPECT_EQ(start_test_cases[i].expected_result, result)
@@ -386,7 +385,7 @@
// End date not set should result in true.
EXPECT_TRUE(internal::CheckStudyEndDate(filter, now));

- for (size_t i = 0; i < base::size(start_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(start_test_cases); ++i) {
filter.set_end_date(TimeToProtoTime(start_test_cases[i].end_date));
const bool result = internal::CheckStudyEndDate(filter, now);
EXPECT_EQ(start_test_cases[i].expected_result, result) << "Case " << i
@@ -441,7 +440,7 @@
// Min/max version not set should result in true.
EXPECT_TRUE(internal::CheckStudyOSVersion(filter, base::Version("1.2.3")));

- for (size_t i = 0; i < base::size(min_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(min_test_cases); ++i) {
filter.set_min_os_version(min_test_cases[i].min_os_version);
const bool result = internal::CheckStudyOSVersion(
filter, base::Version(min_test_cases[i].os_version));
@@ -450,7 +449,7 @@
}
filter.clear_min_os_version();

- for (size_t i = 0; i < base::size(max_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(max_test_cases); ++i) {
filter.set_max_os_version(max_test_cases[i].max_os_version);
const bool result = internal::CheckStudyOSVersion(
filter, base::Version(max_test_cases[i].os_version));
@@ -459,8 +458,8 @@
}

// Check intersection semantics.
- for (size_t i = 0; i < base::size(min_test_cases); ++i) {
- for (size_t j = 0; j < base::size(max_test_cases); ++j) {
+ for (size_t i = 0; i < std::size(min_test_cases); ++i) {
+ for (size_t j = 0; j < std::size(max_test_cases); ++j) {
filter.set_min_os_version(min_test_cases[i].min_os_version);
filter.set_max_os_version(max_test_cases[j].max_os_version);

@@ -539,7 +538,7 @@
// Min/max version not set should result in true.
EXPECT_TRUE(internal::CheckStudyVersion(filter, base::Version("1.2.3")));

- for (size_t i = 0; i < base::size(min_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(min_test_cases); ++i) {
filter.set_min_version(min_test_cases[i].min_version);
const bool result = internal::CheckStudyVersion(
filter, base::Version(min_test_cases[i].version));
@@ -548,7 +547,7 @@
}
filter.clear_min_version();

- for (size_t i = 0; i < base::size(max_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(max_test_cases); ++i) {
filter.set_max_version(max_test_cases[i].max_version);
const bool result = internal::CheckStudyVersion(
filter, base::Version(max_test_cases[i].version));
@@ -557,8 +556,8 @@
}

// Check intersection semantics.
- for (size_t i = 0; i < base::size(min_test_cases); ++i) {
- for (size_t j = 0; j < base::size(max_test_cases); ++j) {
+ for (size_t i = 0; i < std::size(min_test_cases); ++i) {
+ for (size_t j = 0; j < std::size(max_test_cases); ++j) {
filter.set_min_version(min_test_cases[i].min_version);
filter.set_max_version(max_test_cases[j].max_version);

@@ -728,7 +727,7 @@
baseStudy.mutable_filter()->add_platform(Study::PLATFORM_ANDROID);

// Add studies with invalid min_versions.
- for (size_t i = 0; i < base::size(versions); ++i) {
+ for (size_t i = 0; i < std::size(versions); ++i) {
Study* study = seed.add_study();
*study = baseStudy;
study->set_name(
@@ -737,7 +736,7 @@
}

// Add studies with invalid max_versions.
- for (size_t i = 0; i < base::size(versions); ++i) {
+ for (size_t i = 0; i < std::size(versions); ++i) {
Study* study = seed.add_study();
*study = baseStudy;
study->set_name(
@@ -746,7 +745,7 @@
}

// Add studies with invalid min_os_versions.
- for (size_t i = 0; i < base::size(versions); ++i) {
+ for (size_t i = 0; i < std::size(versions); ++i) {
Study* study = seed.add_study();
*study = baseStudy;
study->set_name(
@@ -755,7 +754,7 @@
}

// Add studies with invalid max_os_versions.
- for (size_t i = 0; i < base::size(versions); ++i) {
+ for (size_t i = 0; i < std::size(versions); ++i) {
Study* study = seed.add_study();
*study = baseStudy;
study->set_name(
@@ -779,15 +778,15 @@

ASSERT_EQ(0U, processed_studies.size());
histogram_tester.ExpectTotalCount("Variations.InvalidStudyReason",
- base::size(versions) * 4);
+ std::size(versions) * 4);
histogram_tester.ExpectBucketCount("Variations.InvalidStudyReason", 0,
- base::size(versions));
+ std::size(versions));
histogram_tester.ExpectBucketCount("Variations.InvalidStudyReason", 1,
- base::size(versions));
+ std::size(versions));
histogram_tester.ExpectBucketCount("Variations.InvalidStudyReason", 2,
- base::size(versions));
+ std::size(versions));
histogram_tester.ExpectBucketCount("Variations.InvalidStudyReason", 3,
- base::size(versions));
+ std::size(versions));
}

TEST(VariationsStudyFilteringTest, FilterAndValidateStudiesWithBlankStudyName) {
@@ -915,7 +914,7 @@
// Expiry date not set should result in false.
EXPECT_FALSE(internal::IsStudyExpired(study, now));

- for (size_t i = 0; i < base::size(expiry_test_cases); ++i) {
+ for (size_t i = 0; i < std::size(expiry_test_cases); ++i) {
study.set_expiry_date(TimeToProtoTime(expiry_test_cases[i].expiry_date));
const bool result = internal::IsStudyExpired(study, now);
EXPECT_EQ(expiry_test_cases[i].expected_result, result)
diff --git a/components/variations/variations_seed_processor_unittest.cc b/components/variations/variations_seed_processor_unittest.cc
index 827118f..1ac2db4 100644
--- a/components/variations/variations_seed_processor_unittest.cc
+++ b/components/variations/variations_seed_processor_unittest.cc
@@ -15,7 +15,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/format_macros.h"
#include "base/strings/string_split.h"
@@ -692,7 +691,7 @@
{nullptr, kFeatureOffByDefault.name, false, true},
};

- for (size_t i = 0; i < base::size(test_cases); i++) {
+ for (size_t i = 0; i < std::size(test_cases); i++) {
const auto& test_case = test_cases[i];
SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]", i));

@@ -814,7 +813,7 @@
kForcedOffGroup, false, true},
};

- for (size_t i = 0; i < base::size(test_cases); i++) {
+ for (size_t i = 0; i < std::size(test_cases); i++) {
const auto& test_case = test_cases[i];
const int group = test_case.one_hundred_percent_group;
SCOPED_TRACE(base::StringPrintf(
@@ -890,7 +889,7 @@
{kEnabledFeature, false, year_later, false},
};

- for (size_t i = 0; i < base::size(test_cases); i++) {
+ for (size_t i = 0; i < std::size(test_cases); i++) {
const auto& test_case = test_cases[i];
SCOPED_TRACE(
base::StringPrintf("Test[%" PRIuS "]: %s", i, test_case.feature.name));
diff --git a/components/visitedlink/browser/visitedlink_writer.cc b/components/visitedlink/browser/visitedlink_writer.cc
index 8e18dd63..af287fa 100644
--- a/components/visitedlink/browser/visitedlink_writer.cc
+++ b/components/visitedlink/browser/visitedlink_writer.cc
@@ -6,15 +6,14 @@

#include <stdio.h>
#include <string.h>
-#include <algorithm>
-#include <utility>

+#include <algorithm>
#include <memory>
+#include <utility>

#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/containers/stack_container.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/logging.h"
@@ -1001,7 +1000,7 @@
int desired = item_count * 3;

// Find the closest prime.
- for (size_t i = 0; i < base::size(table_sizes); i++) {
+ for (size_t i = 0; i < std::size(table_sizes); i++) {
if (table_sizes[i] > desired)
return table_sizes[i];
}
diff --git a/components/viz/common/delegated_ink_prediction_configuration.h b/components/viz/common/delegated_ink_prediction_configuration.h
index 2e9cb32..2d57b9b 100644
--- a/components/viz/common/delegated_ink_prediction_configuration.h
+++ b/components/viz/common/delegated_ink_prediction_configuration.h
@@ -5,8 +5,6 @@
#ifndef COMPONENTS_VIZ_COMMON_DELEGATED_INK_PREDICTION_CONFIGURATION_H_
#define COMPONENTS_VIZ_COMMON_DELEGATED_INK_PREDICTION_CONFIGURATION_H_

-#include "base/cxx17_backports.h"
-
namespace viz {

struct PredictionConfiguration {
@@ -25,7 +23,7 @@
{2, 3}};

// Current number of different prediction configurations that are being tested.
-constexpr int kNumberOfPredictionConfigs = base::size(kPredictionConfigs);
+constexpr int kNumberOfPredictionConfigs = std::size(kPredictionConfigs);

// Indicates which element of |kPredictionConfigs| is being selected in
// tests and viz/common/features.cc
diff --git a/components/viz/common/resources/resource_format_utils.cc b/components/viz/common/resources/resource_format_utils.cc
index 3deb072f..cdcc20e 100644
--- a/components/viz/common/resources/resource_format_utils.cc
+++ b/components/viz/common/resources/resource_format_utils.cc
@@ -11,7 +11,6 @@
#include <ostream>

#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "ui/gfx/buffer_types.h"

@@ -209,7 +208,7 @@
GL_ZERO, // YUV_420_BIPLANAR
GL_ZERO, // P010
};
- static_assert(base::size(format_gl_data_type) == (RESOURCE_FORMAT_MAX + 1),
+ static_assert(std::size(format_gl_data_type) == (RESOURCE_FORMAT_MAX + 1),
"format_gl_data_type does not handle all cases.");

return format_gl_data_type[format];
@@ -240,7 +239,7 @@
GL_ZERO, // YUV_420_BIPLANAR
GL_ZERO, // P010
};
- static_assert(base::size(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1),
+ static_assert(std::size(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1),
"format_gl_data_format does not handle all cases.");

return format_gl_data_format[format];
@@ -298,7 +297,7 @@
GL_ZERO, // P010
};

- static_assert(base::size(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1),
+ static_assert(std::size(format_gl_data_format) == (RESOURCE_FORMAT_MAX + 1),
"format_gl_data_format does not handle all cases.");

return format_gl_data_format[format];
diff --git a/components/viz/common/yuv_readback_unittest.cc b/components/viz/common/yuv_readback_unittest.cc
index 5cf43adb..6a0851c 100644
--- a/components/viz/common/yuv_readback_unittest.cc
+++ b/components/viz/common/yuv_readback_unittest.cc
@@ -514,8 +514,8 @@
unsigned int x = std::get<2>(GetParam());
unsigned int y = std::get<3>(GetParam());

- for (unsigned int ox = x; ox < base::size(kYUVReadbackSizes); ox++) {
- for (unsigned int oy = y; oy < base::size(kYUVReadbackSizes); oy++) {
+ for (unsigned int ox = x; ox < std::size(kYUVReadbackSizes); ox++) {
+ for (unsigned int oy = y; oy < std::size(kYUVReadbackSizes); oy++) {
// If output is a subsection of the destination frame, (letterbox)
// then try different variations of where the subsection goes.
for (Margin xm = x < ox ? MarginLeft : MarginRight; xm <= MarginRight;
@@ -546,8 +546,8 @@
::testing::Combine(
::testing::Bool(),
::testing::Bool(),
- ::testing::Range<unsigned int>(0, base::size(kYUVReadbackSizes)),
- ::testing::Range<unsigned int>(0, base::size(kYUVReadbackSizes))));
+ ::testing::Range<unsigned int>(0, std::size(kYUVReadbackSizes)),
+ ::testing::Range<unsigned int>(0, std::size(kYUVReadbackSizes))));

} // namespace viz

diff --git a/components/viz/demo/client/demo_client.cc b/components/viz/demo/client/demo_client.cc
index d47f91f..cea51ef 100644
--- a/components/viz/demo/client/demo_client.cc
+++ b/components/viz/demo/client/demo_client.cc
@@ -135,7 +135,7 @@
viz::SolidColorDrawQuad* color_quad =
render_pass->CreateAndAppendDrawQuad<viz::SolidColorDrawQuad>();
color_quad->SetNew(quad_state, output_rect, output_rect,
- colors[(++frame_count_ / 60) % base::size(colors)], false);
+ colors[(++frame_count_ / 60) % std::size(colors)], false);

frame.render_pass_list.push_back(std::move(render_pass));

diff --git a/components/viz/host/host_gpu_memory_buffer_manager.cc b/components/viz/host/host_gpu_memory_buffer_manager.cc
index 0c78238..88d20a6 100644
--- a/components/viz/host/host_gpu_memory_buffer_manager.cc
+++ b/components/viz/host/host_gpu_memory_buffer_manager.cc
@@ -263,7 +263,7 @@
// TileManager can set to cancel this wait.
base::WaitableEvent* waitables[] = {&wait_event, shutdown_event};
size_t index =
- base::WaitableEvent::WaitMany(waitables, base::size(waitables));
+ base::WaitableEvent::WaitMany(waitables, std::size(waitables));
if (index == 1)
cancelled->data = true;
} else {
diff --git a/components/viz/service/display/bsp_tree_unittest.cc b/components/viz/service/display/bsp_tree_unittest.cc
index 41b1df7..4545316 100644
--- a/components/viz/service/display/bsp_tree_unittest.cc
+++ b/components/viz/service/display/bsp_tree_unittest.cc
@@ -11,7 +11,6 @@
#include <utility>

#include "base/containers/circular_deque.h"
-#include "base/cxx17_backports.h"
#include "components/viz/service/display/bsp_walk_action.h"
#include "components/viz/service/display/draw_polygon.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -28,7 +27,7 @@
} while (false);

#define INT_VECTOR_FROM_ARRAY(array) \
- std::vector<int>(array, array + base::size(array))
+ std::vector<int>(array, array + std::size(array))

#define CREATE_DRAW_POLYGON(vertex_vector, normal, polygon_id) \
new DrawPolygon(NULL, vertex_vector, normal, polygon_id)
diff --git a/components/viz/service/display/display_unittest.cc b/components/viz/service/display/display_unittest.cc
index 2539b3de..67fc377 100644
--- a/components/viz/service/display/display_unittest.cc
+++ b/components/viz/service/display/display_unittest.cc
@@ -1041,9 +1041,9 @@
// +---+ | 0 |
// | 2 | . |
// +-----+---+
- EXPECT_EQ(base::size(rects), root_render_pass->quad_list.size());
+ EXPECT_EQ(std::size(rects), root_render_pass->quad_list.size());
display_->RemoveOverdrawQuads(&frame);
- ASSERT_EQ(base::size(rects), root_render_pass->quad_list.size());
+ ASSERT_EQ(std::size(rects), root_render_pass->quad_list.size());

for (int i = 0; i < 3; i++) {
EXPECT_EQ(rects[i], root_render_pass->quad_list.ElementAt(i)->visible_rect);
@@ -4227,7 +4227,7 @@
gfx::Rect(850, 200, 500, 70),
};

- for (size_t i = 0; i < base::size(expected_visible_rects); ++i) {
+ for (size_t i = 0; i < std::size(expected_visible_rects); ++i) {
EXPECT_EQ(
expected_visible_rects[i],
frame.render_pass_list.front()->quad_list.ElementAt(i)->visible_rect);
diff --git a/components/viz/service/display/gl_renderer.cc b/components/viz/service/display/gl_renderer.cc
index 62a4e2b..11df6a6 100644
--- a/components/viz/service/display/gl_renderer.cc
+++ b/components/viz/service/display/gl_renderer.cc
@@ -18,7 +18,6 @@
#include "base/callback_helpers.h"
#include "base/check_op.h"
#include "base/containers/cxx20_erase.h"
-#include "base/cxx17_backports.h"
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
@@ -518,7 +517,7 @@
output_surface_->capabilities().uses_default_gl_framebuffer;
GLenum attachments[] = {static_cast<GLenum>(
using_default_framebuffer ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0_EXT)};
- gl_->DiscardFramebufferEXT(GL_FRAMEBUFFER, base::size(attachments),
+ gl_->DiscardFramebufferEXT(GL_FRAMEBUFFER, std::size(attachments),
attachments);
}

diff --git a/components/viz/service/display/overlay_unittest.cc b/components/viz/service/display/overlay_unittest.cc
index 4fba6c24..cf91ff1 100644
--- a/components/viz/service/display/overlay_unittest.cc
+++ b/components/viz/service/display/overlay_unittest.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/containers/flat_map.h"
-#include "base/cxx17_backports.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
@@ -1326,7 +1325,7 @@
gfx::Rect(6, 6, kCandidateSmall, kCandidateSmall)};

AddExpectedRectToOverlayProcessor(gfx::RectF(kOverlayDisplayRect));
- for (size_t i = 0; i < base::size(kDamageRect); ++i) {
+ for (size_t i = 0; i < std::size(kDamageRect); ++i) {
SCOPED_TRACE(i);

auto pass = CreateRenderPass();
@@ -1382,7 +1381,7 @@
};

AddExpectedRectToOverlayProcessor(gfx::RectF(kOverlayDisplayRect));
- for (size_t i = 0; i < base::size(kExpectedDamage); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedDamage); ++i) {
SCOPED_TRACE(i);

auto pass = CreateRenderPass();
@@ -1432,7 +1431,7 @@
gfx::UnionRects(kInFrontDamage, kBehindOverlayDamage)};

AddExpectedRectToOverlayProcessor(gfx::RectF(kOverlayDisplayRect));
- for (size_t i = 0; i < base::size(kExpectedDamage); ++i) {
+ for (size_t i = 0; i < std::size(kExpectedDamage); ++i) {
SCOPED_TRACE(i);

auto pass = CreateRenderPass();
@@ -3493,7 +3492,7 @@
gfx::Rect(0, 0, 312, 256)};
size_t expected_candidate_size[] = {1, 1, 0};

- for (size_t i = 0; i < base::size(expected_damages); ++i) {
+ for (size_t i = 0; i < std::size(expected_damages); ++i) {
SCOPED_TRACE(i);

auto pass = CreateRenderPass();
@@ -5099,16 +5098,16 @@
kOccluderWidth * kOccluderWidth * 2};

static_assert(
- base::size(kCandidateRects) == base::size(kCandidateUseSurfaceIndex),
+ std::size(kCandidateRects) == std::size(kCandidateUseSurfaceIndex),
"Number of elements in each list should be the identical.");
- static_assert(base::size(kCandidateRects) == base::size(kExpectedDamages),
+ static_assert(std::size(kCandidateRects) == std::size(kExpectedDamages),
"Number of elements in each list should be the identical.");

QuadList& quad_list = pass->quad_list;
auto occluder_iter_count = quad_list.size();

SurfaceDamageRectList surface_damage_rect_list;
- for (size_t i = 0; i < base::size(kCandidateRects); ++i) {
+ for (size_t i = 0; i < std::size(kCandidateRects); ++i) {
SCOPED_TRACE(i);

// Create fake surface damage for this candidate.
diff --git a/components/viz/service/display/skia_renderer.cc b/components/viz/service/display/skia_renderer.cc
index 5ae3189f..a5ffac47 100644
--- a/components/viz/service/display/skia_renderer.cc
+++ b/components/viz/service/display/skia_renderer.cc
@@ -520,7 +520,7 @@
SkPath draw_region_in_path() const {
if (draw_region) {
return SkPath::Polygon(draw_region->points,
- base::size(draw_region->points),
+ std::size(draw_region->points),
/*isClosed=*/true);
}
return SkPath();
@@ -1584,7 +1584,7 @@
// quadrilateral to the bypass'ed quad's coordinate space so that BSP
// splitting is still respected.
rpdq_to_bypass.mapPoints(params->draw_region->points,
- base::size(params->draw_region->points));
+ std::size(params->draw_region->points));
}

// Compute draw params for the bypass quad from scratch, but since the
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc
index 4e86f15..2b6641b 100644
--- a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc
+++ b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc
@@ -7,7 +7,6 @@
#include <utility>

#include "base/bind.h"
-#include "base/cxx17_backports.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "build/build_config.h"
@@ -265,7 +264,7 @@
TEST_F(CompositorFrameSinkSupportTest, ResourceLifetimeSimple) {
ResourceId first_frame_ids[] = {ResourceId(1), ResourceId(2), ResourceId(3)};
SubmitCompositorFrameWithResources(first_frame_ids,
- base::size(first_frame_ids));
+ std::size(first_frame_ids));

// All of the resources submitted in the first frame are still in use at this
// time by virtue of being in the pending frame, so none can be returned to
@@ -283,11 +282,11 @@
// Resources were never consumed so no sync token should be set.
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), gpu::SyncToken());
+ std::size(expected_returned_counts), gpu::SyncToken());

ResourceId third_frame_ids[] = {ResourceId(4), ResourceId(5), ResourceId(6)};
SubmitCompositorFrameWithResources(third_frame_ids,
- base::size(third_frame_ids));
+ std::size(third_frame_ids));

// All of the resources submitted in the third frame are still in use at this
// time by virtue of being in the pending frame, so none can be returned to
@@ -299,7 +298,7 @@
// make all resources of third frame available to be returned.
ResourceId forth_frame_ids[] = {ResourceId(7), ResourceId(8), ResourceId(9)};
SubmitCompositorFrameWithResources(forth_frame_ids,
- base::size(forth_frame_ids));
+ std::size(forth_frame_ids));

ResourceId forth_expected_returned_ids[] = {ResourceId(4), ResourceId(5),
ResourceId(6)};
@@ -307,7 +306,7 @@
// Resources were never consumed so no sync token should be set.
CheckReturnedResourcesMatchExpected(
forth_expected_returned_ids, forth_expected_returned_counts,
- base::size(forth_expected_returned_counts), gpu::SyncToken());
+ std::size(forth_expected_returned_counts), gpu::SyncToken());
}

// Tests submitting a frame with resources followed by one with no resources
@@ -316,7 +315,7 @@
ResourceLifetimeSimpleWithProviderHoldingAlive) {
ResourceId first_frame_ids[] = {ResourceId(1), ResourceId(2), ResourceId(3)};
SubmitCompositorFrameWithResources(first_frame_ids,
- base::size(first_frame_ids));
+ std::size(first_frame_ids));

// All of the resources submitted in the first frame are still in use at this
// time by virtue of being in the pending frame, so none can be returned to
@@ -335,7 +334,7 @@
fake_support_client_.clear_returned_resources();

int release_counts[] = {1, 1, 1};
- UnrefResources(first_frame_ids, release_counts, base::size(first_frame_ids));
+ UnrefResources(first_frame_ids, release_counts, std::size(first_frame_ids));

// None is returned to the client since DidReceiveCompositorAck is not
// invoked.
@@ -349,7 +348,7 @@
int expected_returned_counts[] = {1, 1, 1};
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), consumer_sync_token_);
+ std::size(expected_returned_counts), consumer_sync_token_);
}

// Tests referencing a resource, unref'ing it to zero, then using it again
@@ -357,14 +356,14 @@
TEST_F(CompositorFrameSinkSupportTest, ResourceReusedBeforeReturn) {
ResourceId first_frame_ids[] = {ResourceId(7)};
SubmitCompositorFrameWithResources(first_frame_ids,
- base::size(first_frame_ids));
+ std::size(first_frame_ids));

// This removes all references to resource id 7.
SubmitCompositorFrameWithResources(nullptr, 0);

// This references id 7 again.
SubmitCompositorFrameWithResources(first_frame_ids,
- base::size(first_frame_ids));
+ std::size(first_frame_ids));

// This removes it again.
SubmitCompositorFrameWithResources(nullptr, 0);
@@ -387,7 +386,7 @@
TEST_F(CompositorFrameSinkSupportTest, ResourceRefMultipleTimes) {
ResourceId first_frame_ids[] = {ResourceId(3), ResourceId(4)};
SubmitCompositorFrameWithResources(first_frame_ids,
- base::size(first_frame_ids));
+ std::size(first_frame_ids));

// Ref resources from the first frame twice.
RefCurrentFrameResources();
@@ -395,7 +394,7 @@

ResourceId second_frame_ids[] = {ResourceId(4), ResourceId(5)};
SubmitCompositorFrameWithResources(second_frame_ids,
- base::size(second_frame_ids));
+ std::size(second_frame_ids));

// Ref resources from the second frame 3 times.
RefCurrentFrameResources();
@@ -417,18 +416,18 @@
SCOPED_TRACE("unref all 3");
ResourceId ids_to_unref[] = {ResourceId(3), ResourceId(4), ResourceId(5)};
int counts[] = {1, 1, 1};
- UnrefResources(ids_to_unref, counts, base::size(ids_to_unref));
+ UnrefResources(ids_to_unref, counts, std::size(ids_to_unref));

EXPECT_EQ(0u, fake_support_client_.returned_resources().size());
fake_support_client_.clear_returned_resources();

- UnrefResources(ids_to_unref, counts, base::size(ids_to_unref));
+ UnrefResources(ids_to_unref, counts, std::size(ids_to_unref));
SubmitCompositorFrameWithResources(nullptr, 0);
ResourceId expected_returned_ids[] = {ResourceId(3)};
int expected_returned_counts[] = {1};
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), consumer_sync_token_);
+ std::size(expected_returned_counts), consumer_sync_token_);
}

// Expected refs remaining:
@@ -438,14 +437,14 @@
SCOPED_TRACE("unref 4 and 5");
ResourceId ids_to_unref[] = {ResourceId(4), ResourceId(5)};
int counts[] = {1, 1};
- UnrefResources(ids_to_unref, counts, base::size(ids_to_unref));
+ UnrefResources(ids_to_unref, counts, std::size(ids_to_unref));
SubmitCompositorFrameWithResources(nullptr, 0);

ResourceId expected_returned_ids[] = {ResourceId(5)};
int expected_returned_counts[] = {1};
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), consumer_sync_token_);
+ std::size(expected_returned_counts), consumer_sync_token_);
}

// Now, just 2 refs remaining on resource 4. Unref both at once and make sure
@@ -454,21 +453,21 @@
SCOPED_TRACE("unref only 4");
ResourceId ids_to_unref[] = {ResourceId(4)};
int counts[] = {2};
- UnrefResources(ids_to_unref, counts, base::size(ids_to_unref));
+ UnrefResources(ids_to_unref, counts, std::size(ids_to_unref));
SubmitCompositorFrameWithResources(nullptr, 0);

ResourceId expected_returned_ids[] = {ResourceId(4)};
int expected_returned_counts[] = {2};
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), consumer_sync_token_);
+ std::size(expected_returned_counts), consumer_sync_token_);
}
}

TEST_F(CompositorFrameSinkSupportTest, ResourceLifetime) {
ResourceId first_frame_ids[] = {ResourceId(1), ResourceId(2), ResourceId(3)};
SubmitCompositorFrameWithResources(first_frame_ids,
- base::size(first_frame_ids));
+ std::size(first_frame_ids));

// All of the resources submitted in the first frame are still in use at this
// time by virtue of being in the pending frame, so none can be returned to
@@ -481,14 +480,14 @@
// only referenced by the first frame.
ResourceId second_frame_ids[] = {ResourceId(2), ResourceId(3), ResourceId(4)};
SubmitCompositorFrameWithResources(second_frame_ids,
- base::size(second_frame_ids));
+ std::size(second_frame_ids));
{
SCOPED_TRACE("second frame");
ResourceId expected_returned_ids[] = {ResourceId(1)};
int expected_returned_counts[] = {1};
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), gpu::SyncToken());
+ std::size(expected_returned_counts), gpu::SyncToken());
}

// The third frame references a disjoint set of resources, so we expect to
@@ -498,7 +497,7 @@
ResourceId third_frame_ids[] = {ResourceId(10), ResourceId(11),
ResourceId(12), ResourceId(13)};
SubmitCompositorFrameWithResources(third_frame_ids,
- base::size(third_frame_ids));
+ std::size(third_frame_ids));

{
SCOPED_TRACE("third frame");
@@ -507,7 +506,7 @@
int expected_returned_counts[] = {2, 2, 1};
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), gpu::SyncToken());
+ std::size(expected_returned_counts), gpu::SyncToken());
}

// Simulate a ResourceProvider taking a ref on all of the resources.
@@ -515,7 +514,7 @@

ResourceId fourth_frame_ids[] = {ResourceId(12), ResourceId(13)};
SubmitCompositorFrameWithResources(fourth_frame_ids,
- base::size(fourth_frame_ids));
+ std::size(fourth_frame_ids));

EXPECT_EQ(0u, fake_support_client_.returned_resources().size());

@@ -531,7 +530,7 @@
ResourceId ids_to_unref[] = {ResourceId(10), ResourceId(11), ResourceId(12),
ResourceId(13)};
int counts[] = {1, 1, 1, 1};
- UnrefResources(ids_to_unref, counts, base::size(ids_to_unref));
+ UnrefResources(ids_to_unref, counts, std::size(ids_to_unref));
}

// Nothing is returned to the client yet since DidReceiveCompositorFrameAck
@@ -545,7 +544,7 @@
{
ResourceId ids_to_unref[] = {ResourceId(12), ResourceId(13)};
int counts[] = {1, 1};
- UnrefResources(ids_to_unref, counts, base::size(ids_to_unref));
+ UnrefResources(ids_to_unref, counts, std::size(ids_to_unref));
}

// Resources 12 and 13 are still in use by the current frame, so they
@@ -563,7 +562,7 @@
int expected_returned_counts[] = {1, 1, 2, 2};
CheckReturnedResourcesMatchExpected(
expected_returned_ids, expected_returned_counts,
- base::size(expected_returned_counts), consumer_sync_token_);
+ std::size(expected_returned_counts), consumer_sync_token_);
}
}

@@ -673,7 +672,7 @@
ResourceId frame_resource_ids[] = {ResourceId(1), ResourceId(2),
ResourceId(3)};
AddResourcesToFrame(&frame, frame_resource_ids,
- base::size(frame_resource_ids));
+ std::size(frame_resource_ids));

EXPECT_FALSE(SubmitCompositorFrameWithCopyRequest(std::move(frame),
std::move(request)));
@@ -682,7 +681,7 @@

// All the resources in the rejected frame should have been returned.
CheckReturnedResourcesMatchExpected(frame_resource_ids,
- base::size(frame_resource_ids));
+ std::size(frame_resource_ids));

manager_.InvalidateFrameSinkId(kAnotherArbitraryFrameSinkId);
}
@@ -975,7 +974,7 @@
ResourceId frame_resource_ids[] = {ResourceId(1), ResourceId(2),
ResourceId(3)};
AddResourcesToFrame(&frame, frame_resource_ids,
- base::size(frame_resource_ids));
+ std::size(frame_resource_ids));

result = support_->MaybeSubmitCompositorFrame(
local_surface_id_, std::move(frame), absl::nullopt, 0,
@@ -985,7 +984,7 @@

// All the resources in the rejected frame should have been returned.
CheckReturnedResourcesMatchExpected(frame_resource_ids,
- base::size(frame_resource_ids));
+ std::size(frame_resource_ids));
}

// Check that if the device scale factor of a CompositorFrame doesn't match the
@@ -1639,7 +1638,7 @@
ResourceId first_frame_ids[] = {ResourceId(1), ResourceId(2), ResourceId(3),
ResourceId(4), ResourceId(5)};
SubmitCompositorFrameWithResources(first_frame_ids,
- base::size(first_frame_ids));
+ std::size(first_frame_ids));
EXPECT_EQ((gfx::Rect{0, 0, 20, 20}),
(support_->GetCopyOutputRequestRegion(VideoCaptureSubTarget())));

diff --git a/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc b/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc
index 92b3298..44a9861 100644
--- a/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc
+++ b/components/viz/service/frame_sinks/video_capture/video_capture_overlay_unittest.cc
@@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_path.h"
#include "base/numerics/safe_conversions.h"
#include "base/path_service.h"
@@ -103,8 +102,8 @@
CHECK(result.tryAllocPixels(info, info.minRowBytes()));
SkCanvas canvas(result, SkSurfaceProps{});
canvas.drawColor(kTestImageBackground);
- for (size_t i = 0; i < base::size(kTestImageColors); ++i) {
- const size_t idx = (i + cycle) % base::size(kTestImageColors);
+ for (size_t i = 0; i < std::size(kTestImageColors); ++i) {
+ const size_t idx = (i + cycle) % std::size(kTestImageColors);
SkPaint paint;
paint.setBlendMode(SkBlendMode::kSrc);
paint.setColor(SkColor4f::FromColor(kTestImageColors[idx]),
diff --git a/components/viz/test/test_context_provider.cc b/components/viz/test/test_context_provider.cc
index 158bc2f..8cc2954 100644
--- a/components/viz/test/test_context_provider.cc
+++ b/components/viz/test/test_context_provider.cc
@@ -16,7 +16,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "components/viz/common/gpu/context_cache_controller.h"
@@ -125,7 +124,7 @@
return nullptr;
}
const GrGLubyte* GetStringi(GrGLenum name, GrGLuint i) override {
- if (name == GL_EXTENSIONS && i < base::size(kExtensions))
+ if (name == GL_EXTENSIONS && i < std::size(kExtensions))
return reinterpret_cast<const GLubyte*>(kExtensions[i]);
return nullptr;
}
@@ -158,7 +157,7 @@
private:
static std::string BuildExtensionString(std::string additional_extensions) {
std::string extension_string = kExtensions[0];
- for (size_t i = 1; i < base::size(kExtensions); ++i) {
+ for (size_t i = 1; i < std::size(kExtensions); ++i) {
extension_string += " ";
extension_string += kExtensions[i];
}
diff --git a/components/webcrypto/algorithms/aes_cbc_unittest.cc b/components/webcrypto/algorithms/aes_cbc_unittest.cc
index 1776385..c3759e6 100644
--- a/components/webcrypto/algorithms/aes_cbc_unittest.cc
+++ b/components/webcrypto/algorithms/aes_cbc_unittest.cc
@@ -9,7 +9,6 @@
#include <memory>
#include <utility>

-#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -171,7 +170,7 @@
// Check key generation for each allowed key length.
std::vector<blink::WebCryptoAlgorithm> algorithm;
const uint16_t kKeyLength[] = {128, 256};
- for (size_t key_length_i = 0; key_length_i < base::size(kKeyLength);
+ for (size_t key_length_i = 0; key_length_i < std::size(kKeyLength);
++key_length_i) {
blink::WebCryptoKey key;

@@ -201,7 +200,7 @@
TEST_F(WebCryptoAesCbcTest, GenerateKeyBadLength) {
const uint16_t kKeyLen[] = {0, 127, 257};
blink::WebCryptoKey key;
- for (size_t i = 0; i < base::size(kKeyLen); ++i) {
+ for (size_t i = 0; i < std::size(kKeyLen); ++i) {
SCOPED_TRACE(i);
EXPECT_EQ(Status::ErrorGenerateAesKeyLength(),
GenerateSecretKey(CreateAesCbcKeyGenAlgorithm(kKeyLen[i]), true,
@@ -443,7 +442,7 @@

std::vector<uint8_t> key_bytes(16);

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey key;
@@ -461,7 +460,7 @@
blink::kWebCryptoKeyUsageDecrypt | blink::kWebCryptoKeyUsageVerify,
};

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey key;
diff --git a/components/webcrypto/algorithms/aes_ctr_unittest.cc b/components/webcrypto/algorithms/aes_ctr_unittest.cc
index 62ec521..de633028 100644
--- a/components/webcrypto/algorithms/aes_ctr_unittest.cc
+++ b/components/webcrypto/algorithms/aes_ctr_unittest.cc
@@ -5,7 +5,6 @@
#include <stddef.h>
#include <stdint.h>

-#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -85,7 +84,7 @@
std::vector<uint8_t> input(32);
std::vector<uint8_t> output;

- for (size_t i = 0; i < base::size(kBadCounterBlockLengthBytes); ++i) {
+ for (size_t i = 0; i < std::size(kBadCounterBlockLengthBytes); ++i) {
std::vector<uint8_t> bad_counter(kBadCounterBlockLengthBytes[i]);

EXPECT_EQ(Status::ErrorIncorrectSizeAesCtrCounter(),
@@ -111,7 +110,7 @@
std::vector<uint8_t> input(32);
std::vector<uint8_t> output;

- for (size_t i = 0; i < base::size(kBadCounterLengthBits); ++i) {
+ for (size_t i = 0; i < std::size(kBadCounterLengthBits); ++i) {
uint8_t bad_counter_length_bits = kBadCounterLengthBits[i];

EXPECT_EQ(Status::ErrorInvalidAesCtrCounterLength(),
@@ -149,7 +148,7 @@

std::vector<uint8_t> output;

- for (size_t i = 0; i < base::size(kStartCounter); ++i) {
+ for (size_t i = 0; i < std::size(kStartCounter); ++i) {
std::vector<uint8_t> counter(16);
counter[15] = kStartCounter[i];

diff --git a/components/webcrypto/algorithms/aes_gcm_unittest.cc b/components/webcrypto/algorithms/aes_gcm_unittest.cc
index 7f64590..89a1dff73 100644
--- a/components/webcrypto/algorithms/aes_gcm_unittest.cc
+++ b/components/webcrypto/algorithms/aes_gcm_unittest.cc
@@ -5,7 +5,6 @@
#include <stddef.h>
#include <stdint.h>

-#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -99,7 +98,7 @@
TEST_F(WebCryptoAesGcmTest, GenerateKeyBadLength) {
const uint16_t kKeyLen[] = {0, 127, 257};
blink::WebCryptoKey key;
- for (size_t i = 0; i < base::size(kKeyLen); ++i) {
+ for (size_t i = 0; i < std::size(kKeyLen); ++i) {
SCOPED_TRACE(i);
EXPECT_EQ(Status::ErrorGenerateAesKeyLength(),
GenerateSecretKey(CreateAesGcmKeyGenAlgorithm(kKeyLen[i]), true,
@@ -208,7 +207,7 @@

// Try different incorrect tag lengths
uint8_t kAlternateTagLengths[] = {0, 8, 96, 120, 128, 160, 255};
- for (size_t tag_i = 0; tag_i < base::size(kAlternateTagLengths); ++tag_i) {
+ for (size_t tag_i = 0; tag_i < std::size(kAlternateTagLengths); ++tag_i) {
unsigned int wrong_tag_size_bits = kAlternateTagLengths[tag_i];
if (test_tag_size_bits == wrong_tag_size_bits)
continue;
diff --git a/components/webcrypto/algorithms/aes_kw_unittest.cc b/components/webcrypto/algorithms/aes_kw_unittest.cc
index a96303d..3511d0a 100644
--- a/components/webcrypto/algorithms/aes_kw_unittest.cc
+++ b/components/webcrypto/algorithms/aes_kw_unittest.cc
@@ -7,7 +7,6 @@

#include <memory>

-#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -30,7 +29,7 @@
TEST_F(WebCryptoAesKwTest, GenerateKeyBadLength) {
const uint16_t kKeyLen[] = {0, 127, 257};
blink::WebCryptoKey key;
- for (size_t i = 0; i < base::size(kKeyLen); ++i) {
+ for (size_t i = 0; i < std::size(kKeyLen); ++i) {
SCOPED_TRACE(i);
EXPECT_EQ(Status::ErrorGenerateAesKeyLength(),
GenerateSecretKey(CreateAesKwKeyGenAlgorithm(kKeyLen[i]), true,
@@ -447,7 +446,7 @@

std::vector<uint8_t> key_bytes(16);

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey key;
@@ -485,7 +484,7 @@
"C2B7F19A32EE31372CD40C9C969B8CD67553E5AEA7FD1144874584E46ABCD79FDC308848"
"B2DD8BD36A2D61062B9C5B8B499B8D6EF8EB320D87A614952B4EE771";

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey key;
@@ -534,7 +533,7 @@
"40C72DCF0AEA454113CC47457B13305B25507CBEAB9BDC8D8E0F867F9167F9DCEF0D9F9B"
"30F2EE83CEDFD51136852C8A5939B768";

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey key;
diff --git a/components/webcrypto/algorithms/ec.cc b/components/webcrypto/algorithms/ec.cc
index 13774c8..30b7b239e 100644
--- a/components/webcrypto/algorithms/ec.cc
+++ b/components/webcrypto/algorithms/ec.cc
@@ -5,9 +5,9 @@
#include "components/webcrypto/algorithms/ec.h"

#include <stddef.h>
+
#include <utility>

-#include "base/cxx17_backports.h"
#include "components/webcrypto/algorithms/asymmetric_key_util.h"
#include "components/webcrypto/algorithms/util.h"
#include "components/webcrypto/blink_key_handle.h"
@@ -81,7 +81,7 @@
if (status.IsError())
return status;

- for (size_t i = 0; i < base::size(kJwkCrvMappings); ++i) {
+ for (size_t i = 0; i < std::size(kJwkCrvMappings); ++i) {
if (kJwkCrvMappings[i].jwk_curve == jwk_curve) {
*named_curve = kJwkCrvMappings[i].named_curve;
return Status::Success();
@@ -94,7 +94,7 @@
// Converts a WebCryptoNamedCurve to an equivalent JWK "crv".
Status WebCryptoCurveToJwkCrv(blink::WebCryptoNamedCurve named_curve,
std::string* jwk_crv) {
- for (size_t i = 0; i < base::size(kJwkCrvMappings); ++i) {
+ for (size_t i = 0; i < std::size(kJwkCrvMappings); ++i) {
if (kJwkCrvMappings[i].named_curve == named_curve) {
*jwk_crv = kJwkCrvMappings[i].jwk_curve;
return Status::Success();
diff --git a/components/webcrypto/algorithms/rsa_oaep_unittest.cc b/components/webcrypto/algorithms/rsa_oaep_unittest.cc
index eb8f8ef..210c337 100644
--- a/components/webcrypto/algorithms/rsa_oaep_unittest.cc
+++ b/components/webcrypto/algorithms/rsa_oaep_unittest.cc
@@ -6,7 +6,6 @@
#include <stdint.h>

#include "base/base64url.h"
-#include "base/cxx17_backports.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
#include "components/webcrypto/crypto_data.h"
@@ -128,7 +127,7 @@
{blink::kWebCryptoAlgorithmIdSha256, "RSA-OAEP-256"},
{blink::kWebCryptoAlgorithmIdSha384, "RSA-OAEP-384"},
{blink::kWebCryptoAlgorithmIdSha512, "RSA-OAEP-512"}};
- for (size_t i = 0; i < base::size(kTestData); ++i) {
+ for (size_t i = 0; i < std::size(kTestData); ++i) {
const TestData& test_data = kTestData[i];
SCOPED_TRACE(test_data.expected_jwk_alg);

@@ -481,7 +480,7 @@
{blink::kWebCryptoAlgorithmIdSha512, blink::kWebCryptoKeyUsageEncrypt,
"RSA-OAEP-512"}};

- for (size_t test_index = 0; test_index < base::size(kTests); ++test_index) {
+ for (size_t test_index = 0; test_index < std::size(kTests); ++test_index) {
SCOPED_TRACE(test_index);
const TestCase& test = kTests[test_index];

diff --git a/components/webcrypto/algorithms/rsa_ssa_unittest.cc b/components/webcrypto/algorithms/rsa_ssa_unittest.cc
index 04834ea..db13e2b 100644
--- a/components/webcrypto/algorithms/rsa_ssa_unittest.cc
+++ b/components/webcrypto/algorithms/rsa_ssa_unittest.cc
@@ -6,7 +6,6 @@
#include <stdint.h>

#include "base/check_op.h"
-#include "base/cxx17_backports.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -485,7 +484,7 @@

const std::vector<uint8_t> public_exponent = HexStringToBytes("010001");

- for (size_t i = 0; i < base::size(kBadModulusBits); ++i) {
+ for (size_t i = 0; i < std::size(kBadModulusBits); ++i) {
const unsigned int modulus_length_bits = kBadModulusBits[i];
blink::WebCryptoAlgorithm algorithm = CreateRsaHashedKeyGenAlgorithm(
blink::kWebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
@@ -517,7 +516,7 @@
"010000", // 65536
};

- for (size_t i = 0; i < base::size(kPublicExponents); ++i) {
+ for (size_t i = 0; i < std::size(kPublicExponents); ++i) {
SCOPED_TRACE(i);
blink::WebCryptoAlgorithm algorithm = CreateRsaHashedKeyGenAlgorithm(
blink::kWebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
@@ -700,7 +699,7 @@
blink::kWebCryptoKeyUsageEncrypt | blink::kWebCryptoKeyUsageDecrypt,
};

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey public_key;
@@ -730,7 +729,7 @@
dict.RemoveKey("use");
dict.SetString("alg", "RS256");

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey public_key;
@@ -752,7 +751,7 @@
const unsigned int modulus_length = 256;
const std::vector<uint8_t> public_exponent = HexStringToBytes("010001");

- for (size_t i = 0; i < base::size(bad_usages); ++i) {
+ for (size_t i = 0; i < std::size(bad_usages); ++i) {
SCOPED_TRACE(i);

blink::WebCryptoKey public_key;
@@ -888,7 +887,7 @@
{blink::kWebCryptoAlgorithmIdSha512,
blink::kWebCryptoKeyUsageVerify, "RS512"}};

- for (size_t test_index = 0; test_index < base::size(kTests); ++test_index) {
+ for (size_t test_index = 0; test_index < std::size(kTests); ++test_index) {
SCOPED_TRACE(test_index);
const TestCase& test = kTests[test_index];

@@ -955,7 +954,7 @@

// Fail if either "n" or "e" is not present or malformed.
const std::string kKtyParmName[] = {"n", "e"};
- for (size_t idx = 0; idx < base::size(kKtyParmName); ++idx) {
+ for (size_t idx = 0; idx < std::size(kKtyParmName); ++idx) {
// Fail on missing parameter.
dict.RemoveKey(kKtyParmName[idx]);
EXPECT_NE(Status::Success(),
diff --git a/components/webcrypto/algorithms/test_helpers.cc b/components/webcrypto/algorithms/test_helpers.cc
index 87e2f54..93f5398 100644
--- a/components/webcrypto/algorithms/test_helpers.cc
+++ b/components/webcrypto/algorithms/test_helpers.cc
@@ -10,7 +10,6 @@

#include "base/base64url.h"
#include "base/check.h"
-#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
@@ -221,7 +220,7 @@
{"sha-512", blink::kWebCryptoAlgorithmIdSha512},
};

- for (size_t i = 0; i < base::size(kDigestNameToId); ++i) {
+ for (size_t i = 0; i < std::size(kDigestNameToId); ++i) {
if (kDigestNameToId[i].name == algorithm_name)
return CreateAlgorithm(kDigestNameToId[i].id);
}
diff --git a/components/webrtc/fake_ssl_client_socket.cc b/components/webrtc/fake_ssl_client_socket.cc
index ee11f24..e41bac58 100644
--- a/components/webrtc/fake_ssl_client_socket.cc
+++ b/components/webrtc/fake_ssl_client_socket.cc
@@ -6,13 +6,13 @@

#include <stddef.h>
#include <stdint.h>
+
#include <cstdlib>
#include <cstring>
#include <utility>

#include "base/bind.h"
#include "base/compiler_specific.h"
-#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -81,12 +81,12 @@

base::StringPiece FakeSSLClientSocket::GetSslClientHello() {
return base::StringPiece(reinterpret_cast<const char*>(kSslClientHello),
- base::size(kSslClientHello));
+ std::size(kSslClientHello));
}

base::StringPiece FakeSSLClientSocket::GetSslServerHello() {
return base::StringPiece(reinterpret_cast<const char*>(kSslServerHello),
- base::size(kSslServerHello));
+ std::size(kSslServerHello));
}

FakeSSLClientSocket::FakeSSLClientSocket(
@@ -94,10 +94,10 @@
: transport_socket_(std::move(transport_socket)),
next_handshake_state_(STATE_NONE),
handshake_completed_(false),
- write_buf_(NewDrainableIOBufferWithSize(base::size(kSslClientHello))),
- read_buf_(NewDrainableIOBufferWithSize(base::size(kSslServerHello))) {
+ write_buf_(NewDrainableIOBufferWithSize(std::size(kSslClientHello))),
+ read_buf_(NewDrainableIOBufferWithSize(std::size(kSslServerHello))) {
CHECK(transport_socket_.get());
- std::memcpy(write_buf_->data(), kSslClientHello, base::size(kSslClientHello));
+ std::memcpy(write_buf_->data(), kSslClientHello, std::size(kSslClientHello));
}

FakeSSLClientSocket::~FakeSSLClientSocket() {}
@@ -301,7 +301,7 @@
return net::ERR_UNEXPECTED;
}
const uint8_t* expected_data_start =
- &kSslServerHello[base::size(kSslServerHello) -
+ &kSslServerHello[std::size(kSslServerHello) -
read_buf_->BytesRemaining()];
if (std::memcmp(expected_data_start, read_buf_->data(), read) != 0) {
return net::ERR_UNEXPECTED;
diff --git a/components/webrtc/fake_ssl_client_socket_unittest.cc b/components/webrtc/fake_ssl_client_socket_unittest.cc
index ca9f06e..46468bd 100644
--- a/components/webrtc/fake_ssl_client_socket_unittest.cc
+++ b/components/webrtc/fake_ssl_client_socket_unittest.cc
@@ -12,7 +12,6 @@
#include <utility>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/memory/ref_counted.h"
#include "base/test/task_environment.h"
#include "net/base/completion_once_callback.h"
@@ -158,9 +157,9 @@
AddChunkedOps(ssl_server_hello, read_chunk_size, mode, &reads);
AddChunkedOps(ssl_client_hello, write_chunk_size, mode, &writes);
reads.push_back(
- net::MockRead(mode, kReadTestData, base::size(kReadTestData)));
+ net::MockRead(mode, kReadTestData, std::size(kReadTestData)));
writes.push_back(
- net::MockWrite(mode, kWriteTestData, base::size(kWriteTestData)));
+ net::MockWrite(mode, kWriteTestData, std::size(kWriteTestData)));
}
SetData(mock_connect, &reads, &writes);

@@ -175,7 +174,7 @@
}
ExpectStatus(mode, net::OK, status, &connect_callback);
if (fake_ssl_client_socket.IsConnected()) {
- int read_len = base::size(kReadTestData);
+ int read_len = std::size(kReadTestData);
int read_buf_len = 2 * read_len;
auto read_buf = base::MakeRefCounted<net::IOBuffer>(read_buf_len);

@@ -188,9 +187,9 @@
base::MakeRefCounted<net::StringIOBuffer>(kWriteTestData);
net::TestCompletionCallback write_callback;
int write_status = fake_ssl_client_socket.Write(
- write_buf.get(), base::size(kWriteTestData),
+ write_buf.get(), std::size(kWriteTestData),
write_callback.callback(), TRAFFIC_ANNOTATION_FOR_TESTS);
- ExpectStatus(mode, base::size(kWriteTestData), write_status,
+ ExpectStatus(mode, std::size(kWriteTestData), write_status,
&write_callback);
} else {
ADD_FAILURE();
@@ -239,7 +238,7 @@
if (error == ERR_MALFORMED_SERVER_HELLO) {
static const char kBadData[] = "BAD_DATA";
reads[index].data = kBadData;
- reads[index].data_len = base::size(kBadData);
+ reads[index].data_len = std::size(kBadData);
} else {
reads[index].result = error;
reads[index].data = NULL;
diff --git a/components/webrtc/thread_wrapper.cc b/components/webrtc/thread_wrapper.cc
index 3789fc1..27baeaa 100644
--- a/components/webrtc/thread_wrapper.cc
+++ b/components/webrtc/thread_wrapper.cc
@@ -6,11 +6,11 @@

#include <stddef.h>
#include <stdint.h>
+
#include <memory>

#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/cxx17_backports.h"
#include "base/lazy_instance.h"
#include "base/memory/raw_ptr.h"
#include "base/sequence_checker.h"
@@ -272,7 +272,7 @@
while (!pending_send.done_event.IsSignaled()) {
base::WaitableEvent* events[] = {&pending_send.done_event,
&current_thread->pending_send_event_};
- size_t event = base::WaitableEvent::WaitMany(events, base::size(events));
+ size_t event = base::WaitableEvent::WaitMany(events, std::size(events));
DCHECK(event == 0 || event == 1);

if (event == 1)
diff --git a/components/zoom/page_zoom_constants.cc b/components/zoom/page_zoom_constants.cc
index 5a8437f..290643d3 100644
--- a/components/zoom/page_zoom_constants.cc
+++ b/components/zoom/page_zoom_constants.cc
@@ -4,7 +4,6 @@

#include "components/zoom/page_zoom_constants.h"

-#include "base/cxx17_backports.h"
#include "base/json/json_writer.h"
#include "base/values.h"

@@ -13,7 +12,7 @@
const double kPresetZoomFactors[] = {0.25, 1 / 3.0, 0.5, 2 / 3.0, 0.75, 0.8,
0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0, 2.5,
3.0, 4.0, 5.0};
-const std::size_t kPresetZoomFactorsSize = base::size(kPresetZoomFactors);
+const std::size_t kPresetZoomFactorsSize = std::size(kPresetZoomFactors);

std::string GetPresetZoomFactorsAsJSON() {
base::Value zoom_factors(base::Value::Type::LIST);
diff --git a/components/zucchini/disassembler_ztf_unittest.cc b/components/zucchini/disassembler_ztf_unittest.cc
index 9b53e625..3703b56 100644
--- a/components/zucchini/disassembler_ztf_unittest.cc
+++ b/components/zucchini/disassembler_ztf_unittest.cc
@@ -13,7 +13,6 @@
#include <utility>
#include <vector>

-#include "base/cxx17_backports.h"
#include "base/strings/string_piece.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/element_detection.h"
@@ -30,7 +29,7 @@
txTZ
TRAILING DATA)";
// -1 to exclude null byte.
-constexpr size_t kNormalTextExtraBytes = base::size("TRAILING DATA") - 1;
+constexpr size_t kNormalTextExtraBytes = std::size("TRAILING DATA") - 1;

constexpr char kOutOfBoundsText[] = R"(ZTxt<1,1>
Hello World!
Reply all
Reply to author
Forward
0 new messages