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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // the Thread's Stop method instead. | 105 // the Thread's Stop method instead. |
106 // | 106 // |
107 MessageLoop* message_loop() const { return message_loop_; } | 107 MessageLoop* message_loop() const { return message_loop_; } |
108 | 108 |
109 // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's | 109 // Returns a MessageLoopProxy for this thread. Use the MessageLoopProxy's |
110 // PostTask methods to execute code on the thread. This only returns | 110 // PostTask methods to execute code on the thread. This only returns |
111 // non-NULL after a successful call to Start. After Stop has been called, | 111 // non-NULL after a successful call to Start. After Stop has been called, |
112 // this will return NULL. Callers can hold on to this even after the thread | 112 // this will return NULL. Callers can hold on to this even after the thread |
113 // is gone. | 113 // is gone. |
114 // TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy. | 114 // TODO(sanjeevr): Look into merging MessageLoop and MessageLoopProxy. |
115 scoped_refptr<MessageLoopProxy> message_loop_proxy() { | 115 scoped_refptr<MessageLoopProxy> message_loop_proxy() const { |
116 return message_loop_proxy_; | 116 return message_loop_proxy_; |
117 } | 117 } |
118 | 118 |
119 // Set the name of this thread (for display in debugger too). | 119 // Set the name of this thread (for display in debugger too). |
120 const std::string &thread_name() { return name_; } | 120 const std::string &thread_name() { return name_; } |
121 | 121 |
122 // The native thread handle. | 122 // The native thread handle. |
123 PlatformThreadHandle thread_handle() { return thread_; } | 123 PlatformThreadHandle thread_handle() { return thread_; } |
124 | 124 |
125 // The thread ID. | 125 // The thread ID. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 std::string name_; | 186 std::string name_; |
187 | 187 |
188 friend class ThreadQuitTask; | 188 friend class ThreadQuitTask; |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(Thread); | 190 DISALLOW_COPY_AND_ASSIGN(Thread); |
191 }; | 191 }; |
192 | 192 |
193 } // namespace base | 193 } // namespace base |
194 | 194 |
195 #endif // BASE_THREAD_H_ | 195 #endif // BASE_THREAD_H_ |
OLD | NEW |