Remove RTC_DISALLOW_COPY_AND_ASSIGN from rtc_base/

Bug: webrtc:13555, webrtc:13082
Change-Id: I406b7f04497562866ea3329e97c5adc96e927b6f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245680
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: (Daniel.L) Byoungchan Lee <daniel.l@hpcnt.com>
Cr-Commit-Position: refs/heads/main@{#35691}
diff --git a/rtc_base/async_invoker.h b/rtc_base/async_invoker.h
index e5a3c15..c1f2060 100644
--- a/rtc_base/async_invoker.h
+++ b/rtc_base/async_invoker.h
@@ -18,7 +18,6 @@
 #include "absl/base/attributes.h"
 #include "api/scoped_refptr.h"
 #include "rtc_base/async_invoker_inl.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/event.h"
 #include "rtc_base/ref_counted_object.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
@@ -94,6 +93,9 @@
   DEPRECATED_AsyncInvoker();
   ~DEPRECATED_AsyncInvoker() override;
 
+  DEPRECATED_AsyncInvoker(const DEPRECATED_AsyncInvoker&) = delete;
+  DEPRECATED_AsyncInvoker& operator=(const DEPRECATED_AsyncInvoker&) = delete;
+
   // Call `functor` asynchronously on `thread`, with no callback upon
   // completion. Returns immediately.
   template <class ReturnT, class FunctorT>
@@ -159,8 +161,6 @@
   std::atomic<bool> destroying_;
 
   friend class AsyncClosure;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(DEPRECATED_AsyncInvoker);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/async_packet_socket.h b/rtc_base/async_packet_socket.h
index b5fcf8e..2e334ec 100644
--- a/rtc_base/async_packet_socket.h
+++ b/rtc_base/async_packet_socket.h
@@ -13,7 +13,6 @@
 
 #include <vector>
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/dscp.h"
 #include "rtc_base/network/sent_packet.h"
 #include "rtc_base/socket.h"
@@ -69,6 +68,9 @@
   AsyncPacketSocket();
   ~AsyncPacketSocket() override;
 
+  AsyncPacketSocket(const AsyncPacketSocket&) = delete;
+  AsyncPacketSocket& operator=(const AsyncPacketSocket&) = delete;
+
   // Returns current local address. Address may be set to null if the
   // socket is not bound yet (GetState() returns STATE_BINDING).
   virtual SocketAddress GetLocalAddress() const = 0;
@@ -127,9 +129,6 @@
   // Emitted for client TCP sockets when state is changed from
   // CONNECTED to CLOSED.
   sigslot::signal2<AsyncPacketSocket*, int> SignalClose;
-
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncPacketSocket);
 };
 
 // Listen socket, producing an AsyncPacketSocket when a peer connects.
diff --git a/rtc_base/async_tcp_socket.h b/rtc_base/async_tcp_socket.h
index ca61b54..541080f 100644
--- a/rtc_base/async_tcp_socket.h
+++ b/rtc_base/async_tcp_socket.h
@@ -17,7 +17,6 @@
 
 #include "rtc_base/async_packet_socket.h"
 #include "rtc_base/buffer.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/socket.h"
 #include "rtc_base/socket_address.h"
 
@@ -31,6 +30,9 @@
   AsyncTCPSocketBase(Socket* socket, size_t max_packet_size);
   ~AsyncTCPSocketBase() override;
 
