Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/resource.h> | 8 #include <sys/resource.h> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 // where they were created. This sets all new threads to the default. | 88 // where they were created. This sets all new threads to the default. |
| 89 PlatformThread::SetThreadPriority(PlatformThread::CurrentHandle(), | 89 PlatformThread::SetThreadPriority(PlatformThread::CurrentHandle(), |
| 90 kThreadPriority_Normal); | 90 kThreadPriority_Normal); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void TerminateOnThread() { | 93 void TerminateOnThread() { |
| 94 base::android::DetachFromVM(); | 94 base::android::DetachFromVM(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { | 97 size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { |
| 98 #if !defined(ADDRESS_SANITIZER) | |
| 98 return 0; | 99 return 0; |
| 100 #else | |
| 101 // 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). | |
| 103 return 2 * (1 << 20); // 2Mb | |
|
Alexander Potapenko
2014/01/27 14:54:51
Two spaces before the comment, please.
eugenis
2014/01/27 15:14:30
Done.
| |
| 104 #endif | |
| 99 } | 105 } |
| 100 | 106 |
| 101 bool RegisterThreadUtils(JNIEnv* env) { | 107 bool RegisterThreadUtils(JNIEnv* env) { |
| 102 return RegisterNativesImpl(env); | 108 return RegisterNativesImpl(env); |
| 103 } | 109 } |
| 104 | 110 |
| 105 } // namespace base | 111 } // namespace base |
| OLD | NEW |