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

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

Issue 1678893002: allocator: add use_experimental_allocator_shim build flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « third_party/tcmalloc/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #define TCMALLOC_LIBC_OVERRIDE_INL_H_ 52 #define TCMALLOC_LIBC_OVERRIDE_INL_H_
53 53
54 #include <config.h> 54 #include <config.h>
55 #ifdef HAVE_FEATURES_H 55 #ifdef HAVE_FEATURES_H
56 #include <features.h> // for __GLIBC__ 56 #include <features.h> // for __GLIBC__
57 #endif 57 #endif
58 #include <gperftools/tcmalloc.h> 58 #include <gperftools/tcmalloc.h>
59 59
60 static void ReplaceSystemAlloc(); // defined in the .h files below 60 static void ReplaceSystemAlloc(); // defined in the .h files below
61 61
62 #if defined(TCMALLOC_DONT_REPLACE_SYSTEM_ALLOC)
63
64 static void ReplaceSystemAlloc() {}
Will Harris 2016/02/08 19:23:55 add some comment here. it's a bit subtle what this
Primiano Tucci (use gerrit) 2016/02/09 11:38:53 Done.
65
62 // For windows, there are two ways to get tcmalloc. If we're 66 // For windows, there are two ways to get tcmalloc. If we're
63 // patching, then src/windows/patch_function.cc will do the necessary 67 // patching, then src/windows/patch_function.cc will do the necessary
64 // overriding here. Otherwise, we doing the 'redefine' trick, where 68 // overriding here. Otherwise, we doing the 'redefine' trick, where
65 // we remove malloc/new/etc from mscvcrt.dll, and just need to define 69 // we remove malloc/new/etc from mscvcrt.dll, and just need to define
66 // them now. 70 // them now.
67 #if defined(_WIN32) && defined(WIN32_DO_PATCHING) 71 #elif defined(_WIN32) && defined(WIN32_DO_PATCHING)
68 void PatchWindowsFunctions(); // in src/windows/patch_function.cc 72 void PatchWindowsFunctions(); // in src/windows/patch_function.cc
69 static void ReplaceSystemAlloc() { PatchWindowsFunctions(); } 73 static void ReplaceSystemAlloc() { PatchWindowsFunctions(); }
70 74
71 #elif defined(_WIN32) && !defined(WIN32_DO_PATCHING) 75 #elif defined(_WIN32) && !defined(WIN32_DO_PATCHING)
72 // "libc_override_redefine.h" is included in the original gperftools. But, 76 // "libc_override_redefine.h" is included in the original gperftools. But,
73 // we define allocator functions in Chromium's base/allocator/allocator_shim.cc 77 // we define allocator functions in Chromium's base/allocator/allocator_shim.cc
74 // on Windows. We don't include libc_override_redefine.h here. 78 // on Windows. We don't include libc_override_redefine.h here.
75 // ReplaceSystemAlloc() is defined here instead. 79 // ReplaceSystemAlloc() is defined here instead.
76 static void ReplaceSystemAlloc() { } 80 static void ReplaceSystemAlloc() { }
77 81
78 #elif defined(__APPLE__) 82 #elif defined(__APPLE__)
79 #include "libc_override_osx.h" 83 #include "libc_override_osx.h"
80 84
81 #elif defined(__GLIBC__) 85 #elif defined(__GLIBC__)
82 #include "libc_override_glibc.h" 86 #include "libc_override_glibc.h"
83 87
84 // Not all gcc systems necessarily support weak symbols, but all the 88 // Not all gcc systems necessarily support weak symbols, but all the
85 // ones I know of do, so for now just assume they all do. 89 // ones I know of do, so for now just assume they all do.
86 #elif defined(__GNUC__) 90 #elif defined(__GNUC__)
87 #include "libc_override_gcc_and_weak.h" 91 #include "libc_override_gcc_and_weak.h"
88 92
89 #else 93 #else
90 #error Need to add support for your libc/OS here 94 #error Need to add support for your libc/OS here
91 95
92 #endif 96 #endif
93 97
94 #endif // TCMALLOC_LIBC_OVERRIDE_INL_H_ 98 #endif // TCMALLOC_LIBC_OVERRIDE_INL_H_
OLDNEW
« no previous file with comments | « third_party/tcmalloc/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698