+  AsyncTCPSocketBase(const AsyncTCPSocketBase&) = delete;
+  AsyncTCPSocketBase& operator=(const AsyncTCPSocketBase&) = delete;
+
   // Pure virtual methods to send and recv data.
   int Send(const void* pv,
            size_t cb,
@@ -78,8 +80,6 @@
   Buffer outbuf_;
   size_t max_insize_;
   size_t max_outsize_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocketBase);
 };
 
 class AsyncTCPSocket : public AsyncTCPSocketBase {
@@ -93,13 +93,13 @@
   explicit AsyncTCPSocket(Socket* socket);
   ~AsyncTCPSocket() override {}
 
+  AsyncTCPSocket(const AsyncTCPSocket&) = delete;
+  AsyncTCPSocket& operator=(const AsyncTCPSocket&) = delete;
+
   int Send(const void* pv,
            size_t cb,
            const rtc::PacketOptions& options) override;
   void ProcessInput(char* data, size_t* len) override;
-
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocket);
 };
 
 class AsyncTcpListenSocket : public AsyncListenSocket {
diff --git a/rtc_base/bit_buffer.h b/rtc_base/bit_buffer.h
index 5375550..b4991bc 100644
--- a/rtc_base/bit_buffer.h
+++ b/rtc_base/bit_buffer.h
@@ -14,8 +14,6 @@
 #include <stddef.h>  // For size_t.
 #include <stdint.h>  // For integer types.
 
-#include "rtc_base/constructor_magic.h"
-
 namespace rtc {
 
 // A BitBuffer API for write operations. Supports symmetric write APIs to the
@@ -27,6 +25,9 @@
   // Constructs a bit buffer for the writable buffer of `bytes`.
   BitBufferWriter(uint8_t* bytes, size_t byte_count);
 
+  BitBufferWriter(const BitBufferWriter&) = delete;
+  BitBufferWriter& operator=(const BitBufferWriter&) = delete;
+
   // Gets the current offset, in bytes/bits, from the start of the buffer. The
   // bit offset is the offset into the current byte, in the range [0,7].
   void GetCurrentOffset(size_t* out_byte_offset, size_t* out_bit_offset);
@@ -80,8 +81,6 @@
   size_t byte_offset_;
   // The current offset, in bits, into the current byte.
   size_t bit_offset_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(BitBufferWriter);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/boringssl_certificate.h b/rtc_base/boringssl_certificate.h
index 40a4bd8..8b4577a 100644
--- a/rtc_base/boringssl_certificate.h
+++ b/rtc_base/boringssl_certificate.h
@@ -19,7 +19,6 @@
 #include <string>
 
 #include "rtc_base/buffer.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/ssl_certificate.h"
 #include "rtc_base/ssl_identity.h"
 
@@ -43,6 +42,9 @@
 
   ~BoringSSLCertificate() override;
 
+  BoringSSLCertificate(const BoringSSLCertificate&) = delete;
+  BoringSSLCertificate& operator=(const BoringSSLCertificate&) = delete;
+
   std::unique_ptr<SSLCertificate> Clone() const override;
 
   CRYPTO_BUFFER* cert_buffer() const { return cert_buffer_.get(); }
@@ -72,7 +74,6 @@
  private:
   // A handle to the DER encoded certificate data.
   bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(BoringSSLCertificate);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/boringssl_identity.h b/rtc_base/boringssl_identity.h
index 71b29b4..e322afa 100644
--- a/rtc_base/boringssl_identity.h
+++ b/rtc_base/boringssl_identity.h
@@ -18,7 +18,6 @@
 #include <string>
 
 #include "rtc_base/boringssl_certificate.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/openssl_key_pair.h"
 #include "rtc_base/ssl_certificate.h"
 #include "rtc_base/ssl_identity.h"
@@ -44,6 +43,9 @@
       const std::string& certificate_chain);
   ~BoringSSLIdentity() override;
 
+  BoringSSLIdentity(const BoringSSLIdentity&) = delete;
+  BoringSSLIdentity& operator=(const BoringSSLIdentity&) = delete;
+
   const BoringSSLCertificate& certificate() const override;
   const SSLCertChain& cert_chain() const override;
 
@@ -67,8 +69,6 @@
 
   std::unique_ptr<OpenSSLKeyPair> key_pair_;
   std::unique_ptr<SSLCertChain> cert_chain_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(BoringSSLIdentity);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/buffer_queue.h b/rtc_base/buffer_queue.h
index ee435f4..b018e16 100644
--- a/rtc_base/buffer_queue.h
+++ b/rtc_base/buffer_queue.h
@@ -18,7 +18,6 @@
 
 #include "api/sequence_checker.h"
 #include "rtc_base/buffer.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/system/no_unique_address.h"
 #include "rtc_base/thread_annotations.h"
 
@@ -30,6 +29,9 @@
   BufferQueue(size_t capacity, size_t default_size);
   ~BufferQueue();
 
+  BufferQueue(const BufferQueue&) = delete;
+  BufferQueue& operator=(const BufferQueue&) = delete;
+
   // Return number of queued buffers.
   size_t size() const;
 
@@ -61,8 +63,6 @@
   const size_t default_size_;
   std::deque<Buffer*> queue_ RTC_GUARDED_BY(sequence_checker_);
   std::vector<Buffer*> free_list_ RTC_GUARDED_BY(sequence_checker_);
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(BufferQueue);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/byte_buffer.h b/rtc_base/byte_buffer.h
index fc383f0..d2dda3c 100644
--- a/rtc_base/byte_buffer.h
+++ b/rtc_base/byte_buffer.h
@@ -18,7 +18,6 @@
 
 #include "rtc_base/buffer.h"
 #include "rtc_base/byte_order.h"
-#include "rtc_base/constructor_magic.h"
 
 // Reads/Writes from/to buffer using network byte order (big endian)
 namespace rtc {
@@ -29,6 +28,9 @@
   ByteBufferWriterT() { Construct(nullptr, kDefaultCapacity); }
   ByteBufferWriterT(const char* bytes, size_t len) { Construct(bytes, len); }
 
+  ByteBufferWriterT(const ByteBufferWriterT&) = delete;
+  ByteBufferWriterT& operator=(const ByteBufferWriterT&) = delete;
+
   const char* Data() const { return buffer_.data(); }
   size_t Length() const { return buffer_.size(); }
   size_t Capacity() const { return buffer_.capacity(); }
@@ -104,7 +106,6 @@
 
   // There are sensible ways to define these, but they aren't needed in our code
   // base.
-  RTC_DISALLOW_COPY_AND_ASSIGN(ByteBufferWriterT);
 };
 
 class ByteBufferWriter : public ByteBufferWriterT<BufferT<char>> {
@@ -112,8 +113,8 @@
   ByteBufferWriter();
   ByteBufferWriter(const char* bytes, size_t len);
 
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(ByteBufferWriter);
+  ByteBufferWriter(const ByteBufferWriter&) = delete;
+  ByteBufferWriter& operator=(const ByteBufferWriter&) = delete;
 };
 
 // The ByteBufferReader references the passed data, i.e. the pointer must be
@@ -129,6 +130,9 @@
 
   explicit ByteBufferReader(const ByteBufferWriter& buf);
 
+  ByteBufferReader(const ByteBufferReader&) = delete;
+  ByteBufferReader& operator=(const ByteBufferReader&) = delete;
+
   // Returns start of unprocessed data.
   const char* Data() const { return bytes_ + start_; }
   // Returns number of unprocessed bytes.
@@ -161,9 +165,6 @@
   size_t size_;
   size_t start_;
   size_t end_;
-
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(ByteBufferReader);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/deprecated/recursive_critical_section.h b/rtc_base/deprecated/recursive_critical_section.h
index 15b1f97..cc308e4 100644
--- a/rtc_base/deprecated/recursive_critical_section.h
+++ b/rtc_base/deprecated/recursive_critical_section.h
@@ -11,7 +11,6 @@
 #ifndef RTC_BASE_DEPRECATED_RECURSIVE_CRITICAL_SECTION_H_
 #define RTC_BASE_DEPRECATED_RECURSIVE_CRITICAL_SECTION_H_
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/platform_thread_types.h"
 #include "rtc_base/thread_annotations.h"
 
@@ -94,9 +93,11 @@
       RTC_EXCLUSIVE_LOCK_FUNCTION(cs);
   ~CritScope() RTC_UNLOCK_FUNCTION();
 
+  CritScope(const CritScope&) = delete;
+  CritScope& operator=(const CritScope&) = delete;
+
  private:
   const RecursiveCriticalSection* const cs_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(CritScope);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/file_rotating_stream.h b/rtc_base/file_rotating_stream.h
index beb47c8..6aaa0bd 100644
--- a/rtc_base/file_rotating_stream.h
+++ b/rtc_base/file_rotating_stream.h
@@ -17,7 +17,6 @@
 #include <string>
 #include <vector>
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/system/file_wrapper.h"
 
 namespace rtc {
@@ -37,6 +36,9 @@
 
   virtual ~FileRotatingStream();
 
+  FileRotatingStream(const FileRotatingStream&) = delete;
+  FileRotatingStream& operator=(const FileRotatingStream&) = delete;
+
   bool IsOpen() const;
 
   bool Write(const void* data, size_t data_len);
@@ -100,8 +102,6 @@
   // buffering the file size read from disk might not be accurate.
   size_t current_bytes_written_;
   bool disable_buffering_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(FileRotatingStream);
 };
 
 // CallSessionFileRotatingStream is meant to be used in situations where we will
@@ -130,6 +130,10 @@
                                 size_t max_total_log_size);
   ~CallSessionFileRotatingStream() override {}
 
+  CallSessionFileRotatingStream(const CallSessionFileRotatingStream&) = delete;
+  CallSessionFileRotatingStream& operator=(
+      const CallSessionFileRotatingStream&) = delete;
+
  protected:
   void OnRotation() override;
 
@@ -140,8 +144,6 @@
 
   const size_t max_total_log_size_;
   size_t num_rotations_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(CallSessionFileRotatingStream);
 };
 
 // This is a convenience class, to read all files produced by a
