[Code Health] Add deprecation comment for base::SupportsWeakPtr.

This class is deprecated, per the Code Health bug, and multiple
reviewers have requested a comment to help avoid its use in new
code.

In addition, the constructor of this class is now private and the
remaining uses are allowed via friend declarations. These will be
cleaned up as the remaining uses are fixed.

Bug: 40485134
Change-Id: I48812866b4137b7336241fb5c905306a046c99a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5526324
Reviewed-by: Wez <[email protected]>
Commit-Queue: David Bertoni <[email protected]>
Auto-Submit: David Bertoni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1326242}
diff --git a/base/memory/weak_ptr_unittest.cc b/base/memory/weak_ptr_unittest.cc
index 02a4477..bd5d7c4 100644
--- a/base/memory/weak_ptr_unittest.cc
+++ b/base/memory/weak_ptr_unittest.cc
@@ -64,9 +64,20 @@
 struct Derived : public Base {};
 
 struct TargetBase {};
+
+}  // namespace
+
+// TODO(crbug.com/40485134): Target needs to be visible to declare
+// it as a friend of SupportsWeakPtr.
+namespace weak_ptr_unittest {
 struct Target : public TargetBase, public SupportsWeakPtr<Target> {
   virtual ~Target() = default;
 };
+}  // namespace weak_ptr_unittest
+
+namespace {
+
+using weak_ptr_unittest::Target;
 
 struct DerivedTarget : public Target {};