Chromium Code Reviews| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // NOTE: You must not call this MessageLoop's Quit method directly. Use | 110 // NOTE: You must not call this MessageLoop's Quit method directly. Use |
| 111 // the Thread's Stop method instead. | 111 // the Thread's Stop method instead. |
| 112 // | 112 // |
| 113 MessageLoop* message_loop() const { return message_loop_; } | 113 MessageLoop* message_loop() const { return message_loop_; } |
| 114 | 114 |
| 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. |
|
willchan no longer on Chromium
2012/05/04 19:00:57
Can you delete this comment? They aren't gonna be
Do not use (sergeyu)
2012/05/04 21:01:36
Done.
| |
| 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_->message_loop_proxy() : NULL; |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Returns 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_; } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 std::string name_; | 183 std::string name_; |
| 184 | 184 |
| 185 friend void ThreadQuitHelper(); | 185 friend void ThreadQuitHelper(); |
| 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 |