diff --git a/rtc_base/log_sinks.h b/rtc_base/log_sinks.h
index 87bec6d..d2c286a 100644
--- a/rtc_base/log_sinks.h
+++ b/rtc_base/log_sinks.h
@@ -16,7 +16,6 @@
 #include <memory>
 #include <string>
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/file_rotating_stream.h"
 #include "rtc_base/logging.h"
 
@@ -34,6 +33,9 @@
                       size_t num_log_files);
   ~FileRotatingLogSink() override;
 
+  FileRotatingLogSink(const FileRotatingLogSink&) = delete;
+  FileRotatingLogSink& operator=(const FileRotatingLogSink&) = delete;
+
   // Writes the message to the current file. It will spill over to the next
   // file if needed.
   void OnLogMessage(const std::string& message) override;
@@ -52,8 +54,6 @@
 
  private:
   std::unique_ptr<FileRotatingStream> stream_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(FileRotatingLogSink);
 };
 
 // Log sink that uses a CallSessionFileRotatingStream to write to disk.
@@ -64,8 +64,10 @@
                                  size_t max_total_log_size);
   ~CallSessionFileRotatingLogSink() override;
 
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(CallSessionFileRotatingLogSink);
+  CallSessionFileRotatingLogSink(const CallSessionFileRotatingLogSink&) =
+      delete;
+  CallSessionFileRotatingLogSink& operator=(
+      const CallSessionFileRotatingLogSink&) = delete;
 };
 
 }  // namespace rtc
diff --git a/rtc_base/logging.h b/rtc_base/logging.h
index 3ac12d7..b981357 100644
--- a/rtc_base/logging.h
+++ b/rtc_base/logging.h
@@ -54,7 +54,6 @@
 #include "absl/base/attributes.h"
 #include "absl/meta/type_traits.h"
 #include "absl/strings/string_view.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/strings/string_builder.h"
 #include "rtc_base/system/inline.h"
 
@@ -443,6 +442,9 @@
              const std::string& tag);
   ~LogMessage();
 
+  LogMessage(const LogMessage&) = delete;
+  LogMessage& operator=(const LogMessage&) = delete;
+
   void AddTag(const char* tag);
   rtc::StringBuilder& stream();
   // Returns the time at which this function was called for the first time.
@@ -602,8 +604,6 @@
 
   // The stringbuilder that buffers the formatted message before output
   rtc::StringBuilder print_stream_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(LogMessage);
 };
 
 //////////////////////////////////////////////////////////////////////
diff --git a/rtc_base/memory/fifo_buffer.h b/rtc_base/memory/fifo_buffer.h
index 0bc943a..e3d29f4 100644
--- a/rtc_base/memory/fifo_buffer.h
+++ b/rtc_base/memory/fifo_buffer.h
@@ -29,6 +29,10 @@
   // Creates a FIFO buffer with the specified capacity and owner
   FifoBuffer(size_t length, Thread* owner);
   ~FifoBuffer() override;
+
+  FifoBuffer(const FifoBuffer&) = delete;
+  FifoBuffer& operator=(const FifoBuffer&) = delete;
+
   // Gets the amount of data currently readable from the buffer.
   bool GetBuffered(size_t* data_len) const;
 
@@ -110,7 +114,6 @@
   Thread* const owner_;
   // object lock
   mutable webrtc::Mutex mutex_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(FifoBuffer);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/message_handler.h b/rtc_base/message_handler.h
index 62c8344..c5e05ca 100644
--- a/rtc_base/message_handler.h
+++ b/rtc_base/message_handler.h
@@ -14,7 +14,6 @@
 #include <utility>
 
 #include "api/function_view.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/system/rtc_export.h"
 
 namespace rtc {
@@ -37,11 +36,12 @@
  public:
   ~MessageHandlerAutoCleanup() override;
 
+  MessageHandlerAutoCleanup(const MessageHandlerAutoCleanup&) = delete;
+  MessageHandlerAutoCleanup& operator=(const MessageHandlerAutoCleanup&) =
+      delete;
+
  protected:
   MessageHandlerAutoCleanup();
-
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(MessageHandlerAutoCleanup);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/nat_server.h b/rtc_base/nat_server.h
index 5078fbb..acbd62a 100644
--- a/rtc_base/nat_server.h
+++ b/rtc_base/nat_server.h
@@ -15,7 +15,6 @@
 #include <set>
 
 #include "rtc_base/async_udp_socket.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/nat_types.h"
 #include "rtc_base/proxy_server.h"
 #include "rtc_base/socket_address_pair.h"
@@ -69,6 +68,9 @@
             const SocketAddress& external_ip);
   ~NATServer() override;
 
+  NATServer(const NATServer&) = delete;
+  NATServer& operator=(const NATServer&) = delete;
+
   SocketAddress internal_udp_address() const {
     return udp_server_socket_->GetLocalAddress();
   }
@@ -122,7 +124,6 @@
   ProxyServer* tcp_proxy_server_;
   InternalMap* int_map_;
   ExternalMap* ext_map_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(NATServer);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/nat_socket_factory.h b/rtc_base/nat_socket_factory.h
index 9b1d2f0..70cb303 100644
--- a/rtc_base/nat_socket_factory.h
+++ b/rtc_base/nat_socket_factory.h
@@ -17,7 +17,6 @@
 #include <memory>
 #include <set>
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/nat_server.h"
 #include "rtc_base/nat_types.h"
 #include "rtc_base/socket.h"
@@ -50,6 +49,9 @@
                    const SocketAddress& nat_udp_addr,
                    const SocketAddress& nat_tcp_addr);
 
+  NATSocketFactory(const NATSocketFactory&) = delete;
+  NATSocketFactory& operator=(const NATSocketFactory&) = delete;
+
   // SocketFactory implementation
   Socket* CreateSocket(int family, int type) override;
 
@@ -63,7 +65,6 @@
   SocketFactory* factory_;
   SocketAddress nat_udp_addr_;
   SocketAddress nat_tcp_addr_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(NATSocketFactory);
 };
 
 // Creates sockets that will send traffic through a NAT depending on what
@@ -135,6 +136,9 @@
 
   explicit NATSocketServer(SocketServer* ss);
 
+  NATSocketServer(const NATSocketServer&) = delete;
+  NATSocketServer& operator=(const NATSocketServer&) = delete;
+
   SocketServer* socketserver() { return server_; }
   Thread* queue() { return msg_queue_; }
 
@@ -161,7 +165,6 @@
   SocketServer* server_;
   Thread* msg_queue_;
   TranslatorMap nats_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(NATSocketServer);
 };
 
 // Free-standing NAT helper functions.
