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

Side by Side Diff: chrome/browser/chrome_thread.h

Issue 149238: Change the lifetime of the WebKit thread to be a subset of the IO thread's li... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/chrome_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_CHROME_THREAD_H__ 5 #ifndef CHROME_BROWSER_CHROME_THREAD_H__
6 #define CHROME_BROWSER_CHROME_THREAD_H__ 6 #define CHROME_BROWSER_CHROME_THREAD_H__
7 7
8 #include "base/lock.h" 8 #include "base/lock.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 10
(...skipping 20 matching lines...) Expand all
31 enum ID { 31 enum ID {
32 // This is the thread that processes IPC and network messages. 32 // This is the thread that processes IPC and network messages.
33 IO, 33 IO,
34 34
35 // This is the thread that interacts with the file system. 35 // This is the thread that interacts with the file system.
36 FILE, 36 FILE,
37 37
38 // This is the thread that interacts with the database. 38 // This is the thread that interacts with the database.
39 DB, 39 DB,
40 40
41 // This is the "main" thread for WebKit within the browser process when
42 // NOT in --single-process mode.
43 WEBKIT,
44
41 // This is the thread that interacts with the history database. 45 // This is the thread that interacts with the history database.
42 HISTORY, 46 HISTORY,
43 47
44 #if defined(OS_LINUX) 48 #if defined(OS_LINUX)
45 // This thread has a second connection to the X server and is used to 49 // This thread has a second connection to the X server and is used to
46 // process UI requests when routing the request to the UI thread would risk 50 // process UI requests when routing the request to the UI thread would risk
47 // deadlock. 51 // deadlock.
48 BACKGROUND_X11, 52 BACKGROUND_X11,
49 #endif 53 #endif
50 54
(...skipping 10 matching lines...) Expand all
61 65
62 // Callable on any thread, this helper function returns a pointer to the 66 // Callable on any thread, this helper function returns a pointer to the
63 // thread's MessageLoop. 67 // thread's MessageLoop.
64 // 68 //
65 // WARNING: 69 // WARNING:
66 // Nothing in this class prevents the MessageLoop object returned from this 70 // Nothing in this class prevents the MessageLoop object returned from this
67 // function from being destroyed on another thread. Use with care. 71 // function from being destroyed on another thread. Use with care.
68 // 72 //
69 static MessageLoop* GetMessageLoop(ID identifier); 73 static MessageLoop* GetMessageLoop(ID identifier);
70 74
75 // Callable on any thread. Returns whether you're currently on a particular
76 // thread.
77 //
78 // WARNING:
79 // When running under unit-tests, this will return true if you're on the
80 // main thread and the thread ID you pass in isn't running. This is
81 // normally the correct behavior because you want to ignore these asserts
82 // unless you've specifically spun up the threads, but be mindful of it.
83 static bool CurrentlyOn(ID identifier);
84
71 private: 85 private:
72 // The identifier of this thread. Only one thread can exist with a given 86 // The identifier of this thread. Only one thread can exist with a given
73 // identifier at a given time. 87 // identifier at a given time.
74 ID identifier_; 88 ID identifier_;
75 89
76 // This lock protects |chrome_threads_|. Do not read or modify that array 90 // This lock protects |chrome_threads_|. Do not read or modify that array
77 // without holding this lock. Do not block while holding this lock. 91 // without holding this lock. Do not block while holding this lock.
78 static Lock lock_; 92 static Lock lock_;
79 93
80 // An array of the ChromeThread objects. This array is protected by |lock_|. 94 // An array of the ChromeThread objects. This array is protected by |lock_|.
81 // The threads are not owned by this array. Typically, the threads are owned 95 // The threads are not owned by this array. Typically, the threads are owned
82 // on the UI thread by the g_browser_process object. ChromeThreads remove 96 // on the UI thread by the g_browser_process object. ChromeThreads remove
83 // themselves from this array upon destruction. 97 // themselves from this array upon destruction.
84 static ChromeThread* chrome_threads_[ID_COUNT]; 98 static ChromeThread* chrome_threads_[ID_COUNT];
85 }; 99 };
86 100
87 #endif // #ifndef CHROME_BROWSER_CHROME_THREAD_H__ 101 #endif // #ifndef CHROME_BROWSER_CHROME_THREAD_H__
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698