| Index: content/app/content_main.cc
|
| ===================================================================
|
| --- content/app/content_main.cc (revision 107639)
|
| +++ content/app/content_main.cc (working copy)
|
| @@ -9,22 +9,21 @@
|
| #include "base/debug/debugger.h"
|
| #include "base/i18n/icu_util.h"
|
| #include "base/logging.h"
|
| -#include "base/mac/scoped_nsautorelease_pool.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/metrics/stats_table.h"
|
| #include "base/process_util.h"
|
| #include "base/stringprintf.h"
|
| #include "base/string_number_conversions.h"
|
| -#include "content/app/startup_helper_win.h"
|
| #include "content/browser/browser_main.h"
|
| #include "content/common/content_constants.h"
|
| #include "content/common/main_function_params.h"
|
| -#include "content/common/sandbox_init_wrapper.h"
|
| #include "content/common/set_process_title.h"
|
| #include "content/public/app/content_main_delegate.h"
|
| +#include "content/public/app/startup_helper_win.h"
|
| #include "content/public/common/content_client.h"
|
| #include "content/public/common/content_paths.h"
|
| #include "content/public/common/content_switches.h"
|
| +#include "content/public/common/sandbox_init.h"
|
| #include "crypto/nss_util.h"
|
| #include "ipc/ipc_switches.h"
|
| #include "ui/base/ui_base_switches.h"
|
| @@ -36,6 +35,7 @@
|
| #include <atlapp.h>
|
| #include <malloc.h>
|
| #elif defined(OS_MACOSX)
|
| +#include "base/mac/scoped_nsautorelease_pool.h"
|
| #include "base/mach_ipc_mac.h"
|
| #include "base/system_monitor/system_monitor.h"
|
| #include "content/browser/mach_broker_mac.h"
|
| @@ -219,9 +219,8 @@
|
| base::GetParentProcessId(base::GetCurrentProcId()));
|
| InitializeStatsTable(browser_pid, command_line);
|
|
|
| - MainFunctionParams main_params(command_line,
|
| - main_function_params.sandbox_info_,
|
| - main_function_params.autorelease_pool_);
|
| + MainFunctionParams main_params(command_line);
|
| +
|
| // Get the new process type from the new command line.
|
| std::string process_type =
|
| command_line.GetSwitchValueASCII(switches::kProcessType);
|
| @@ -327,11 +326,13 @@
|
| // The exit manager is in charge of calling the dtors of singleton objects.
|
| base::AtExitManager exit_manager;
|
|
|
| +#if defined(OS_MACOSX)
|
| // We need this pool for all the objects created before we get to the
|
| // event loop, but we don't want to leave them hanging around until the
|
| // app quits. Each "main" needs to flush this pool right before it goes into
|
| // its main event loop to get rid of the cruft.
|
| base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
| +#endif
|
|
|
| CommandLine::Init(argc, argv);
|
|
|
| @@ -415,38 +416,31 @@
|
| if (!process_type.empty())
|
| CommonSubprocessInit(process_type);
|
|
|
| - // Initialize the sandbox for this process.
|
| - SandboxInitWrapper sandbox_wrapper;
|
| - bool initialize_sandbox = true;
|
| -
|
| #if defined(OS_WIN)
|
| - sandbox_wrapper.SetServices(sandbox_info);
|
| + CHECK(content::InitializeSandbox(sandbox_info));
|
| #elif defined(OS_MACOSX)
|
| - // On OS X the renderer sandbox needs to be initialized later in the startup
|
| - // sequence in RendererMainPlatformDelegate::EnableSandbox().
|
| if (process_type == switches::kRendererProcess ||
|
| process_type == switches::kPpapiPluginProcess ||
|
| (delegate && delegate->DelaySandboxInitialization(process_type))) {
|
| - initialize_sandbox = false;
|
| + // On OS X the renderer sandbox needs to be initialized later in the startup
|
| + // sequence in RendererMainPlatformDelegate::EnableSandbox().
|
| + } else {
|
| + CHECK(content::InitializeSandbox());
|
| }
|
| #endif
|
|
|
| - if (initialize_sandbox) {
|
| - bool sandbox_initialized_ok =
|
| - sandbox_wrapper.InitializeSandbox(command_line, process_type);
|
| - // Die if the sandbox can't be enabled.
|
| - CHECK(sandbox_initialized_ok) << "Error initializing sandbox for "
|
| - << process_type;
|
| - }
|
| -
|
| if (delegate) delegate->SandboxInitialized(process_type);
|
|
|
| #if defined(OS_POSIX)
|
| SetProcessTitleFromCommandLine(argv);
|
| #endif
|
|
|
| - MainFunctionParams main_params(command_line, sandbox_wrapper,
|
| - &autorelease_pool);
|
| + MainFunctionParams main_params(command_line);
|
| +#if defined(OS_WIN)
|
| + main_params.sandbox_info = sandbox_info;
|
| +#elif defined(OS_MACOSX)
|
| + main_params.autorelease_pool = &autorelease_pool;
|
| +#endif
|
|
|
| exit_code = RunNamedProcessTypeMain(process_type, main_params, delegate);
|
|
|
|
|