diff --git a/rtc_base/numerics/moving_max_counter.h b/rtc_base/numerics/moving_max_counter.h
index 26dd506..5eb45d39 100644
--- a/rtc_base/numerics/moving_max_counter.h
+++ b/rtc_base/numerics/moving_max_counter.h
@@ -19,7 +19,6 @@
 
 #include "absl/types/optional.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/constructor_magic.h"
 
 namespace rtc {
 
@@ -34,6 +33,10 @@
 class MovingMaxCounter {
  public:
   explicit MovingMaxCounter(int64_t window_length_ms);
+
+  MovingMaxCounter(const MovingMaxCounter&) = delete;
+  MovingMaxCounter& operator=(const MovingMaxCounter&) = delete;
+
   // Advances the current time, and adds a new sample. The new current time must
   // be at least as large as the old current time.
   void Add(const T& sample, int64_t current_time_ms);
@@ -57,7 +60,6 @@
 #if RTC_DCHECK_IS_ON
   int64_t last_call_time_ms_ = std::numeric_limits<int64_t>::min();
 #endif
-  RTC_DISALLOW_COPY_AND_ASSIGN(MovingMaxCounter);
 };
 
 template <class T>
diff --git a/rtc_base/numerics/moving_median_filter.h b/rtc_base/numerics/moving_median_filter.h
index 157eb15..2a8ea7d 100644
--- a/rtc_base/numerics/moving_median_filter.h
+++ b/rtc_base/numerics/moving_median_filter.h
@@ -17,7 +17,6 @@
 #include <list>
 
 #include "rtc_base/checks.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/numerics/percentile_filter.h"
 
 namespace webrtc {
@@ -30,6 +29,9 @@
   // used to take median. `window_size` must be positive.
   explicit MovingMedianFilter(size_t window_size);
 
+  MovingMedianFilter(const MovingMedianFilter&) = delete;
+  MovingMedianFilter& operator=(const MovingMedianFilter&) = delete;
+
   // Insert a new sample.
   void Insert(const T& value);
 
@@ -47,8 +49,6 @@
   std::list<T> samples_;
   size_t samples_stored_;
   const size_t window_size_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(MovingMedianFilter);
 };
 
 template <typename T>
diff --git a/rtc_base/numerics/percentile_filter_unittest.cc b/rtc_base/numerics/percentile_filter_unittest.cc
index 0de8be5..d6baa32 100644
--- a/rtc_base/numerics/percentile_filter_unittest.cc
+++ b/rtc_base/numerics/percentile_filter_unittest.cc
@@ -18,7 +18,6 @@
 #include <random>
 
 #include "absl/algorithm/container.h"
-#include "rtc_base/constructor_magic.h"
 #include "test/gtest.h"
 
 namespace webrtc {
@@ -30,11 +29,11 @@
     srand(42);
   }
 
+  PercentileFilterTest(const PercentileFilterTest&) = delete;
+  PercentileFilterTest& operator=(const PercentileFilterTest&) = delete;
+
  protected:
   PercentileFilter<int64_t> filter_;
-
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(PercentileFilterTest);
 };
 
 INSTANTIATE_TEST_SUITE_P(PercentileFilterTests,
diff --git a/rtc_base/openssl_key_pair.h b/rtc_base/openssl_key_pair.h
index a84c43b..d9a4939 100644
--- a/rtc_base/openssl_key_pair.h
+++ b/rtc_base/openssl_key_pair.h
@@ -17,7 +17,6 @@
 #include <string>
 
 #include "rtc_base/checks.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/ssl_identity.h"
 
 namespace rtc {
@@ -39,6 +38,9 @@
 
   ~OpenSSLKeyPair();
 
+  OpenSSLKeyPair(const OpenSSLKeyPair&) = delete;
+  OpenSSLKeyPair& operator=(const OpenSSLKeyPair&) = delete;
+
   std::unique_ptr<OpenSSLKeyPair> Clone();
 
   EVP_PKEY* pkey() const { return pkey_; }
@@ -51,8 +53,6 @@
   void AddReference();
 
   EVP_PKEY* pkey_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyPair);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/openssl_session_cache.h b/rtc_base/openssl_session_cache.h
index b049e64..b801ec7 100644
--- a/rtc_base/openssl_session_cache.h
+++ b/rtc_base/openssl_session_cache.h
@@ -16,7 +16,6 @@
 #include <map>
 #include <string>
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/ssl_stream_adapter.h"
 
 #ifndef OPENSSL_IS_BORINGSSL
@@ -36,6 +35,10 @@
   OpenSSLSessionCache(SSLMode ssl_mode, SSL_CTX* ssl_ctx);
   // Frees the cached SSL_SESSIONS and then frees the SSL_CTX.
   ~OpenSSLSessionCache();
+
+  OpenSSLSessionCache(const OpenSSLSessionCache&) = delete;
+  OpenSSLSessionCache& operator=(const OpenSSLSessionCache&) = delete;
+
   // Looks up a session by hostname. The returned SSL_SESSION is not up_refed.
   SSL_SESSION* LookupSession(const std::string& hostname) const;
   // Adds a session to the cache, and up_refs it. Any existing session with the
@@ -60,7 +63,6 @@
   // TODO(juberti): Add LRU eviction to keep the cache from growing forever.
   std::map<std::string, SSL_SESSION*> sessions_;
   // The cache should never be copied or assigned directly.
-  RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLSessionCache);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/operations_chain.h b/rtc_base/operations_chain.h
index e6fb4f9..0e8c068 100644
--- a/rtc_base/operations_chain.h
+++ b/rtc_base/operations_chain.h
@@ -23,7 +23,6 @@
 #include "api/scoped_refptr.h"
 #include "api/sequence_checker.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/ref_count.h"
 #include "rtc_base/ref_counted_object.h"
 #include "rtc_base/system/no_unique_address.h"
@@ -119,6 +118,9 @@
   static scoped_refptr<OperationsChain> Create();
   ~OperationsChain();
 
+  OperationsChain(const OperationsChain&) = delete;
+  OperationsChain& operator=(const OperationsChain&) = delete;
+
   void SetOnChainEmptyCallback(std::function<void()> on_chain_empty_callback);
   bool IsEmpty() const;
 
@@ -169,6 +171,9 @@
     explicit CallbackHandle(scoped_refptr<OperationsChain> operations_chain);
     ~CallbackHandle();
 
+    CallbackHandle(const CallbackHandle&) = delete;
+    CallbackHandle& operator=(const CallbackHandle&) = delete;
+
     void OnOperationComplete();
 
    private:
@@ -176,8 +181,6 @@
 #if RTC_DCHECK_IS_ON
     bool has_run_ = false;
 #endif  // RTC_DCHECK_IS_ON
-
-    RTC_DISALLOW_COPY_AND_ASSIGN(CallbackHandle);
   };
 
   OperationsChain();
