OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chrome_browser_main_posix.h" | 5 #include "chrome/browser/chrome_browser_main_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <signal.h> | 9 #include <signal.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 ShutdownFDClosedError(); | 133 ShutdownFDClosedError(); |
134 break; | 134 break; |
135 } | 135 } |
136 bytes_read += ret; | 136 bytes_read += ret; |
137 } while (bytes_read < sizeof(signal)); | 137 } while (bytes_read < sizeof(signal)); |
138 VLOG(1) << "Handling shutdown for signal " << signal << "."; | 138 VLOG(1) << "Handling shutdown for signal " << signal << "."; |
139 #if defined(OS_CHROMEOS) | 139 #if defined(OS_CHROMEOS) |
140 // On ChromeOS, exiting on signal should be always clean. | 140 // On ChromeOS, exiting on signal should be always clean. |
141 base::Closure task = base::Bind(&BrowserList::ExitCleanly); | 141 base::Closure task = base::Bind(&BrowserList::ExitCleanly); |
142 #else | 142 #else |
143 base::Closure task = base::Bind(&BrowserList::AttemptExit, false); | 143 base::Closure task = base::Bind(&BrowserList::AttemptExit); |
144 #endif | 144 #endif |
145 | 145 |
146 if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) { | 146 if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) { |
147 // Without a UI thread to post the exit task to, there aren't many | 147 // Without a UI thread to post the exit task to, there aren't many |
148 // options. Raise the signal again. The default handler will pick it up | 148 // options. Raise the signal again. The default handler will pick it up |
149 // and cause an ungraceful exit. | 149 // and cause an ungraceful exit. |
150 RAW_LOG(WARNING, "No UI thread, exiting ungracefully."); | 150 RAW_LOG(WARNING, "No UI thread, exiting ungracefully."); |
151 kill(getpid(), signal); | 151 kill(getpid(), signal); |
152 | 152 |
153 // The signal may be handled on another thread. Give that a chance to | 153 // The signal may be handled on another thread. Give that a chance to |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // And SIGHUP, for when the terminal disappears. On shutdown, many Linux | 260 // And SIGHUP, for when the terminal disappears. On shutdown, many Linux |
261 // distros send SIGHUP, SIGTERM, and then SIGKILL. | 261 // distros send SIGHUP, SIGTERM, and then SIGKILL. |
262 action.sa_handler = SIGHUPHandler; | 262 action.sa_handler = SIGHUPHandler; |
263 CHECK(sigaction(SIGHUP, &action, NULL) == 0); | 263 CHECK(sigaction(SIGHUP, &action, NULL) == 0); |
264 | 264 |
265 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) | 265 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) |
266 printing::PrintingContextGtk::SetCreatePrintDialogFunction( | 266 printing::PrintingContextGtk::SetCreatePrintDialogFunction( |
267 &PrintDialogGtk::CreatePrintDialog); | 267 &PrintDialogGtk::CreatePrintDialog); |
268 #endif | 268 #endif |
269 } | 269 } |
OLD | NEW |