OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_THREAD_H_ | 5 #ifndef BASE_THREAD_H_ |
6 #define BASE_THREAD_H_ | 6 #define BASE_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's | 115 // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's |
116 // PostTask methods to execute code on the thread. This only returns | 116 // PostTask methods to execute code on the thread. This only returns |
117 // non-NULL after a successful call to Start. After Stop has been called, | 117 // non-NULL after a successful call to Start. After Stop has been called, |
118 // this will return NULL. Callers can hold on to this even after the thread | 118 // this will return NULL. Callers can hold on to this even after the thread |
119 // is gone. | 119 // is gone. |
120 // TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy. | 120 // TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy. |
121 scoped_refptr<MessageLoopProxy> message_loop_proxy() const { | 121 scoped_refptr<MessageLoopProxy> message_loop_proxy() const { |
122 return message_loop_->message_loop_proxy(); | 122 return message_loop_->message_loop_proxy(); |
123 } | 123 } |
124 | 124 |
125 // Set the name of this thread (for display in debugger too). | 125 // Returns the name of this thread (for display in debugger too). |
126 const std::string &thread_name() { return name_; } | 126 const std::string &thread_name() { return name_; } |
127 | 127 |
128 // The native thread handle. | 128 // The native thread handle. |
129 PlatformThreadHandle thread_handle() { return thread_; } | 129 PlatformThreadHandle thread_handle() { return thread_; } |
130 | 130 |
131 // The thread ID. | 131 // The thread ID. |
132 PlatformThreadId thread_id() const { return thread_id_; } | 132 PlatformThreadId thread_id() const { return thread_id_; } |
133 | 133 |
134 // Returns true if the thread has been started, and not yet stopped. | 134 // Returns true if the thread has been started, and not yet stopped. |
135 // When a thread is running, |thread_id_| is a valid id. | 135 // When a thread is running, |thread_id_| is a valid id. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 std::string name_; | 183 std::string name_; |
184 | 184 |
185 friend class ThreadQuitTask; | 185 friend class ThreadQuitTask; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(Thread); | 187 DISALLOW_COPY_AND_ASSIGN(Thread); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace base | 190 } // namespace base |
191 | 191 |
192 #endif // BASE_THREAD_H_ | 192 #endif // BASE_THREAD_H_ |
OLD | NEW |