@@ -193,8 +196,6 @@
       chained_operations_ RTC_GUARDED_BY(sequence_checker_);
   absl::optional<std::function<void()>> on_chain_empty_callback_
       RTC_GUARDED_BY(sequence_checker_);
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(OperationsChain);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/operations_chain_unittest.cc b/rtc_base/operations_chain_unittest.cc
index f99c05e..a66df5b 100644
--- a/rtc_base/operations_chain_unittest.cc
+++ b/rtc_base/operations_chain_unittest.cc
@@ -219,6 +219,9 @@
     }
   }
 
+  SignalOnDestruction(const SignalOnDestruction&) = delete;
+  SignalOnDestruction& operator=(const SignalOnDestruction&) = delete;
+
   // Move operators.
   SignalOnDestruction(SignalOnDestruction&& other)
       : SignalOnDestruction(other.destructor_called_) {
@@ -232,8 +235,6 @@
 
  private:
   bool* destructor_called_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SignalOnDestruction);
 };
 
 TEST(OperationsChainTest, SynchronousOperation) {
diff --git a/rtc_base/proxy_server.h b/rtc_base/proxy_server.h
index 6db0e12..0b9b655 100644
--- a/rtc_base/proxy_server.h
+++ b/rtc_base/proxy_server.h
@@ -15,7 +15,6 @@
 #include <vector>
 
 #include "absl/memory/memory.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/memory/fifo_buffer.h"
 #include "rtc_base/server_socket_adapters.h"
 #include "rtc_base/socket.h"
@@ -36,6 +35,10 @@
  public:
   ProxyBinding(AsyncProxyServerSocket* in_socket, Socket* out_socket);
   ~ProxyBinding() override;
+
+  ProxyBinding(const ProxyBinding&) = delete;
+  ProxyBinding& operator=(const ProxyBinding&) = delete;
+
   sigslot::signal1<ProxyBinding*> SignalDestroyed;
 
  private:
@@ -59,7 +62,6 @@
   bool connected_;
   FifoBuffer out_buffer_;
   FifoBuffer in_buffer_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(ProxyBinding);
 };
 
 class ProxyServer : public sigslot::has_slots<> {
@@ -70,6 +72,9 @@
               const SocketAddress& ext_ip);
   ~ProxyServer() override;
 
+  ProxyServer(const ProxyServer&) = delete;
+  ProxyServer& operator=(const ProxyServer&) = delete;
+
   // Returns the address to which the proxy server is bound
   SocketAddress GetServerAddress();
 
@@ -82,7 +87,6 @@
   SocketAddress ext_ip_;
   std::unique_ptr<Socket> server_socket_;
   std::vector<std::unique_ptr<ProxyBinding>> bindings_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(ProxyServer);
 };
 
 // SocksProxyServer is a simple extension of ProxyServer to implement SOCKS.
@@ -94,9 +98,11 @@
                    const SocketAddress& ext_ip)
       : ProxyServer(int_factory, int_addr, ext_factory, ext_ip) {}
 
+  SocksProxyServer(const SocksProxyServer&) = delete;
+  SocksProxyServer& operator=(const SocksProxyServer&) = delete;
+
  protected:
   AsyncProxyServerSocket* WrapSocket(Socket* socket) override;
-  RTC_DISALLOW_COPY_AND_ASSIGN(SocksProxyServer);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/ref_counted_object.h b/rtc_base/ref_counted_object.h
index 274eb9e..54aac95 100644
--- a/rtc_base/ref_counted_object.h
+++ b/rtc_base/ref_counted_object.h
@@ -14,7 +14,6 @@
 #include <utility>
 
 #include "api/scoped_refptr.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/ref_count.h"
 #include "rtc_base/ref_counter.h"
 
@@ -42,6 +41,9 @@
  public:
   RefCountedObject() {}
 
+  RefCountedObject(const RefCountedObject&) = delete;
+  RefCountedObject& operator=(const RefCountedObject&) = delete;
+
   template <class P0>
   explicit RefCountedObject(P0&& p0) : T(std::forward<P0>(p0)) {}
 
@@ -73,8 +75,6 @@
   ~RefCountedObject() override {}
 
   mutable webrtc::webrtc_impl::RefCounter ref_count_{0};
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(RefCountedObject);
 };
 
 template <class T>
diff --git a/rtc_base/ref_counted_object_unittest.cc b/rtc_base/ref_counted_object_unittest.cc
index ab7bb09..6b794e6 100644
--- a/rtc_base/ref_counted_object_unittest.cc
+++ b/rtc_base/ref_counted_object_unittest.cc
@@ -27,8 +27,8 @@
  public:
   A() {}
 
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(A);
+  A(const A&) = delete;
+  A& operator=(const A&) = delete;
 };
 
 class RefClass : public RefCountInterface {
diff --git a/rtc_base/rolling_accumulator.h b/rtc_base/rolling_accumulator.h
index 241bd72..84d791e 100644
--- a/rtc_base/rolling_accumulator.h
+++ b/rtc_base/rolling_accumulator.h
@@ -17,7 +17,6 @@
 #include <vector>
 
 #include "rtc_base/checks.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/numerics/running_statistics.h"
 
 namespace rtc {
@@ -35,6 +34,9 @@
   }
   ~RollingAccumulator() {}
 
+  RollingAccumulator(const RollingAccumulator&) = delete;
+  RollingAccumulator& operator=(const RollingAccumulator&) = delete;
+
   size_t max_count() const { return samples_.size(); }
 
   size_t count() const { return static_cast<size_t>(stats_.Size()); }
@@ -136,8 +138,6 @@
   mutable T min_;
   mutable bool min_stale_;
   std::vector<T> samples_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(RollingAccumulator);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/server_socket_adapters.h b/rtc_base/server_socket_adapters.h
index 07e9636..b18c7a6 100644
--- a/rtc_base/server_socket_adapters.h
+++ b/rtc_base/server_socket_adapters.h
@@ -31,9 +31,11 @@
  public:
   explicit AsyncSSLServerSocket(Socket* socket);
 
+  AsyncSSLServerSocket(const AsyncSSLServerSocket&) = delete;
+  AsyncSSLServerSocket& operator=(const AsyncSSLServerSocket&) = delete;
+
  protected:
   void ProcessInput(char* data, size_t* len) override;
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSSLServerSocket);
 };
 
 // Implements a proxy server socket for the SOCKS protocol.
@@ -41,6 +43,10 @@
  public:
   explicit AsyncSocksProxyServerSocket(Socket* socket);
 
+  AsyncSocksProxyServerSocket(const AsyncSocksProxyServerSocket&) = delete;
+  AsyncSocksProxyServerSocket& operator=(const AsyncSocksProxyServerSocket&) =
+      delete;
+
  private:
   void ProcessInput(char* data, size_t* len) override;
   void DirectSend(const ByteBufferWriter& buf);
@@ -64,7 +70,6 @@
     SS_ERROR
   };
   State state_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSocksProxyServerSocket);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/sigslot_tester.h b/rtc_base/sigslot_tester.h
