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

Side by Side 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: Always use phtread_once 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // is not linked with -pthread). 113 // is not linked with -pthread).
114 static bool pthread_once_ran_before_threads = false; 114 static bool pthread_once_ran_before_threads = false;
115 if (pthread_once_ran_before_threads) { 115 if (pthread_once_ran_before_threads) {
116 return 0; 116 return 0;
117 } 117 }
118 if (!__isthreaded) { 118 if (!__isthreaded) {
119 init_routine(); 119 init_routine();
120 pthread_once_ran_before_threads = true; 120 pthread_once_ran_before_threads = true;
121 return 0; 121 return 0;
122 } 122 }
123 #endif 123 #elif defined(__ANDROID__)
124 // Android >= 2.3 (GB) always implement pthread_once.
125 return pthread_once(ctl, init_routine);
126 #else
124 if (pthread_once) { 127 if (pthread_once) {
125 return pthread_once(ctl, init_routine); 128 return pthread_once(ctl, init_routine);
126 } else { 129 } else {
127 if (memcmp(ctl, &pthread_once_init, sizeof(*ctl)) == 0) { 130 if (memcmp(ctl, &pthread_once_init, sizeof(*ctl)) == 0) {
128 init_routine(); 131 init_routine();
129 ++*(char*)(ctl); // make it so it's no longer equal to init 132 ++*(char*)(ctl); // make it so it's no longer equal to init
130 } 133 }
131 return 0; 134 return 0;
132 } 135 }
136 #endif
133 } 137 }
OLDNEW
« 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