From f4e88195f071696af853338c940a92d6c004b0d0 Mon Sep 17 00:00:00 2001 From: Andrew Savage Date: Thu, 23 Jan 2025 15:50:04 +0000 Subject: [PATCH] likely needed --- base/containers/id_map.h | 1 + base/debug/asan_service.cc | 1 + base/environment.cc | 6 ++++ base/i18n/break_iterator_unittest.cc | 8 +++-- base/i18n/icu_util.cc | 10 ++++++ base/task/thread_pool/thread_group_impl.cc | 5 +++ .../thread_pool/thread_group_impl_unittest.cc | 8 +++++ base/trace_event/builtin_categories.h | 33 ++++++++++++++++++- 8 files changed, 68 insertions(+), 4 deletions(-) diff --git a/base/containers/id_map.h b/base/containers/id_map.h index 042a21881c05..8dacf87124ec 100644 --- a/base/containers/id_map.h +++ b/base/containers/id_map.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "base/check.h" #include "base/check_op.h" diff --git a/base/debug/asan_service.cc b/base/debug/asan_service.cc index 1ec961a453a0..eafa6a2739a3 100644 --- a/base/debug/asan_service.cc +++ b/base/debug/asan_service.cc @@ -6,6 +6,7 @@ #if defined(ADDRESS_SANITIZER) #include +#include #include "base/debug/task_trace.h" #include "base/no_destructor.h" diff --git a/base/environment.cc b/base/environment.cc index f3019d317c43..d0db2cc86b3b 100644 --- a/base/environment.cc +++ b/base/environment.cc @@ -72,6 +72,8 @@ class EnvironmentImpl : public Environment { if (result) *result = env_value; return true; +#else + return false; #endif } @@ -83,6 +85,8 @@ class EnvironmentImpl : public Environment { #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) // On success, zero is returned. return !setenv(variable_name.data(), new_value.c_str(), 1); +#else + return false; #endif } @@ -93,6 +97,8 @@ class EnvironmentImpl : public Environment { #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) // On success, zero is returned. return !unsetenv(variable_name.data()); +#else + return false; #endif } }; diff --git a/base/i18n/break_iterator_unittest.cc b/base/i18n/break_iterator_unittest.cc index 432afd34d8ce..09f45aca47c1 100644 --- a/base/i18n/break_iterator_unittest.cc +++ b/base/i18n/break_iterator_unittest.cc @@ -140,9 +140,11 @@ TEST(BreakIteratorTest, BreakWordThai) { // dictionary to detect word boundaries in Thai, Chinese, Japanese, Burmese, // and Khmer. Due to the size of such a table, the part for Chinese and // Japanese is not shipped on mobile. +// Cobalt does not support Chinese/Japanese word breaking yet. This feature +// requires a big dictionary(cjdict.txt) to support. #if !(BUILDFLAG(IS_IOS) || BUILDFLAG(IS_ANDROID)) -TEST(BreakIteratorTest, BreakWordChinese) { +TEST(BreakIteratorTest, DISABLED_BreakWordChinese) { // Terms in Traditional Chinese, without spaces in between. const char16_t term1[] = u"瀏覽"; const char16_t term2[] = u"速度"; @@ -164,7 +166,7 @@ TEST(BreakIteratorTest, BreakWordChinese) { EXPECT_FALSE(iter.IsWord()); } -TEST(BreakIteratorTest, BreakWordJapanese) { +TEST(BreakIteratorTest, DISABLED_BreakWordJapanese) { // Terms in Japanese, without spaces in between. const char16_t term1[] = u"モバイル"; const char16_t term2[] = u"でも"; @@ -182,7 +184,7 @@ TEST(BreakIteratorTest, BreakWordJapanese) { EXPECT_FALSE(iter.IsWord()); } -TEST(BreakIteratorTest, BreakWordChineseEnglish) { +TEST(BreakIteratorTest, DISABLED_BreakWordChineseEnglish) { // Terms in Simplified Chinese mixed with English and wide punctuations. std::u16string space(u" "); const char16_t token1[] = u"下载"; diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc index c63a1c39c73b..55551ccd03a2 100644 --- a/base/i18n/icu_util.cc +++ b/base/i18n/icu_util.cc @@ -56,6 +56,11 @@ #include "third_party/icu/source/i18n/unicode/timezone.h" #endif +#if defined(STARBOARD) +#include "starboard/client_porting/icu_init/icu_init.h" +#include "starboard/types.h" +#endif + namespace base::i18n { #if !BUILDFLAG(IS_NACL) @@ -418,6 +423,10 @@ void SetIcuTimeZoneDataDirForTesting(const char* dir) { #endif // (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE) bool InitializeICU() { +#if defined(STARBOARD) + IcuInit(); + return true; +#else #if DCHECK_IS_ON() DCHECK(!g_check_called_once || !g_called_once); g_called_once = true; @@ -433,6 +442,7 @@ bool InitializeICU() { #endif // (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_STATIC) return DoCommonInitialization(); +#endif // defined(STARBOARD) } void AllowMultipleInitializeCallsForTesting() { diff --git a/base/task/thread_pool/thread_group_impl.cc b/base/task/thread_pool/thread_group_impl.cc index 24f41898fcd5..7ca082ae6bb8 100644 --- a/base/task/thread_pool/thread_group_impl.cc +++ b/base/task/thread_pool/thread_group_impl.cc @@ -38,6 +38,7 @@ #include "base/time/time_override.h" #include "build/build_config.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "starboard/configuration_constants.h" #if BUILDFLAG(IS_WIN) #include "base/win/scoped_com_initializer.h" @@ -51,7 +52,11 @@ namespace internal { namespace { +#ifdef STARBOARD +const size_t kMaxNumberOfWorkers = kSbMaxThreads; +#else constexpr size_t kMaxNumberOfWorkers = 256; +#endif // In a background thread group: // - Blocking calls take more time than in a foreground thread group. diff --git a/base/task/thread_pool/thread_group_impl_unittest.cc b/base/task/thread_pool/thread_group_impl_unittest.cc index 70a3d1850338..3e6e2cb185b6 100644 --- a/base/task/thread_pool/thread_group_impl_unittest.cc +++ b/base/task/thread_pool/thread_group_impl_unittest.cc @@ -1340,7 +1340,11 @@ INSTANTIATE_TEST_SUITE_P(ReclaimType, TEST_F(ThreadGroupImplBlockingTest, MaximumWorkersTest) { CreateAndStartThreadGroup(); +#ifdef STARBOARD + const size_t kMaxNumberOfWorkers = kSbMaxThreads; +#else constexpr size_t kMaxNumberOfWorkers = 256; +#endif constexpr size_t kNumExtraTasks = 10; TestWaitableEvent early_blocking_threads_running; @@ -1647,7 +1651,11 @@ INSTANTIATE_TEST_SUITE_P(WillBlock, // Verify that worker detachment doesn't race with worker cleanup, regression // test for https://crbug.com/810464. TEST_F(ThreadGroupImplImplStartInBodyTest, RacyCleanup) { +#ifdef STARBOARD + const size_t kLocalMaxTasks = kSbMaxThreads; +#else constexpr size_t kLocalMaxTasks = 256; +#endif // STARBOARD constexpr TimeDelta kReclaimTimeForRacyCleanupTest = Milliseconds(10); thread_group_->Start(kLocalMaxTasks, kLocalMaxTasks, diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h index 3c8faea2c239..5c58d94285c4 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h @@ -288,7 +288,38 @@ X(TRACE_DISABLED_BY_DEFAULT("webgpu")) \ X(TRACE_DISABLED_BY_DEFAULT("webrtc")) \ X(TRACE_DISABLED_BY_DEFAULT("worker.scheduler")) \ - X(TRACE_DISABLED_BY_DEFAULT("xr.debug")) + X(TRACE_DISABLED_BY_DEFAULT("xr.debug")) \ + X("cobalt::cssom") \ + X("cobalt::storage") \ + X("cobalt::script") \ + X("cobalt::renderer") \ + X("cobalt::renderer_sandbox") \ + X("cobalt::network") \ + X("cobalt::overlay_info") \ + X("cobalt::css_parser") \ + X("renderer::test::png_utils") \ + X("base::task_runner_util") \ + X("cobalt::audio") \ + X("cobalt::browser") \ + X("cobalt::dom::eme") \ + X("cobalt::base") \ + X("cobalt::dom") \ + X("cobalt::worker") \ + X("cobalt::loader") \ + X("cobalt::layout") \ + X("cobalt::Screencast") \ + X("cobalt::web") \ + X("cobalt::media") \ + X("cobalt::loader::image") \ + X("media") \ + X("media_stream") \ + X("cobalt::webdriver") \ + X("cobalt::Webdriver") \ + X("cobalt::WebDriver") \ + X("media_stack") \ + X("cobalt::loader::image_decoder") \ + X("cobalt::h5vcc::trace_event") \ + X("net::dial") #define INTERNAL_TRACE_LIST_BUILTIN_CATEGORY_GROUPS(X) \ X("android_webview,toplevel") \