Commit 9da2aae7 authored by Keishi Hattori's avatar Keishi Hattori Committed by Chromium LUCI CQ

Add use_backup_ref_ptr gn args flag

Add use_backup_ref_ptr gn args flag which enables the ref count in PA and switches the CheckedPtr implementation to BackupRefPtr.

Also turns off backup ref ptr support for NaCl as it is compiled as 32bit but address_pool_manager is not available, causing a link errors.
https://source.chromium.org/chromium/chromium/src/+/master:base/BUILD.gn;l=1772

Bug: 1073933
Change-Id: I1e0ea1b1181623fa5783d39c6d9a379c1df2daf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626681Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843988}
parent d492f65b
...@@ -70,6 +70,9 @@ declare_args() { ...@@ -70,6 +70,9 @@ declare_args() {
# TODO(https://crbug.com/1149922): Remove this. If you're setting this to # TODO(https://crbug.com/1149922): Remove this. If you're setting this to
# false on a bot, please leave a note on that bug. # false on a bot, please leave a note on that bug.
build_base_unittests = true build_base_unittests = true
# Set to true to use BackupRefPtr as the implementation of CheckedPtr.
use_backup_ref_ptr = false
} }
# Mutex priority inheritance is disabled by default due to security # Mutex priority inheritance is disabled by default due to security
...@@ -2336,7 +2339,10 @@ buildflag_header("partition_alloc_buildflags") { ...@@ -2336,7 +2339,10 @@ buildflag_header("partition_alloc_buildflags") {
header = "partition_alloc_buildflags.h" header = "partition_alloc_buildflags.h"
header_dir = "base" header_dir = "base"
flags = [ "USE_PARTITION_ALLOC=$use_partition_alloc" ] flags = [
"USE_PARTITION_ALLOC=$use_partition_alloc",
"USE_BACKUP_REF_PTR=$use_backup_ref_ptr",
]
} }
buildflag_header("clang_profiling_buildflags") { buildflag_header("clang_profiling_buildflags") {
......
...@@ -5,8 +5,17 @@ ...@@ -5,8 +5,17 @@
#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_CHECKED_PTR_SUPPORT_H_ #ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_CHECKED_PTR_SUPPORT_H_
#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_CHECKED_PTR_SUPPORT_H_ #define BASE_ALLOCATOR_PARTITION_ALLOCATOR_CHECKED_PTR_SUPPORT_H_
#include "base/partition_alloc_buildflags.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#if BUILDFLAG(USE_BACKUP_REF_PTR) && !defined(OS_NACL)
#define ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR 1
#define DISABLE_REF_COUNT_IN_RENDERER 1
#else
#define ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR 0 #define ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR 0
#define DISABLE_REF_COUNT_IN_RENDERER 0 #define DISABLE_REF_COUNT_IN_RENDERER 0
#endif
#if DISABLE_REF_COUNT_IN_RENDERER #if DISABLE_REF_COUNT_IN_RENDERER
static_assert(ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR, static_assert(ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR,
......
...@@ -20,7 +20,12 @@ ...@@ -20,7 +20,12 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "build/buildflag.h" #include "build/buildflag.h"
#if BUILDFLAG(USE_BACKUP_REF_PTR) && !defined(OS_NACL)
#define ENABLE_BACKUP_REF_PTR_IMPL 1
#else
#define ENABLE_BACKUP_REF_PTR_IMPL 0 #define ENABLE_BACKUP_REF_PTR_IMPL 0
#endif
#if ENABLE_BACKUP_REF_PTR_IMPL #if ENABLE_BACKUP_REF_PTR_IMPL
static_assert(ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR, static_assert(ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR,
"BackupRefPtrImpl can only by used if PartitionRefCount is " "BackupRefPtrImpl can only by used if PartitionRefCount is "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment