From 7dcaafee268b4fb3dcd46e8b7a1bd2f70c41556e Mon Sep 17 00:00:00 2001 From: Claudio DeSouza Date: Thu, 4 Sep 2025 16:43:02 +0100 Subject: [PATCH] [cr142] `WTF::` now all under `blink::` Chromium changes: https://chromium.googlesource.com/chromium/src/+/c31ed6ad77ee0d2e8b21ec551264ba80b2e96a0c commit c31ed6ad77ee0d2e8b21ec551264ba80b2e96a0c Author: Kent Tamura 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 Auto-Submit: Kent Tamura Reviewed-by: Koji Ishii Cr-Commit-Position: refs/heads/main@{#1510080} --- .../modules/plugins/dom_plugin_array.cc | 3 +- .../modules/speech/speech_synthesis.cc | 3 +- .../blink/renderer/brave_font_whitelist.cc | 4 +- .../blink/renderer/brave_font_whitelist.h | 4 +- .../renderer/brave_font_whitelist_unittest.cc | 95 ++++++++----------- .../core/farbling/brave_session_cache.cc | 10 +- .../core/farbling/brave_session_cache.h | 9 +- 7 files changed, 57 insertions(+), 71 deletions(-) diff --git a/chromium_src/third_party/blink/renderer/modules/plugins/dom_plugin_array.cc b/chromium_src/third_party/blink/renderer/modules/plugins/dom_plugin_array.cc index 4da719de6ad..76f5b5ee999 100644 --- a/chromium_src/third_party/blink/renderer/modules/plugins/dom_plugin_array.cc +++ b/chromium_src/third_party/blink/renderer/modules/plugins/dom_plugin_array.cc @@ -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 { diff --git a/chromium_src/third_party/blink/renderer/modules/speech/speech_synthesis.cc b/chromium_src/third_party/blink/renderer/modules/speech/speech_synthesis.cc index 85b0f983754..bb85eb5b863 100644 --- a/chromium_src/third_party/blink/renderer/modules/speech/speech_synthesis.cc +++ b/chromium_src/third_party/blink/renderer/modules/speech/speech_synthesis.cc @@ -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( diff --git a/third_party/blink/renderer/brave_font_whitelist.cc b/third_party/blink/renderer/brave_font_whitelist.cc index 19b60de241e..3643311bbe7 100644 --- a/third_party/blink/renderer/brave_font_whitelist.cc +++ b/third_party/blink/renderer/brave_font_whitelist.cc @@ -1975,7 +1975,7 @@ base::span 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 GetAdditionalFontWhitelistByLocale( - WTF::String locale_language) { + blink::String locale_language) { #if BUILDFLAG(IS_LINUX) if (locale_language != "en" && locale_language != "la") { const auto distro = GetLinuxDistro(); diff --git a/third_party/blink/renderer/brave_font_whitelist.h b/third_party/blink/renderer/brave_font_whitelist.h index d343aeec040..17513247d39 100644 --- a/third_party/blink/renderer/brave_font_whitelist.h +++ b/third_party/blink/renderer/brave_font_whitelist.h @@ -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 -GetAdditionalFontWhitelistByLocale(WTF::String locale_language); +GetAdditionalFontWhitelistByLocale(blink::String locale_language); // Testing-only functions diff --git a/third_party/blink/renderer/brave_font_whitelist_unittest.cc b/third_party/blink/renderer/brave_font_whitelist_unittest.cc index 22781a615c0..491a372b0fc 100644 --- a/third_party/blink/renderer/brave_font_whitelist_unittest.cc +++ b/third_party/blink/renderer/brave_font_whitelist_unittest.cc @@ -64,67 +64,48 @@ TEST(BraveFontWhitelistTest, Locales) { expected_size = 0UL; } #endif - const std::vector> test_cases = { + const std::vector> 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; diff --git a/third_party/blink/renderer/core/farbling/brave_session_cache.cc b/third_party/blink/renderer/core/farbling/brave_session_cache.cc index b5f56434662..4bd07db83a0 100644 --- a/third_party/blink/renderer/core/farbling/brave_session_cache.cc +++ b/third_party/blink/renderer/core/farbling/brave_session_cache.cc @@ -349,8 +349,9 @@ void BraveSessionCache::PerturbPixelsInternal(base::span 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(key); base::span 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); diff --git a/third_party/blink/renderer/core/farbling/brave_session_cache.h b/third_party/blink/renderer/core/farbling/brave_session_cache.h index a1b0a2c2896..f6304e8c65f 100644 --- a/third_party/blink/renderer/core/farbling/brave_session_cache.h +++ b/third_party/blink/renderer/core/farbling/brave_session_cache.h @@ -84,8 +84,9 @@ class CORE_EXPORT BraveSessionCache final ContentSettingsType webcompat_settings_type); void FarbleAudioChannel(base::span dst); void PerturbPixels(base::span 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 data); - WTF::HashMap farbled_integers_; + blink::HashMap farbled_integers_; brave_shields::mojom::ShieldsSettingsPtr default_shields_settings_; std::optional audio_farbling_helper_; - WTF::HashMap farbling_levels_; + blink::HashMap farbling_levels_; }; } // namespace brave