index 58be511..92483c0 100644
--- a/rtc_base/sigslot_tester.h
+++ b/rtc_base/sigslot_tester.h
@@ -38,7 +38,6 @@
 //   EXPECT_EQ("hello", capture);
 //   /* See unit-tests for more examples */
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
 
 namespace rtc {
@@ -50,13 +49,14 @@
     signal->connect(this, &SigslotTester0::OnSignalCallback);
   }
 
+  SigslotTester0(const SigslotTester0&) = delete;
+  SigslotTester0& operator=(const SigslotTester0&) = delete;
+
   int callback_count() const { return callback_count_; }
 
  private:
   void OnSignalCallback() { callback_count_++; }
   int callback_count_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester0);
 };
 
 // Versions below are for testing signals that pass arguments. For all the
@@ -74,6 +74,9 @@
     signal->connect(this, &SigslotTester1::OnSignalCallback);
   }
 
+  SigslotTester1(const SigslotTester1&) = delete;
+  SigslotTester1& operator=(const SigslotTester1&) = delete;
+
   int callback_count() const { return callback_count_; }
 
  private:
@@ -84,8 +87,6 @@
 
   int callback_count_;
   C1* capture1_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester1);
 };
 
 template <class A1, class A2, class C1, class C2>
@@ -96,6 +97,9 @@
     signal->connect(this, &SigslotTester2::OnSignalCallback);
   }
 
+  SigslotTester2(const SigslotTester2&) = delete;
+  SigslotTester2& operator=(const SigslotTester2&) = delete;
+
   int callback_count() const { return callback_count_; }
 
  private:
@@ -108,8 +112,6 @@
   int callback_count_;
   C1* capture1_;
   C2* capture2_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester2);
 };
 
 template <class A1, class A2, class A3, class C1, class C2, class C3>
@@ -126,6 +128,9 @@
     signal->connect(this, &SigslotTester3::OnSignalCallback);
   }
 
+  SigslotTester3(const SigslotTester3&) = delete;
+  SigslotTester3& operator=(const SigslotTester3&) = delete;
+
   int callback_count() const { return callback_count_; }
 
  private:
@@ -140,8 +145,6 @@
   C1* capture1_;
   C2* capture2_;
   C3* capture3_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester3);
 };
 
 template <class A1,
@@ -167,6 +170,9 @@
     signal->connect(this, &SigslotTester4::OnSignalCallback);
   }
 
+  SigslotTester4(const SigslotTester4&) = delete;
+  SigslotTester4& operator=(const SigslotTester4&) = delete;
+
   int callback_count() const { return callback_count_; }
 
  private:
@@ -183,8 +189,6 @@
   C2* capture2_;
   C3* capture3_;
   C4* capture4_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester4);
 };
 
 template <class A1,
@@ -214,6 +218,9 @@
     signal->connect(this, &SigslotTester5::OnSignalCallback);
   }
 
+  SigslotTester5(const SigslotTester5&) = delete;
+  SigslotTester5& operator=(const SigslotTester5&) = delete;
+
   int callback_count() const { return callback_count_; }
 
  private:
@@ -232,8 +239,6 @@
   C3* capture3_;
   C4* capture4_;
   C5* capture5_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester5);
 };
 }  // namespace rtc
 
diff --git a/rtc_base/socket.h b/rtc_base/socket.h
index 6482117..0ed3a7f 100644
--- a/rtc_base/socket.h
+++ b/rtc_base/socket.h
@@ -25,7 +25,6 @@
 #include "rtc_base/win32.h"
 #endif
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/socket_address.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
 
@@ -83,6 +82,9 @@
  public:
   virtual ~Socket() {}
 
+  Socket(const Socket&) = delete;
+  Socket& operator=(const Socket&) = delete;
+
   // Returns the address to which the socket is bound.  If the socket is not
   // bound, then the any-address is returned.
   virtual SocketAddress GetLocalAddress() const = 0;
@@ -138,9 +140,6 @@
 
  protected:
   Socket() {}
-
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(Socket);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/socket_adapters.h b/rtc_base/socket_adapters.h
index 67d3bbf..55f6211 100644
--- a/rtc_base/socket_adapters.h
+++ b/rtc_base/socket_adapters.h
@@ -15,7 +15,6 @@
 
 #include "api/array_view.h"
 #include "rtc_base/async_socket.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/crypt_string.h"
 
 namespace rtc {
@@ -34,6 +33,9 @@
   BufferedReadAdapter(Socket* socket, size_t buffer_size);
   ~BufferedReadAdapter() override;
 
+  BufferedReadAdapter(const BufferedReadAdapter&) = delete;
+  BufferedReadAdapter& operator=(const BufferedReadAdapter&) = delete;
+
   int Send(const void* pv, size_t cb) override;
   int Recv(void* pv, size_t cb, int64_t* timestamp) override;
 
@@ -51,7 +53,6 @@
   char* buffer_;
   size_t buffer_size_, data_len_;
   bool buffering_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(BufferedReadAdapter);
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -65,12 +66,14 @@
 
   explicit AsyncSSLSocket(Socket* socket);
 
+  AsyncSSLSocket(const AsyncSSLSocket&) = delete;
+  AsyncSSLSocket& operator=(const AsyncSSLSocket&) = delete;
+
   int Connect(const SocketAddress& addr) override;
 
  protected:
   void OnConnectEvent(Socket* socket) override;
   void ProcessInput(char* data, size_t* len) override;
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSSLSocket);
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -85,6 +88,9 @@
                         const CryptString& password);
   ~AsyncHttpsProxySocket() override;
 
+  AsyncHttpsProxySocket(const AsyncHttpsProxySocket&) = delete;
+  AsyncHttpsProxySocket& operator=(const AsyncHttpsProxySocket&) = delete;
+
   // If connect is forced, the adapter will always issue an HTTP CONNECT to the
   // target address.  Otherwise, it will connect only if the destination port
   // is not port 80.
@@ -128,7 +134,6 @@
   } state_;
   HttpAuthContext* context_;
   std::string unknown_mechanisms_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncHttpsProxySocket);
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -142,6 +147,9 @@
                         const CryptString& password);
   ~AsyncSocksProxySocket() override;
 
+  AsyncSocksProxySocket(const AsyncSocksProxySocket&) = delete;
+  AsyncSocksProxySocket& operator=(const AsyncSocksProxySocket&) = delete;
+
   int Connect(const SocketAddress& addr) override;
   SocketAddress GetRemoteAddress() const override;
   int Close() override;
@@ -162,7 +170,6 @@
   SocketAddress proxy_, dest_;
   std::string user_;
   CryptString pass_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(AsyncSocksProxySocket);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/socket_stream.h b/rtc_base/socket_stream.h
