diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 20:40:34 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 20:40:34 +0000 |
commit | e66d704b2fb60846d399cc45cee04d26573725ec (patch) | |
tree | b49c9dcae3598793e373ee9923c6fcade700a625 /chrome/browser/browser_list.cc | |
parent | c36a87afc467a1fd2eb4bb2309051bc8e45e4393 (diff) | |
download | chromium_src-e66d704b2fb60846d399cc45cee04d26573725ec.zip chromium_src-e66d704b2fb60846d399cc45cee04d26573725ec.tar.gz chromium_src-e66d704b2fb60846d399cc45cee04d26573725ec.tar.bz2 |
Allow overriding of X error functions
BUG=50006 (and various other reports)
TEST=Run chrome under nested window manager using Xephyr (see
http://code.google.com/p/chromium/wiki/LayoutTestsLinux)
use --enable-logging=stderr --log-level=0
kill xephyr
examine log. You should see
X IO Error detected
followed (not necessarily immediately) by
successfully saved /tmp/tx/Default/Preferences
successfully saved /tmp/tx/Local State
successfully saved /tmp/tx/Local State
successfully saved /tmp/tx/Default/Preferences
along with no crash.
There is a high ranking crash report on both linux and chromeos that happens whenever X sends an error to chrome. This change causes us to log and continue when we get a regular error from X. When we get an IO error, indicating X is gone, we attempt to shut down gracefully.
Review URL: http://codereview.chromium.org/3175038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_list.cc')
-rw-r--r-- | chrome/browser/browser_list.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc index 0ce399d..31e09cc 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(); } } |