OLD | NEW |
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 import("//build/config/allocator.gni") | 5 import("//build/config/allocator.gni") |
6 | 6 |
| 7 declare_args() { |
| 8 # Provide a way to force disable debugallocation in Debug builds, |
| 9 # e.g. for profiling (it's more rare to profile Debug builds, |
| 10 # but people sometimes need to do that). |
| 11 enable_debugallocation = is_debug |
| 12 } |
| 13 |
7 # Only executables and not libraries should depend on the allocator target; | 14 # Only executables and not libraries should depend on the allocator target; |
8 # only the application (the final executable) knows what allocator makes sense. | 15 # only the application (the final executable) knows what allocator makes sense. |
9 # This "allocator" meta-target will forward to the default allocator according | 16 # This "allocator" meta-target will forward to the default allocator according |
10 # to the build settings. | 17 # to the build settings. |
11 group("allocator") { | 18 group("allocator") { |
12 public_deps = [] | 19 public_deps = [] |
13 if (use_allocator == "tcmalloc") { | 20 if (use_allocator == "tcmalloc") { |
14 public_deps += [ ":tcmalloc" ] | 21 public_deps += [ ":tcmalloc" ] |
15 } | 22 } |
16 | 23 |
17 # This condition expresses the win_use_allocator_shim in the GYP build. | 24 # This condition expresses the win_use_allocator_shim in the GYP build. |
18 if (is_win && !is_component_build) { | 25 if (is_win && !is_component_build) { |
19 public_deps += [ ":allocator_shim" ] | 26 public_deps += [ ":allocator_shim" ] |
20 } | 27 } |
21 } | 28 } |
22 | 29 |
23 # This config defines ALLOCATOR_SHIM in the same conditions that the allocator | 30 # This config defines ALLOCATOR_SHIM in the same conditions that the allocator |
24 # shim will be used by the allocator target. | 31 # shim will be used by the allocator target. |
25 # | 32 # |
26 # TODO(brettw) this is only used in one place and is kind of mess, because it | 33 # TODO(brettw) this is only used in one place and is kind of mess, because it |
27 # assumes that the library using it will eventually be linked with | 34 # assumes that the library using it will eventually be linked with |
28 # //base/allocator in the default way. Clean this up and delete this. | 35 # //base/allocator in the default way. Clean this up and delete this. |
29 config("allocator_shim_define") { | 36 config("allocator_shim_define") { |
30 if (is_win && !is_component_build) { | 37 if (is_win && !is_component_build) { |
31 defines = [ "ALLOCATOR_SHIM" ] | 38 defines = [ "ALLOCATOR_SHIM" ] |
32 } | 39 } |
33 } | 40 } |
34 | 41 |
| 42 config("tcmalloc_flags") { |
| 43 if (enable_debugallocation) { |
| 44 defines = [ |
| 45 # Use debugallocation for Debug builds to catch problems early |
| 46 # and cleanly, http://crbug.com/30715 . |
| 47 "TCMALLOC_FOR_DEBUGALLOCATION", |
| 48 ] |
| 49 } |
| 50 } |
| 51 |
35 # This config and libc modification are only used on Windows. | 52 # This config and libc modification are only used on Windows. |
36 if (is_win) { | 53 if (is_win) { |
37 import("//build/config/win/visual_studio_version.gni") | 54 import("//build/config/win/visual_studio_version.gni") |
38 | 55 |
39 config("nocmt") { | 56 config("nocmt") { |
40 ldflags = [ | 57 ldflags = [ |
41 "/NODEFAULTLIB:libcmt", | 58 "/NODEFAULTLIB:libcmt", |
42 "/NODEFAULTLIB:libcmtd", | 59 "/NODEFAULTLIB:libcmtd", |
43 ] | 60 ] |
44 libs = [ rebase_path("$target_gen_dir/allocator/libcmt.lib") ] | 61 libs = [ rebase_path("$target_gen_dir/allocator/libcmt.lib") ] |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 # Disable the heap checker in tcmalloc. | 205 # Disable the heap checker in tcmalloc. |
189 defines = [ "NO_HEAP_CHECK" ] | 206 defines = [ "NO_HEAP_CHECK" ] |
190 | 207 |
191 include_dirs = [ | 208 include_dirs = [ |
192 ".", | 209 ".", |
193 "$tcmalloc_dir/src/base", | 210 "$tcmalloc_dir/src/base", |
194 "$tcmalloc_dir/src", | 211 "$tcmalloc_dir/src", |
195 ] | 212 ] |
196 | 213 |
197 configs -= [ "//build/config/compiler:chromium_code" ] | 214 configs -= [ "//build/config/compiler:chromium_code" ] |
198 configs += [ "//build/config/compiler:no_chromium_code" ] | 215 configs += [ |
| 216 "//build/config/compiler:no_chromium_code", |
| 217 ":tcmalloc_flags", |
| 218 ] |
199 | 219 |
200 deps = [] | 220 deps = [] |
201 | 221 |
202 if (is_win) { | 222 if (is_win) { |
203 sources -= [ | 223 sources -= [ |
204 "$tcmalloc_dir/src/base/elf_mem_image.cc", | 224 "$tcmalloc_dir/src/base/elf_mem_image.cc", |
205 "$tcmalloc_dir/src/base/elf_mem_image.h", | 225 "$tcmalloc_dir/src/base/elf_mem_image.h", |
206 "$tcmalloc_dir/src/base/linuxthreads.cc", | 226 "$tcmalloc_dir/src/base/linuxthreads.cc", |
207 "$tcmalloc_dir/src/base/linuxthreads.h", | 227 "$tcmalloc_dir/src/base/linuxthreads.h", |
208 "$tcmalloc_dir/src/base/vdso_support.cc", | 228 "$tcmalloc_dir/src/base/vdso_support.cc", |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 visibility = [ "//base/*" ] | 303 visibility = [ "//base/*" ] |
284 sources = [ | 304 sources = [ |
285 "allocator_extension_thunks.cc", | 305 "allocator_extension_thunks.cc", |
286 "allocator_extension_thunks.h", | 306 "allocator_extension_thunks.h", |
287 ] | 307 ] |
288 if (is_android && !is_debug) { | 308 if (is_android && !is_debug) { |
289 configs -= [ "//build/config/compiler:optimize" ] | 309 configs -= [ "//build/config/compiler:optimize" ] |
290 configs += [ "//build/config/compiler:optimize_max" ] | 310 configs += [ "//build/config/compiler:optimize_max" ] |
291 } | 311 } |
292 } | 312 } |
OLD | NEW |