index 266a6e6..f678f80 100644
--- a/rtc_base/socket_stream.h
+++ b/rtc_base/socket_stream.h
@@ -13,7 +13,6 @@
 
 #include <stddef.h>
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/socket.h"
 #include "rtc_base/stream.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
@@ -27,6 +26,9 @@
   explicit SocketStream(Socket* socket);
   ~SocketStream() override;
 
+  SocketStream(const SocketStream&) = delete;
+  SocketStream& operator=(const SocketStream&) = delete;
+
   void Attach(Socket* socket);
   Socket* Detach();
 
@@ -53,8 +55,6 @@
   void OnCloseEvent(Socket* socket, int err);
 
   Socket* socket_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SocketStream);
 };
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/rtc_base/ssl_certificate.h b/rtc_base/ssl_certificate.h
index 3b3f24f..d0e60ee 100644
--- a/rtc_base/ssl_certificate.h
+++ b/rtc_base/ssl_certificate.h
@@ -17,12 +17,12 @@
 
 #include <stddef.h>
 #include <stdint.h>
+
 #include <memory>
 #include <string>
 #include <vector>
 
 #include "rtc_base/buffer.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/system/rtc_export.h"
 
 namespace rtc {
@@ -101,6 +101,9 @@
 
   ~SSLCertChain();
 
+  SSLCertChain(const SSLCertChain&) = delete;
+  SSLCertChain& operator=(const SSLCertChain&) = delete;
+
   // Vector access methods.
   size_t GetSize() const { return certs_.size(); }
 
@@ -118,8 +121,6 @@
 
  private:
   std::vector<std::unique_ptr<SSLCertificate>> certs_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(SSLCertChain);
 };
 
 // SSLCertificateVerifier provides a simple interface to allow third parties to
diff --git a/rtc_base/stream.h b/rtc_base/stream.h
index 70de65a..c0ceb4e 100644
--- a/rtc_base/stream.h
+++ b/rtc_base/stream.h
@@ -14,7 +14,6 @@
 #include <memory>
 
 #include "rtc_base/buffer.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/message_handler.h"
 #include "rtc_base/system/rtc_export.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
@@ -52,6 +51,9 @@
  public:
   virtual ~StreamInterface() {}
 
+  StreamInterface(const StreamInterface&) = delete;
+  StreamInterface& operator=(const StreamInterface&) = delete;
+
   virtual StreamState GetState() const = 0;
 
   // Read attempts to fill buffer of size buffer_len.  Write attempts to send
@@ -110,9 +112,6 @@
 
  protected:
   StreamInterface();
-
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(StreamInterface);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/task_queue.h b/rtc_base/task_queue.h
index 86d3597..1798d06 100644
--- a/rtc_base/task_queue.h
+++ b/rtc_base/task_queue.h
@@ -20,7 +20,6 @@
 #include "api/task_queue/queued_task.h"
 #include "api/task_queue/task_queue_base.h"
 #include "api/task_queue/task_queue_factory.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/system/rtc_export.h"
 #include "rtc_base/task_utils/to_queued_task.h"
 #include "rtc_base/thread_annotations.h"
@@ -83,6 +82,9 @@
                                      webrtc::TaskQueueDeleter> task_queue);
   ~TaskQueue();
 
+  TaskQueue(const TaskQueue&) = delete;
+  TaskQueue& operator=(const TaskQueue&) = delete;
+
   // Used for DCHECKing the current queue.
   bool IsCurrent() const;
 
@@ -125,8 +127,6 @@
 
  private:
   webrtc::TaskQueueBase* const impl_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(TaskQueue);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/test_client.h b/rtc_base/test_client.h
index 6989fe1..dd91d37 100644
--- a/rtc_base/test_client.h
+++ b/rtc_base/test_client.h
@@ -15,7 +15,6 @@
 #include <vector>
 
 #include "rtc_base/async_udp_socket.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/fake_clock.h"
 #include "rtc_base/synchronization/mutex.h"
 
@@ -53,6 +52,9 @@
              ThreadProcessingFakeClock* fake_clock);
   ~TestClient() override;
 
+  TestClient(const TestClient&) = delete;
+  TestClient& operator=(const TestClient&) = delete;
+
   SocketAddress address() const { return socket_->GetLocalAddress(); }
   SocketAddress remote_address() const { return socket_->GetRemoteAddress(); }
 
@@ -110,7 +112,6 @@
   std::vector<std::unique_ptr<Packet>> packets_;
   int ready_to_send_count_ = 0;
   int64_t prev_packet_timestamp_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(TestClient);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/test_echo_server.h b/rtc_base/test_echo_server.h
index a061ed0..ba5f997 100644
--- a/rtc_base/test_echo_server.h
+++ b/rtc_base/test_echo_server.h
@@ -20,7 +20,6 @@
 #include "absl/algorithm/container.h"
 #include "rtc_base/async_packet_socket.h"
 #include "rtc_base/async_tcp_socket.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/socket.h"
 #include "rtc_base/socket_address.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
@@ -35,6 +34,9 @@
   TestEchoServer(Thread* thread, const SocketAddress& addr);
   ~TestEchoServer() override;
 
+  TestEchoServer(const TestEchoServer&) = delete;
+  TestEchoServer& operator=(const TestEchoServer&) = delete;
+
   SocketAddress address() const { return server_socket_->GetLocalAddress(); }
 
  private:
@@ -64,7 +66,6 @@
   typedef std::list<AsyncTCPSocket*> ClientList;
   std::unique_ptr<Socket> server_socket_;
   ClientList client_sockets_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(TestEchoServer);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc
index 46e082f..2a79d82 100644
--- a/rtc_base/thread.cc
+++ b/rtc_base/thread.cc
@@ -75,6 +75,9 @@
  public:
   MessageHandlerWithTask() {}
 
+  MessageHandlerWithTask(const MessageHandlerWithTask&) = delete;
+  MessageHandlerWithTask& operator=(const MessageHandlerWithTask&) = delete;
+
   void OnMessage(Message* msg) override {
     static_cast<rtc_thread_internal::MessageLikeTask*>(msg->pdata)->Run();
     delete msg->pdata;
@@ -82,8 +85,6 @@
 
  private:
   ~MessageHandlerWithTask() override {}
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(MessageHandlerWithTask);
 };
 
 class RTC_SCOPED_LOCKABLE MarkProcessingCritScope {
@@ -100,11 +101,12 @@
     cs_->Leave();
   }
 
+  MarkProcessingCritScope(const MarkProcessingCritScope&) = delete;
+  MarkProcessingCritScope& operator=(const MarkProcessingCritScope&) = delete;
+
  private:
   const RecursiveCriticalSection* const cs_;
   size_t* processing_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(MarkProcessingCritScope);
 };
 
 }  // namespace
