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

Side by Side Diff: chrome/browser/chrome_browser_main_posix.cc

Issue 10409022: Move application lifetime functionality off BrowserList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <pthread.h> 9 #include <pthread.h>
10 #include <signal.h> 10 #include <signal.h>
11 #include <sys/resource.h> 11 #include <sys/resource.h>
12 #include <unistd.h> 12 #include <unistd.h>
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/eintr_wrapper.h" 18 #include "base/eintr_wrapper.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/string_number_conversions.h" 20 #include "base/string_number_conversions.h"
21 #include "chrome/browser/ui/browser_list.h" 21 #include "chrome/browser/lifetime/application_lifetime.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 24
25 #if defined(OS_ANDROID) 25 #if defined(OS_ANDROID)
26 #include <asm/page.h> // for PAGE_SIZE needed by PTHREAD_STACK_MIN 26 #include <asm/page.h> // for PAGE_SIZE needed by PTHREAD_STACK_MIN
27 #endif 27 #endif
28 28
29 #if defined(TOOLKIT_GTK) 29 #if defined(TOOLKIT_GTK)
30 #include "chrome/browser/chrome_browser_main_extra_parts_gtk.h" 30 #include "chrome/browser/chrome_browser_main_extra_parts_gtk.h"
31 #include "chrome/browser/printing/print_dialog_gtk.h" 31 #include "chrome/browser/printing/print_dialog_gtk.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } else if (ret == 0) { 137 } else if (ret == 0) {
138 NOTREACHED() << "Unexpected closure of shutdown pipe."; 138 NOTREACHED() << "Unexpected closure of shutdown pipe.";
139 ShutdownFDClosedError(); 139 ShutdownFDClosedError();
140 break; 140 break;
141 } 141 }
142 bytes_read += ret; 142 bytes_read += ret;
143 } while (bytes_read < sizeof(signal)); 143 } while (bytes_read < sizeof(signal));
144 VLOG(1) << "Handling shutdown for signal " << signal << "."; 144 VLOG(1) << "Handling shutdown for signal " << signal << ".";
145 #if defined(OS_CHROMEOS) 145 #if defined(OS_CHROMEOS)
146 // On ChromeOS, exiting on signal should be always clean. 146 // On ChromeOS, exiting on signal should be always clean.
147 base::Closure task = base::Bind(&BrowserList::ExitCleanly); 147 base::Closure task = base::Bind(&browser::ExitCleanly);
148 #else 148 #else
149 base::Closure task = base::Bind(&BrowserList::AttemptExit); 149 base::Closure task = base::Bind(&browser::AttemptExit);
150 #endif 150 #endif
151 151
152 if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) { 152 if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) {
153 // Without a UI thread to post the exit task to, there aren't many 153 // Without a UI thread to post the exit task to, there aren't many
154 // options. Raise the signal again. The default handler will pick it up 154 // options. Raise the signal again. The default handler will pick it up
155 // and cause an ungraceful exit. 155 // and cause an ungraceful exit.
156 RAW_LOG(WARNING, "No UI thread, exiting ungracefully."); 156 RAW_LOG(WARNING, "No UI thread, exiting ungracefully.");
157 kill(getpid(), signal); 157 kill(getpid(), signal);
158 158
159 // The signal may be handled on another thread. Give that a chance to 159 // The signal may be handled on another thread. Give that a chance to
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 ChromeBrowserMainExtraPartsGtk::ShowMessageBox( 295 ChromeBrowserMainExtraPartsGtk::ShowMessageBox(
296 chrome_browser::kMissingLocaleDataMessage); 296 chrome_browser::kMissingLocaleDataMessage);
297 #elif defined(USE_AURA) 297 #elif defined(USE_AURA)
298 // TODO(port): We may want a views based message dialog here eventually, but 298 // TODO(port): We may want a views based message dialog here eventually, but
299 // for now, crash. 299 // for now, crash.
300 NOTREACHED(); 300 NOTREACHED();
301 #else 301 #else
302 #error "Need MessageBox implementation." 302 #error "Need MessageBox implementation."
303 #endif 303 #endif
304 } 304 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_ash.cc ('k') | chrome/browser/chrome_browser_main_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698