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

Side by Side Diff: third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h

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) 2011, Google Inc. 1 // Copyright (c) 2011, 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #ifndef __THROW // I guess we're not on a glibc-like system 46 #ifndef __THROW // I guess we're not on a glibc-like system
47 # define __THROW // __THROW is just an optimization, so ok to make it "" 47 # define __THROW // __THROW is just an optimization, so ok to make it ""
48 #endif 48 #endif
49 49
50 #ifndef __GNUC__ 50 #ifndef __GNUC__
51 # error libc_override_gcc_and_weak.h is for gcc distributions only. 51 # error libc_override_gcc_and_weak.h is for gcc distributions only.
52 #endif 52 #endif
53 53
54 #define ALIAS(tc_fn) __attribute__ ((alias (#tc_fn))) 54 #define ALIAS(tc_fn) __attribute__ ((alias (#tc_fn)))
55 55
56 void* operator new(size_t size) throw (std::bad_alloc) 56 #if defined(__ANDROID__)
57 // Android's bionic doesn't have std::bad_alloc.
58 #define STD_BAD_ALLOC
59 #else
60 #define STD_BAD_ALLOC std::bad_alloc
61 #endif
62
63 void* operator new(size_t size) throw (STD_BAD_ALLOC)
57 ALIAS(tc_new); 64 ALIAS(tc_new);
58 void operator delete(void* p) __THROW 65 void operator delete(void* p) __THROW
59 ALIAS(tc_delete); 66 ALIAS(tc_delete);
60 void* operator new[](size_t size) throw (std::bad_alloc) 67 void* operator new[](size_t size) throw (STD_BAD_ALLOC)
61 ALIAS(tc_newarray); 68 ALIAS(tc_newarray);
62 void operator delete[](void* p) __THROW 69 void operator delete[](void* p) __THROW
63 ALIAS(tc_deletearray); 70 ALIAS(tc_deletearray);
64 void* operator new(size_t size, const std::nothrow_t& nt) __THROW 71 void* operator new(size_t size, const std::nothrow_t& nt) __THROW
65 ALIAS(tc_new_nothrow); 72 ALIAS(tc_new_nothrow);
66 void* operator new[](size_t size, const std::nothrow_t& nt) __THROW 73 void* operator new[](size_t size, const std::nothrow_t& nt) __THROW
67 ALIAS(tc_newarray_nothrow); 74 ALIAS(tc_newarray_nothrow);
68 void operator delete(void* p, const std::nothrow_t& nt) __THROW 75 void operator delete(void* p, const std::nothrow_t& nt) __THROW
69 ALIAS(tc_delete_nothrow); 76 ALIAS(tc_delete_nothrow);
70 void operator delete[](void* p, const std::nothrow_t& nt) __THROW 77 void operator delete[](void* p, const std::nothrow_t& nt) __THROW
(...skipping 19 matching lines...) Expand all
90 size_t malloc_usable_size(void* p) __THROW ALIAS(tc_malloc_size); 97 size_t malloc_usable_size(void* p) __THROW ALIAS(tc_malloc_size);
91 } // extern "C" 98 } // extern "C"
92 99
93 #undef ALIAS 100 #undef ALIAS
94 101
95 // No need to do anything at tcmalloc-registration time: we do it all 102 // No need to do anything at tcmalloc-registration time: we do it all
96 // via overriding weak symbols (at link time). 103 // via overriding weak symbols (at link time).
97 static void ReplaceSystemAlloc() { } 104 static void ReplaceSystemAlloc() { }
98 105
99 #endif // TCMALLOC_LIBC_OVERRIDE_GCC_AND_WEAK_INL_H_ 106 #endif // TCMALLOC_LIBC_OVERRIDE_GCC_AND_WEAK_INL_H_
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/getpc.h ('k') | third_party/tcmalloc/chromium/src/maybe_threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698