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 <mach/mach.h> | 8 #include <mach/mach.h> |
9 #include <mach/mach_time.h> | 9 #include <mach/mach_time.h> |
10 #include <mach/thread_policy.h> | 10 #include <mach/thread_policy.h> |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 return; | 152 return; |
153 } | 153 } |
154 | 154 |
155 } // anonymous namespace | 155 } // anonymous namespace |
156 | 156 |
157 // static | 157 // static |
158 void PlatformThread::SetCurrentThreadPriority(ThreadPriority priority) { | 158 void PlatformThread::SetCurrentThreadPriority(ThreadPriority priority) { |
159 // Convert from pthread_t to mach thread identifier. | 159 // Convert from pthread_t to mach thread identifier. |
160 mach_port_t mach_thread_id = | 160 mach_port_t mach_thread_id = |
161 pthread_mach_thread_np(PlatformThread::CurrentHandle().platform_handle()); | 161 pthread_mach_thread_np(PlatformThread::CurrentHandle().handle_); |
162 | 162 |
163 switch (priority) { | 163 switch (priority) { |
164 case ThreadPriority::NORMAL: | 164 case ThreadPriority::NORMAL: |
165 SetPriorityNormal(mach_thread_id); | 165 SetPriorityNormal(mach_thread_id); |
166 break; | 166 break; |
167 case ThreadPriority::REALTIME_AUDIO: | 167 case ThreadPriority::REALTIME_AUDIO: |
168 SetPriorityRealtimeAudio(mach_thread_id); | 168 SetPriorityRealtimeAudio(mach_thread_id); |
169 break; | 169 break; |
170 default: | 170 default: |
171 NOTREACHED() << "Unknown priority."; | 171 NOTREACHED() << "Unknown priority."; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 #endif | 214 #endif |
215 } | 215 } |
216 | 216 |
217 void InitOnThread() { | 217 void InitOnThread() { |
218 } | 218 } |
219 | 219 |
220 void TerminateOnThread() { | 220 void TerminateOnThread() { |
221 } | 221 } |
222 | 222 |
223 } // namespace base | 223 } // namespace base |
OLD | NEW |