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

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

Issue 1128733002: Update from https://crrev.com/328418 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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.h ('k') | base/threading/platform_thread_freebsd.cc » ('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 <sys/prctl.h> 8 #include <sys/prctl.h>
9 #include <sys/resource.h> 9 #include <sys/resource.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 bool GetThreadPriorityForPlatform(PlatformThreadHandle handle, 59 bool GetThreadPriorityForPlatform(PlatformThreadHandle handle,
60 ThreadPriority* priority) { 60 ThreadPriority* priority) {
61 NOTIMPLEMENTED(); 61 NOTIMPLEMENTED();
62 return false; 62 return false;
63 } 63 }
64 64
65 } // namespace internal 65 } // namespace internal
66 66
67 void PlatformThread::SetName(const char* name) { 67 void PlatformThread::SetName(const std::string& name) {
68 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); 68 ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name);
69 tracked_objects::ThreadData::InitializeThreadContext(name); 69 tracked_objects::ThreadData::InitializeThreadContext(name);
70 70
71 // Like linux, on android we can get the thread names to show up in the 71 // Like linux, on android we can get the thread names to show up in the
72 // debugger by setting the process name for the LWP. 72 // debugger by setting the process name for the LWP.
73 // We don't want to do this for the main thread because that would rename 73 // We don't want to do this for the main thread because that would rename
74 // the process, causing tools like killall to stop working. 74 // the process, causing tools like killall to stop working.
75 if (PlatformThread::CurrentId() == getpid()) 75 if (PlatformThread::CurrentId() == getpid())
76 return; 76 return;
77 77
78 // Set the name for the LWP (which gets truncated to 15 characters). 78 // Set the name for the LWP (which gets truncated to 15 characters).
79 int err = prctl(PR_SET_NAME, name); 79 int err = prctl(PR_SET_NAME, name.c_str());
80 if (err < 0 && errno != EPERM) 80 if (err < 0 && errno != EPERM)
81 DPLOG(ERROR) << "prctl(PR_SET_NAME)"; 81 DPLOG(ERROR) << "prctl(PR_SET_NAME)";
82 } 82 }
83 83
84 84
85 void InitThreading() { 85 void InitThreading() {
86 } 86 }
87 87
88 void InitOnThread() { 88 void InitOnThread() {
89 // Threads on linux/android may inherit their priority from the thread 89 // Threads on linux/android may inherit their priority from the thread
(...skipping 14 matching lines...) Expand all
104 // 1Mb is not enough for some tests (see http://crbug.com/263749 for example). 104 // 1Mb is not enough for some tests (see http://crbug.com/263749 for example).
105 return 2 * (1 << 20); // 2Mb 105 return 2 * (1 << 20); // 2Mb
106 #endif 106 #endif
107 } 107 }
108 108
109 bool RegisterThreadUtils(JNIEnv* env) { 109 bool RegisterThreadUtils(JNIEnv* env) {
110 return RegisterNativesImpl(env); 110 return RegisterNativesImpl(env);
111 } 111 }
112 112
113 } // namespace base 113 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/platform_thread.h ('k') | base/threading/platform_thread_freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698