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 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
9 #include <mach/mach.h> | 9 #include <mach/mach.h> |
10 #include <mach/mach_time.h> | 10 #include <mach/mach_time.h> |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (result != KERN_SUCCESS) | 154 if (result != KERN_SUCCESS) |
155 DVLOG(1) << "thread_policy_set() failure: " << result; | 155 DVLOG(1) << "thread_policy_set() failure: " << result; |
156 | 156 |
157 return; | 157 return; |
158 } | 158 } |
159 | 159 |
160 } // anonymous namespace | 160 } // anonymous namespace |
161 | 161 |
162 // static | 162 // static |
163 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, | 163 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, |
| 164 PlatformThreadId, |
164 ThreadPriority priority) { | 165 ThreadPriority priority) { |
165 // Convert from pthread_t to mach thread identifier. | 166 // Convert from pthread_t to mach thread identifier. |
166 mach_port_t mach_thread_id = pthread_mach_thread_np(handle); | 167 mach_port_t mach_thread_id = pthread_mach_thread_np(handle); |
167 | 168 |
168 switch (priority) { | 169 switch (priority) { |
169 case kThreadPriority_Normal: | 170 case kThreadPriority_Normal: |
170 SetPriorityNormal(mach_thread_id); | 171 SetPriorityNormal(mach_thread_id); |
171 break; | 172 break; |
172 case kThreadPriority_RealtimeAudio: | 173 case kThreadPriority_RealtimeAudio: |
173 SetPriorityRealtimeAudio(mach_thread_id); | 174 SetPriorityRealtimeAudio(mach_thread_id); |
174 break; | 175 break; |
| 176 default: |
| 177 NOTREACHED() << "Unknown priority."; |
| 178 break; |
175 } | 179 } |
176 } | 180 } |
177 | 181 |
178 } // namespace base | 182 } // namespace base |
OLD | NEW |