[cr142] WTF:: now all under blink::

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/c31ed6ad77ee0d2e8b21ec551264ba80b2e96a0c

commit c31ed6ad77ee0d2e8b21ec551264ba80b2e96a0c
Author: Kent Tamura <tkent@chromium.org>
Date:   Wed Sep 3 01:08:30 2025 -0700

    Remove all WTF-prefixed aliases

    This CL has no behavior changes.

    Bug: 422768753
    Change-Id: Ic387df5f14e7543f19b04c736bd8bc0a9d7a40e7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6910097
    Commit-Queue: Koji Ishii <kojii@chromium.org>
    Auto-Submit: Kent Tamura <tkent@chromium.org>
    Reviewed-by: Koji Ishii <kojii@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1510080}
This commit is contained in:
Claudio DeSouza
2025-10-15 18:31:47 -04:00
committed by Emerick Rogul
parent 96b14ff037
commit 7dcaafee26
7 changed files with 57 additions and 71 deletions
@@ -28,7 +28,8 @@ using blink::MimeClassInfo;
using blink::PluginData;
using blink::PluginInfo;
using blink::StrCat;
using WTF::String;
using blink::String;
using blink::StringBuilder;
namespace brave {
@@ -48,7 +48,8 @@ void SpeechSynthesis::OnSetVoiceList(
{"Hubert", "Vernon", "Rudolph", "Clayton", "Irving", "Wilson",
"Alva", "Harley", "Beauregard", "Cleveland", "Cecil", "Reuben",
"Sylvester", "Jasper"});
fake_voice->name = WTF::String(kFakeNames[prng() % kFakeNames.size()]);
fake_voice->name =
blink::String(kFakeNames[prng() % kFakeNames.size()]);
}
}
voice_list_.push_back(
+2 -2
View File
@@ -1975,7 +1975,7 @@ base::span<const std::string_view> GetMainFontWhitelist() {
}
bool AllowFontByFamilyName(const blink::AtomicString& family_name,
WTF::String default_language) {
blink::String default_language) {
auto fontWhitelist = GetMainFontWhitelist();
if (g_simulate_empty_font_whitelist_for_testing) [[unlikely]] {
return false;
@@ -2008,7 +2008,7 @@ bool IsFontAllowedForFarbling(const blink::AtomicString& family_name) {
}
base::span<const std::string_view> GetAdditionalFontWhitelistByLocale(
WTF::String locale_language) {
blink::String locale_language) {
#if BUILDFLAG(IS_LINUX)
if (locale_language != "en" && locale_language != "la") {
const auto distro = GetLinuxDistro();
+2 -2
View File
@@ -16,7 +16,7 @@
namespace brave {
BLINK_EXPORT bool AllowFontByFamilyName(const blink::AtomicString& family_name,
WTF::String default_language);
blink::String default_language);
BLINK_EXPORT bool IsFontAllowedForFarbling(
const blink::AtomicString& family_name);
@@ -24,7 +24,7 @@ BLINK_EXPORT bool IsFontAllowedForFarbling(
// Public for testing but other callers should call
// AllowFontByFamilyName instead.
BLINK_EXPORT base::span<const std::string_view>
GetAdditionalFontWhitelistByLocale(WTF::String locale_language);
GetAdditionalFontWhitelistByLocale(blink::String locale_language);
// Testing-only functions
+38 -57
View File
@@ -64,67 +64,48 @@ TEST(BraveFontWhitelistTest, Locales) {
expected_size = 0UL;
}
#endif
const std::vector<std::tuple<WTF::String, size_t>> test_cases = {
const std::vector<std::tuple<blink::String, size_t>> test_cases = {
#if BUILDFLAG(IS_WIN)
std::make_tuple<>("ar", 14UL),
std::make_tuple<>("fa", 14UL),
std::make_tuple<>("ur", 14UL),
std::make_tuple<>("iu", 1UL),
std::make_tuple<>("hi", 15UL),
std::make_tuple<>("mr", 15UL),
std::make_tuple<>("am", 1UL),
std::make_tuple<>("ti", 1UL),
std::make_tuple<>("gu", 2UL),
std::make_tuple<>("pa", 2UL),
std::make_tuple<>("zh", 10UL),
std::make_tuple<>("he", 12UL),
std::make_tuple<>("ja", 26UL),
std::make_tuple<>("kn", 2UL),
std::make_tuple<>("km", 4UL),
std::make_tuple<>("ko", 8UL),
std::make_tuple<>("lo", 3UL),
std::make_tuple<>("ml", 2UL),
std::make_tuple<>("ar", 14UL), std::make_tuple<>("fa", 14UL),
std::make_tuple<>("ur", 14UL), std::make_tuple<>("iu", 1UL),
std::make_tuple<>("hi", 15UL), std::make_tuple<>("mr", 15UL),
std::make_tuple<>("am", 1UL), std::make_tuple<>("ti", 1UL),
std::make_tuple<>("gu", 2UL), std::make_tuple<>("pa", 2UL),
std::make_tuple<>("zh", 10UL), std::make_tuple<>("he", 12UL),
std::make_tuple<>("ja", 26UL), std::make_tuple<>("kn", 2UL),
std::make_tuple<>("km", 4UL), std::make_tuple<>("ko", 8UL),
std::make_tuple<>("lo", 3UL), std::make_tuple<>("ml", 2UL),
#elif BUILDFLAG(IS_LINUX)
std::make_tuple<>("ar", expected_size),
std::make_tuple<>("fa", expected_size),
std::make_tuple<>("ur", expected_size),
std::make_tuple<>("iu", expected_size),
std::make_tuple<>("hi", expected_size),
std::make_tuple<>("mr", expected_size),
std::make_tuple<>("am", expected_size),
std::make_tuple<>("ti", expected_size),
std::make_tuple<>("gu", expected_size),
std::make_tuple<>("pa", expected_size),
std::make_tuple<>("zh", expected_size),
std::make_tuple<>("he", expected_size),
std::make_tuple<>("ja", expected_size),
std::make_tuple<>("kn", expected_size),
std::make_tuple<>("km", expected_size),
std::make_tuple<>("ko", expected_size),
std::make_tuple<>("lo", expected_size),
std::make_tuple<>("ml", expected_size),
std::make_tuple<>("ar", expected_size),
std::make_tuple<>("fa", expected_size),
std::make_tuple<>("ur", expected_size),
std::make_tuple<>("iu", expected_size),
std::make_tuple<>("hi", expected_size),
std::make_tuple<>("mr", expected_size),
std::make_tuple<>("am", expected_size),
std::make_tuple<>("ti", expected_size),
std::make_tuple<>("gu", expected_size),
std::make_tuple<>("pa", expected_size),
std::make_tuple<>("zh", expected_size),
std::make_tuple<>("he", expected_size),
std::make_tuple<>("ja", expected_size),
std::make_tuple<>("kn", expected_size),
std::make_tuple<>("km", expected_size),
std::make_tuple<>("ko", expected_size),
std::make_tuple<>("lo", expected_size),
std::make_tuple<>("ml", expected_size),
#else
std::make_tuple<>("ar", 0UL),
std::make_tuple<>("fa", 0UL),
std::make_tuple<>("ur", 0UL),
std::make_tuple<>("iu", 0UL),
std::make_tuple<>("hi", 0UL),
std::make_tuple<>("mr", 0UL),
std::make_tuple<>("am", 0UL),
std::make_tuple<>("ti", 0UL),
std::make_tuple<>("gu", 0UL),
std::make_tuple<>("pa", 0UL),
std::make_tuple<>("zh", 0UL),
std::make_tuple<>("he", 0UL),
std::make_tuple<>("ja", 0UL),
std::make_tuple<>("kn", 0UL),
std::make_tuple<>("km", 0UL),
std::make_tuple<>("ko", 0UL),
std::make_tuple<>("lo", 0UL),
std::make_tuple<>("ml", 0UL),
std::make_tuple<>("ar", 0UL), std::make_tuple<>("fa", 0UL),
std::make_tuple<>("ur", 0UL), std::make_tuple<>("iu", 0UL),
std::make_tuple<>("hi", 0UL), std::make_tuple<>("mr", 0UL),
std::make_tuple<>("am", 0UL), std::make_tuple<>("ti", 0UL),
std::make_tuple<>("gu", 0UL), std::make_tuple<>("pa", 0UL),
std::make_tuple<>("zh", 0UL), std::make_tuple<>("he", 0UL),
std::make_tuple<>("ja", 0UL), std::make_tuple<>("kn", 0UL),
std::make_tuple<>("km", 0UL), std::make_tuple<>("ko", 0UL),
std::make_tuple<>("lo", 0UL), std::make_tuple<>("ml", 0UL),
#endif
std::make_tuple<>("en", 0UL),
std::make_tuple<>("la", 0UL),
std::make_tuple<>("en", 0UL), std::make_tuple<>("la", 0UL),
};
for (const auto& c : test_cases) {
std::cout << std::get<0>(c) << std::endl;
@@ -349,8 +349,9 @@ void BraveSessionCache::PerturbPixelsInternal(base::span<uint8_t> data) {
}
}
WTF::String BraveSessionCache::GenerateRandomString(std::string seed,
blink::wtf_size_t length) {
blink::String BraveSessionCache::GenerateRandomString(
std::string seed,
blink::wtf_size_t length) {
uint8_t key[32];
crypto::HMAC h(crypto::HMAC::SHA256);
const auto farbling_token_bytes =
@@ -360,7 +361,7 @@ WTF::String BraveSessionCache::GenerateRandomString(std::string seed,
// initial PRNG seed based on session key and passed-in seed string
uint64_t v = *reinterpret_cast<uint64_t*>(key);
base::span<UChar> destination;
WTF::String value = WTF::String::CreateUninitialized(length, destination);
blink::String value = blink::String::CreateUninitialized(length, destination);
for (auto& c : destination) {
c = UNSAFE_TODO(
kLettersForRandomStrings[v % kLettersForRandomStringsLength]);
@@ -369,7 +370,8 @@ WTF::String BraveSessionCache::GenerateRandomString(std::string seed,
return value;
}
WTF::String BraveSessionCache::FarbledUserAgent(WTF::String real_user_agent) {
blink::String BraveSessionCache::FarbledUserAgent(
blink::String real_user_agent) {
FarblingPRNG prng = MakePseudoRandomGenerator();
blink::StringBuilder result;
result.Append(real_user_agent);
@@ -84,8 +84,9 @@ class CORE_EXPORT BraveSessionCache final
ContentSettingsType webcompat_settings_type);
void FarbleAudioChannel(base::span<float> dst);
void PerturbPixels(base::span<uint8_t> data);
WTF::String GenerateRandomString(std::string seed, blink::wtf_size_t length);
WTF::String FarbledUserAgent(WTF::String real_user_agent);
blink::String GenerateRandomString(std::string seed,
blink::wtf_size_t length);
blink::String FarbledUserAgent(blink::String real_user_agent);
int FarbledInteger(FarbleKey key,
int spoof_value,
int min_random_offset,
@@ -98,10 +99,10 @@ class CORE_EXPORT BraveSessionCache final
private:
void PerturbPixelsInternal(base::span<uint8_t> data);
WTF::HashMap<FarbleKey, int> farbled_integers_;
blink::HashMap<FarbleKey, int> farbled_integers_;
brave_shields::mojom::ShieldsSettingsPtr default_shields_settings_;
std::optional<blink::BraveAudioFarblingHelper> audio_farbling_helper_;
WTF::HashMap<ContentSettingsType, BraveFarblingLevel> farbling_levels_;
blink::HashMap<ContentSettingsType, BraveFarblingLevel> farbling_levels_;
};
} // namespace brave