Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: base/threading/platform_thread_mac.mm

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
177 ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) {
178 NOTIMPLEMENTED();
179 return ThreadPriority::NORMAL;
180 }
181
176 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { 182 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
177 #if defined(OS_IOS) 183 #if defined(OS_IOS)
178 return 0; 184 return 0;
179 #else 185 #else
180 // 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.
181 // 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
182 // DEFAULT_STACK_SIZE for this purpose. 188 // DEFAULT_STACK_SIZE for this purpose.
183 // 189 //
184 // 512kB isn't quite generous enough for some deeply recursive threads that 190 // 512kB isn't quite generous enough for some deeply recursive threads that
185 // otherwise request the default stack size by specifying 0. Here, adopt 191 // otherwise request the default stack size by specifying 0. Here, adopt
(...skipping 22 matching lines...) Expand all
208 #endif 214 #endif
209 } 215 }
210 216
211 void InitOnThread() { 217 void InitOnThread() {
212 } 218 }
213 219
214 void TerminateOnThread() { 220 void TerminateOnThread() {
215 } 221 }
216 222
217 } // namespace base 223 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698