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

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

Issue 1845753006: Don't create redundant ThreadData for Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment Created 4 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
« no previous file with comments | « base/threading/platform_thread_freebsd.cc ('k') | base/threading/platform_thread_mac.mm » ('j') | 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 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 *priority = ThreadPriority::REALTIME_AUDIO; 59 *priority = ThreadPriority::REALTIME_AUDIO;
60 return true; 60 return true;
61 } 61 }
62 #endif 62 #endif
63 return false; 63 return false;
64 } 64 }
65 65
66 } // namespace internal 66 } // namespace internal
67 67
68 // static 68 // static
69 void PlatformThread::SetName(const std::string& name) { 69 void PlatformThread::SetName(const std::string& name,
70 bool is_worker_thread) {
Lei Zhang 2016/05/31 21:43:24 nit: fix on the previous line, just like all the o
70 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); 71 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name);
71 tracked_objects::ThreadData::InitializeThreadContext(name); 72 if (!is_worker_thread)
73 tracked_objects::ThreadData::InitializeThreadContext(name);
72 74
73 #if !defined(OS_NACL) 75 #if !defined(OS_NACL)
74 // On linux we can get the thread names to show up in the debugger by setting 76 // On linux we can get the thread names to show up in the debugger by setting
75 // the process name for the LWP. We don't want to do this for the main 77 // the process name for the LWP. We don't want to do this for the main
76 // thread because that would rename the process, causing tools like killall 78 // thread because that would rename the process, causing tools like killall
77 // to stop working. 79 // to stop working.
78 if (PlatformThread::CurrentId() == getpid()) 80 if (PlatformThread::CurrentId() == getpid())
79 return; 81 return;
80 82
81 // http://0pointer.de/blog/projects/name-your-threads.html 83 // http://0pointer.de/blog/projects/name-your-threads.html
(...skipping 16 matching lines...) Expand all
98 #if !defined(THREAD_SANITIZER) 100 #if !defined(THREAD_SANITIZER)
99 return 0; 101 return 0;
100 #else 102 #else
101 // ThreadSanitizer bloats the stack heavily. Evidence has been that the 103 // ThreadSanitizer bloats the stack heavily. Evidence has been that the
102 // default stack size isn't enough for some browser tests. 104 // default stack size isn't enough for some browser tests.
103 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux). 105 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
104 #endif 106 #endif
105 } 107 }
106 108
107 } // namespace base 109 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread_freebsd.cc ('k') | base/threading/platform_thread_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698