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 #include "base/threading/platform_thread.h" | 5 #include "base/threading/platform_thread.h" |
6 | 6 |
7 #include "base/debug/alias.h" | 7 #include "base/debug/alias.h" |
8 #include "base/debug/profiler.h" | 8 #include "base/debug/profiler.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_id_name_manager.h" | 10 #include "base/threading/thread_id_name_manager.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 } // namespace | 98 } // namespace |
99 | 99 |
100 // static | 100 // static |
101 PlatformThreadId PlatformThread::CurrentId() { | 101 PlatformThreadId PlatformThread::CurrentId() { |
102 return GetCurrentThreadId(); | 102 return GetCurrentThreadId(); |
103 } | 103 } |
104 | 104 |
105 // static | 105 // static |
| 106 PlatformThreadHandle PlatformThread::CurrentHandle() { |
| 107 NOTIMPLEMENTED(); // See OpenThread() |
| 108 return kNullThreadHandle; |
| 109 } |
| 110 |
| 111 // static |
106 void PlatformThread::YieldCurrentThread() { | 112 void PlatformThread::YieldCurrentThread() { |
107 ::Sleep(0); | 113 ::Sleep(0); |
108 } | 114 } |
109 | 115 |
110 // static | 116 // static |
111 void PlatformThread::Sleep(TimeDelta duration) { | 117 void PlatformThread::Sleep(TimeDelta duration) { |
112 ::Sleep(duration.InMillisecondsRoundedUp()); | 118 ::Sleep(duration.InMillisecondsRoundedUp()); |
113 } | 119 } |
114 | 120 |
115 // static | 121 // static |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // static | 198 // static |
193 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, | 199 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, |
194 ThreadPriority priority) { | 200 ThreadPriority priority) { |
195 switch (priority) { | 201 switch (priority) { |
196 case kThreadPriority_Normal: | 202 case kThreadPriority_Normal: |
197 ::SetThreadPriority(handle, THREAD_PRIORITY_NORMAL); | 203 ::SetThreadPriority(handle, THREAD_PRIORITY_NORMAL); |
198 break; | 204 break; |
199 case kThreadPriority_RealtimeAudio: | 205 case kThreadPriority_RealtimeAudio: |
200 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL); | 206 ::SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL); |
201 break; | 207 break; |
| 208 default: |
| 209 NOTREACHED() << "Unknown priority."; |
| 210 break; |
202 } | 211 } |
203 } | 212 } |
204 | 213 |
205 } // namespace base | 214 } // namespace base |
OLD | NEW |