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

Side by Side Diff: webrtc/base/platform_thread.cc

Issue 1472083002: Skip setting thread priorities in NaCl. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // Alertable sleep to permit RaiseFlag to run and update |stop_|. 195 // Alertable sleep to permit RaiseFlag to run and update |stop_|.
196 SleepEx(0, true); 196 SleepEx(0, true);
197 } while (!stop_); 197 } while (!stop_);
198 #else 198 #else
199 } while (!stop_event_.Wait(0)); 199 } while (!stop_event_.Wait(0));
200 #endif // defined(WEBRTC_WIN) 200 #endif // defined(WEBRTC_WIN)
201 } 201 }
202 202
203 bool PlatformThread::SetPriority(ThreadPriority priority) { 203 bool PlatformThread::SetPriority(ThreadPriority priority) {
204 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 204 RTC_DCHECK(thread_checker_.CalledOnValidThread());
205 #if defined(WEBRTC_WIN)
206 return thread_ && SetThreadPriority(thread_, priority);
207 #else
208 if (!thread_) 205 if (!thread_)
209 return false; 206 return false;
210 #if defined(WEBRTC_CHROMIUM_BUILD) && defined(WEBRTC_LINUX) 207 #if defined(WEBRTC_WIN)
211 // TODO(tommi): Switch to the same mechanism as Chromium uses for 208 return SetThreadPriority(thread_, priority);
212 // changing thread priorities. 209 #elif defined(__native_client__)
210 // Setting thread priorities is not supported in NaCl.
211 return true;
212 #elif defined(WEBRTC_CHROMIUM_BUILD) && defined(WEBRTC_LINUX)
213 // TODO(tommi): Switch to the same mechanism as Chromium uses for changing
214 // thread priorities.
213 return true; 215 return true;
214 #else 216 #else
215 #ifdef WEBRTC_THREAD_RR 217 #ifdef WEBRTC_THREAD_RR
216 const int policy = SCHED_RR; 218 const int policy = SCHED_RR;
217 #else 219 #else
218 const int policy = SCHED_FIFO; 220 const int policy = SCHED_FIFO;
219 #endif 221 #endif
220 const int min_prio = sched_get_priority_min(policy); 222 const int min_prio = sched_get_priority_min(policy);
221 const int max_prio = sched_get_priority_max(policy); 223 const int max_prio = sched_get_priority_max(policy);
222 if (min_prio == -1 || max_prio == -1) { 224 if (min_prio == -1 || max_prio == -1) {
(...skipping 20 matching lines...) Expand all
243 param.sched_priority = std::max(top_prio - 2, low_prio); 245 param.sched_priority = std::max(top_prio - 2, low_prio);
244 break; 246 break;
245 case kHighestPriority: 247 case kHighestPriority:
246 param.sched_priority = std::max(top_prio - 1, low_prio); 248 param.sched_priority = std::max(top_prio - 1, low_prio);
247 break; 249 break;
248 case kRealtimePriority: 250 case kRealtimePriority:
249 param.sched_priority = top_prio; 251 param.sched_priority = top_prio;
250 break; 252 break;
251 } 253 }
252 return pthread_setschedparam(thread_, policy, &param) == 0; 254 return pthread_setschedparam(thread_, policy, &param) == 0;
253 #endif // defined(WEBRTC_CHROMIUM_BUILD) && defined(WEBRTC_LINUX)
254 #endif // defined(WEBRTC_WIN) 255 #endif // defined(WEBRTC_WIN)
255 } 256 }
256 257
257 } // namespace webrtc 258 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698