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/buildflag_header.gni") | 5 import("//build/buildflag_header.gni") |
6 import("//build/config/allocator.gni") | 6 import("//build/config/allocator.gni") |
7 import("//build/config/compiler/compiler.gni") | 7 import("//build/config/compiler/compiler.gni") |
8 | 8 |
9 declare_args() { | 9 declare_args() { |
10 # Provide a way to force disable debugallocation in Debug builds, | 10 # Provide a way to force disable debugallocation in Debug builds, |
11 # e.g. for profiling (it's more rare to profile Debug builds, | 11 # e.g. for profiling (it's more rare to profile Debug builds, |
12 # but people sometimes need to do that). | 12 # but people sometimes need to do that). |
13 enable_debugallocation = is_debug | 13 enable_debugallocation = is_debug |
14 } | 14 } |
15 | 15 |
16 # Allocator shim is only enabled for Release static builds. | 16 # The Windows-only allocator shim is only enabled for Release static builds, and |
17 win_use_allocator_shim = is_win && !is_component_build && !is_debug | 17 # is mutually exclusive with the generalized shim. |
18 win_use_allocator_shim = is_win && !is_component_build && !is_debug && | |
19 !use_experimental_allocator_shim | |
18 | 20 |
19 # This "allocator" meta-target will forward to the default allocator according | 21 # This "allocator" meta-target will forward to the default allocator according |
20 # to the build settings. | 22 # to the build settings. |
21 group("allocator") { | 23 group("allocator") { |
22 public_deps = [] | 24 public_deps = [] |
23 deps = [] | 25 deps = [] |
24 | 26 |
25 if (use_allocator == "tcmalloc") { | 27 if (use_allocator == "tcmalloc") { |
26 deps += [ ":tcmalloc" ] | 28 deps += [ ":tcmalloc" ] |
27 } | 29 } |
28 | 30 |
29 if (win_use_allocator_shim) { | 31 if (win_use_allocator_shim) { |
30 public_deps += [ ":allocator_shim" ] | 32 public_deps += [ ":allocator_shim" ] |
31 } | 33 } |
32 } | 34 } |
33 | 35 |
34 # This config defines ALLOCATOR_SHIM in the same conditions that the allocator | 36 # This config defines ALLOCATOR_SHIM in the same conditions that the allocator |
35 # shim will be used by the allocator target. | 37 # shim will be used by the allocator target. |
36 # | 38 # |
37 # TODO(brettw) this is only used in one place and is kind of mess, because it | 39 # TODO(brettw) this is only used in one place and is kind of mess, because it |
38 # assumes that the library using it will eventually be linked with | 40 # assumes that the library using it will eventually be linked with |
39 # //base/allocator in the default way. Clean this up and delete this. | 41 # //base/allocator in the default way. Clean this up and delete this. |
40 config("allocator_shim_define") { | 42 config("allocator_shim_define") { |
41 if (win_use_allocator_shim) { | 43 defines = [ "ALLOCATOR_SHIM" ] |
Primiano Tucci (use gerrit)
2016/07/12 14:51:04
If I am understanding this correctly you are dropp
Sigurður Ásgeirsson
2016/07/14 19:04:26
Done.
| |
42 defines = [ "ALLOCATOR_SHIM" ] | |
43 } | |
44 } | 44 } |
45 | 45 |
46 config("tcmalloc_flags") { | 46 config("tcmalloc_flags") { |
47 defines = [] | 47 defines = [] |
48 if (enable_debugallocation) { | 48 if (enable_debugallocation) { |
49 defines += [ | 49 defines += [ |
50 # Use debugallocation for Debug builds to catch problems early | 50 # Use debugallocation for Debug builds to catch problems early |
51 # and cleanly, http://crbug.com/30715 . | 51 # and cleanly, http://crbug.com/30715 . |
52 "TCMALLOC_FOR_DEBUGALLOCATION", | 52 "TCMALLOC_FOR_DEBUGALLOCATION", |
53 ] | 53 ] |
(...skipping 18 matching lines...) Expand all Loading... | |
72 "-Wno-unused-private-field", | 72 "-Wno-unused-private-field", |
73 ] | 73 ] |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 # This config is only used on Windows static release builds for the | 77 # This config is only used on Windows static release builds for the |
78 # allocator shim. | 78 # allocator shim. |
79 if (win_use_allocator_shim) { | 79 if (win_use_allocator_shim) { |
80 source_set("allocator_shim") { | 80 source_set("allocator_shim") { |
81 sources = [ | 81 sources = [ |
82 "allocator_impl_win.cc", | |
Primiano Tucci (use gerrit)
2016/07/12 14:51:04
I think just for the sake of making all these file
Sigurður Ásgeirsson
2016/07/14 19:04:26
Done.
| |
83 "allocator_impl_win.h", | |
82 "allocator_shim_win.cc", | 84 "allocator_shim_win.cc", |
83 "allocator_shim_win.h", | 85 "allocator_shim_win.h", |
84 ] | 86 ] |
85 configs += [ ":allocator_shim_define" ] | 87 configs += [ ":allocator_shim_define" ] |
86 } | 88 } |
87 } | 89 } |
88 | 90 |
89 if (use_allocator == "tcmalloc") { | 91 if (use_allocator == "tcmalloc") { |
90 # tcmalloc currently won't compile on Android. | 92 # tcmalloc currently won't compile on Android. |
91 source_set("tcmalloc") { | 93 source_set("tcmalloc") { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 # Linux/CrOS/Android. http://crbug.com/550886 . | 297 # Linux/CrOS/Android. http://crbug.com/550886 . |
296 configs += [ "//base:base_implementation" ] # for BASE_EXPORT | 298 configs += [ "//base:base_implementation" ] # for BASE_EXPORT |
297 visibility = [ "//base:base" ] | 299 visibility = [ "//base:base" ] |
298 sources = [ | 300 sources = [ |
299 "allocator_shim.cc", | 301 "allocator_shim.cc", |
300 "allocator_shim.h", | 302 "allocator_shim.h", |
301 "allocator_shim_internals.h", | 303 "allocator_shim_internals.h", |
302 "allocator_shim_override_cpp_symbols.h", | 304 "allocator_shim_override_cpp_symbols.h", |
303 "allocator_shim_override_libc_symbols.h", | 305 "allocator_shim_override_libc_symbols.h", |
304 ] | 306 ] |
305 if (is_linux && use_allocator == "tcmalloc") { | 307 if (is_win) { |
308 sources += [ | |
309 "allocator_impl_win.cc", | |
310 "allocator_impl_win.h", | |
311 ] | |
312 | |
313 # This gates tests that require the presence of the allocator shim. | |
314 configs += [ ":allocator_shim_define" ] | |
Primiano Tucci (use gerrit)
2016/07/12 14:51:04
if you follow my suggestion above about having the
Sigurður Ásgeirsson
2016/07/14 19:04:26
Done.
| |
315 } | |
316 if (is_win) { | |
317 sources += [ "allocator_shim_default_dispatch_to_winheap.cc" ] | |
318 } else if (is_linux && use_allocator == "tcmalloc") { | |
306 sources += [ | 319 sources += [ |
307 "allocator_shim_default_dispatch_to_tcmalloc.cc", | 320 "allocator_shim_default_dispatch_to_tcmalloc.cc", |
308 "allocator_shim_override_glibc_weak_symbols.h", | 321 "allocator_shim_override_glibc_weak_symbols.h", |
309 ] | 322 ] |
310 deps = [ | 323 deps = [ |
311 ":tcmalloc", | 324 ":tcmalloc", |
312 ] | 325 ] |
313 } else if (is_linux && use_allocator == "none") { | 326 } else if (is_linux && use_allocator == "none") { |
314 sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ] | 327 sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ] |
315 } else if (is_android && use_allocator == "none") { | 328 } else if (is_android && use_allocator == "none") { |
316 sources += [ | 329 sources += [ |
317 "allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc", | 330 "allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc", |
318 "allocator_shim_override_linker_wrapped_symbols.h", | 331 "allocator_shim_override_linker_wrapped_symbols.h", |
319 ] | 332 ] |
320 all_dependent_configs = [ ":wrap_malloc_symbols" ] | 333 all_dependent_configs = [ ":wrap_malloc_symbols" ] |
321 } | 334 } |
322 } | 335 } |
323 } | 336 } |
OLD | NEW |