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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return ThreadPriority::NORMAL; | 198 return ThreadPriority::NORMAL; |
199 | 199 |
200 ThreadPriority thread_priority = | 200 ThreadPriority thread_priority = |
201 static_cast<ThreadPriority>(priority.intValue); | 201 static_cast<ThreadPriority>(priority.intValue); |
202 switch (thread_priority) { | 202 switch (thread_priority) { |
203 case ThreadPriority::BACKGROUND: | 203 case ThreadPriority::BACKGROUND: |
204 case ThreadPriority::NORMAL: | 204 case ThreadPriority::NORMAL: |
205 case ThreadPriority::DISPLAY: | 205 case ThreadPriority::DISPLAY: |
206 case ThreadPriority::REALTIME_AUDIO: | 206 case ThreadPriority::REALTIME_AUDIO: |
207 return thread_priority; | 207 return thread_priority; |
| 208 default: |
| 209 NOTREACHED() << "Unknown priority."; |
| 210 return ThreadPriority::NORMAL; |
208 } | 211 } |
209 NOTREACHED() << "Unknown priority."; | |
210 return ThreadPriority::NORMAL; | |
211 } | 212 } |
212 | 213 |
213 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { | 214 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { |
214 #if defined(OS_IOS) | 215 #if defined(OS_IOS) |
215 return 0; | 216 return 0; |
216 #else | 217 #else |
217 // The Mac OS X default for a pthread stack size is 512kB. | 218 // The Mac OS X default for a pthread stack size is 512kB. |
218 // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses | 219 // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses |
219 // DEFAULT_STACK_SIZE for this purpose. | 220 // DEFAULT_STACK_SIZE for this purpose. |
220 // | 221 // |
(...skipping 21 matching lines...) Expand all Loading... |
242 static_cast<size_t>(stack_rlimit.rlim_cur)); | 243 static_cast<size_t>(stack_rlimit.rlim_cur)); |
243 } | 244 } |
244 return default_stack_size; | 245 return default_stack_size; |
245 #endif | 246 #endif |
246 } | 247 } |
247 | 248 |
248 void TerminateOnThread() { | 249 void TerminateOnThread() { |
249 } | 250 } |
250 | 251 |
251 } // namespace base | 252 } // namespace base |
OLD | NEW |