| 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 // WARNING: You should *NOT* be using this class directly. PlatformThread is | 5 // WARNING: You should *NOT* be using this class directly. PlatformThread is |
| 6 // the low-level platform-specific abstraction to the OS's threading interface. | 6 // the low-level platform-specific abstraction to the OS's threading interface. |
| 7 // You should instead be using a message-loop driven Thread, see thread.h. | 7 // You should instead be using a message-loop driven Thread, see thread.h. |
| 8 | 8 |
| 9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_ | 9 #ifndef BASE_THREADING_PLATFORM_THREAD_H_ |
| 10 #define BASE_THREADING_PLATFORM_THREAD_H_ | 10 #define BASE_THREADING_PLATFORM_THREAD_H_ |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 friend class PlatformThread; | 105 friend class PlatformThread; |
| 106 | 106 |
| 107 Handle handle_; | 107 Handle handle_; |
| 108 PlatformThreadId id_; | 108 PlatformThreadId id_; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 const PlatformThreadId kInvalidThreadId(0); | 111 const PlatformThreadId kInvalidThreadId(0); |
| 112 | 112 |
| 113 // Valid values for SetThreadPriority() | 113 // Valid values for SetThreadPriority(), listed in increasing order of |
| 114 enum ThreadPriority { | 114 // importance. |
| 115 kThreadPriority_Normal, | 115 enum class ThreadPriority { |
| 116 // Suitable for threads that shouldn't disrupt high priority work. |
| 117 BACKGROUND, |
| 118 // Default priority level. |
| 119 NORMAL, |
| 120 // Suitable for threads which generate data for the display (at ~60Hz). |
| 121 DISPLAY, |
| 116 // Suitable for low-latency, glitch-resistant audio. | 122 // Suitable for low-latency, glitch-resistant audio. |
| 117 kThreadPriority_RealtimeAudio, | 123 REALTIME_AUDIO, |
| 118 // Suitable for threads which generate data for the display (at ~60Hz). | |
| 119 kThreadPriority_Display, | |
| 120 // Suitable for threads that shouldn't disrupt high priority work. | |
| 121 kThreadPriority_Background | |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 // A namespace for low-level thread functions. | 126 // A namespace for low-level thread functions. |
| 125 class BASE_EXPORT PlatformThread { | 127 class BASE_EXPORT PlatformThread { |
| 126 public: | 128 public: |
| 127 // Implement this interface to run code on a background thread. Your | 129 // Implement this interface to run code on a background thread. Your |
| 128 // ThreadMain method will be called on the newly created thread. | 130 // ThreadMain method will be called on the newly created thread. |
| 129 class BASE_EXPORT Delegate { | 131 class BASE_EXPORT Delegate { |
| 130 public: | 132 public: |
| 131 virtual void ThreadMain() = 0; | 133 virtual void ThreadMain() = 0; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 196 |
| 195 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle); | 197 static ThreadPriority GetThreadPriority(PlatformThreadHandle handle); |
| 196 | 198 |
| 197 private: | 199 private: |
| 198 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); | 200 DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread); |
| 199 }; | 201 }; |
| 200 | 202 |
| 201 } // namespace base | 203 } // namespace base |
| 202 | 204 |
| 203 #endif // BASE_THREADING_PLATFORM_THREAD_H_ | 205 #endif // BASE_THREADING_PLATFORM_THREAD_H_ |
| OLD | NEW |