summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 20:12:34 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 20:12:34 +0000
commit1a6e72c054869c988f224e68a45d4a580d596be8 (patch)
tree95035651c4b388e54498012b23e68e2b8d2384e3
parent3973de072a4da1a688847e6d7a4b161be34b6633 (diff)
downloadchromium_src-1a6e72c054869c988f224e68a45d4a580d596be8.zip
chromium_src-1a6e72c054869c988f224e68a45d4a580d596be8.tar.gz
chromium_src-1a6e72c054869c988f224e68a45d4a580d596be8.tar.bz2
Revert 68046 - Broke 10.6 Tests - 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 TBR=evan@chromium.org Review URL: http://codereview.chromium.org/5522006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68053 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chrome_main.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index d16da67..b27e144 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -785,6 +785,19 @@ 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
@@ -858,13 +871,7 @@ int ChromeMain(int argc, char** argv) {
if (!process_type.empty())
CommonSubprocessInit();
- // 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)
+#if 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(),
@@ -873,17 +880,13 @@ 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.