| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 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, | |
| 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. | |
| 9 | |
| 10 #include <stdint.h> | |
| 11 | |
| 12 #include "base/files/file.h" | |
| 13 #include "base/i18n/icu_util.h" | |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/rand_util.h" | |
| 16 #include "base/sys_info.h" | |
| 17 #include "mojo/public/c/system/types.h" | |
| 18 | |
| 19 #if !defined(OS_ANDROID) | |
| 20 #include "third_party/icu/source/i18n/unicode/timezone.h" | |
| 21 #endif | |
| 22 | |
| 23 extern "C" { | |
| 24 #if defined(WIN32) | |
| 25 __declspec(dllexport) void __cdecl | |
| 26 #else | |
| 27 void __attribute__((visibility("default"))) | |
| 28 #endif | |
| 29 InitializeBase(const uint8_t* icu_data) { | |
| 30 base::RandUint64(); | |
| 31 base::SysInfo::AmountOfPhysicalMemory(); | |
| 32 base::SysInfo::NumberOfProcessors(); | |
| 33 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 34 base::SysInfo::MaxSharedMemorySize(); | |
| 35 #endif | |
| 36 | |
| 37 // Initialize core ICU. We must perform the full initialization before we | |
| 38 // initialize icu::TimeZone subsystem because otherwise ICU gets in a state | |
| 39 // where the timezone data is disconnected from the locale data which can | |
| 40 // cause crashes. | |
| 41 CHECK(base::i18n::InitializeICUFromRawMemory(icu_data)); | |
| 42 | |
| 43 #if !defined(OS_ANDROID) | |
| 44 // ICU DateFormat class (used in base/time_format.cc) needs to get the | |
| 45 // Olson timezone ID by accessing the zoneinfo files on disk. After | |
| 46 // TimeZone::createDefault is called once here, the timezone ID is | |
| 47 // cached and there's no more need to access the file system. | |
| 48 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | |
| 49 #endif | |
| 50 } | |
| 51 } | |
| OLD | NEW |