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/chrome_thread.cc

Issue 171088: Add the UI thread to the list of ChromeThreads. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « chrome/browser/chrome_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_thread.cc
===================================================================
--- chrome/browser/chrome_thread.cc (revision 23591)
+++ chrome/browser/chrome_thread.cc (working copy)
@@ -6,6 +6,7 @@
// Friendly names for the well-known threads.
static const char* chrome_thread_names[ChromeThread::ID_COUNT] = {
+ "", // UI (name assembled in browser_main.cc).
"Chrome_IOThread", // IO
"Chrome_FileThread", // FILE
"Chrome_DBThread", // DB
@@ -19,6 +20,7 @@
Lock ChromeThread::lock_;
ChromeThread* ChromeThread::chrome_threads_[ID_COUNT] = {
+ NULL, // UI
NULL, // IO
NULL, // FILE
NULL, // DB
@@ -32,9 +34,20 @@
ChromeThread::ChromeThread(ChromeThread::ID identifier)
: Thread(chrome_thread_names[identifier]),
identifier_(identifier) {
+ Initialize();
+}
+
+ChromeThread::ChromeThread()
+ : Thread(MessageLoop::current()->thread_name().c_str()),
+ identifier_(UI) {
+ set_message_loop(MessageLoop::current());
+ Initialize();
+}
+
+void ChromeThread::Initialize() {
AutoLock lock(lock_);
- DCHECK(identifier >= 0 && identifier < ID_COUNT);
- DCHECK(chrome_threads_[identifier] == NULL);
+ DCHECK(identifier_ >= 0 && identifier_ < ID_COUNT);
+ DCHECK(chrome_threads_[identifier_] == NULL);
chrome_threads_[identifier_] = this;
}
@@ -63,3 +76,4 @@
MessageLoop* message_loop = GetMessageLoop(identifier);
return MessageLoop::current() == message_loop;
}
+
« no previous file with comments | « chrome/browser/chrome_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698