| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 *priority = ThreadPriority::REALTIME_AUDIO; | 62 *priority = ThreadPriority::REALTIME_AUDIO; |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 #endif | 65 #endif |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace internal | 69 } // namespace internal |
| 70 | 70 |
| 71 // static | 71 // static |
| 72 void PlatformThread::SetName(const char* name) { | 72 void PlatformThread::SetName(const std::string& name) { |
| 73 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); | 73 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); |
| 74 tracked_objects::ThreadData::InitializeThreadContext(name); | 74 tracked_objects::ThreadData::InitializeThreadContext(name); |
| 75 | 75 |
| 76 #if !defined(OS_NACL) | 76 #if !defined(OS_NACL) |
| 77 // On FreeBSD we can get the thread names to show up in the debugger by | 77 // On FreeBSD we can get the thread names to show up in the debugger by |
| 78 // setting the process name for the LWP. We don't want to do this for the | 78 // setting the process name for the LWP. We don't want to do this for the |
| 79 // main thread because that would rename the process, causing tools like | 79 // main thread because that would rename the process, causing tools like |
| 80 // killall to stop working. | 80 // killall to stop working. |
| 81 if (PlatformThread::CurrentId() == getpid()) | 81 if (PlatformThread::CurrentId() == getpid()) |
| 82 return; | 82 return; |
| 83 setproctitle("%s", name); | 83 setproctitle("%s", name.c_str()); |
| 84 #endif // !defined(OS_NACL) | 84 #endif // !defined(OS_NACL) |
| 85 } | 85 } |
| 86 | 86 |
| 87 void InitThreading() {} | 87 void InitThreading() {} |
| 88 | 88 |
| 89 void InitOnThread() {} | 89 void InitOnThread() {} |
| 90 | 90 |
| 91 void TerminateOnThread() {} | 91 void TerminateOnThread() {} |
| 92 | 92 |
| 93 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { | 93 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { |
| 94 #if !defined(THREAD_SANITIZER) | 94 #if !defined(THREAD_SANITIZER) |
| 95 return 0; | 95 return 0; |
| 96 #else | 96 #else |
| 97 // ThreadSanitizer bloats the stack heavily. Evidence has been that the | 97 // ThreadSanitizer bloats the stack heavily. Evidence has been that the |
| 98 // default stack size isn't enough for some browser tests. | 98 // default stack size isn't enough for some browser tests. |
| 99 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux). | 99 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux). |
| 100 #endif | 100 #endif |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace base | 103 } // namespace base |
| OLD | NEW |