Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 // task is posted to is guaranteed to outlive the current thread, then no locks | 52 // task is posted to is guaranteed to outlive the current thread, then no locks |
| 53 // are used. You should never need to cache pointers to MessageLoops, since | 53 // are used. You should never need to cache pointers to MessageLoops, since |
| 54 // they're not thread safe. | 54 // they're not thread safe. |
| 55 class CONTENT_EXPORT BrowserThread { | 55 class CONTENT_EXPORT BrowserThread { |
| 56 public: | 56 public: |
| 57 // An enumeration of the well-known threads. | 57 // An enumeration of the well-known threads. |
| 58 // NOTE: threads must be listed in the order of their life-time, with each | 58 // NOTE: threads must be listed in the order of their life-time, with each |
| 59 // thread outliving every other thread below it. | 59 // thread outliving every other thread below it. |
| 60 enum ID { | 60 enum ID { |
| 61 // The main thread in the browser. | 61 // The main thread in the browser. |
| 62 UI, | 62 UI, // 0 |
|
jochen (gone - plz use gerrit)
2014/02/12 09:56:07
unrelated change?
aboxhall
2014/02/12 18:16:57
Debugging cruft. Will remove.
| |
| 63 | 63 |
| 64 // This is the thread that interacts with the database. | 64 // This is the thread that interacts with the database. |
| 65 DB, | 65 DB, // 1 |
| 66 | 66 |
| 67 // This is the thread that interacts with the file system. | 67 // This is the thread that interacts with the file system. |
| 68 FILE, | 68 FILE,// 2 |
| 69 | 69 |
| 70 // Used for file system operations that block user interactions. | 70 // Used for file system operations that block user interactions. |
| 71 // Responsiveness of this thread affect users. | 71 // Responsiveness of this thread affect users. |
| 72 FILE_USER_BLOCKING, | 72 FILE_USER_BLOCKING, // 3 |
| 73 | 73 |
| 74 // Used to launch and terminate Chrome processes. | 74 // Used to launch and terminate Chrome processes. |
| 75 PROCESS_LAUNCHER, | 75 PROCESS_LAUNCHER, // 4 |
| 76 | 76 |
| 77 // This is the thread to handle slow HTTP cache operations. | 77 // This is the thread to handle slow HTTP cache operations. |
| 78 CACHE, | 78 CACHE, // 5 |
| 79 | 79 |
| 80 // This is the thread that processes IPC and network messages. | 80 // This is the thread that processes IPC and network messages. |
| 81 IO, | 81 IO, // 6 |
| 82 | 82 |
| 83 // NOTE: do not add new threads here that are only used by a small number of | 83 // NOTE: do not add new threads here that are only used by a small number of |
| 84 // files. Instead you should just use a Thread class and pass its | 84 // files. Instead you should just use a Thread class and pass its |
| 85 // MessageLoopProxy around. Named threads there are only for threads that | 85 // MessageLoopProxy around. Named threads there are only for threads that |
| 86 // are used in many places. | 86 // are used in many places. |
| 87 | 87 |
| 88 // This identifier does not represent a thread. Instead it counts the | 88 // This identifier does not represent a thread. Instead it counts the |
| 89 // number of well-known threads. Insert new well-known threads before this | 89 // number of well-known threads. Insert new well-known threads before this |
| 90 // identifier. | 90 // identifier. |
| 91 ID_COUNT | 91 ID_COUNT // 7 |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 // These are the same methods in message_loop.h, but are guaranteed to either | 94 // These are the same methods in message_loop.h, but are guaranteed to either |
| 95 // get posted to the MessageLoop if it's still alive, or be deleted otherwise. | 95 // get posted to the MessageLoop if it's still alive, or be deleted otherwise. |
| 96 // They return true iff the thread existed and the task was posted. Note that | 96 // They return true iff the thread existed and the task was posted. Note that |
| 97 // even if the task is posted, there's no guarantee that it will run, since | 97 // even if the task is posted, there's no guarantee that it will run, since |
| 98 // the target thread may already have a Quit message in its queue. | 98 // the target thread may already have a Quit message in its queue. |
| 99 static bool PostTask(ID identifier, | 99 static bool PostTask(ID identifier, |
| 100 const tracked_objects::Location& from_here, | 100 const tracked_objects::Location& from_here, |
| 101 const base::Closure& task); | 101 const base::Closure& task); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 private: | 269 private: |
| 270 friend class BrowserThreadImpl; | 270 friend class BrowserThreadImpl; |
| 271 | 271 |
| 272 BrowserThread() {} | 272 BrowserThread() {} |
| 273 DISALLOW_COPY_AND_ASSIGN(BrowserThread); | 273 DISALLOW_COPY_AND_ASSIGN(BrowserThread); |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 } // namespace content | 276 } // namespace content |
| 277 | 277 |
| 278 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 278 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
| OLD | NEW |