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

Side by Side Diff: base/security_unittest.cc

Issue 177353002: Add use_allocator instead of linux_use_tcmalloc to switch the allocator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 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 | Annotate | Revision Log
« no previous file with comments | « base/base.gyp ('k') | build/common.gypi » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include <fcntl.h> 5 #include <fcntl.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 24 matching lines...) Expand all
35 template <typename Type> 35 template <typename Type>
36 Type HideValueFromCompiler(volatile Type value) { 36 Type HideValueFromCompiler(volatile Type value) {
37 #if defined(__GNUC__) 37 #if defined(__GNUC__)
38 // In a GCC compatible compiler (GCC or Clang), make this compiler barrier 38 // In a GCC compatible compiler (GCC or Clang), make this compiler barrier
39 // more robust than merely using "volatile". 39 // more robust than merely using "volatile".
40 __asm__ volatile ("" : "+r" (value)); 40 __asm__ volatile ("" : "+r" (value));
41 #endif // __GNUC__ 41 #endif // __GNUC__
42 return value; 42 return value;
43 } 43 }
44 44
45 // - NO_TCMALLOC (should be defined if we compile with linux_use_tcmalloc=0) 45 // - NO_TCMALLOC (should be defined if compiled with use_allocator!="tcmalloc")
46 // - ADDRESS_SANITIZER because it has its own memory allocator 46 // - ADDRESS_SANITIZER because it has its own memory allocator
47 // - IOS does not use tcmalloc 47 // - IOS does not use tcmalloc
48 // - OS_MACOSX does not use tcmalloc 48 // - OS_MACOSX does not use tcmalloc
49 #if !defined(NO_TCMALLOC) && !defined(ADDRESS_SANITIZER) && \ 49 #if !defined(NO_TCMALLOC) && !defined(ADDRESS_SANITIZER) && \
50 !defined(OS_IOS) && !defined(OS_MACOSX) 50 !defined(OS_IOS) && !defined(OS_MACOSX)
51 #define TCMALLOC_TEST(function) function 51 #define TCMALLOC_TEST(function) function
52 #else 52 #else
53 #define TCMALLOC_TEST(function) DISABLED_##function 53 #define TCMALLOC_TEST(function) DISABLED_##function
54 #endif 54 #endif
55 55
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // kRandomMask, so we use it as an additional detection mechanism. 282 // kRandomMask, so we use it as an additional detection mechanism.
283 const uintptr_t kRandomMask = 0x3fffffffffffULL; 283 const uintptr_t kRandomMask = 0x3fffffffffffULL;
284 bool impossible_random_address = 284 bool impossible_random_address =
285 reinterpret_cast<uintptr_t>(ptr.get()) & ~kRandomMask; 285 reinterpret_cast<uintptr_t>(ptr.get()) & ~kRandomMask;
286 EXPECT_FALSE(impossible_random_address); 286 EXPECT_FALSE(impossible_random_address);
287 } 287 }
288 288
289 #endif // (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(__x86_64__) 289 #endif // (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(__x86_64__)
290 290
291 } // namespace 291 } // namespace
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698