From c065e739e2fbb58f0ec5a38716f851b9fe319f43 Mon Sep 17 00:00:00 2001 From: Byoungchan Lee Date: Tue, 18 Jan 2022 09:35:48 +0900 Subject: [PATCH] Remove RTC_DISALLOW_COPY_AND_ASSIGN more. Bug: webrtc:13555, webrtc:13082 Change-Id: I9c07708108da0a26f5e228384fd56cef4d1540b3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/247300 Reviewed-by: Harald Alvestrand Reviewed-by: Tomas Gunnarsson Reviewed-by: Artem Titov Commit-Queue: (Daniel.L) Byoungchan Lee Cr-Commit-Position: refs/heads/main@{#35749} --- api/audio/audio_frame.h | 6 +++--- api/audio_codecs/audio_decoder.h | 7 +++---- api/jsep_ice_candidate.h | 7 ++++--- api/jsep_session_description.h | 6 +++--- api/ref_counted_base.h | 11 ++++++----- api/stats_types.h | 11 ++++++----- call/call.cc | 6 +++--- call/fake_network_pipe.h | 6 +++--- call/rtp_bitrate_configurator.h | 7 ++++--- call/rtp_transport_controller_send.h | 6 ++++-- call/rtp_video_sender.h | 6 +++--- logging/rtc_event_log/encoder/bit_writer.h | 6 +++--- logging/rtc_event_log/encoder/delta_encoding.cc | 11 ++++++----- modules/video_coding/utility/ivf_file_reader.h | 1 + p2p/base/async_stun_tcp_socket.h | 6 +++--- p2p/base/dtls_transport.h | 11 ++++++----- p2p/base/dtls_transport_internal.h | 5 +++-- p2p/base/p2p_transport_channel.h | 6 +++--- p2p/stunprober/stun_prober.cc | 6 +++--- p2p/stunprober/stun_prober.h | 6 +++--- pc/dtmf_sender.h | 6 +++--- pc/jsep_transport.h | 6 +++--- pc/jsep_transport_controller.h | 6 +++--- pc/srtp_session.h | 5 +++-- pc/video_rtp_track_source.h | 6 +++--- pc/webrtc_session_description_factory.h | 8 +++++--- system_wrappers/source/metrics.cc | 11 ++++++----- test/network/network_emulation.h | 1 + 28 files changed, 100 insertions(+), 86 deletions(-) diff --git a/api/audio/audio_frame.h b/api/audio/audio_frame.h index 628a1ec4c1..d5dcb5f788 100644 --- a/api/audio/audio_frame.h +++ b/api/audio/audio_frame.h @@ -16,7 +16,6 @@ #include "api/audio/channel_layout.h" #include "api/rtp_packet_infos.h" -#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -58,6 +57,9 @@ class AudioFrame { AudioFrame(); + AudioFrame(const AudioFrame&) = delete; + AudioFrame& operator=(const AudioFrame&) = delete; + // Resets all members to their default state. void Reset(); // Same as Reset(), but leaves mute state unchanged. Muting a frame requires @@ -164,8 +166,6 @@ class AudioFrame { // capture timestamp of a received frame is found in `packet_infos_`. // This timestamp MUST be based on the same clock as rtc::TimeMillis(). absl::optional absolute_capture_timestamp_ms_; - - RTC_DISALLOW_COPY_AND_ASSIGN(AudioFrame); }; } // namespace webrtc diff --git a/api/audio_codecs/audio_decoder.h b/api/audio_codecs/audio_decoder.h index 336e38449b..41138741bb 100644 --- a/api/audio_codecs/audio_decoder.h +++ b/api/audio_codecs/audio_decoder.h @@ -20,7 +20,6 @@ #include "absl/types/optional.h" #include "api/array_view.h" #include "rtc_base/buffer.h" -#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -37,6 +36,9 @@ class AudioDecoder { AudioDecoder() = default; virtual ~AudioDecoder() = default; + AudioDecoder(const AudioDecoder&) = delete; + AudioDecoder& operator=(const AudioDecoder&) = delete; + class EncodedAudioFrame { public: struct DecodeResult { @@ -187,9 +189,6 @@ class AudioDecoder { int sample_rate_hz, int16_t* decoded, SpeechType* speech_type); - - private: - RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); }; } // namespace webrtc diff --git a/api/jsep_ice_candidate.h b/api/jsep_ice_candidate.h index 40e2783457..8f47a102e7 100644 --- a/api/jsep_ice_candidate.h +++ b/api/jsep_ice_candidate.h @@ -22,7 +22,6 @@ #include "api/candidate.h" #include "api/jsep.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -64,6 +63,10 @@ class JsepCandidateCollection : public IceCandidateCollection { // Move constructor is defined so that a vector of JsepCandidateCollections // can be resized. JsepCandidateCollection(JsepCandidateCollection&& o); + + JsepCandidateCollection(const JsepCandidateCollection&) = delete; + JsepCandidateCollection& operator=(const JsepCandidateCollection&) = delete; + // Returns a copy of the candidate collection. JsepCandidateCollection Clone() const; size_t count() const override; @@ -80,8 +83,6 @@ class JsepCandidateCollection : public IceCandidateCollection { private: std::vector> candidates_; - - RTC_DISALLOW_COPY_AND_ASSIGN(JsepCandidateCollection); }; } // namespace webrtc diff --git a/api/jsep_session_description.h b/api/jsep_session_description.h index a4300eba98..0b65734ea9 100644 --- a/api/jsep_session_description.h +++ b/api/jsep_session_description.h @@ -22,7 +22,6 @@ #include "api/candidate.h" #include "api/jsep.h" #include "api/jsep_ice_candidate.h" -#include "rtc_base/constructor_magic.h" namespace cricket { class SessionDescription; @@ -43,6 +42,9 @@ class JsepSessionDescription : public SessionDescriptionInterface { absl::string_view session_version); virtual ~JsepSessionDescription(); + JsepSessionDescription(const JsepSessionDescription&) = delete; + JsepSessionDescription& operator=(const JsepSessionDescription&) = delete; + // Takes ownership of `description`. bool Initialize(std::unique_ptr description, const std::string& session_id, @@ -82,8 +84,6 @@ class JsepSessionDescription : public SessionDescriptionInterface { bool GetMediasectionIndex(const IceCandidateInterface* candidate, size_t* index); int GetMediasectionIndex(const cricket::Candidate& candidate); - - RTC_DISALLOW_COPY_AND_ASSIGN(JsepSessionDescription); }; } // namespace webrtc diff --git a/api/ref_counted_base.h b/api/ref_counted_base.h index 931cb20762..f20228b740 100644 --- a/api/ref_counted_base.h +++ b/api/ref_counted_base.h @@ -12,7 +12,6 @@ #include -#include "rtc_base/constructor_magic.h" #include "rtc_base/ref_counter.h" namespace rtc { @@ -21,6 +20,9 @@ class RefCountedBase { public: RefCountedBase() = default; + RefCountedBase(const RefCountedBase&) = delete; + RefCountedBase& operator=(const RefCountedBase&) = delete; + void AddRef() const { ref_count_.IncRef(); } RefCountReleaseStatus Release() const { const auto status = ref_count_.DecRef(); @@ -39,8 +41,6 @@ class RefCountedBase { private: mutable webrtc::webrtc_impl::RefCounter ref_count_{0}; - - RTC_DISALLOW_COPY_AND_ASSIGN(RefCountedBase); }; // Template based version of `RefCountedBase` for simple implementations that do @@ -61,6 +61,9 @@ class RefCountedNonVirtual { public: RefCountedNonVirtual() = default; + RefCountedNonVirtual(const RefCountedNonVirtual&) = delete; + RefCountedNonVirtual& operator=(const RefCountedNonVirtual&) = delete; + void AddRef() const { ref_count_.IncRef(); } RefCountReleaseStatus Release() const { // If you run into this assert, T has virtual methods. There are two @@ -88,8 +91,6 @@ class RefCountedNonVirtual { private: mutable webrtc::webrtc_impl::RefCounter ref_count_{0}; - - RTC_DISALLOW_COPY_AND_ASSIGN(RefCountedNonVirtual); }; } // namespace rtc diff --git a/api/stats_types.h b/api/stats_types.h index b7cb8eff7d..c3e4451ef6 100644 --- a/api/stats_types.h +++ b/api/stats_types.h @@ -22,7 +22,6 @@ #include "api/scoped_refptr.h" #include "api/sequence_checker.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" @@ -288,6 +287,9 @@ class RTC_EXPORT StatsReport { ~Value(); + Value(const Value&) = delete; + Value& operator=(const Value&) = delete; + // Support ref counting. Note that for performance reasons, we // don't use thread safe operations. Therefore, all operations // affecting the ref count (in practice, creation and copying of @@ -358,8 +360,6 @@ class RTC_EXPORT StatsReport { const char* static_string_; Id* id_; } value_; - - RTC_DISALLOW_COPY_AND_ASSIGN(Value); }; typedef rtc::scoped_refptr ValuePtr; @@ -369,6 +369,9 @@ class RTC_EXPORT StatsReport { explicit StatsReport(const Id& id); ~StatsReport(); + StatsReport(const StatsReport&) = delete; + StatsReport& operator=(const StatsReport&) = delete; + // Factory functions for various types of stats IDs. static Id NewBandwidthEstimationId(); static Id NewTypedId(StatsType type, const std::string& id); @@ -408,8 +411,6 @@ class RTC_EXPORT StatsReport { const Id id_; double timestamp_; // Time since 1970-01-01T00:00:00Z in milliseconds. Values values_; - - RTC_DISALLOW_COPY_AND_ASSIGN(StatsReport); }; // Typedef for an array of const StatsReport pointers. diff --git a/call/call.cc b/call/call.cc index d83d5fbbcc..d34b9d3d73 100644 --- a/call/call.cc +++ b/call/call.cc @@ -51,7 +51,6 @@ #include "modules/utility/include/process_thread.h" #include "modules/video_coding/fec_controller_default.h" #include "rtc_base/checks.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/location.h" #include "rtc_base/logging.h" #include "rtc_base/strings/string_builder.h" @@ -209,6 +208,9 @@ class Call final : public webrtc::Call, TaskQueueFactory* task_queue_factory); ~Call() override; + Call(const Call&) = delete; + Call& operator=(const Call&) = delete; + // Implements webrtc::Call. PacketReceiver* Receiver() override; @@ -469,8 +471,6 @@ class Call final : public webrtc::Call, RTC_NO_UNIQUE_ADDRESS SequenceChecker sent_packet_sequence_checker_; absl::optional last_sent_packet_ RTC_GUARDED_BY(sent_packet_sequence_checker_); - - RTC_DISALLOW_COPY_AND_ASSIGN(Call); }; } // namespace internal diff --git a/call/fake_network_pipe.h b/call/fake_network_pipe.h index fadae337f5..be72e91637 100644 --- a/call/fake_network_pipe.h +++ b/call/fake_network_pipe.h @@ -23,7 +23,6 @@ #include "api/test/simulated_network.h" #include "call/call.h" #include "call/simulated_packet_receiver.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/thread_annotations.h" @@ -109,6 +108,9 @@ class FakeNetworkPipe : public SimulatedPacketReceiverInterface { ~FakeNetworkPipe() override; + FakeNetworkPipe(const FakeNetworkPipe&) = delete; + FakeNetworkPipe& operator=(const FakeNetworkPipe&) = delete; + void SetClockOffset(int64_t offset_ms); // Must not be called in parallel with DeliverPacket or Process. @@ -228,8 +230,6 @@ class FakeNetworkPipe : public SimulatedPacketReceiverInterface { int64_t last_log_time_us_; std::map active_transports_ RTC_GUARDED_BY(config_lock_); - - RTC_DISALLOW_COPY_AND_ASSIGN(FakeNetworkPipe); }; } // namespace webrtc diff --git a/call/rtp_bitrate_configurator.h b/call/rtp_bitrate_configurator.h index 7ad83f8b0b..5cb779a3b3 100644 --- a/call/rtp_bitrate_configurator.h +++ b/call/rtp_bitrate_configurator.h @@ -14,7 +14,6 @@ #include "absl/types/optional.h" #include "api/transport/bitrate_settings.h" #include "api/units/data_rate.h" -#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -24,6 +23,10 @@ class RtpBitrateConfigurator { public: explicit RtpBitrateConfigurator(const BitrateConstraints& bitrate_config); ~RtpBitrateConfigurator(); + + RtpBitrateConfigurator(const RtpBitrateConfigurator&) = delete; + RtpBitrateConfigurator& operator=(const RtpBitrateConfigurator&) = delete; + BitrateConstraints GetConfig() const; // The greater min and smaller max set by this and SetClientBitratePreferences @@ -68,8 +71,6 @@ class RtpBitrateConfigurator { // Bandwidth cap applied for relayed calls. DataRate max_bitrate_over_relay_ = DataRate::PlusInfinity(); - - RTC_DISALLOW_COPY_AND_ASSIGN(RtpBitrateConfigurator); }; } // namespace webrtc diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h index 62af78ceb8..e5ff162687 100644 --- a/call/rtp_transport_controller_send.h +++ b/call/rtp_transport_controller_send.h @@ -32,7 +32,6 @@ #include "modules/pacing/rtp_packet_pacer.h" #include "modules/pacing/task_queue_paced_sender.h" #include "modules/utility/include/process_thread.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/network_route.h" #include "rtc_base/race_checker.h" #include "rtc_base/task_queue.h" @@ -63,6 +62,10 @@ class RtpTransportControllerSend final const WebRtcKeyValueConfig* trials); ~RtpTransportControllerSend() override; + RtpTransportControllerSend(const RtpTransportControllerSend&) = delete; + RtpTransportControllerSend& operator=(const RtpTransportControllerSend&) = + delete; + // TODO(tommi): Change to std::unique_ptr<>. RtpVideoSenderInterface* CreateRtpVideoSender( const std::map& suspended_ssrcs, @@ -215,7 +218,6 @@ class RtpTransportControllerSend final // `task_queue_` is defined last to ensure all pending tasks are cancelled // and deleted before any other members. rtc::TaskQueue task_queue_; - RTC_DISALLOW_COPY_AND_ASSIGN(RtpTransportControllerSend); }; } // namespace webrtc diff --git a/call/rtp_video_sender.h b/call/rtp_video_sender.h index 25ef20f0a9..9832246665 100644 --- a/call/rtp_video_sender.h +++ b/call/rtp_video_sender.h @@ -35,7 +35,6 @@ #include "modules/rtp_rtcp/source/rtp_sender_video.h" #include "modules/rtp_rtcp/source/rtp_sequence_number_map.h" #include "modules/rtp_rtcp/source/rtp_video_header.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/rate_limiter.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/thread_annotations.h" @@ -89,6 +88,9 @@ class RtpVideoSender : public RtpVideoSenderInterface, rtc::scoped_refptr frame_transformer); ~RtpVideoSender() override; + RtpVideoSender(const RtpVideoSender&) = delete; + RtpVideoSender& operator=(const RtpVideoSender&) = delete; + // RtpVideoSender will only route packets if being active, all packets will be // dropped otherwise. void SetActive(bool active) RTC_LOCKS_EXCLUDED(mutex_) override; @@ -209,8 +211,6 @@ class RtpVideoSender : public RtpVideoSenderInterface, // This map is set at construction time and never changed, but it's // non-trivial to make it properly const. std::map ssrc_to_rtp_module_; - - RTC_DISALLOW_COPY_AND_ASSIGN(RtpVideoSender); }; } // namespace webrtc diff --git a/logging/rtc_event_log/encoder/bit_writer.h b/logging/rtc_event_log/encoder/bit_writer.h index 85340c380d..421e7c4370 100644 --- a/logging/rtc_event_log/encoder/bit_writer.h +++ b/logging/rtc_event_log/encoder/bit_writer.h @@ -20,7 +20,6 @@ #include "absl/strings/string_view.h" #include "rtc_base/bit_buffer.h" #include "rtc_base/checks.h" -#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -36,6 +35,9 @@ class BitWriter final { RTC_DCHECK_GT(byte_count, 0); } + BitWriter(const BitWriter&) = delete; + BitWriter& operator=(const BitWriter&) = delete; + void WriteBits(uint64_t val, size_t bit_count); void WriteBits(absl::string_view input); @@ -52,8 +54,6 @@ class BitWriter final { // to go anywhere near the limit, though, so this is good enough. size_t written_bits_; bool valid_; - - RTC_DISALLOW_COPY_AND_ASSIGN(BitWriter); }; } // namespace webrtc diff --git a/logging/rtc_event_log/encoder/delta_encoding.cc b/logging/rtc_event_log/encoder/delta_encoding.cc index a96d3a7dc2..3a2bee1d31 100644 --- a/logging/rtc_event_log/encoder/delta_encoding.cc +++ b/logging/rtc_event_log/encoder/delta_encoding.cc @@ -21,7 +21,6 @@ #include "rtc_base/bit_buffer.h" #include "rtc_base/bitstream_reader.h" #include "rtc_base/checks.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_conversions.h" @@ -187,6 +186,9 @@ class FixedLengthDeltaEncoder final { absl::optional base, const std::vector>& values); + FixedLengthDeltaEncoder(const FixedLengthDeltaEncoder&) = delete; + FixedLengthDeltaEncoder& operator=(const FixedLengthDeltaEncoder&) = delete; + private: // Calculate min/max values of unsigned/signed deltas, given the bit width // of all the values in the series. @@ -249,8 +251,6 @@ class FixedLengthDeltaEncoder final { // ctor has finished running when this is constructed, so that the lower // bound on the buffer size would be guaranteed correct. std::unique_ptr writer_; - - RTC_DISALLOW_COPY_AND_ASSIGN(FixedLengthDeltaEncoder); }; // TODO(eladalon): Reduce the number of passes. @@ -566,6 +566,9 @@ class FixedLengthDeltaDecoder final { absl::optional base, size_t num_of_deltas); + FixedLengthDeltaDecoder(const FixedLengthDeltaDecoder&) = delete; + FixedLengthDeltaDecoder& operator=(const FixedLengthDeltaDecoder&) = delete; + private: // Reads the encoding header in `input` and returns a FixedLengthDeltaDecoder // with the corresponding configuration, that can be used to decode the @@ -619,8 +622,6 @@ class FixedLengthDeltaDecoder final { // The number of values to be known to be decoded. const size_t num_of_deltas_; - - RTC_DISALLOW_COPY_AND_ASSIGN(FixedLengthDeltaDecoder); }; bool FixedLengthDeltaDecoder::IsSuitableDecoderFor(const std::string& input) { diff --git a/modules/video_coding/utility/ivf_file_reader.h b/modules/video_coding/utility/ivf_file_reader.h index 5e0634f9fd..cc64d4c5c1 100644 --- a/modules/video_coding/utility/ivf_file_reader.h +++ b/modules/video_coding/utility/ivf_file_reader.h @@ -17,6 +17,7 @@ #include "absl/types/optional.h" #include "api/video/encoded_image.h" #include "api/video_codecs/video_codec.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/system/file_wrapper.h" namespace webrtc { diff --git a/p2p/base/async_stun_tcp_socket.h b/p2p/base/async_stun_tcp_socket.h index eb4eef7cdc..f0df42b52a 100644 --- a/p2p/base/async_stun_tcp_socket.h +++ b/p2p/base/async_stun_tcp_socket.h @@ -15,7 +15,6 @@ #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" @@ -32,6 +31,9 @@ class AsyncStunTCPSocket : public rtc::AsyncTCPSocketBase { explicit AsyncStunTCPSocket(rtc::Socket* socket); + AsyncStunTCPSocket(const AsyncStunTCPSocket&) = delete; + AsyncStunTCPSocket& operator=(const AsyncStunTCPSocket&) = delete; + int Send(const void* pv, size_t cb, const rtc::PacketOptions& options) override; @@ -42,8 +44,6 @@ class AsyncStunTCPSocket : public rtc::AsyncTCPSocketBase { // This method also returns the number of padding bytes needed/added to the // turn message. `pad_bytes` should be used only when `is_turn` is true. size_t GetExpectedLength(const void* data, size_t len, int* pad_bytes); - - RTC_DISALLOW_COPY_AND_ASSIGN(AsyncStunTCPSocket); }; } // namespace cricket diff --git a/p2p/base/dtls_transport.h b/p2p/base/dtls_transport.h index edfa8896ce..d503a928b4 100644 --- a/p2p/base/dtls_transport.h +++ b/p2p/base/dtls_transport.h @@ -22,7 +22,6 @@ #include "p2p/base/ice_transport_internal.h" #include "rtc_base/buffer.h" #include "rtc_base/buffer_queue.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/ssl_stream_adapter.h" #include "rtc_base/stream.h" #include "rtc_base/strings/string_builder.h" @@ -40,6 +39,9 @@ class StreamInterfaceChannel : public rtc::StreamInterface { public: explicit StreamInterfaceChannel(IceTransportInternal* ice_transport); + StreamInterfaceChannel(const StreamInterfaceChannel&) = delete; + StreamInterfaceChannel& operator=(const StreamInterfaceChannel&) = delete; + // Push in a packet; this gets pulled out from Read(). bool OnPacketReceived(const char* data, size_t size); @@ -60,8 +62,6 @@ class StreamInterfaceChannel : public rtc::StreamInterface { IceTransportInternal* const ice_transport_; // owned by DtlsTransport rtc::StreamState state_ RTC_GUARDED_BY(sequence_checker_); rtc::BufferQueue packets_ RTC_GUARDED_BY(sequence_checker_); - - RTC_DISALLOW_COPY_AND_ASSIGN(StreamInterfaceChannel); }; // This class provides a DTLS SSLStreamAdapter inside a TransportChannel-style @@ -110,6 +110,9 @@ class DtlsTransport : public DtlsTransportInternal { ~DtlsTransport() override; + DtlsTransport(const DtlsTransport&) = delete; + DtlsTransport& operator=(const DtlsTransport&) = delete; + webrtc::DtlsTransportState dtls_state() const override; const std::string& transport_name() const override; int component() const override; @@ -248,8 +251,6 @@ class DtlsTransport : public DtlsTransportInternal { bool writable_ = false; webrtc::RtcEventLog* const event_log_; - - RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransport); }; } // namespace cricket diff --git a/p2p/base/dtls_transport_internal.h b/p2p/base/dtls_transport_internal.h index 0b26a7fd7a..24c682ff0e 100644 --- a/p2p/base/dtls_transport_internal.h +++ b/p2p/base/dtls_transport_internal.h @@ -25,7 +25,6 @@ #include "p2p/base/ice_transport_internal.h" #include "p2p/base/packet_transport_internal.h" #include "rtc_base/callback_list.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/ssl_certificate.h" #include "rtc_base/ssl_fingerprint.h" #include "rtc_base/ssl_stream_adapter.h" @@ -48,6 +47,9 @@ class DtlsTransportInternal : public rtc::PacketTransportInternal { public: ~DtlsTransportInternal() override; + DtlsTransportInternal(const DtlsTransportInternal&) = delete; + DtlsTransportInternal& operator=(const DtlsTransportInternal&) = delete; + virtual webrtc::DtlsTransportState dtls_state() const = 0; virtual int component() const = 0; @@ -135,7 +137,6 @@ class DtlsTransportInternal : public rtc::PacketTransportInternal { DtlsTransportInternal(); private: - RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportInternal); webrtc::CallbackList dtls_handshake_error_callback_list_; webrtc::CallbackList diff --git a/p2p/base/p2p_transport_channel.h b/p2p/base/p2p_transport_channel.h index 28248e7948..7f5fb050e7 100644 --- a/p2p/base/p2p_transport_channel.h +++ b/p2p/base/p2p_transport_channel.h @@ -56,7 +56,6 @@ #include "p2p/base/transport_description.h" #include "rtc_base/async_packet_socket.h" #include "rtc_base/checks.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/dscp.h" #include "rtc_base/network/sent_packet.h" #include "rtc_base/network_route.h" @@ -124,6 +123,9 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal { IceControllerFactoryInterface* ice_controller_factory = nullptr); ~P2PTransportChannel() override; + P2PTransportChannel(const P2PTransportChannel&) = delete; + P2PTransportChannel& operator=(const P2PTransportChannel&) = delete; + // From TransportChannelImpl: IceTransportState GetState() const override; webrtc::IceTransportState GetIceTransportState() const override; @@ -494,8 +496,6 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal { int64_t last_data_received_ms_ = 0; IceFieldTrials field_trials_; - - RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); }; } // namespace cricket diff --git a/p2p/stunprober/stun_prober.cc b/p2p/stunprober/stun_prober.cc index 4195230313..efe0fbdea8 100644 --- a/p2p/stunprober/stun_prober.cc +++ b/p2p/stunprober/stun_prober.cc @@ -21,7 +21,6 @@ #include "rtc_base/async_packet_socket.h" #include "rtc_base/async_resolver_interface.h" #include "rtc_base/checks.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/helpers.h" #include "rtc_base/logging.h" #include "rtc_base/task_utils/to_queued_task.h" @@ -69,6 +68,9 @@ class StunProber::Requester : public sigslot::has_slots<> { const std::vector& server_ips); ~Requester() override; + Requester(const Requester&) = delete; + Requester& operator=(const Requester&) = delete; + // There is no callback for SendStunRequest as the underneath socket send is // expected to be completed immediately. Otherwise, it'll skip this request // and move to the next one. @@ -105,8 +107,6 @@ class StunProber::Requester : public sigslot::has_slots<> { int16_t num_response_received_ = 0; webrtc::SequenceChecker& thread_checker_; - - RTC_DISALLOW_COPY_AND_ASSIGN(Requester); }; StunProber::Requester::Requester( diff --git a/p2p/stunprober/stun_prober.h b/p2p/stunprober/stun_prober.h index fe2f14ca4e..b562394fcc 100644 --- a/p2p/stunprober/stun_prober.h +++ b/p2p/stunprober/stun_prober.h @@ -17,7 +17,6 @@ #include "api/sequence_checker.h" #include "rtc_base/byte_buffer.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/ip_address.h" #include "rtc_base/network.h" #include "rtc_base/socket_address.h" @@ -101,6 +100,9 @@ class RTC_EXPORT StunProber : public sigslot::has_slots<> { const rtc::NetworkManager::NetworkList& networks); ~StunProber() override; + StunProber(const StunProber&) = delete; + StunProber& operator=(const StunProber&) = delete; + // Begin performing the probe test against the `servers`. If // `shared_socket_mode` is false, each request will be done with a new socket. // Otherwise, a unique socket will be used for a single round of requests @@ -241,8 +243,6 @@ class RTC_EXPORT StunProber : public sigslot::has_slots<> { rtc::NetworkManager::NetworkList networks_; webrtc::ScopedTaskSafety task_safety_; - - RTC_DISALLOW_COPY_AND_ASSIGN(StunProber); }; } // namespace stunprober diff --git a/pc/dtmf_sender.h b/pc/dtmf_sender.h index a208b100d4..915d9874b3 100644 --- a/pc/dtmf_sender.h +++ b/pc/dtmf_sender.h @@ -18,7 +18,6 @@ #include "api/dtmf_sender_interface.h" #include "api/scoped_refptr.h" #include "pc/proxy.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/location.h" #include "rtc_base/ref_count.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" @@ -72,6 +71,9 @@ class DtmfSender : public DtmfSenderInterface, public sigslot::has_slots<> { DtmfSender(rtc::Thread* signaling_thread, DtmfProviderInterface* provider); virtual ~DtmfSender(); + DtmfSender(const DtmfSender&) = delete; + DtmfSender& operator=(const DtmfSender&) = delete; + private: DtmfSender(); @@ -96,8 +98,6 @@ class DtmfSender : public DtmfSenderInterface, public sigslot::has_slots<> { // For cancelling the tasks which feed the DTMF provider one tone at a time. rtc::scoped_refptr safety_flag_ RTC_GUARDED_BY( signaling_thread_) RTC_PT_GUARDED_BY(signaling_thread_) = nullptr; - - RTC_DISALLOW_COPY_AND_ASSIGN(DtmfSender); }; // Define proxy for DtmfSenderInterface. diff --git a/pc/jsep_transport.h b/pc/jsep_transport.h index e3e929bfd2..93604a179f 100644 --- a/pc/jsep_transport.h +++ b/pc/jsep_transport.h @@ -44,7 +44,6 @@ #include "pc/srtp_transport.h" #include "pc/transport_stats.h" #include "rtc_base/checks.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/rtc_certificate.h" #include "rtc_base/ssl_fingerprint.h" #include "rtc_base/ssl_stream_adapter.h" @@ -106,6 +105,9 @@ class JsepTransport { ~JsepTransport(); + JsepTransport(const JsepTransport&) = delete; + JsepTransport& operator=(const JsepTransport&) = delete; + // Returns the MID of this transport. This is only used for logging. const std::string& mid() const { return mid_; } @@ -326,8 +328,6 @@ class JsepTransport { // `rtcp_dtls_transport_` is destroyed. The JsepTransportController will // receive the callback and update the aggregate transport states. std::function rtcp_mux_active_callback_; - - RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport); }; } // namespace cricket diff --git a/pc/jsep_transport_controller.h b/pc/jsep_transport_controller.h index fb420090d4..4e06566806 100644 --- a/pc/jsep_transport_controller.h +++ b/pc/jsep_transport_controller.h @@ -58,7 +58,6 @@ #include "pc/transport_stats.h" #include "rtc_base/callback_list.h" #include "rtc_base/checks.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/copy_on_write_buffer.h" #include "rtc_base/helpers.h" #include "rtc_base/ref_counted_object.h" @@ -150,6 +149,9 @@ class JsepTransportController : public sigslot::has_slots<> { Config config); virtual ~JsepTransportController(); + JsepTransportController(const JsepTransportController&) = delete; + JsepTransportController& operator=(const JsepTransportController&) = delete; + // The main method to be called; applies a description at the transport // level, creating/destroying transport objects as needed and updating their // properties. This includes RTP, DTLS, and ICE (but not SCTP). At least not @@ -478,8 +480,6 @@ class JsepTransportController : public sigslot::has_slots<> { rtc::scoped_refptr certificate_; BundleManager bundles_; - - RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransportController); }; } // namespace webrtc diff --git a/pc/srtp_session.h b/pc/srtp_session.h index 89fab0daf2..f1b6a52b47 100644 --- a/pc/srtp_session.h +++ b/pc/srtp_session.h @@ -15,7 +15,6 @@ #include "api/scoped_refptr.h" #include "api/sequence_checker.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" // Forward declaration to avoid pulling in libsrtp headers here @@ -35,6 +34,9 @@ class SrtpSession { SrtpSession(); ~SrtpSession(); + SrtpSession(const SrtpSession&) = delete; + SrtpSession& operator=(const SrtpSession&) = delete; + // Configures the session for sending data using the specified // cipher-suite and key. Receiving must be done by a separate session. bool SetSend(int cs, @@ -141,7 +143,6 @@ class SrtpSession { bool external_auth_enabled_ = false; int decryption_failure_count_ = 0; bool dump_plain_rtp_ = false; - RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession); }; } // namespace cricket diff --git a/pc/video_rtp_track_source.h b/pc/video_rtp_track_source.h index 23a7cd224f..a9e43f6667 100644 --- a/pc/video_rtp_track_source.h +++ b/pc/video_rtp_track_source.h @@ -20,7 +20,6 @@ #include "api/video/video_source_interface.h" #include "media/base/video_broadcaster.h" #include "pc/video_track_source.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" @@ -45,6 +44,9 @@ class VideoRtpTrackSource : public VideoTrackSource { explicit VideoRtpTrackSource(Callback* callback); + VideoRtpTrackSource(const VideoRtpTrackSource&) = delete; + VideoRtpTrackSource& operator=(const VideoRtpTrackSource&) = delete; + // Call before the object implementing Callback finishes it's destructor. No // more callbacks will be fired after completion. Must be called on the // worker thread @@ -83,8 +85,6 @@ class VideoRtpTrackSource : public VideoTrackSource { std::vector*> encoded_sinks_ RTC_GUARDED_BY(mu_); Callback* callback_ RTC_GUARDED_BY(worker_sequence_checker_); - - RTC_DISALLOW_COPY_AND_ASSIGN(VideoRtpTrackSource); }; } // namespace webrtc diff --git a/pc/webrtc_session_description_factory.h b/pc/webrtc_session_description_factory.h index 8e80fb556d..efa208ff78 100644 --- a/pc/webrtc_session_description_factory.h +++ b/pc/webrtc_session_description_factory.h @@ -26,7 +26,6 @@ #include "pc/channel_manager.h" #include "pc/media_session.h" #include "pc/sdp_state_provider.h" -#include "rtc_base/constructor_magic.h" #include "rtc_base/message_handler.h" #include "rtc_base/rtc_certificate.h" #include "rtc_base/rtc_certificate_generator.h" @@ -92,6 +91,11 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, on_certificate_ready); virtual ~WebRtcSessionDescriptionFactory(); + WebRtcSessionDescriptionFactory(const WebRtcSessionDescriptionFactory&) = + delete; + WebRtcSessionDescriptionFactory& operator=( + const WebRtcSessionDescriptionFactory&) = delete; + static void CopyCandidatesFromSessionDescription( const SessionDescriptionInterface* source_desc, const std::string& content_name, @@ -159,8 +163,6 @@ class WebRtcSessionDescriptionFactory : public rtc::MessageHandler, std::function&)> on_certificate_ready_; - - RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSessionDescriptionFactory); }; } // namespace webrtc diff --git a/system_wrappers/source/metrics.cc b/system_wrappers/source/metrics.cc index b14eef4618..8c9cf0c574 100644 --- a/system_wrappers/source/metrics.cc +++ b/system_wrappers/source/metrics.cc @@ -11,7 +11,6 @@ #include -#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/thread_annotations.h" @@ -35,6 +34,9 @@ class RtcHistogram { RTC_DCHECK_GT(bucket_count, 0); } + RtcHistogram(const RtcHistogram&) = delete; + RtcHistogram& operator=(const RtcHistogram&) = delete; + void Add(int sample) { sample = std::min(sample, max_); sample = std::max(sample, min_ - 1); // Underflow bucket. @@ -99,8 +101,6 @@ class RtcHistogram { const int min_; const int max_; SampleInfo info_ RTC_GUARDED_BY(mutex_); - - RTC_DISALLOW_COPY_AND_ASSIGN(RtcHistogram); }; class RtcHistogramMap { @@ -108,6 +108,9 @@ class RtcHistogramMap { RtcHistogramMap() {} ~RtcHistogramMap() {} + RtcHistogramMap(const RtcHistogramMap&) = delete; + RtcHistogramMap& operator=(const RtcHistogramMap&) = delete; + Histogram* GetCountsHistogram(const std::string& name, int min, int max, @@ -178,8 +181,6 @@ class RtcHistogramMap { mutable Mutex mutex_; std::map> map_ RTC_GUARDED_BY(mutex_); - - RTC_DISALLOW_COPY_AND_ASSIGN(RtcHistogramMap); }; // RtcHistogramMap is allocated upon call to Enable(). diff --git a/test/network/network_emulation.h b/test/network/network_emulation.h index e60deafcc7..d10e9a8ebc 100644 --- a/test/network/network_emulation.h +++ b/test/network/network_emulation.h @@ -26,6 +26,7 @@ #include "api/test/network_emulation_manager.h" #include "api/test/simulated_network.h" #include "api/units/timestamp.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/copy_on_write_buffer.h" #include "rtc_base/network.h" #include "rtc_base/network_constants.h"