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/browser_main_posix.h" | 5 #include "chrome/browser/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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 break; | 128 break; |
129 } else if (ret == 0) { | 129 } else if (ret == 0) { |
130 NOTREACHED() << "Unexpected closure of shutdown pipe."; | 130 NOTREACHED() << "Unexpected closure of shutdown pipe."; |
131 ShutdownFDClosedError(); | 131 ShutdownFDClosedError(); |
132 break; | 132 break; |
133 } | 133 } |
134 bytes_read += ret; | 134 bytes_read += ret; |
135 } while (bytes_read < sizeof(signal)); | 135 } while (bytes_read < sizeof(signal)); |
136 VLOG(1) << "Handling shutdown for signal " << signal << "."; | 136 VLOG(1) << "Handling shutdown for signal " << signal << "."; |
137 #if defined(OS_CHROMEOS) | 137 #if defined(OS_CHROMEOS) |
138 // On ChromeOS, exiting on signal should be always clean. | 138 // On ChromeOS, exiting on signal means END_SESSION. |
139 Task* task = NewRunnableFunction(BrowserList::ExitCleanly); | 139 Task* task = NewRunnableFunction(BrowserList::SessionEnding); |
140 #else | 140 #else |
141 Task* task = NewRunnableFunction(BrowserList::AttemptExit); | 141 Task* task = NewRunnableFunction(BrowserList::AttemptExit); |
142 #endif | 142 #endif |
143 | 143 |
144 if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) { | 144 if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) { |
145 // Without a UI thread to post the exit task to, there aren't many | 145 // Without a UI thread to post the exit task to, there aren't many |
146 // options. Raise the signal again. The default handler will pick it up | 146 // options. Raise the signal again. The default handler will pick it up |
147 // and cause an ungraceful exit. | 147 // and cause an ungraceful exit. |
148 RAW_LOG(WARNING, "No UI thread, exiting ungracefully."); | 148 RAW_LOG(WARNING, "No UI thread, exiting ungracefully."); |
149 kill(getpid(), signal); | 149 kill(getpid(), signal); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 new ShutdownDetector(g_shutdown_pipe_read_fd))) { | 256 new ShutdownDetector(g_shutdown_pipe_read_fd))) { |
257 LOG(DFATAL) << "Failed to create shutdown detector task."; | 257 LOG(DFATAL) << "Failed to create shutdown detector task."; |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) | 261 #if defined(TOOLKIT_USES_GTK) && !defined(OS_CHROMEOS) |
262 printing::PrintingContextCairo::SetCreatePrintDialogFunction( | 262 printing::PrintingContextCairo::SetCreatePrintDialogFunction( |
263 &PrintDialogGtk::CreatePrintDialog); | 263 &PrintDialogGtk::CreatePrintDialog); |
264 #endif | 264 #endif |
265 } | 265 } |
OLD | NEW |