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

Unified Diff: chrome/browser/browser_main.cc

Issue 306032: Simplify threading in browser thread by making only ChromeThread deal with di... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: a few more simplifications Created 11 years, 2 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
Index: chrome/browser/browser_main.cc
===================================================================
--- chrome/browser/browser_main.cc (revision 30037)
+++ chrome/browser/browser_main.cc (working copy)
@@ -164,11 +164,10 @@
DCHECK_EQ(signal, SIGTERM);
LOG(WARNING) << "Addressing SIGTERM on " << PlatformThread::CurrentId();
- MessageLoop* main_loop = ChromeThread::GetMessageLoop(ChromeThread::UI);
- if (main_loop) {
- // Post the exit task to the main thread.
- main_loop->PostTask(
- FROM_HERE, NewRunnableFunction(BrowserList::CloseAllBrowsersAndExit));
+ bool posted = ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableFunction(BrowserList::CloseAllBrowsersAndExit));
+ if (posted) {
LOG(WARNING) << "Posted task to UI thread; resetting SIGTERM handler";
}
@@ -178,7 +177,7 @@
term_action.sa_handler = SIG_DFL;
CHECK(sigaction(SIGTERM, &term_action, NULL) == 0);
- if (!main_loop) {
+ if (!posted) {
// Without a UI thread to post the exit task to, there aren't many
// options. Raise the signal again. The default handler will pick it up
// and cause an ungraceful exit.
@@ -331,7 +330,7 @@
main_message_loop.set_thread_name(thread_name);
// Register the main thread by instantiating it, but don't call any methods.
- ChromeThread main_thread;
+ ChromeThread main_thread(ChromeThread::UI, MessageLoop::current());
FilePath user_data_dir;
#if defined(OS_WIN)
@@ -411,6 +410,9 @@
local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled,
GoogleUpdateSettings::GetCollectStatsConsent());
+ // Start the database thread (the order doesn't really matter for it).
darin (slow to review) 2009/10/27 00:06:52 Q: i'm not sure what the second part means. the o
jam 2009/10/27 02:38:18 I was trying to say that we just need to start the
darin (slow to review) 2009/10/27 04:43:33 OK
+ browser_process->db_thread();
+
#if defined(TOOLKIT_GTK)
// It is important for this to happen before the first run dialog, as it
// styles the dialog as well.

Powered by Google App Engine
This is Rietveld 408576698