Index: chrome/browser/chrome_browser_application_mac.mm |
diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm |
index 0e151e0bb7dd461b8efa90f95fa91b1981ae7d87..93ea7b0d87902bcda35948c84f836e4219e22b65 100644 |
--- a/chrome/browser/chrome_browser_application_mac.mm |
+++ b/chrome/browser/chrome_browser_application_mac.mm |
@@ -331,14 +331,15 @@ void SwizzleInit() { |
// Termination is cancelled by resetting this flag. The standard |
// |-applicationShouldTerminate:| is not supported, and code paths leading to it |
// must be redirected. |
+// |
+// When the last browser has been destroyed, the BrowserList calls |
+// browser::OnAppExiting(), which is the point of no return. That will cause |
+// the NSApplicationWillTerminateNotification to be posted, which ends the |
+// NSApplication event loop, so final post- MessageLoop::Run() work is done |
+// before exiting. |
- (void)terminate:(id)sender { |
AppController* appController = static_cast<AppController*>([NSApp delegate]); |
- if ([appController tryToTerminateApplication:self]) { |
- [[NSNotificationCenter defaultCenter] |
- postNotificationName:NSApplicationWillTerminateNotification |
- object:self]; |
- } |
- |
+ [appController tryToTerminateApplication:self]; |
// Return, don't exit. The application is responsible for exiting on its own. |
} |