summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_controller_mac.mm
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-09 15:35:47 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-09 15:35:47 +0000
commit7c32108b22446be27129324ce41d32e9c909e379 (patch)
tree2b18444c829ae9155036ef3c55ab1fb645b9621e /chrome/browser/app_controller_mac.mm
parent54131d25aa7e887f89ba25851b983150cd1384a8 (diff)
downloadchromium_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/app_controller_mac.mm')
-rw-r--r--chrome/browser/app_controller_mac.mm21
1 files changed, 13 insertions, 8 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 3895ece..5a9609a 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -19,10 +19,18 @@
@implementation AppController
- (void)awakeFromNib {
- // set up the command updater for when there are no windows open
+ // Set up the command updater for when there are no windows open
[self initMenuState];
}
+- (void)applicationDidFinishLaunching:(NSNotification*)notify {
+ // Hold an extra ref to the BrowserProcess singleton so it doesn't go away
+ // when all the browser windows get closed. We'll release it on quit which
+ // will be the signal to exit.
+ DCHECK(g_browser_process);
+ g_browser_process->AddRefModule();
+}
+
- (void)dealloc {
delete menuState_;
[super dealloc];
@@ -41,14 +49,11 @@
// go back to normal.
// Close all the windows.
- // TODO(pinkerton): the close code assumes that teardown happens
- // synchronously, however with autorelease pools and ref-counting, we can't
- // guarantee the window controller hits 0 inside this call, and thus the
- // number of Browsers still alive will certainly be non-zero. Not sure yet
- // how to handle this case.
- // BrowserList::CloseAllBrowsers(false);
+ BrowserList::CloseAllBrowsers(true);
- MessageLoopForUI::current()->Quit();
+ // Release the reference to the browser process. Once all the browsers get
+ // dealloc'd, it will stop the RunLoop and fall back into main().
+ g_browser_process->ReleaseModule();
}
// Called to validate menu items when there are no key windows. All the