summaryrefslogtreecommitdiffstats
path: root/mandoline
diff options
context:
space:
mode:
authorerg <erg@chromium.org>2015-11-10 15:40:41 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-10 23:42:09 +0000
commitf786c621fe5559d054a793f44ce365e86c6210a8 (patch)
tree28daa91272aa52789bb7ff0fb3658505996a34af /mandoline
parentd67d36141e516432d33fc0031e5e3bc5ee1ff756 (diff)
downloadchromium_src-f786c621fe5559d054a793f44ce365e86c6210a8.zip
chromium_src-f786c621fe5559d054a793f44ce365e86c6210a8.tar.gz
chromium_src-f786c621fe5559d054a793f44ce365e86c6210a8.tar.bz2
Revert of mandoline: Fix ICU initialization. (patchset #31 id:570001 of https://codereview.chromium.org/1425853003/ )
Reason for revert: Failures on Chromium Mojo Linux Perf which appears to be because the perf bots don't have an up to date kernel and on Chromium Mojo Android which has some weird crash. Original issue's description: > mandoline: Fix ICU initialization. > > We need to complete the initialization of ICU before we raise the > sandbox. That means we can't pass a file descriptor to the ICU data file > across mojo pipes. Due to how Android handles resources files, we also > can't pass a file descriptor around inside the same process. So pass a > raw pointer to a memory mapped file during the sandbox warm-up phase, > and make a new option to initialize ICU from this raw pointer. > > But that just uncovers a bigger issue: we don't always call what was the > sandbox warming code. If it's general initialization that needs to be > called before we run MojoMain(), we need to include initialization code > in most all main.cc implementations. This bakes a base initialize call > into the mojo application library. > > This fixes a crash in the page cycler set, which happens when a page > tries to do date operations, which fail because of missing locale data. > This should let us raise the sandbox on the page cycler. > > BUG=546644 > > Committed: https://crrev.com/e5735ff0a8ddb61672d964a44ebc8a8ebe2b6242 > Cr-Commit-Position: refs/heads/master@{#358904} TBR=sky@chromium.org,jam@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=546644 Review URL: https://codereview.chromium.org/1429263005 Cr-Commit-Position: refs/heads/master@{#358955}
Diffstat (limited to 'mandoline')
-rw-r--r--mandoline/app/desktop/launcher_process.cc2
-rw-r--r--mandoline/services/core_services/BUILD.gn5
-rw-r--r--mandoline/services/core_services/main.cc26
3 files changed, 33 insertions, 0 deletions
diff --git a/mandoline/app/desktop/launcher_process.cc b/mandoline/app/desktop/launcher_process.cc
index 938534a..6cec880 100644
--- a/mandoline/app/desktop/launcher_process.cc
+++ b/mandoline/app/desktop/launcher_process.cc
@@ -33,6 +33,8 @@ int LauncherProcessMain(int argc, char** argv) {
if (!command_line->HasSwitch(switches::kMojoSingleProcess))
command_line->AppendSwitch(switches::kEnableMultiprocess);
command_line->AppendSwitch("use-new-edk");
+ // http://crbug.com/546644
+ command_line->AppendSwitch(switches::kMojoNoSandbox);
bool trace_startup = command_line->HasSwitch(switches::kTraceStartup);
if (trace_startup) {
diff --git a/mandoline/services/core_services/BUILD.gn b/mandoline/services/core_services/BUILD.gn
index 8e093f8..f3b6ed7 100644
--- a/mandoline/services/core_services/BUILD.gn
+++ b/mandoline/services/core_services/BUILD.gn
@@ -27,6 +27,11 @@ mojo_native_application("core_services") {
}
deps += [ ":copy_files" ]
}
+
+ if (!is_android) {
+ deps += [ "//third_party/icu:icudata" ]
+ resources = [ "$root_out_dir/icudtl.dat" ]
+ }
}
source_set("sources") {
diff --git a/mandoline/services/core_services/main.cc b/mandoline/services/core_services/main.cc
index ef8c847..e9d36ba 100644
--- a/mandoline/services/core_services/main.cc
+++ b/mandoline/services/core_services/main.cc
@@ -6,6 +6,32 @@
#include "mojo/application/public/cpp/application_runner.h"
#include "third_party/mojo/src/mojo/public/c/system/main.h"
+// TODO(erg): Much of this will be the same between mojo applications. Maybe we
+// could centralize this code?
+#if defined(OS_LINUX) && !defined(OS_ANDROID)
+#include "base/rand_util.h"
+#include "base/sys_info.h"
+#include "third_party/icu/source/i18n/unicode/timezone.h"
+
+// TODO(erg): Much of this was coppied from zygote_main_linux.cc
+extern "C" {
+void __attribute__((visibility("default"))) MojoSandboxWarm() {
+ base::RandUint64();
+ base::SysInfo::AmountOfPhysicalMemory();
+ base::SysInfo::MaxSharedMemorySize();
+ base::SysInfo::NumberOfProcessors();
+
+ // 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());
+
+ // TODO(erg): Perform OpenSSL warmup; it wants access to /dev/urandom.
+}
+}
+#endif // defined(OS_LINUX) && !defined(OS_ANDROID)
+
MojoResult MojoMain(MojoHandle shell_handle) {
mojo::ApplicationRunner runner(
new core_services::CoreServicesApplicationDelegate);