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

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

Issue 1845753006: Don't create redundant ThreadData for Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #include <errno.h> 7 #include <errno.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <sys/prctl.h> 9 #include <sys/prctl.h>
10 #include <sys/resource.h> 10 #include <sys/resource.h>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (Java_ThreadUtils_isThreadPriorityAudio( 54 if (Java_ThreadUtils_isThreadPriorityAudio(
55 env, PlatformThread::CurrentId())) { 55 env, PlatformThread::CurrentId())) {
56 *priority = ThreadPriority::REALTIME_AUDIO; 56 *priority = ThreadPriority::REALTIME_AUDIO;
57 return true; 57 return true;
58 } 58 }
59 return false; 59 return false;
60 } 60 }
61 61
62 } // namespace internal 62 } // namespace internal
63 63
64 void PlatformThread::SetName(const std::string& name) { 64 void PlatformThread::SetName(const std::string& name, bool is_worker_thread) {
65 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); 65 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name);
66 tracked_objects::ThreadData::InitializeThreadContext(name); 66 tracked_objects::ThreadData::InitializeThreadContext(name, is_worker_thread);
67 67
68 // Like linux, on android we can get the thread names to show up in the 68 // Like linux, on android we can get the thread names to show up in the
69 // debugger by setting the process name for the LWP. 69 // debugger by setting the process name for the LWP.
70 // We don't want to do this for the main thread because that would rename 70 // We don't want to do this for the main thread because that would rename
71 // the process, causing tools like killall to stop working. 71 // the process, causing tools like killall to stop working.
72 if (PlatformThread::CurrentId() == getpid()) 72 if (PlatformThread::CurrentId() == getpid())
73 return; 73 return;
74 74
75 // Set the name for the LWP (which gets truncated to 15 characters). 75 // Set the name for the LWP (which gets truncated to 15 characters).
76 int err = prctl(PR_SET_NAME, name.c_str()); 76 int err = prctl(PR_SET_NAME, name.c_str());
(...skipping 17 matching lines...) Expand all
94 // 1Mb is not enough for some tests (see http://crbug.com/263749 for example). 94 // 1Mb is not enough for some tests (see http://crbug.com/263749 for example).
95 return 2 * (1 << 20); // 2Mb 95 return 2 * (1 << 20); // 2Mb
96 #endif 96 #endif
97 } 97 }
98 98
99 bool RegisterThreadUtils(JNIEnv* env) { 99 bool RegisterThreadUtils(JNIEnv* env) {
100 return RegisterNativesImpl(env); 100 return RegisterNativesImpl(env);
101 } 101 }
102 102
103 } // namespace base 103 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698