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

Unified Diff: third_party/tcmalloc/chromium/src/maybe_threads.cc

Issue 14321006: Adds TCMalloc support for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/chromium/src/maybe_threads.cc
diff --git a/third_party/tcmalloc/chromium/src/maybe_threads.cc b/third_party/tcmalloc/chromium/src/maybe_threads.cc
index 15c8a23dcb3509549ef6b45531f2418e988a3cf5..37646d6a50f40042ae70f591f14487246989f024 100644
--- a/third_party/tcmalloc/chromium/src/maybe_threads.cc
+++ b/third_party/tcmalloc/chromium/src/maybe_threads.cc
@@ -124,7 +124,17 @@ int perftools_pthread_once(pthread_once_t *ctl,
if (pthread_once) {
return pthread_once(ctl, init_routine);
} else {
+#if defined(__ANDROID__)
+ // Android's pthread_once_t is typedef volatile and memcmp only takes
Jeffrey Yasskin 2013/05/21 17:09:43 Are there any situations where Android is missing
digit1 2013/05/21 18:16:24 No, pthread_once() and pthread_once_t are definite
bulach 2013/05/22 07:41:41 thanks both! so it seems pthread_once is guarantee
+ // const void*, cast the volatile away.
+ if (memcmp(const_cast<const void*>(reinterpret_cast<const volatile void*>(
Jeffrey Yasskin 2013/05/21 17:09:43 http://goto.google.com/c++03pdf [dcl.type.cv]p7 sa
Dai Mikurube (NOT FULLTIME) 2013/05/21 17:21:46 A comment from a side: It's just a local change t
Dai Mikurube (NOT FULLTIME) 2013/05/21 17:26:12 Hmm, sorry. I might make a misunderstanding of yo
bulach 2013/05/22 07:41:41 thanks jeffrey! yeah, one of the previous patches
+ ctl)),
+ const_cast<const void*>(reinterpret_cast<const volatile void*>(
+ &pthread_once_init)),
+ sizeof(*ctl)) == 0) {
+#else
if (memcmp(ctl, &pthread_once_init, sizeof(*ctl)) == 0) {
+#endif
init_routine();
++*(char*)(ctl); // make it so it's no longer equal to init
}
« no previous file with comments | « third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h ('k') | third_party/tcmalloc/chromium/src/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698