Replace DISALLOW_COPY_AND_ASSIGN in third_party/

This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).

This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: I1daa712b586d5a73c90891e3f9c7bd8245e927a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3182423
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#924827}
NOKEYCHECK=True
GitOrigin-RevId: 80c123a1c777b6009baff72e0364bb6137b7caa4
diff --git a/src/base/low_level_alloc.cc b/src/base/low_level_alloc.cc
index 6a944b6..346a793 100644
--- a/src/base/low_level_alloc.cc
+++ b/src/base/low_level_alloc.cc
@@ -248,6 +248,10 @@
       }
       this->arena_->mu.Lock();
     }
+
+    ArenaLock(const ArenaLock&) = delete;
+    ArenaLock& operator=(const ArenaLock&) = delete;
+
     ~ArenaLock() { RAW_CHECK(this->left_, "haven't left Arena region"); }
     void Leave() UNLOCK_FUNCTION() {
       this->arena_->mu.Unlock();
@@ -265,7 +269,6 @@
     sigset_t mask_;   // old mask of blocked signals
 #endif
     LowLevelAlloc::Arena *arena_;
-    DISALLOW_COPY_AND_ASSIGN(ArenaLock);
   };
 } // anonymous namespace
 
diff --git a/src/heap-profile-table.h b/src/heap-profile-table.h
index 3c62847..0429ec4 100644
--- a/src/heap-profile-table.h
+++ b/src/heap-profile-table.h
@@ -86,6 +86,10 @@
   // interface ---------------------------
 
   HeapProfileTable(Allocator alloc, DeAllocator dealloc, bool profile_mmap);
+
+  HeapProfileTable(const HeapProfileTable&) = delete;
+  HeapProfileTable& operator=(const HeapProfileTable&) = delete;
+
   ~HeapProfileTable();
 
   // Collect the stack trace for the function that asked to do the
@@ -340,8 +344,6 @@
 
   // Map of all currently allocated objects and mapped regions we know about.
   AllocationMap* address_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(HeapProfileTable);
 };
 
 class HeapProfileTable::Snapshot {
diff --git a/src/memory_region_map.h b/src/memory_region_map.h
index f774994..2cb097f 100644
--- a/src/memory_region_map.h
+++ b/src/memory_region_map.h
@@ -126,9 +126,11 @@
   class LockHolder {
    public:
     LockHolder() { Lock(); }
+
+    LockHolder(const LockHolder&) = delete;
+    LockHolder& operator=(const LockHolder&) = delete;
+
     ~LockHolder() { Unlock(); }
-   private:
-    DISALLOW_COPY_AND_ASSIGN(LockHolder);
   };
 
   // A memory region that we know about through malloc_hook-s.