| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's | 124 // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's |
| 125 // PostTask methods to execute code on the thread. This only returns | 125 // PostTask methods to execute code on the thread. This only returns |
| 126 // non-NULL after a successful call to Start. After Stop has been called, | 126 // non-NULL after a successful call to Start. After Stop has been called, |
| 127 // this will return NULL. Callers can hold on to this even after the thread | 127 // this will return NULL. Callers can hold on to this even after the thread |
| 128 // is gone. | 128 // is gone. |
| 129 scoped_refptr<MessageLoopProxy> message_loop_proxy() const { | 129 scoped_refptr<MessageLoopProxy> message_loop_proxy() const { |
| 130 return message_loop_ ? message_loop_->message_loop_proxy() : NULL; | 130 return message_loop_ ? message_loop_->message_loop_proxy() : NULL; |
| 131 } | 131 } |
| 132 | 132 |
| 133 // Returns the name of this thread (for display in debugger too). | 133 // Returns the name of this thread (for display in debugger too). |
| 134 const std::string &thread_name() { return name_; } | 134 const std::string& thread_name() const { return name_; } |
| 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 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 std::string name_; | 204 std::string name_; |
| 205 | 205 |
| 206 friend void ThreadQuitHelper(); | 206 friend void ThreadQuitHelper(); |
| 207 | 207 |
| 208 DISALLOW_COPY_AND_ASSIGN(Thread); | 208 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 } // namespace base | 211 } // namespace base |
| 212 | 212 |
| 213 #endif // BASE_THREADING_THREAD_H_ | 213 #endif // BASE_THREADING_THREAD_H_ |
| OLD | NEW |