Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: services/shell/public/cpp/lib/initialize_base_and_icu.cc

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 <memory>
13
14 #include "base/files/file.h"
15 #include "base/i18n/icu_util.h"
16 #include "base/rand_util.h"
17 #include "base/sys_info.h"
18 #include "build/build_config.h"
19 #include "mojo/public/c/system/types.h"
20
21 #if !defined(OS_ANDROID)
22 #include "third_party/icu/source/i18n/unicode/timezone.h"
23 #endif
24
25 extern "C" {
26 #if defined(OS_WIN)
27 __declspec(dllexport) void __cdecl
28 #else
29 void __attribute__((visibility("default")))
30 #endif
31 InitializeBase(const uint8_t* icu_data) {
32 base::RandUint64();
33 base::SysInfo::AmountOfPhysicalMemory();
34 base::SysInfo::NumberOfProcessors();
35
36 #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
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 #endif // ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
43
44 #if !defined(OS_ANDROID)
45 // ICU DateFormat class (used in base/time_format.cc) needs to get the
46 // Olson timezone ID by accessing the zoneinfo files on disk. After
47 // TimeZone::createDefault is called once here, the timezone ID is
48 // cached and there's no more need to access the file system.
49 std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
50 #endif
51 }
52 }
OLDNEW
« no previous file with comments | « services/shell/public/cpp/lib/init_commandline.cc ('k') | services/shell/public/cpp/lib/interface_factory_binder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698