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 BASE_THREADING_THREAD_H_ | 5 #ifndef BASE_THREADING_THREAD_H_ |
6 #define BASE_THREADING_THREAD_H_ | 6 #define BASE_THREADING_THREAD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 // The native thread handle. | 136 // The native thread handle. |
137 PlatformThreadHandle thread_handle() { return thread_; } | 137 PlatformThreadHandle thread_handle() { return thread_; } |
138 | 138 |
139 // The thread ID. | 139 // The thread ID. |
140 PlatformThreadId thread_id() const { return thread_id_; } | 140 PlatformThreadId thread_id() const { return thread_id_; } |
141 | 141 |
142 // Returns true if the thread has been started, and not yet stopped. | 142 // Returns true if the thread has been started, and not yet stopped. |
143 bool IsRunning() const; | 143 bool IsRunning() const; |
144 | 144 |
| 145 // Sets the thread priority. The thread must already be started. |
| 146 void SetPriority(ThreadPriority priority); |
| 147 |
145 protected: | 148 protected: |
146 // Called just prior to starting the message loop | 149 // Called just prior to starting the message loop |
147 virtual void Init() {} | 150 virtual void Init() {} |
148 | 151 |
149 // Called to start the message loop | 152 // Called to start the message loop |
150 virtual void Run(MessageLoop* message_loop); | 153 virtual void Run(MessageLoop* message_loop); |
151 | 154 |
152 // Called just after the message loop ends | 155 // Called just after the message loop ends |
153 virtual void CleanUp() {} | 156 virtual void CleanUp() {} |
154 | 157 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 std::string name_; | 207 std::string name_; |
205 | 208 |
206 friend void ThreadQuitHelper(); | 209 friend void ThreadQuitHelper(); |
207 | 210 |
208 DISALLOW_COPY_AND_ASSIGN(Thread); | 211 DISALLOW_COPY_AND_ASSIGN(Thread); |
209 }; | 212 }; |
210 | 213 |
211 } // namespace base | 214 } // namespace base |
212 | 215 |
213 #endif // BASE_THREADING_THREAD_H_ | 216 #endif // BASE_THREADING_THREAD_H_ |
OLD | NEW |