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

Side by Side Diff: base/allocator/allocator_shim_override_cpp_symbols.h

Issue 2720703004: allocator: Fix function type mismatch in allocator function definitions. (Closed)
Patch Set: Change shim functions to be ALWAYS_INLINE and replace all aliases with calls Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_CPP_SYMBOLS_H_ 5 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_CPP_SYMBOLS_H_
6 #error This header is meant to be included only once by allocator_shim.cc 6 #error This header is meant to be included only once by allocator_shim.cc
7 #endif 7 #endif
8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_CPP_SYMBOLS_H_ 8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_CPP_SYMBOLS_H_
9 9
10 // Alias the default new/delete C++ symbols to the shim entry points. 10 // Preempt the default new/delete C++ symbols so they call the shim entry
11 // This file is strongly inspired by tcmalloc's libc_override_redefine.h. 11 // points. This file is strongly inspired by tcmalloc's
12 // libc_override_redefine.h.
12 13
13 #include <new> 14 #include <new>
14 15
15 #include "base/allocator/allocator_shim_internals.h" 16 #include "base/allocator/allocator_shim_internals.h"
16 17
17 SHIM_ALWAYS_EXPORT void* operator new(size_t size) 18 SHIM_ALWAYS_EXPORT void* operator new(size_t size) {
18 SHIM_ALIAS_SYMBOL(ShimCppNew); 19 return ShimCppNew(size);
20 }
19 21
20 SHIM_ALWAYS_EXPORT void operator delete(void* p) __THROW 22 SHIM_ALWAYS_EXPORT void operator delete(void* p) __THROW {
21 SHIM_ALIAS_SYMBOL(ShimCppDelete); 23 ShimCppDelete(p);
24 }
22 25
23 SHIM_ALWAYS_EXPORT void* operator new[](size_t size) 26 SHIM_ALWAYS_EXPORT void* operator new[](size_t size) {
24 SHIM_ALIAS_SYMBOL(ShimCppNew); 27 return ShimCppNew(size);
28 }
25 29
26 SHIM_ALWAYS_EXPORT void operator delete[](void* p) __THROW 30 SHIM_ALWAYS_EXPORT void operator delete[](void* p) __THROW {
27 SHIM_ALIAS_SYMBOL(ShimCppDelete); 31 ShimCppDelete(p);
32 }
28 33
29 SHIM_ALWAYS_EXPORT void* operator new(size_t size, 34 SHIM_ALWAYS_EXPORT void* operator new(size_t size,
30 const std::nothrow_t&) __THROW 35 const std::nothrow_t&) __THROW {
31 SHIM_ALIAS_SYMBOL(ShimCppNew); 36 return ShimCppNew(size);
37 }
32 38
33 SHIM_ALWAYS_EXPORT void* operator new[](size_t size, 39 SHIM_ALWAYS_EXPORT void* operator new[](size_t size,
34 const std::nothrow_t&) __THROW 40 const std::nothrow_t&) __THROW {
35 SHIM_ALIAS_SYMBOL(ShimCppNew); 41 return ShimCppNew(size);
42 }
36 43
37 SHIM_ALWAYS_EXPORT void operator delete(void* p, const std::nothrow_t&) __THROW 44 SHIM_ALWAYS_EXPORT void operator delete(void* p, const std::nothrow_t&) __THROW {
38 SHIM_ALIAS_SYMBOL(ShimCppDelete); 45 ShimCppDelete(p);
46 }
39 47
40 SHIM_ALWAYS_EXPORT void operator delete[](void* p, 48 SHIM_ALWAYS_EXPORT void operator delete[](void* p,
41 const std::nothrow_t&) __THROW 49 const std::nothrow_t&) __THROW {
42 SHIM_ALIAS_SYMBOL(ShimCppDelete); 50 ShimCppDelete(p);
51 }
OLDNEW
« no previous file with comments | « base/allocator/allocator_shim_internals.h ('k') | base/allocator/allocator_shim_override_glibc_weak_symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698