Debian Codegraph @

build_overrides/partition_alloc.gni

raw
1 # Copyright 2024 Google Inc.
2 #
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # PartitionAlloc is still depending on a couple of "common" `is_xxx` variables
7 # shared by Chromium / Dawn / Pdfium / etc... Only Skia is really independent.
8 #
9 # While waiting for partition_alloc to do the same, they need to be set:
10 is_asan = sanitize == "address"
11 is_cast_android = false
12 is_castos = false
13 is_cronet_build = false
14 is_nacl = false
15 is_posix = !is_win
16
17 # Skia standalone isn't built as part of chromium.
18 build_with_chromium = false
19
20 # Contrary to Skia, Chrome/PartitionAlloc do not enforce strict aliasing rules.
21 # Contrary to Clang, GCC is aggressively relying on the strict aliasing rule for
22 # optimization and this breaks PartitionAlloc.
23 # See https://crbug.com/379844655 for more details.
24 partition_alloc_remove_configs = [ "//gn/skia:strict_aliasing" ]
25 partition_alloc_add_configs = [ "//gn/skia:no_strict_aliasing" ]
26
27 # partition_alloc is performance critical and it should generally be optimized
28 # for speed, even in debug mode.
29 if (is_debug) {
30 partition_alloc_add_configs += [
31 "//gn/skia:optimize",
32 "//gn/skia:NDEBUG",
33 ]
34 }
35
36 # MSVC's cl.exe compiler is not supported.
37 _supported_compiler = is_clang || !is_win
38
39 # Windows: debug CRT is not yet compatible with the allocator shim.
40 # https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/free-dbg
41 _supported_build_type = !is_win || (!is_component_build && !is_debug)
42
43 # TODO(351867706): Resolve compile assertions issues on Mac, and add `is_mac`
44 # here.
45 _supported_platform = is_android || is_chromeos || is_linux || is_win
46
47 # Sanitizers replace the allocator, don't replace it ourselves with
48 # partition_alloc.
49 _is_using_sanitizers = sanitize != ""
50
51 _supported = _supported_compiler && _supported_build_type &&
52 _supported_platform && !_is_using_sanitizers
53
54 use_partition_alloc_as_malloc_default = _supported
55 use_allocator_shim_default = _supported
56 enable_backup_ref_ptr_support_default = _supported
57 put_ref_count_in_previous_slot_default = true
58 enable_backup_ref_ptr_slow_checks_default = false
59 enable_dangling_raw_ptr_checks_default = _supported
60
61 # This is the default build configuration for pointers/raw_ptr*.
62 raw_ptr_zero_on_construct_default = true
63 raw_ptr_zero_on_move_default = true
64 raw_ptr_zero_on_destruct_default = false
65
66 # For now, don't check for additional costly memory safety errors in Skia.
67 # Some will be enforced in the future.
68 can_unwind_with_frame_pointers = false
69 dcheck_always_on = false
70 dcheck_is_configurable = false
71 enable_expensive_dchecks = false