diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-09 15:35:47 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-09 15:35:47 +0000 |
commit | 7c32108b22446be27129324ce41d32e9c909e379 (patch) | |
tree | 2b18444c829ae9155036ef3c55ab1fb645b9621e /chrome/browser/browser_main.cc | |
parent | 54131d25aa7e887f89ba25851b983150cd1384a8 (diff) | |
download | chromium_src-7c32108b22446be27129324ce41d32e9c909e379.zip chromium_src-7c32108b22446be27129324ce41d32e9c909e379.tar.gz chromium_src-7c32108b22446be27129324ce41d32e9c909e379.tar.bz2 |
Add Recycle() method to scoped autorelease pool to allow cleaning out any junk
created at startup before the main runloop. Correct quit on Mac to let the
BrowserProcess shut down the event loop when its refcount goes to zero after
cleaning up all browser windows.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 23a8078..654da338 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "base/histogram.h" #include "base/lazy_instance.h" +#include "base/scoped_nsautorelease_pool.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/string_piece.h" @@ -190,6 +191,7 @@ void RunUIMessageLoop(BrowserProcess* browser_process) { // Main routine for running as the Browser process. int BrowserMain(const MainFunctionParams& parameters) { const CommandLine& parsed_command_line = parameters.command_line_; + base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; // WARNING: If we get a WM_ENDSESSION objects created on the stack here // are NOT deleted. If you need something to run during WM_ENDSESSION add it @@ -554,13 +556,18 @@ int BrowserMain(const MainFunctionParams& parameters) { // This should happen before ProcessCommandLine. profile->InitExtensions(); + // Call Recycle() here as late as possible, just before going into the main + // loop. We can't do it any earlier, as ProcessCommandLine() will add things + // to it in the act of creating the initial browser window. int result_code = ResultCodes::NORMAL_EXIT; if (parameters.ui_task) { + if (pool) pool->Recycle(); MessageLoopForUI::current()->PostTask(FROM_HERE, parameters.ui_task); RunUIMessageLoop(browser_process.get()); } else if (BrowserInit::ProcessCommandLine(parsed_command_line, std::wstring(), local_state, true, profile, &result_code)) { + if (pool) pool->Recycle(); RunUIMessageLoop(browser_process.get()); } |