1*c8dee2aaSAndroid Build Coastguard Worker# Copyright 2024 Google Inc. 2*c8dee2aaSAndroid Build Coastguard Worker# 3*c8dee2aaSAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be 4*c8dee2aaSAndroid Build Coastguard Worker# found in the LICENSE file. 5*c8dee2aaSAndroid Build Coastguard Worker 6*c8dee2aaSAndroid Build Coastguard Worker# PartitionAlloc is still depending on a couple of "common" `is_xxx` variables 7*c8dee2aaSAndroid Build Coastguard Worker# shared by Chromium / Dawn / Pdfium / etc... Only Skia is really independent. 8*c8dee2aaSAndroid Build Coastguard Worker# 9*c8dee2aaSAndroid Build Coastguard Worker# While waiting for partition_alloc to do the same, they need to be set: 10*c8dee2aaSAndroid Build Coastguard Workeris_asan = sanitize == "address" 11*c8dee2aaSAndroid Build Coastguard Workeris_cast_android = false 12*c8dee2aaSAndroid Build Coastguard Workeris_castos = false 13*c8dee2aaSAndroid Build Coastguard Workeris_cronet_build = false 14*c8dee2aaSAndroid Build Coastguard Workeris_nacl = false 15*c8dee2aaSAndroid Build Coastguard Workeris_posix = !is_win && !is_fuchsia 16*c8dee2aaSAndroid Build Coastguard Worker 17*c8dee2aaSAndroid Build Coastguard Worker# Skia standalone isn't built as part of chromium. 18*c8dee2aaSAndroid Build Coastguard Workerbuild_with_chromium = false 19*c8dee2aaSAndroid Build Coastguard Worker 20*c8dee2aaSAndroid Build Coastguard Worker# Skia still need to supports C++17 for quite some time. 21*c8dee2aaSAndroid Build Coastguard Workerassert_cpp20_default = false 22*c8dee2aaSAndroid Build Coastguard Worker 23*c8dee2aaSAndroid Build Coastguard Worker# Contrary to Skia, Chrome/PartitionAlloc do not enforce strict aliasing rules. 24*c8dee2aaSAndroid Build Coastguard Worker# Contrary to Clang, GCC is aggressively relying on the strict aliasing rule for 25*c8dee2aaSAndroid Build Coastguard Worker# optimization and this breaks PartitionAlloc. 26*c8dee2aaSAndroid Build Coastguard Worker# See https://crbug.com/379844655 for more details. 27*c8dee2aaSAndroid Build Coastguard Workerpartition_alloc_remove_configs = [ "//gn/skia:strict_aliasing" ] 28*c8dee2aaSAndroid Build Coastguard Workerpartition_alloc_add_configs = [ "//gn/skia:no_strict_aliasing" ] 29*c8dee2aaSAndroid Build Coastguard Worker 30*c8dee2aaSAndroid Build Coastguard Worker# partition_alloc is performance critical and it should generally be optimized 31*c8dee2aaSAndroid Build Coastguard Worker# for speed, even in debug mode. 32*c8dee2aaSAndroid Build Coastguard Workerif (is_debug) { 33*c8dee2aaSAndroid Build Coastguard Worker partition_alloc_add_configs += [ 34*c8dee2aaSAndroid Build Coastguard Worker "//gn/skia:optimize", 35*c8dee2aaSAndroid Build Coastguard Worker "//gn/skia:NDEBUG", 36*c8dee2aaSAndroid Build Coastguard Worker ] 37*c8dee2aaSAndroid Build Coastguard Worker} 38*c8dee2aaSAndroid Build Coastguard Worker 39*c8dee2aaSAndroid Build Coastguard Worker# MSVC's cl.exe compiler is not supported. 40*c8dee2aaSAndroid Build Coastguard Worker_supported_compiler = is_clang || !is_win 41*c8dee2aaSAndroid Build Coastguard Worker 42*c8dee2aaSAndroid Build Coastguard Worker# Windows: debug CRT is not yet compatible with the allocator shim. 43*c8dee2aaSAndroid Build Coastguard Worker# https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/free-dbg 44*c8dee2aaSAndroid Build Coastguard Worker_supported_build_type = !is_win || (!is_component_build && !is_debug) 45*c8dee2aaSAndroid Build Coastguard Worker 46*c8dee2aaSAndroid Build Coastguard Worker# TODO(351867706): Resolve compile assertions issues on Mac, and add `is_mac` 47*c8dee2aaSAndroid Build Coastguard Worker# here. 48*c8dee2aaSAndroid Build Coastguard Worker_supported_platform = 49*c8dee2aaSAndroid Build Coastguard Worker is_android || is_chromeos || is_fuchsia || is_linux || is_win 50*c8dee2aaSAndroid Build Coastguard Worker 51*c8dee2aaSAndroid Build Coastguard Worker# Sanitizers replace the allocator, don't replace it ourselves with 52*c8dee2aaSAndroid Build Coastguard Worker# partition_alloc. 53*c8dee2aaSAndroid Build Coastguard Worker_is_using_sanitizers = sanitize != "" 54*c8dee2aaSAndroid Build Coastguard Worker 55*c8dee2aaSAndroid Build Coastguard Worker_supported = _supported_compiler && _supported_build_type && 56*c8dee2aaSAndroid Build Coastguard Worker _supported_platform && !_is_using_sanitizers 57*c8dee2aaSAndroid Build Coastguard Worker 58*c8dee2aaSAndroid Build Coastguard Workeruse_partition_alloc_as_malloc_default = _supported 59*c8dee2aaSAndroid Build Coastguard Workeruse_allocator_shim_default = _supported 60*c8dee2aaSAndroid Build Coastguard Workerenable_backup_ref_ptr_support_default = _supported 61*c8dee2aaSAndroid Build Coastguard Workerput_ref_count_in_previous_slot_default = true 62*c8dee2aaSAndroid Build Coastguard Workerenable_backup_ref_ptr_slow_checks_default = false 63*c8dee2aaSAndroid Build Coastguard Workerenable_dangling_raw_ptr_checks_default = _supported 64*c8dee2aaSAndroid Build Coastguard Worker 65*c8dee2aaSAndroid Build Coastguard Worker# This is the default build configuration for pointers/raw_ptr*. 66*c8dee2aaSAndroid Build Coastguard Workerraw_ptr_zero_on_construct_default = true 67*c8dee2aaSAndroid Build Coastguard Workerraw_ptr_zero_on_move_default = true 68*c8dee2aaSAndroid Build Coastguard Workerraw_ptr_zero_on_destruct_default = false 69*c8dee2aaSAndroid Build Coastguard Worker 70*c8dee2aaSAndroid Build Coastguard Worker# For now, don't check for additional costly memory safety errors in Skia. 71*c8dee2aaSAndroid Build Coastguard Worker# Some will be enforced in the future. 72*c8dee2aaSAndroid Build Coastguard Workercan_unwind_with_frame_pointers = false 73*c8dee2aaSAndroid Build Coastguard Workerdcheck_always_on = false 74*c8dee2aaSAndroid Build Coastguard Workerdcheck_is_configurable = false 75*c8dee2aaSAndroid Build Coastguard Workerenable_expensive_dchecks = false 76