libchrome: revert r1090883 which introduced use of process_vm_readv
By using StackTrace in ObserverList with the flag DCHECK_IS_ON()
(instead of the previous EXPENSIVE_DCHECKS_ARE_ON, which is false on
CrOS libchrome).
BUG=b:266589848, b:267260507
TEST=build trogdor with new libchrome; run hwsec.*
TEST=build corsola with new libchrome; run arc.DataCollector.*
Change-Id: Icaa3bf6ae52d07ab7b930eb5188abc1192e68bb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/libchrome/+/4206848
Commit-Queue: Zubin Mithra <zsm@chromium.org>
Tested-by: Grace Cham <hscham@chromium.org>
Auto-Submit: Grace Cham <hscham@chromium.org>
Reviewed-by: Qijiang Yūki Ishii <fqj@google.com>
(cherry picked from commit c52c74a58e6b98b83eaba285fa067ad50dc1ed12)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/libchrome/+/4220920
Commit-Queue: Qijiang Yūki Ishii <fqj@google.com>
diff --git a/libchrome_tools/patches/backward-compatibility-0600-Revert-Capture-ObserverList-stacks.patch b/libchrome_tools/patches/backward-compatibility-0600-Revert-Capture-ObserverList-stacks.patch
new file mode 100644
index 0000000..0fe030f
--- /dev/null
+++ b/libchrome_tools/patches/backward-compatibility-0600-Revert-Capture-ObserverList-stacks.patch
@@ -0,0 +1,90 @@
+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
+