Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5055)

Unified Diff: chrome/browser/browser_list.cc

Issue 3175038: Allow overriding of X error functions (Closed)
Patch Set: Messed up #ifdef Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_list.h ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_list.cc
diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc
index 0ce399d7eec6e1aa6cca674a1576751c823e3b74..31e09ccf6b0962889d63613f1c04756e55dd1dfe 100644
--- a/chrome/browser/browser_list.cc
+++ b/chrome/browser/browser_list.cc
@@ -223,7 +223,15 @@ void BrowserList::RemoveObserver(BrowserList::Observer* observer) {
}
// static
-void BrowserList::CloseAllBrowsers(bool use_post) {
+void BrowserList::CloseAllBrowsers() {
+ bool session_ending =
+ browser_shutdown::GetShutdownType() == browser_shutdown::END_SESSION;
+ bool use_post = !session_ending;
+ bool force_exit = false;
+#if defined(USE_X11)
+ if (session_ending)
+ force_exit = true;
+#endif
// Tell everyone that we are shutting down.
browser_shutdown::SetTryingToQuit(true);
@@ -233,7 +241,7 @@ void BrowserList::CloseAllBrowsers(bool use_post) {
// If there are no browsers, send the APP_TERMINATING action here. Otherwise,
// it will be sent by RemoveBrowser() when the last browser has closed.
- if (browsers_.empty()) {
+ if (force_exit || browsers_.empty()) {
NotificationService::current()->Notify(NotificationType::APP_TERMINATING,
NotificationService::AllSources(),
NotificationService::NoDetails());
@@ -276,10 +284,10 @@ void BrowserList::CloseAllBrowsersAndExit() {
#if !defined(OS_MACOSX)
// On most platforms, closing all windows causes the application to exit.
- CloseAllBrowsers(true);
+ CloseAllBrowsers();
#else
// On the Mac, the application continues to run once all windows are closed.
- // Terminate will result in a CloseAllBrowsers(true) call, and once (and if)
+ // Terminate will result in a CloseAllBrowsers() call, and once (and if)
// that is done, will cause the application to exit cleanly.
chrome_browser_application_mac::Terminate();
#endif
@@ -303,8 +311,7 @@ void BrowserList::WindowsSessionEnding() {
// Write important data first.
g_browser_process->EndSession();
- // Close all the browsers.
- BrowserList::CloseAllBrowsers(false);
+ BrowserList::CloseAllBrowsers();
// Send out notification. This is used during testing so that the test harness
// can properly shutdown before we exit.
@@ -320,6 +327,8 @@ void BrowserList::WindowsSessionEnding() {
// At this point the message loop is still running yet we've shut everything
// down. If any messages are processed we'll likely crash. Exit now.
ExitProcess(ResultCodes::NORMAL_EXIT);
+#elif defined(OS_LINUX)
+ _exit(ResultCodes::NORMAL_EXIT);
#else
NOTIMPLEMENTED();
#endif
@@ -358,7 +367,7 @@ void BrowserList::EndKeepAlive() {
// (MessageLoop::current() == null).
if (browsers_.empty() && !browser_shutdown::IsTryingToQuit() &&
MessageLoop::current())
- CloseAllBrowsers(true);
+ CloseAllBrowsers();
}
}
« no previous file with comments | « chrome/browser/browser_list.h ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698