| Index: mojo/application/public/cpp/initialize_base_and_icu.cc | 
| diff --git a/mojo/application/public/cpp/initialize_base_and_icu.cc b/mojo/application/public/cpp/initialize_base_and_icu.cc | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..d61ca798b6368eca979a03be9aa305d29dea59ae | 
| --- /dev/null | 
| +++ b/mojo/application/public/cpp/initialize_base_and_icu.cc | 
| @@ -0,0 +1,44 @@ | 
| +// Copyright 2015 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +// This file declares a raw symbol and should be included only once in a | 
| +// certain binary target. This needs to be run before we raise the sandbox, | 
| +// which means that it can't use mojo. Our runners will dig around in the | 
| +// symbol table and run this before the mojo system is initialized. | 
| + | 
| +#include "base/files/file.h" | 
| +#include "base/i18n/icu_util.h" | 
| +#include "base/rand_util.h" | 
| +#include "base/sys_info.h" | 
| +#include "mojo/public/c/system/types.h" | 
| +#include "third_party/icu/source/i18n/unicode/timezone.h" | 
| + | 
| +extern "C" { | 
| +#if defined(WIN32) | 
| +__declspec(dllexport) void __cdecl | 
| +#else | 
| +void __attribute__((visibility("default"))) | 
| +#endif | 
| +InitializeBase(base::PlatformFile platform_file) { | 
| +  base::RandUint64(); | 
| +  base::SysInfo::AmountOfPhysicalMemory(); | 
| +  base::SysInfo::NumberOfProcessors(); | 
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) | 
| +  base::SysInfo::MaxSharedMemorySize(); | 
| +#endif | 
| + | 
| +  // Initialize core ICU. We must perform the full initialization before we | 
| +  // initialize icu::TimeZone subsystem because otherwise ICU gets in a state | 
| +  // where the timezone data is disconnected from the locale data which can | 
| +  // cause crashes. | 
| +  base::i18n::InitializeICUWithFileDescriptor( | 
| +      platform_file, base::MemoryMappedFile::Region::kWholeFile); | 
| + | 
| +  // ICU DateFormat class (used in base/time_format.cc) needs to get the | 
| +  // Olson timezone ID by accessing the zoneinfo files on disk. After | 
| +  // TimeZone::createDefault is called once here, the timezone ID is | 
| +  // cached and there's no more need to access the file system. | 
| +  scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 
| +} | 
| +} | 
|  |