| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // | 95 // |
| 96 MessageLoop* message_loop() const { return message_loop_; } | 96 MessageLoop* message_loop() const { return message_loop_; } |
| 97 | 97 |
| 98 // Set the name of this thread (for display in debugger too). | 98 // Set the name of this thread (for display in debugger too). |
| 99 const std::string &thread_name() { return name_; } | 99 const std::string &thread_name() { return name_; } |
| 100 | 100 |
| 101 // The native thread handle. | 101 // The native thread handle. |
| 102 PlatformThreadHandle thread_handle() { return thread_; } | 102 PlatformThreadHandle thread_handle() { return thread_; } |
| 103 | 103 |
| 104 // The thread ID. | 104 // The thread ID. |
| 105 int thread_id() const { return thread_id_; } | 105 PlatformThreadId thread_id() const { return thread_id_; } |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 // Called just prior to starting the message loop | 108 // Called just prior to starting the message loop |
| 109 virtual void Init() {} | 109 virtual void Init() {} |
| 110 | 110 |
| 111 // Called just after the message loop ends | 111 // Called just after the message loop ends |
| 112 virtual void CleanUp() {} | 112 virtual void CleanUp() {} |
| 113 | 113 |
| 114 static void SetThreadWasQuitProperly(bool flag); | 114 static void SetThreadWasQuitProperly(bool flag); |
| 115 static bool GetThreadWasQuitProperly(); | 115 static bool GetThreadWasQuitProperly(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 127 StartupData* startup_data_; | 127 StartupData* startup_data_; |
| 128 | 128 |
| 129 // The thread's handle. | 129 // The thread's handle. |
| 130 PlatformThreadHandle thread_; | 130 PlatformThreadHandle thread_; |
| 131 | 131 |
| 132 // The thread's message loop. Valid only while the thread is alive. Set | 132 // The thread's message loop. Valid only while the thread is alive. Set |
| 133 // by the created thread. | 133 // by the created thread. |
| 134 MessageLoop* message_loop_; | 134 MessageLoop* message_loop_; |
| 135 | 135 |
| 136 // Our thread's ID. | 136 // Our thread's ID. |
| 137 int thread_id_; | 137 PlatformThreadId thread_id_; |
| 138 | 138 |
| 139 // The name of the thread. Used for debugging purposes. | 139 // The name of the thread. Used for debugging purposes. |
| 140 std::string name_; | 140 std::string name_; |
| 141 | 141 |
| 142 friend class ThreadQuitTask; | 142 friend class ThreadQuitTask; |
| 143 | 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(Thread); | 144 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace base | 147 } // namespace base |
| 148 | 148 |
| 149 #endif // BASE_THREAD_H_ | 149 #endif // BASE_THREAD_H_ |
| 150 | 150 |
| OLD | NEW |