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

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

Issue 1660273004: base: Set initial thread priority in ThreadFunc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | base/threading/platform_thread_posix.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 <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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // Set the name for the LWP (which gets truncated to 15 characters). 77 // Set the name for the LWP (which gets truncated to 15 characters).
78 int err = prctl(PR_SET_NAME, name.c_str()); 78 int err = prctl(PR_SET_NAME, name.c_str());
79 if (err < 0 && errno != EPERM) 79 if (err < 0 && errno != EPERM)
80 DPLOG(ERROR) << "prctl(PR_SET_NAME)"; 80 DPLOG(ERROR) << "prctl(PR_SET_NAME)";
81 } 81 }
82 82
83 83
84 void InitThreading() { 84 void InitThreading() {
85 } 85 }
86 86
87 void InitOnThread() { 87 void InitOnThread() {
Robert Sesek 2016/02/03 23:23:19 I think you can just remove base::InitOnThread now
reveman 2016/02/03 23:31:02 Done.
88 // Threads on linux/android may inherit their priority from the thread
89 // where they were created. This sets all new threads to the default.
90 PlatformThread::SetCurrentThreadPriority(ThreadPriority::NORMAL);
91 } 88 }
92 89
93 void TerminateOnThread() { 90 void TerminateOnThread() {
94 base::android::DetachFromVM(); 91 base::android::DetachFromVM();
95 } 92 }
96 93
97 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { 94 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
98 #if !defined(ADDRESS_SANITIZER) 95 #if !defined(ADDRESS_SANITIZER)
99 return 0; 96 return 0;
100 #else 97 #else
101 // AddressSanitizer bloats the stack approximately 2x. Default stack size of 98 // AddressSanitizer bloats the stack approximately 2x. Default stack size of
102 // 1Mb is not enough for some tests (see http://crbug.com/263749 for example). 99 // 1Mb is not enough for some tests (see http://crbug.com/263749 for example).
103 return 2 * (1 << 20); // 2Mb 100 return 2 * (1 << 20); // 2Mb
104 #endif 101 #endif
105 } 102 }
106 103
107 bool RegisterThreadUtils(JNIEnv* env) { 104 bool RegisterThreadUtils(JNIEnv* env) {
108 return RegisterNativesImpl(env); 105 return RegisterNativesImpl(env);
109 } 106 }
110 107
111 } // namespace base 108 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/threading/platform_thread_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698