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

Side by Side Diff: base/threading/platform_thread_linux.cc

Issue 257143003: Cleanup random bits of base/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « base/sequence_checker_unittest.cc ('k') | 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 // 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 #include <errno.h> 7 #include <errno.h>
8 #include <sched.h> 8 #include <sched.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/safe_strerror_posix.h" 13 #include "base/safe_strerror_posix.h"
14 #include "base/threading/thread_id_name_manager.h" 14 #include "base/threading/thread_id_name_manager.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "base/tracked_objects.h" 16 #include "base/tracked_objects.h"
17 17
18 #if !defined(OS_NACL) 18 #if !defined(OS_NACL)
19 #include <sys/prctl.h> 19 #include <sys/prctl.h>
20 #include <sys/resource.h> 20 #include <sys/resource.h>
21 #include <sys/syscall.h> 21 #include <sys/syscall.h>
22 #include <sys/time.h> 22 #include <sys/time.h>
23 #include <unistd.h> 23 #include <unistd.h>
24 #endif 24 #endif
25 25
26 namespace base { 26 namespace base {
27 27
28 namespace { 28 namespace {
29
29 int ThreadNiceValue(ThreadPriority priority) { 30 int ThreadNiceValue(ThreadPriority priority) {
30 switch (priority) { 31 switch (priority) {
31 case kThreadPriority_RealtimeAudio: 32 case kThreadPriority_RealtimeAudio:
32 return -10; 33 return -10;
33 case kThreadPriority_Background: 34 case kThreadPriority_Background:
34 return 10; 35 return 10;
35 case kThreadPriority_Normal: 36 case kThreadPriority_Normal:
36 return 0; 37 return 0;
37 case kThreadPriority_Display: 38 case kThreadPriority_Display:
38 return -6; 39 return -6;
39 default: 40 default:
40 NOTREACHED() << "Unknown priority."; 41 NOTREACHED() << "Unknown priority.";
41 return 0; 42 return 0;
42 } 43 }
43 } 44 }
44 } // namespace 45
46 } // namespace
45 47
46 // static 48 // static
47 void PlatformThread::SetName(const char* name) { 49 void PlatformThread::SetName(const char* name) {
48 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); 50 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name);
49 tracked_objects::ThreadData::InitializeThreadContext(name); 51 tracked_objects::ThreadData::InitializeThreadContext(name);
50 52
51 #if !defined(OS_NACL) 53 #if !defined(OS_NACL)
52 // On linux we can get the thread names to show up in the debugger by setting 54 // On linux we can get the thread names to show up in the debugger by setting
53 // the process name for the LWP. We don't want to do this for the main 55 // the process name for the LWP. We don't want to do this for the main
54 // thread because that would rename the process, causing tools like killall 56 // thread because that would rename the process, causing tools like killall
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return 0; 106 return 0;
105 #else 107 #else
106 // ThreadSanitizer bloats the stack heavily. Evidence has been that the 108 // ThreadSanitizer bloats the stack heavily. Evidence has been that the
107 // default stack size isn't enough for some browser tests. 109 // default stack size isn't enough for some browser tests.
108 // MemorySanitizer needs this as a temporary fix for http://crbug.com/353687 110 // MemorySanitizer needs this as a temporary fix for http://crbug.com/353687
109 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux). 111 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
110 #endif 112 #endif
111 } 113 }
112 114
113 } // namespace base 115 } // namespace base
OLDNEW
« no previous file with comments | « base/sequence_checker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698