OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file declares a raw symbol and should be included only once in a | 5 // This file declares a raw symbol and should be included only once in a |
6 // certain binary target. This needs to be run before we raise the sandbox, | 6 // certain binary target. This needs to be run before we raise the sandbox, |
7 // which means that it can't use mojo. Our runners will dig around in the | 7 // which means that it can't use mojo. Our runners will dig around in the |
8 // symbol table and run this before the mojo system is initialized. | 8 // symbol table and run this before the mojo system is initialized. |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
11 #include "base/i18n/icu_util.h" | 11 #include "base/i18n/icu_util.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
14 #include "mojo/public/c/system/types.h" | 14 #include "mojo/public/c/system/types.h" |
| 15 |
| 16 #if !defined(OS_ANDROID) |
15 #include "third_party/icu/source/i18n/unicode/timezone.h" | 17 #include "third_party/icu/source/i18n/unicode/timezone.h" |
| 18 #endif |
16 | 19 |
17 extern "C" { | 20 extern "C" { |
18 #if defined(WIN32) | 21 #if defined(WIN32) |
19 __declspec(dllexport) void __cdecl | 22 __declspec(dllexport) void __cdecl |
20 #else | 23 #else |
21 void __attribute__((visibility("default"))) | 24 void __attribute__((visibility("default"))) |
22 #endif | 25 #endif |
23 InitializeBase(const uint8* icu_data) { | 26 InitializeBase(const uint8* icu_data) { |
24 base::RandUint64(); | 27 base::RandUint64(); |
25 base::SysInfo::AmountOfPhysicalMemory(); | 28 base::SysInfo::AmountOfPhysicalMemory(); |
26 base::SysInfo::NumberOfProcessors(); | 29 base::SysInfo::NumberOfProcessors(); |
27 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 30 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
28 base::SysInfo::MaxSharedMemorySize(); | 31 base::SysInfo::MaxSharedMemorySize(); |
29 #endif | 32 #endif |
30 | 33 |
31 // Initialize core ICU. We must perform the full initialization before we | 34 // Initialize core ICU. We must perform the full initialization before we |
32 // initialize icu::TimeZone subsystem because otherwise ICU gets in a state | 35 // initialize icu::TimeZone subsystem because otherwise ICU gets in a state |
33 // where the timezone data is disconnected from the locale data which can | 36 // where the timezone data is disconnected from the locale data which can |
34 // cause crashes. | 37 // cause crashes. |
35 CHECK(base::i18n::InitializeICUFromRawMemory(icu_data)); | 38 CHECK(base::i18n::InitializeICUFromRawMemory(icu_data)); |
36 | 39 |
| 40 #if !defined(OS_ANDROID) |
37 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 41 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
38 // Olson timezone ID by accessing the zoneinfo files on disk. After | 42 // Olson timezone ID by accessing the zoneinfo files on disk. After |
39 // TimeZone::createDefault is called once here, the timezone ID is | 43 // TimeZone::createDefault is called once here, the timezone ID is |
40 // cached and there's no more need to access the file system. | 44 // cached and there's no more need to access the file system. |
41 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 45 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
| 46 #endif |
42 } | 47 } |
43 } | 48 } |
OLD | NEW |