summaryrefslogtreecommitdiffstats
path: root/chrome/app/chrome_main.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 19:30:00 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 19:30:00 +0000
commit1ffacfd8a743eb9d375080db95d900166758551c (patch)
tree153c4f679fd12c17525bfb64fef84ec69fee90d7 /chrome/app/chrome_main.cc
parentc309e216982bbd2aecf29bbd16d873970d779757 (diff)
downloadchromium_src-1ffacfd8a743eb9d375080db95d900166758551c.zip
chromium_src-1ffacfd8a743eb9d375080db95d900166758551c.tar.gz
chromium_src-1ffacfd8a743eb9d375080db95d900166758551c.tar.bz2
startup: move sandbox initialization together
The initialization call was happening on one place on Windows, then later on OS X. This moves Windows down alongside OS X. The comment above this code, dating back to 2008, says that we must initialize the sandbox before the crash handler. But this code as it currently works runs way after we initialize breakpad (we do breakpad in WinMain, which then loads this code from chrome.dll and runs it) and there is no breakpad code in between its old location and its new one. Review URL: http://codereview.chromium.org/5439003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68046 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/chrome_main.cc')
-rw-r--r--chrome/app/chrome_main.cc27
1 files changed, 12 insertions, 15 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index b27e144..d16da67 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -785,19 +785,6 @@ int ChromeMain(int argc, char** argv) {
if (parsed_command_line.HasSwitch(switches::kMessageLoopHistogrammer))
MessageLoop::EnableHistogrammer(true);
- // Checks if the sandbox is enabled in this process and initializes it if this
- // is the case. The crash handler depends on this so it has to be done before
- // its initialization.
- SandboxInitWrapper sandbox_wrapper;
-#if defined(OS_WIN)
- sandbox_wrapper.SetServices(sandbox_info);
-#endif
-
- // OS X enables sandboxing later in the startup process.
-#if !defined (OS_MACOSX)
- sandbox_wrapper.InitializeSandbox(parsed_command_line, process_type);
-#endif // !OS_MACOSX
-
#if defined(OS_WIN)
_Module.Init(NULL, instance);
#endif
@@ -871,7 +858,13 @@ int ChromeMain(int argc, char** argv) {
if (!process_type.empty())
CommonSubprocessInit();
-#if defined(OS_MACOSX)
+ // Initialize the sandbox for this process.
+ SandboxInitWrapper sandbox_wrapper;
+ bool initialize_sandbox = true;
+
+#if defined(OS_WIN)
+ sandbox_wrapper.SetServices(sandbox_info);
+#elif defined(OS_MACOSX)
// On OS X the renderer sandbox needs to be initialized later in the startup
// sequence in RendererMainPlatformDelegate::EnableSandbox().
// Same goes for NaClLoader, in NaClMainPlatformDelegate::EnableSandbox(),
@@ -880,13 +873,17 @@ int ChromeMain(int argc, char** argv) {
process_type != switches::kExtensionProcess &&
process_type != switches::kNaClLoaderProcess &&
process_type != switches::kGpuProcess) {
+ initialize_sandbox = false;
+ }
+#endif
+
+ if (initialize_sandbox) {
bool sandbox_initialized_ok =
sandbox_wrapper.InitializeSandbox(parsed_command_line, process_type);
// Die if the sandbox can't be enabled.
CHECK(sandbox_initialized_ok) << "Error initializing sandbox for "
<< process_type;
}
-#endif // OS_MACOSX
startup_timer.Stop(); // End of Startup Time Measurement.