diff --git a/rtc_base/thread.h b/rtc_base/thread.h
index 38e9732..70cafe0 100644
--- a/rtc_base/thread.h
+++ b/rtc_base/thread.h
@@ -29,7 +29,6 @@
 #include "api/task_queue/queued_task.h"
 #include "api/task_queue/task_queue_base.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/deprecated/recursive_critical_section.h"
 #include "rtc_base/location.h"
 #include "rtc_base/message_handler.h"
@@ -89,14 +88,15 @@
   explicit MessageWithFunctor(FunctorT&& functor)
       : functor_(std::forward<FunctorT>(functor)) {}
 
+  MessageWithFunctor(const MessageWithFunctor&) = delete;
+  MessageWithFunctor& operator=(const MessageWithFunctor&) = delete;
+
   void Run() override { functor_(); }
 
  private:
   ~MessageWithFunctor() override {}
 
   typename std::remove_reference<FunctorT>::type functor_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(MessageWithFunctor);
 };
 
 }  // namespace rtc_thread_internal
@@ -152,6 +152,9 @@
   ThreadManager();
   ~ThreadManager();
 
+  ThreadManager(const ThreadManager&) = delete;
+  ThreadManager& operator=(const ThreadManager&) = delete;
+
   void SetCurrentThreadInternal(Thread* thread);
   void AddInternal(Thread* message_queue);
   void RemoveInternal(Thread* message_queue);
@@ -186,8 +189,6 @@
 
   // The thread to potentially autowrap.
   const PlatformThreadRef main_thread_ref_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(ThreadManager);
 };
 
 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS!  See ~Thread().
@@ -221,6 +222,9 @@
   // calling Clear on the object from a different thread.
   ~Thread() override;
 
+  Thread(const Thread&) = delete;
+  Thread& operator=(const Thread&) = delete;
+
   static std::unique_ptr<Thread> CreateWithSocketServer();
   static std::unique_ptr<Thread> Create();
   static Thread* Current();
@@ -685,8 +689,6 @@
   friend class ThreadManager;
 
   int dispatch_warning_ms_ RTC_GUARDED_BY(this) = kSlowDispatchLoggingThreshold;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(Thread);
 };
 
 // AutoThread automatically installs itself at construction
@@ -700,8 +702,8 @@
   AutoThread();
   ~AutoThread() override;
 
- private:
-  RTC_DISALLOW_COPY_AND_ASSIGN(AutoThread);
+  AutoThread(const AutoThread&) = delete;
+  AutoThread& operator=(const AutoThread&) = delete;
 };
 
 // AutoSocketServerThread automatically installs itself at
@@ -714,10 +716,11 @@
   explicit AutoSocketServerThread(SocketServer* ss);
   ~AutoSocketServerThread() override;
 
+  AutoSocketServerThread(const AutoSocketServerThread&) = delete;
+  AutoSocketServerThread& operator=(const AutoSocketServerThread&) = delete;
+
  private:
   rtc::Thread* old_thread_;
-
-  RTC_DISALLOW_COPY_AND_ASSIGN(AutoSocketServerThread);
 };
 }  // namespace rtc
 
diff --git a/rtc_base/thread_unittest.cc b/rtc_base/thread_unittest.cc
index 62f00ec..424210a 100644
--- a/rtc_base/thread_unittest.cc
+++ b/rtc_base/thread_unittest.cc
@@ -204,6 +204,10 @@
  public:
   explicit FunctorD(AtomicBool* flag) : flag_(flag) {}
   FunctorD(FunctorD&&) = default;
+
+  FunctorD(const FunctorD&) = delete;
+  FunctorD& operator=(const FunctorD&) = delete;
+
   FunctorD& operator=(FunctorD&&) = default;
   void operator()() {
     if (flag_)
@@ -212,7 +216,6 @@
 
  private:
   AtomicBool* flag_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(FunctorD);
 };
 
 // See: https://code.google.com/p/webrtc/issues/detail?id=2409
diff --git a/rtc_base/timestamp_aligner.h b/rtc_base/timestamp_aligner.h
index 73af9de..138e936 100644
--- a/rtc_base/timestamp_aligner.h
+++ b/rtc_base/timestamp_aligner.h
@@ -13,7 +13,6 @@
 
 #include <stdint.h>
 
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/system/rtc_export.h"
 
 namespace rtc {
@@ -35,6 +34,9 @@
   TimestampAligner();
   ~TimestampAligner();
 
+  TimestampAligner(const TimestampAligner&) = delete;
+  TimestampAligner& operator=(const TimestampAligner&) = delete;
+
  public:
   // Translates timestamps of a capture system to the same timescale as is used
   // by rtc::TimeMicros(). `capturer_time_us` is assumed to be accurate, but
@@ -77,7 +79,6 @@
   // Offset between `prev_translated_time_us_` and the corresponding capturer
   // time.
   int64_t prev_time_offset_us_;
-  RTC_DISALLOW_COPY_AND_ASSIGN(TimestampAligner);
 };
 
 }  // namespace rtc
diff --git a/rtc_base/virtual_socket_server.h b/rtc_base/virtual_socket_server.h
index 8873f18..b172567 100644
--- a/rtc_base/virtual_socket_server.h
+++ b/rtc_base/virtual_socket_server.h
@@ -16,7 +16,6 @@
 #include <vector>
 
 #include "rtc_base/checks.h"
-#include "rtc_base/constructor_magic.h"
 #include "rtc_base/event.h"
 #include "rtc_base/fake_clock.h"
 #include "rtc_base/message_handler.h"
@@ -163,6 +162,9 @@
   explicit VirtualSocketServer(ThreadProcessingFakeClock* fake_clock);
   ~VirtualSocketServer() override;
 
+  VirtualSocketServer(const VirtualSocketServer&) = delete;
+  VirtualSocketServer& operator=(const VirtualSocketServer&) = delete;
+
   // The default source address specifies which local address to use when a
   // socket is bound to the 'any' address, e.g. 0.0.0.0. (If not set, the 'any'
   // address is used as the source address on outgoing virtual packets, exposed
@@ -419,7 +421,6 @@
   size_t max_udp_payload_ RTC_GUARDED_BY(mutex_) = 65507;
 
   bool sending_blocked_ RTC_GUARDED_BY(mutex_) = false;
-  RTC_DISALLOW_COPY_AND_ASSIGN(VirtualSocketServer);
 };
 
 }  // namespace rtc
diff --git a/rtc_tools/sanitizers_unittest.cc b/rtc_tools/sanitizers_unittest.cc
index eec037c..ee57583 100644
--- a/rtc_tools/sanitizers_unittest.cc
+++ b/rtc_tools/sanitizers_unittest.cc
@@ -15,6 +15,7 @@
 #include <random>
 
 #include "rtc_base/checks.h"
+#include "rtc_base/constructor_magic.h"
 #include "rtc_base/null_socket_server.h"
 #include "rtc_base/thread.h"
 #include "test/gtest.h"