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

Unified Diff: mandoline/services/core_services/main.cc

Issue 1264463005: mandoline sandbox: prewarm libraries before we raise the sandbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: mandoline/services/core_services/main.cc
diff --git a/mandoline/services/core_services/main.cc b/mandoline/services/core_services/main.cc
index ef8c8477a0e3a8494fbc3061219c48742719dd3b..91f81e5f5cb96325b5d8d4652d80da2b51f2db90 100644
--- a/mandoline/services/core_services/main.cc
+++ b/mandoline/services/core_services/main.cc
@@ -6,6 +6,30 @@
#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"
+
+// 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();
+
+ // TODO(erg): icu does timezone initialization here.
+
+ // TODO(erg): Perform OpenSSL warmup; it wants access to /dev/urandom.
+
+ // TODO(erg): Initialize SkFontConfigInterface; it has its own odd IPC system
+ // which probably must be ported to mojo.
+}
+}
+#endif // defined(OS_LINUX) && !defined(OS_ANDROID)
+
MojoResult MojoMain(MojoHandle shell_handle) {
mojo::ApplicationRunner runner(
new core_services::CoreServicesApplicationDelegate);

Powered by Google App Engine
This is Rietveld 408576698