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