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 <stdint.h> | 10 #include <stdint.h> |
(...skipping 13 matching lines...) Expand all Loading... |
24 extern "C" { | 24 extern "C" { |
25 #if defined(WIN32) | 25 #if defined(WIN32) |
26 __declspec(dllexport) void __cdecl | 26 __declspec(dllexport) void __cdecl |
27 #else | 27 #else |
28 void __attribute__((visibility("default"))) | 28 void __attribute__((visibility("default"))) |
29 #endif | 29 #endif |
30 InitializeBase(const uint8_t* icu_data) { | 30 InitializeBase(const uint8_t* icu_data) { |
31 base::RandUint64(); | 31 base::RandUint64(); |
32 base::SysInfo::AmountOfPhysicalMemory(); | 32 base::SysInfo::AmountOfPhysicalMemory(); |
33 base::SysInfo::NumberOfProcessors(); | 33 base::SysInfo::NumberOfProcessors(); |
34 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
35 base::SysInfo::MaxSharedMemorySize(); | |
36 #endif | |
37 | 34 |
38 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE | 35 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE |
39 // Initialize core ICU. We must perform the full initialization before we | 36 // Initialize core ICU. We must perform the full initialization before we |
40 // initialize icu::TimeZone subsystem because otherwise ICU gets in a state | 37 // initialize icu::TimeZone subsystem because otherwise ICU gets in a state |
41 // where the timezone data is disconnected from the locale data which can | 38 // where the timezone data is disconnected from the locale data which can |
42 // cause crashes. | 39 // cause crashes. |
43 CHECK(base::i18n::InitializeICUFromRawMemory(icu_data)); | 40 CHECK(base::i18n::InitializeICUFromRawMemory(icu_data)); |
44 #endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE | 41 #endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE |
45 | 42 |
46 #if !defined(OS_ANDROID) | 43 #if !defined(OS_ANDROID) |
47 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 44 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
48 // Olson timezone ID by accessing the zoneinfo files on disk. After | 45 // Olson timezone ID by accessing the zoneinfo files on disk. After |
49 // TimeZone::createDefault is called once here, the timezone ID is | 46 // TimeZone::createDefault is called once here, the timezone ID is |
50 // cached and there's no more need to access the file system. | 47 // cached and there's no more need to access the file system. |
51 std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 48 std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
52 #endif | 49 #endif |
53 } | 50 } |
54 } | 51 } |
OLD | NEW |