Enable AsanRawPtrServiceV2 for LibFuzzer by decoupling build configs

This CL restructures the AsanRawPtrService integration to fix build
dependency issues and resolve sanitizer false positives.

Key changes:

- Decouple from `//build`: Moves the `-fsanitize-recover=address`
  configuration to `//base` using `all_dependent_configs`. This
  ensures the flag is only active when
  `use_asan_backup_ref_ptr_v2=true`, preventing PartitionAlloc GN
  variables from polluting the global `//build` directory and
  breaking standalone projects like V8.

- Isolate as a `source_set`: Extracts `asan_raw_ptr_service` into
  a dedicated `source_set`. This cleanly scopes the new compiler
  flags and guarantees that inlined functions (from libc++ or
  PartitionAlloc) aren't accidentally instrumented by ASan,
  preventing performance regressions.

Bug: 447520906
Change-Id: I8de5d5f21965ed748a423b8bf4c9201c201a9c66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7741881
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1619382}
NOKEYCHECK=True
GitOrigin-RevId: 5cadc03d73d8630975295207c93b523d1bac039b
diff --git a/src/partition_alloc/pointers/raw_ref_unittest.cc b/src/partition_alloc/pointers/raw_ref_unittest.cc
index 8374869..4e5b774 100644
--- a/src/partition_alloc/pointers/raw_ref_unittest.cc
+++ b/src/partition_alloc/pointers/raw_ref_unittest.cc
@@ -13,10 +13,6 @@
 #include "partition_alloc/pointers/raw_ptr_counting_impl_for_test.h"
 #include "partition_alloc/pointers/raw_ptr_test_support.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#if PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR)
-#include "base/debug/asan_service.h"
-#include "base/memory/raw_ptr_asan_service.h"
-#endif  // PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR)
 
 namespace {
 
@@ -1018,74 +1014,4 @@
               CountersMatch());
 }
 
-#if PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR)
-
-TEST(AsanBackupRefPtrImpl, RawRefGet) {
-  base::debug::AsanService::GetInstance()->Initialize();
-
-#if PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR_V2)
-  base::RawPtrAsanService::GetInstance().Configure(
-      true, {.enable_data_race_check = base::RawPtrAsanServiceOptions::kEnabled,
-             .enable_free_after_quarantined_check =
-                 base::RawPtrAsanServiceOptions::kEnabled});
-#else
-  if (!base::RawPtrAsanService::GetInstance().IsEnabled()) {
-    base::RawPtrAsanService::GetInstance().Configure(
-        base::EnableDereferenceCheck(true), base::EnableExtractionCheck(true),
-        base::EnableInstantiationCheck(true));
-  } else {
-    ASSERT_TRUE(
-        base::RawPtrAsanService::GetInstance().is_dereference_check_enabled());
-    ASSERT_TRUE(
-        base::RawPtrAsanService::GetInstance().is_extraction_check_enabled());
-    ASSERT_TRUE(base::RawPtrAsanService::GetInstance()
-                    .is_instantiation_check_enabled());
-  }
-#endif  // PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR_V2)
-
-  auto ptr = ::std::make_unique<int>();
-  raw_ref<int> safe_ref(*ptr);
-  ptr.reset();
-
-  // This test is specifically to ensure that raw_ref.get() does not cause a
-  // dereference of the memory referred to by the reference. If there is a
-  // dereference, then this test will crash.
-  [[maybe_unused]] volatile int& ref = safe_ref.get();
-}
-
-TEST(AsanBackupRefPtrImpl, RawRefOperatorStar) {
-  base::debug::AsanService::GetInstance()->Initialize();
-
-#if PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR_V2)
-  base::RawPtrAsanService::GetInstance().Configure(
-      true, {.enable_data_race_check = base::RawPtrAsanServiceOptions::kEnabled,
-             .enable_free_after_quarantined_check =
-                 base::RawPtrAsanServiceOptions::kEnabled});
-#else
-  if (!base::RawPtrAsanService::GetInstance().IsEnabled()) {
-    base::RawPtrAsanService::GetInstance().Configure(
-        base::EnableDereferenceCheck(true), base::EnableExtractionCheck(true),
-        base::EnableInstantiationCheck(true));
-  } else {
-    ASSERT_TRUE(
-        base::RawPtrAsanService::GetInstance().is_dereference_check_enabled());
-    ASSERT_TRUE(
-        base::RawPtrAsanService::GetInstance().is_extraction_check_enabled());
-    ASSERT_TRUE(base::RawPtrAsanService::GetInstance()
-                    .is_instantiation_check_enabled());
-  }
-#endif  // PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR_V2)
-
-  auto ptr = ::std::make_unique<int>();
-  raw_ref<int> safe_ref(*ptr);
-  ptr.reset();
-
-  // This test is specifically to ensure that &*raw_ref does not cause a
-  // dereference of the memory referred to by the reference. If there is a
-  // dereference, then this test will crash.
-  [[maybe_unused]] volatile int& ref = *safe_ref;
-}
-
-#endif  // PA_BUILDFLAG(USE_ASAN_BACKUP_REF_PTR)
-
 }  // namespace