• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
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
7 #endif
8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_CPP_SYMBOLS_H_
9 
10 // Alias the default new/delete C++ symbols to the shim entry points.
11 // This file is strongly inspired by tcmalloc's libc_override_redefine.h.
12 
13 #include <new>
14 
15 #include "base/allocator/allocator_shim_internals.h"
16 
17 SHIM_ALWAYS_EXPORT void* operator new(size_t size)
18     SHIM_ALIAS_SYMBOL(ShimCppNew);
19 
20 SHIM_ALWAYS_EXPORT void operator delete(void* p) __THROW
21     SHIM_ALIAS_SYMBOL(ShimCppDelete);
22 
23 SHIM_ALWAYS_EXPORT void* operator new[](size_t size)
24     SHIM_ALIAS_SYMBOL(ShimCppNew);
25 
26 SHIM_ALWAYS_EXPORT void operator delete[](void* p) __THROW
27     SHIM_ALIAS_SYMBOL(ShimCppDelete);
28 
29 SHIM_ALWAYS_EXPORT void* operator new(size_t size,
30                                       const std::nothrow_t&) __THROW
31     SHIM_ALIAS_SYMBOL(ShimCppNew);
32 
33 SHIM_ALWAYS_EXPORT void* operator new[](size_t size,
34                                         const std::nothrow_t&) __THROW
35     SHIM_ALIAS_SYMBOL(ShimCppNew);
36 
37 SHIM_ALWAYS_EXPORT void operator delete(void* p, const std::nothrow_t&) __THROW
38     SHIM_ALIAS_SYMBOL(ShimCppDelete);
39 
40 SHIM_ALWAYS_EXPORT void operator delete[](void* p,
41                                           const std::nothrow_t&) __THROW
42     SHIM_ALIAS_SYMBOL(ShimCppDelete);
43