Skip to content

Commit

Permalink
Add Starboard ICU initialization (#3145)
Browse files Browse the repository at this point in the history
b/332735376

Change-Id: I303a1c37fd4b313ac4952f3e22096e74c33cc3ca
  • Loading branch information
johnxwork committed May 7, 2024
1 parent 43f89aa commit 5327e5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,7 @@ component("i18n") {
"//base/third_party/dynamic_annotations",
"//build:chromecast_buildflags",
"//build:chromeos_buildflags",
"//starboard/client_porting/icu_init",
]

if (is_starboard) {
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

0 comments on commit 5327e5f

Please sign in to comment.