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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 } // anonymous namespace | 155 } // anonymous namespace |
156 | 156 |
157 // static | 157 // static |
158 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, | 158 void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, |
159 ThreadPriority priority) { | 159 ThreadPriority priority) { |
160 // Convert from pthread_t to mach thread identifier. | 160 // Convert from pthread_t to mach thread identifier. |
161 mach_port_t mach_thread_id = pthread_mach_thread_np(handle.handle_); | 161 mach_port_t mach_thread_id = pthread_mach_thread_np(handle.handle_); |
162 | 162 |
163 switch (priority) { | 163 switch (priority) { |
164 case kThreadPriority_Normal: | 164 case ThreadPriority::NORMAL: |
165 SetPriorityNormal(mach_thread_id); | 165 SetPriorityNormal(mach_thread_id); |
166 break; | 166 break; |
167 case kThreadPriority_RealtimeAudio: | 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."; |
172 break; | 172 break; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 // static | 176 // static |
177 ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) { | 177 ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) { |
178 NOTIMPLEMENTED(); | 178 NOTIMPLEMENTED(); |
179 return kThreadPriority_Normal; | 179 return ThreadPriority::NORMAL; |
180 } | 180 } |
181 | 181 |
182 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { | 182 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { |
183 #if defined(OS_IOS) | 183 #if defined(OS_IOS) |
184 return 0; | 184 return 0; |
185 #else | 185 #else |
186 // The Mac OS X default for a pthread stack size is 512kB. | 186 // The Mac OS X default for a pthread stack size is 512kB. |
187 // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses | 187 // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses |
188 // DEFAULT_STACK_SIZE for this purpose. | 188 // DEFAULT_STACK_SIZE for this purpose. |
189 // | 189 // |
(...skipping 24 matching lines...) Expand all 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 |