| From 55c8e06c6d8a48e80866e2372965e00c8b0e8d23 Mon Sep 17 00:00:00 2001 |
| From: Grace Cham <hscham@chromium.org> |
| Date: Thu, 26 Jan 2023 16:59:59 +0900 |
| Subject: [PATCH] Revert "Capture ObserverList stacks for all DCHECK builds" |
| |
| This reverts commit 698997ff6bbf258b34e66dbe447622233c321732. |
| |
| Change-Id: I476dfaa0aa5f658b505cbef38bd00b8bc7fa4279 |
| --- |
| base/observer_list.h | 7 ++++--- |
| base/observer_list_internal.h | 14 +++++++------- |
| 2 files changed, 11 insertions(+), 10 deletions(-) |
| |
| diff --git a/base/observer_list.h b/base/observer_list.h |
| index ae1acac007..c445f3a1b1 100644 |
| --- a/base/observer_list.h |
| +++ b/base/observer_list.h |
| @@ -340,7 +340,7 @@ class ObserverList { |
| } |
| |
| std::string GetObserversCreationStackString() const { |
| -#if DCHECK_IS_ON() |
| +#if EXPENSIVE_DCHECKS_ARE_ON() |
| std::string result; |
| #if BUILDFLAG(IS_IOS) |
| result += "Use go/observer-list-empty to interpret.\n"; |
| @@ -351,8 +351,9 @@ class ObserverList { |
| } |
| return result; |
| #else |
| - return "For observer stack traces, build with `dcheck_always_on=true`."; |
| -#endif // DCHECK_IS_ON() |
| + return "For observer stack traces, build with " |
| + "`enable_expensive_dchecks=true`."; |
| +#endif // EXPENSIVE_DCHECKS_ARE_ON() |
| } |
| |
| std::vector<ObserverStorageType> observers_; |
| diff --git a/base/observer_list_internal.h b/base/observer_list_internal.h |
| index 5909cb1c18..0e7ed221cb 100644 |
| --- a/base/observer_list_internal.h |
| +++ b/base/observer_list_internal.h |
| @@ -16,7 +16,7 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list_types.h" |
| |
| -#if DCHECK_IS_ON() |
| +#if EXPENSIVE_DCHECKS_ARE_ON() |
| #include "base/debug/stack_trace.h" |
| #endif |
| |
| @@ -47,15 +47,15 @@ class BASE_EXPORT UncheckedObserverAdapter { |
| return static_cast<ObserverType*>(adapter.ptr_); |
| } |
| |
| -#if DCHECK_IS_ON() |
| +#if EXPENSIVE_DCHECKS_ARE_ON() |
| std::string GetCreationStackString() const { return stack_.ToString(); } |
| -#endif // DCHECK_IS_ON() |
| +#endif // EXPENSIVE_DCHECKS_ARE_ON() |
| |
| private: |
| raw_ptr<void, DanglingUntriaged> ptr_; |
| -#if DCHECK_IS_ON() |
| +#if EXPENSIVE_DCHECKS_ARE_ON() |
| base::debug::StackTrace stack_; |
| -#endif // DCHECK_IS_ON() |
| +#endif // EXPENSIVE_DCHECKS_ARE_ON() |
| }; |
| |
| // Adapter for CheckedObserver types so that they can use the same syntax as a |
| @@ -107,13 +107,13 @@ class BASE_EXPORT CheckedObserverAdapter { |
| return static_cast<ObserverType*>(adapter.weak_ptr_.get()); |
| } |
| |
| -#if DCHECK_IS_ON() |
| +#if EXPENSIVE_DCHECKS_ARE_ON() |
| std::string GetCreationStackString() const { return stack_.ToString(); } |
| #endif |
| |
| private: |
| WeakPtr<CheckedObserver> weak_ptr_; |
| -#if DCHECK_IS_ON() |
| +#if EXPENSIVE_DCHECKS_ARE_ON() |
| base::debug::StackTrace stack_; |
| #endif |
| }; |
| -- |
| 2.39.1.456.gfc5497dd1b-goog |
| |