Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back necessary c25 base changes #4752

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/containers/id_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <limits>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe not needed
Also there is not #ifdef guard.


#include "base/check.h"
#include "base/check_op.h"
Expand Down
1 change: 1 addition & 0 deletions base/debug/asan_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#if defined(ADDRESS_SANITIZER)
#include <sanitizer/asan_interface.h>
#include <string.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


#include "base/debug/task_trace.h"
#include "base/no_destructor.h"
Expand Down
6 changes: 6 additions & 0 deletions base/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class EnvironmentImpl : public Environment {
if (result)
*result = env_value;
return true;
#else
return false;
#endif
}

Expand All @@ -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
}

Expand All @@ -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
}
};
Expand Down
8 changes: 5 additions & 3 deletions base/i18n/break_iterator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"速度";
Expand All @@ -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"でも";
Expand All @@ -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"下载";
Expand Down
10 changes: 10 additions & 0 deletions base/i18n/icu_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -433,6 +442,7 @@ bool InitializeICU() {
#endif // (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_STATIC)

return DoCommonInitialization();
#endif // defined(STARBOARD)
}

void AllowMultipleInitializeCallsForTesting() {
Expand Down
5 changes: 5 additions & 0 deletions base/task/thread_pool/thread_group_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs #ifdef check


#if BUILDFLAG(IS_WIN)
#include "base/win/scoped_com_initializer.h"
Expand All @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions base/task/thread_pool/thread_group_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
33 changes: 32 additions & 1 deletion base/trace_event/builtin_categories.h
Original file line number Diff line number Diff line change
Expand Up @@ -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") \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those seem custom events from Cobalt. Probably most would not be needed. There could be something about media to keep around.

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") \
Expand Down
Loading