diff --git a/api/DEPS b/api/DEPS index ce88d34ef4..0b8a70eabf 100644 --- a/api/DEPS +++ b/api/DEPS @@ -112,6 +112,14 @@ specific_include_rules = { "+rtc_base/ref_count.h", ], + "jsep_ice_candidate\.h": [ + "+rtc_base/constructor_magic.h", + ], + + "jsep_session_description\.h": [ + "+rtc_base/constructor_magic.h", + ], + "media_stream_interface\.h": [ "+modules/audio_processing/include/audio_processing_statistics.h", "+rtc_base/ref_count.h", @@ -148,6 +156,7 @@ specific_include_rules = { ], "ref_counted_base\.h": [ + "+rtc_base/constructor_magic.h", "+rtc_base/ref_count.h", "+rtc_base/ref_counter.h", ], @@ -186,6 +195,7 @@ specific_include_rules = { ], "stats_types\.h": [ + "+rtc_base/constructor_magic.h", "+rtc_base/ref_count.h", "+rtc_base/thread_checker.h", ], @@ -194,12 +204,17 @@ specific_include_rules = { "+rtc_base/ref_count.h", ], + "audio_frame\.h": [ + "+rtc_base/constructor_magic.h", + ], + "audio_mixer\.h": [ "+rtc_base/ref_count.h", ], "audio_decoder\.h": [ "+rtc_base/buffer.h", + "+rtc_base/constructor_magic.h", ], "audio_decoder_factory\.h": [ diff --git a/call/adaptation/video_stream_adapter.cc b/call/adaptation/video_stream_adapter.cc index ce1c300a72..3d4c4dde3b 100644 --- a/call/adaptation/video_stream_adapter.cc +++ b/call/adaptation/video_stream_adapter.cc @@ -23,6 +23,7 @@ #include "call/adaptation/video_source_restrictions.h" #include "call/adaptation/video_stream_input_state.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_conversions.h" diff --git a/common_audio/audio_converter.h b/common_audio/audio_converter.h index 4afbb6d0fd..e12e601b24 100644 --- a/common_audio/audio_converter.h +++ b/common_audio/audio_converter.h @@ -15,6 +15,8 @@ #include +#include "rtc_base/constructor_magic.h" + namespace webrtc { // Format conversion (remixing and resampling) for audio. Only simple remixing @@ -33,9 +35,6 @@ class AudioConverter { size_t dst_frames); virtual ~AudioConverter() {} - AudioConverter(const AudioConverter&) = delete; - AudioConverter& operator=(const AudioConverter&) = delete; - // Convert `src`, containing `src_size` samples, to `dst`, having a sample // capacity of `dst_capacity`. Both point to a series of buffers containing // the samples for each channel. The sizes must correspond to the format @@ -65,6 +64,8 @@ class AudioConverter { const size_t src_frames_; const size_t dst_channels_; const size_t dst_frames_; + + RTC_DISALLOW_COPY_AND_ASSIGN(AudioConverter); }; } // namespace webrtc diff --git a/common_audio/resampler/push_sinc_resampler.h b/common_audio/resampler/push_sinc_resampler.h index 7946ef8f82..88792d427a 100644 --- a/common_audio/resampler/push_sinc_resampler.h +++ b/common_audio/resampler/push_sinc_resampler.h @@ -17,6 +17,7 @@ #include #include "common_audio/resampler/sinc_resampler.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -32,9 +33,6 @@ class PushSincResampler : public SincResamplerCallback { PushSincResampler(size_t source_frames, size_t destination_frames); ~PushSincResampler() override; - PushSincResampler(const PushSincResampler&) = delete; - PushSincResampler& operator=(const PushSincResampler&) = delete; - // Perform the resampling. `source_frames` must always equal the // `source_frames` provided at construction. `destination_capacity` must be // at least as large as `destination_frames`. Returns the number of samples @@ -74,6 +72,8 @@ class PushSincResampler : public SincResamplerCallback { // Used to assert we are only requested for as much data as is available. size_t source_available_; + + RTC_DISALLOW_COPY_AND_ASSIGN(PushSincResampler); }; } // namespace webrtc diff --git a/common_audio/resampler/sinc_resampler.h b/common_audio/resampler/sinc_resampler.h index b89bba7ab4..d071e96f4f 100644 --- a/common_audio/resampler/sinc_resampler.h +++ b/common_audio/resampler/sinc_resampler.h @@ -18,6 +18,7 @@ #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/gtest_prod_util.h" #include "rtc_base/memory/aligned_malloc.h" #include "rtc_base/system/arch.h" @@ -63,9 +64,6 @@ class SincResampler { SincResamplerCallback* read_cb); virtual ~SincResampler(); - SincResampler(const SincResampler&) = delete; - SincResampler& operator=(const SincResampler&) = delete; - // Resample `frames` of data from `read_cb_` into `destination`. void Resample(size_t frames, float* destination); @@ -174,6 +172,8 @@ class SincResampler { float* const r2_; float* r3_; float* r4_; + + RTC_DISALLOW_COPY_AND_ASSIGN(SincResampler); }; } // namespace webrtc diff --git a/common_audio/resampler/sinusoidal_linear_chirp_source.h b/common_audio/resampler/sinusoidal_linear_chirp_source.h index a57cbfef02..8534119e5c 100644 --- a/common_audio/resampler/sinusoidal_linear_chirp_source.h +++ b/common_audio/resampler/sinusoidal_linear_chirp_source.h @@ -15,6 +15,7 @@ #define COMMON_AUDIO_RESAMPLER_SINUSOIDAL_LINEAR_CHIRP_SOURCE_H_ #include "common_audio/resampler/sinc_resampler.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -32,10 +33,6 @@ class SinusoidalLinearChirpSource : public SincResamplerCallback { ~SinusoidalLinearChirpSource() override {} - SinusoidalLinearChirpSource(const SinusoidalLinearChirpSource&) = delete; - SinusoidalLinearChirpSource& operator=(const SinusoidalLinearChirpSource&) = - delete; - void Run(size_t frames, float* destination) override; double Frequency(size_t position); @@ -49,6 +46,8 @@ class SinusoidalLinearChirpSource : public SincResamplerCallback { double k_; size_t current_index_; double delay_samples_; + + RTC_DISALLOW_COPY_AND_ASSIGN(SinusoidalLinearChirpSource); }; } // namespace webrtc diff --git a/examples/peerconnection/client/main.cc b/examples/peerconnection/client/main.cc index 32bc52bda4..04a331d2bd 100644 --- a/examples/peerconnection/client/main.cc +++ b/examples/peerconnection/client/main.cc @@ -23,6 +23,7 @@ #include "examples/peerconnection/client/main_wnd.h" #include "examples/peerconnection/client/peer_connection_client.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ssl_adapter.h" #include "rtc_base/string_utils.h" // For ToUtf8 #include "rtc_base/win32_socket_init.h" @@ -39,9 +40,6 @@ class WindowsCommandLineArguments { public: WindowsCommandLineArguments(); - WindowsCommandLineArguments(const WindowsCommandLineArguments&) = delete; - WindowsCommandLineArguments& operator=(WindowsCommandLineArguments&) = delete; - int argc() { return argv_.size(); } char** argv() { return argv_.data(); } @@ -50,6 +48,9 @@ class WindowsCommandLineArguments { std::vector args_; // Pointers, to get layout compatible with char** argv. std::vector argv_; + + private: + RTC_DISALLOW_COPY_AND_ASSIGN(WindowsCommandLineArguments); }; WindowsCommandLineArguments::WindowsCommandLineArguments() { diff --git a/logging/rtc_event_log/rtc_event_log_impl.cc b/logging/rtc_event_log/rtc_event_log_impl.cc index df59cba79b..4237b2a713 100644 --- a/logging/rtc_event_log/rtc_event_log_impl.cc +++ b/logging/rtc_event_log/rtc_event_log_impl.cc @@ -22,6 +22,7 @@ #include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h" #include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/event.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_conversions.h" diff --git a/media/base/media_engine.h b/media/base/media_engine.h index 1778104a30..500e1ba5e5 100644 --- a/media/base/media_engine.h +++ b/media/base/media_engine.h @@ -64,9 +64,7 @@ class VoiceEngineInterface : public RtpHeaderExtensionQueryInterface { public: VoiceEngineInterface() = default; virtual ~VoiceEngineInterface() = default; - - VoiceEngineInterface(const VoiceEngineInterface&) = delete; - VoiceEngineInterface& operator=(const VoiceEngineInterface&) = delete; + RTC_DISALLOW_COPY_AND_ASSIGN(VoiceEngineInterface); // Initialization // Starts the engine. @@ -100,9 +98,7 @@ class VideoEngineInterface : public RtpHeaderExtensionQueryInterface { public: VideoEngineInterface() = default; virtual ~VideoEngineInterface() = default; - - VideoEngineInterface(const VideoEngineInterface&) = delete; - VideoEngineInterface& operator=(const VideoEngineInterface&) = delete; + RTC_DISALLOW_COPY_AND_ASSIGN(VideoEngineInterface); // Creates a video media channel, paired with the specified voice channel. // Returns NULL on failure. diff --git a/media/base/stream_params.h b/media/base/stream_params.h index c9c8a09592..1f46469cb5 100644 --- a/media/base/stream_params.h +++ b/media/base/stream_params.h @@ -54,6 +54,7 @@ #include "absl/algorithm/container.h" #include "media/base/rid_description.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/unique_id_generator.h" namespace cricket { diff --git a/media/base/video_adapter.h b/media/base/video_adapter.h index 071330f330..1bae10d419 100644 --- a/media/base/video_adapter.h +++ b/media/base/video_adapter.h @@ -19,6 +19,7 @@ #include "api/video/video_source_interface.h" #include "common_video/framerate_controller.h" #include "media/base/video_common.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/system/rtc_export.h" #include "rtc_base/thread_annotations.h" @@ -37,9 +38,6 @@ class RTC_EXPORT VideoAdapter { explicit VideoAdapter(int source_resolution_alignment); virtual ~VideoAdapter(); - VideoAdapter(const VideoAdapter&) = delete; - VideoAdapter& operator=(const VideoAdapter&) = delete; - // Return the adapted resolution and cropping parameters given the // input resolution. The input frame should first be cropped, then // scaled to the final output resolution. Returns true if the frame @@ -148,6 +146,8 @@ class RTC_EXPORT VideoAdapter { // The critical section to protect the above variables. mutable webrtc::Mutex mutex_; + + RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter); }; } // namespace cricket diff --git a/media/sctp/usrsctp_transport.h b/media/sctp/usrsctp_transport.h index 2dd6abf9c5..06988fd156 100644 --- a/media/sctp/usrsctp_transport.h +++ b/media/sctp/usrsctp_transport.h @@ -22,6 +22,7 @@ #include "absl/types/optional.h" #include "rtc_base/buffer.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/copy_on_write_buffer.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/third_party/sigslot/sigslot.h" @@ -75,9 +76,6 @@ class UsrsctpTransport : public SctpTransportInternal, rtc::PacketTransportInternal* transport); ~UsrsctpTransport() override; - UsrsctpTransport(const UsrsctpTransport&) = delete; - UsrsctpTransport& operator=(const UsrsctpTransport&) = delete; - // SctpTransportInternal overrides (see sctptransportinternal.h for comments). void SetDtlsTransport(rtc::PacketTransportInternal* transport) override; bool Start(int local_port, int remote_port, int max_message_size) override; @@ -287,6 +285,8 @@ class UsrsctpTransport : public SctpTransportInternal, uintptr_t id_ = 0; friend class UsrsctpTransportMap; + + RTC_DISALLOW_COPY_AND_ASSIGN(UsrsctpTransport); }; class UsrsctpTransportMap; diff --git a/media/sctp/usrsctp_transport_reliability_unittest.cc b/media/sctp/usrsctp_transport_reliability_unittest.cc index 987dd04358..a06d8d84dd 100644 --- a/media/sctp/usrsctp_transport_reliability_unittest.cc +++ b/media/sctp/usrsctp_transport_reliability_unittest.cc @@ -58,9 +58,6 @@ class SimulatedPacketTransport final : public rtc::PacketTransportInternal { SignalWritableState(this); } - SimulatedPacketTransport(const SimulatedPacketTransport&) = delete; - SimulatedPacketTransport& operator=(const SimulatedPacketTransport&) = delete; - const std::string& transport_name() const override { return transport_name_; } bool writable() const override { return destination_ != nullptr; } @@ -132,6 +129,7 @@ class SimulatedPacketTransport final : public rtc::PacketTransportInternal { std::atomic destination_ ATOMIC_VAR_INIT(nullptr); webrtc::Random random_; webrtc::ScopedTaskSafety task_safety_; + RTC_DISALLOW_COPY_AND_ASSIGN(SimulatedPacketTransport); }; /** @@ -158,9 +156,6 @@ class SctpDataSender final { RTC_DCHECK(transport_); } - SctpDataSender(const SctpDataSender&) = delete; - SctpDataSender& operator=(const SctpDataSender&) = delete; - void Start() { thread_->PostTask(ToQueuedTask(task_safety_.flag(), [this] { if (started_) { @@ -241,6 +236,7 @@ class SctpDataSender final { std::atomic num_bytes_sent_ ATOMIC_VAR_INIT(0); absl::optional last_error_; webrtc::ScopedTaskSafetyDetached task_safety_; + RTC_DISALLOW_COPY_AND_ASSIGN(SctpDataSender); }; /** @@ -255,9 +251,6 @@ class SctpDataReceiver final : public sigslot::has_slots<> { : receiver_id_(receiver_id), target_messages_count_(target_messages_count) {} - SctpDataReceiver(const SctpDataReceiver&) = delete; - SctpDataReceiver& operator=(const SctpDataReceiver&) = delete; - void OnDataReceived(const cricket::ReceiveDataParams& params, const rtc::CopyOnWriteBuffer& data) { num_bytes_received_ += data.size(); @@ -285,6 +278,7 @@ class SctpDataReceiver final : public sigslot::has_slots<> { rtc::Event received_target_messages_count_{true, false}; const uint32_t receiver_id_; const uint64_t target_messages_count_; + RTC_DISALLOW_COPY_AND_ASSIGN(SctpDataReceiver); }; /** @@ -303,9 +297,6 @@ class ThreadPool final { } } - ThreadPool(const ThreadPool&) = delete; - ThreadPool& operator=(const ThreadPool&) = delete; - rtc::Thread* GetRandomThread() { return threads_[random_.Rand(0U, threads_.size() - 1)].get(); } @@ -313,6 +304,7 @@ class ThreadPool final { private: webrtc::Random random_; std::vector> threads_; + RTC_DISALLOW_COPY_AND_ASSIGN(ThreadPool); }; /** @@ -368,9 +360,6 @@ class SctpPingPong final { }); } - SctpPingPong(const SctpPingPong&) = delete; - SctpPingPong& operator=(const SctpPingPong&) = delete; - bool Start() { CreateTwoConnectedSctpTransportsWithAllStreams(); @@ -588,6 +577,7 @@ class SctpPingPong final { const uint8_t packet_loss_percents_; const uint16_t avg_send_delay_millis_; const webrtc::SendDataParams send_params_; + RTC_DISALLOW_COPY_AND_ASSIGN(SctpPingPong); }; /** diff --git a/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h b/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h index 8fdf2f7728..367f659542 100644 --- a/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h +++ b/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h @@ -15,6 +15,7 @@ #include "modules/audio_coding/audio_network_adaptor/controller.h" #include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ignore_wundef.h" #include "rtc_base/system/file_wrapper.h" #if WEBRTC_ENABLE_PROTOBUF diff --git a/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc b/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc index c688004363..a34c563d33 100644 --- a/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc +++ b/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc @@ -14,6 +14,7 @@ #include #include "common_audio/vad/mock/mock_vad.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/numerics/safe_conversions.h" #include "test/gtest.h" #include "test/mock_audio_encoder.h" @@ -49,9 +50,6 @@ class AudioEncoderCngTest : public ::testing::Test { EXPECT_CALL(*mock_encoder_, NumChannels()).WillRepeatedly(Return(1)); } - AudioEncoderCngTest(const AudioEncoderCngTest&) = delete; - AudioEncoderCngTest& operator=(const AudioEncoderCngTest&) = delete; - void TearDown() override { EXPECT_CALL(*mock_vad_, Die()).Times(1); cng_.reset(); @@ -210,6 +208,8 @@ class AudioEncoderCngTest : public ::testing::Test { rtc::Buffer encoded_; AudioEncoder::EncodedInfo encoded_info_; int sample_rate_hz_; + + RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderCngTest); }; TEST_F(AudioEncoderCngTest, CreateAndDestroy) { diff --git a/modules/audio_device/linux/latebindingsymboltable_linux.h b/modules/audio_device/linux/latebindingsymboltable_linux.h index 9484b075ef..6cfb659749 100644 --- a/modules/audio_device/linux/latebindingsymboltable_linux.h +++ b/modules/audio_device/linux/latebindingsymboltable_linux.h @@ -15,6 +15,7 @@ #include #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" // This file provides macros for creating "symbol table" classes to simplify the // dynamic loading of symbols from DLLs. Currently the implementation only @@ -54,9 +55,6 @@ class LateBindingSymbolTable { ~LateBindingSymbolTable() { Unload(); } - LateBindingSymbolTable(const LateBindingSymbolTable&) = delete; - LateBindingSymbolTable& operator=(LateBindingSymbolTable&) = delete; - static int NumSymbols() { return SYMBOL_TABLE_SIZE; } // We do not use this, but we offer it for theoretical convenience. @@ -111,6 +109,8 @@ class LateBindingSymbolTable { DllHandle handle_; bool undefined_symbols_; void* symbols_[SYMBOL_TABLE_SIZE]; + + RTC_DISALLOW_COPY_AND_ASSIGN(LateBindingSymbolTable); }; // This macro must be invoked in a header to declare a symbol table class. diff --git a/modules/audio_processing/aec3/comfort_noise_generator.h b/modules/audio_processing/aec3/comfort_noise_generator.h index 2785b765c5..16eaf3550f 100644 --- a/modules/audio_processing/aec3/comfort_noise_generator.h +++ b/modules/audio_processing/aec3/comfort_noise_generator.h @@ -19,6 +19,7 @@ #include "modules/audio_processing/aec3/aec3_common.h" #include "modules/audio_processing/aec3/aec_state.h" #include "modules/audio_processing/aec3/fft_data.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/system/arch.h" namespace webrtc { diff --git a/modules/audio_processing/aec3/echo_audibility.h b/modules/audio_processing/aec3/echo_audibility.h index b9d6f87d2a..1ffc017b7d 100644 --- a/modules/audio_processing/aec3/echo_audibility.h +++ b/modules/audio_processing/aec3/echo_audibility.h @@ -19,6 +19,7 @@ #include "modules/audio_processing/aec3/render_buffer.h" #include "modules/audio_processing/aec3/spectrum_buffer.h" #include "modules/audio_processing/aec3/stationarity_estimator.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { diff --git a/modules/audio_processing/aec3/filter_analyzer.h b/modules/audio_processing/aec3/filter_analyzer.h index e05fb71138..b0b7070119 100644 --- a/modules/audio_processing/aec3/filter_analyzer.h +++ b/modules/audio_processing/aec3/filter_analyzer.h @@ -20,6 +20,7 @@ #include "api/array_view.h" #include "api/audio/echo_canceller3_config.h" #include "modules/audio_processing/aec3/aec3_common.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { diff --git a/modules/audio_processing/agc2/limiter.h b/modules/audio_processing/agc2/limiter.h index 669e202c20..f8894a308d 100644 --- a/modules/audio_processing/agc2/limiter.h +++ b/modules/audio_processing/agc2/limiter.h @@ -17,6 +17,7 @@ #include "modules/audio_processing/agc2/fixed_digital_level_estimator.h" #include "modules/audio_processing/agc2/interpolated_gain_curve.h" #include "modules/audio_processing/include/audio_frame_view.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { class ApmDataDumper; diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index 03c193d780..492b53a344 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc @@ -30,6 +30,7 @@ #include "modules/audio_processing/optionally_built_submodule_creators.h" #include "rtc_base/atomic_ops.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/logging.h" #include "rtc_base/ref_counted_object.h" #include "rtc_base/time_utils.h" diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h index b7e2841d00..4d567ca110 100644 --- a/modules/audio_processing/include/audio_processing.h +++ b/modules/audio_processing/include/audio_processing.h @@ -30,6 +30,7 @@ #include "api/scoped_refptr.h" #include "modules/audio_processing/include/audio_processing_statistics.h" #include "rtc_base/arraysize.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ref_count.h" #include "rtc_base/system/file_wrapper.h" #include "rtc_base/system/rtc_export.h" diff --git a/modules/audio_processing/test/conversational_speech/simulator.cc b/modules/audio_processing/test/conversational_speech/simulator.cc index c0fb589852..20c8608c9e 100644 --- a/modules/audio_processing/test/conversational_speech/simulator.cc +++ b/modules/audio_processing/test/conversational_speech/simulator.cc @@ -22,6 +22,7 @@ #include "common_audio/include/audio_util.h" #include "common_audio/wav_file.h" #include "modules/audio_processing/test/conversational_speech/wavreader_interface.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_conversions.h" #include "test/testsupport/file_utils.h" diff --git a/modules/audio_processing/test/conversational_speech/simulator.h b/modules/audio_processing/test/conversational_speech/simulator.h index 2584782c22..a9992eb5d8 100644 --- a/modules/audio_processing/test/conversational_speech/simulator.h +++ b/modules/audio_processing/test/conversational_speech/simulator.h @@ -17,6 +17,7 @@ #include #include "modules/audio_processing/test/conversational_speech/multiend_call.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { namespace test { diff --git a/modules/desktop_capture/desktop_frame_win.h b/modules/desktop_capture/desktop_frame_win.h index f8faad6777..73e864868d 100644 --- a/modules/desktop_capture/desktop_frame_win.h +++ b/modules/desktop_capture/desktop_frame_win.h @@ -16,6 +16,7 @@ #include #include "modules/desktop_capture/desktop_frame.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -25,9 +26,6 @@ class DesktopFrameWin : public DesktopFrame { public: ~DesktopFrameWin() override; - DesktopFrameWin(const DesktopFrameWin&) = delete; - DesktopFrameWin& operator=(const DesktopFrameWin&) = delete; - static std::unique_ptr Create(DesktopSize size, SharedMemoryFactory* shared_memory_factory, HDC hdc); @@ -42,6 +40,8 @@ class DesktopFrameWin : public DesktopFrame { HBITMAP bitmap_; std::unique_ptr owned_shared_memory_; + + RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWin); }; } // namespace webrtc diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.h b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.h index 7663cb60ae..79bdf031b4 100644 --- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.h +++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.h @@ -15,6 +15,7 @@ #include "modules/desktop_capture/desktop_capturer.h" #include "modules/desktop_capture/linux/wayland/screencast_portal.h" #include "modules/desktop_capture/linux/wayland/shared_screencast_stream.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -24,9 +25,6 @@ class BaseCapturerPipeWire : public DesktopCapturer, BaseCapturerPipeWire(const DesktopCaptureOptions& options); ~BaseCapturerPipeWire() override; - BaseCapturerPipeWire(const BaseCapturerPipeWire&) = delete; - BaseCapturerPipeWire& operator=(const BaseCapturerPipeWire&) = delete; - // DesktopCapturer interface. void Start(Callback* delegate) override; void CaptureFrame() override; @@ -44,6 +42,8 @@ class BaseCapturerPipeWire : public DesktopCapturer, Callback* callback_ = nullptr; bool capturer_failed_ = false; std::unique_ptr screencast_portal_; + + RTC_DISALLOW_COPY_AND_ASSIGN(BaseCapturerPipeWire); }; } // namespace webrtc diff --git a/modules/desktop_capture/linux/x11/screen_capturer_x11.h b/modules/desktop_capture/linux/x11/screen_capturer_x11.h index d2a437aaa2..ebf18a451b 100644 --- a/modules/desktop_capture/linux/x11/screen_capturer_x11.h +++ b/modules/desktop_capture/linux/x11/screen_capturer_x11.h @@ -29,6 +29,7 @@ #include "modules/desktop_capture/screen_capture_frame_queue.h" #include "modules/desktop_capture/screen_capturer_helper.h" #include "modules/desktop_capture/shared_desktop_frame.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -45,9 +46,6 @@ class ScreenCapturerX11 : public DesktopCapturer, ScreenCapturerX11(); ~ScreenCapturerX11() override; - ScreenCapturerX11(const ScreenCapturerX11&) = delete; - ScreenCapturerX11& operator=(const ScreenCapturerX11&) = delete; - static std::unique_ptr CreateRawScreenCapturer( const DesktopCaptureOptions& options); @@ -140,6 +138,8 @@ class ScreenCapturerX11 : public DesktopCapturer, DesktopRegion last_invalid_region_; std::unique_ptr atom_cache_; + + RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerX11); }; } // namespace webrtc diff --git a/modules/desktop_capture/linux/x11/shared_x_display.h b/modules/desktop_capture/linux/x11/shared_x_display.h index 6405c36a2d..13e1c8d2d5 100644 --- a/modules/desktop_capture/linux/x11/shared_x_display.h +++ b/modules/desktop_capture/linux/x11/shared_x_display.h @@ -17,6 +17,7 @@ #include "api/ref_counted_base.h" #include "api/scoped_refptr.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/system/rtc_export.h" // Including Xlib.h will involve evil defines (Bool, Status, True, False), which @@ -64,9 +65,6 @@ class RTC_EXPORT SharedXDisplay ~SharedXDisplay(); - SharedXDisplay(const SharedXDisplay&) = delete; - SharedXDisplay& operator=(const SharedXDisplay&) = delete; - protected: // Takes ownership of `display`. explicit SharedXDisplay(Display* display); @@ -77,6 +75,8 @@ class RTC_EXPORT SharedXDisplay Display* display_; EventHandlersMap event_handlers_; + + RTC_DISALLOW_COPY_AND_ASSIGN(SharedXDisplay); }; } // namespace webrtc diff --git a/modules/desktop_capture/linux/x11/window_capturer_x11.h b/modules/desktop_capture/linux/x11/window_capturer_x11.h index ac591c272e..f15b1474e0 100644 --- a/modules/desktop_capture/linux/x11/window_capturer_x11.h +++ b/modules/desktop_capture/linux/x11/window_capturer_x11.h @@ -25,6 +25,7 @@ #include "modules/desktop_capture/linux/x11/window_finder_x11.h" #include "modules/desktop_capture/linux/x11/x_atom_cache.h" #include "modules/desktop_capture/linux/x11/x_server_pixel_buffer.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -34,9 +35,6 @@ class WindowCapturerX11 : public DesktopCapturer, explicit WindowCapturerX11(const DesktopCaptureOptions& options); ~WindowCapturerX11() override; - WindowCapturerX11(const WindowCapturerX11&) = delete; - WindowCapturerX11& operator=(const WindowCapturerX11&) = delete; - static std::unique_ptr CreateRawWindowCapturer( const DesktopCaptureOptions& options); @@ -67,6 +65,8 @@ class WindowCapturerX11 : public DesktopCapturer, XServerPixelBuffer x_server_pixel_buffer_; XAtomCache atom_cache_; WindowFinderX11 window_finder_; + + RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerX11); }; } // namespace webrtc diff --git a/modules/desktop_capture/linux/x11/window_list_utils.cc b/modules/desktop_capture/linux/x11/window_list_utils.cc index ff2d467e29..a366f9e061 100644 --- a/modules/desktop_capture/linux/x11/window_list_utils.cc +++ b/modules/desktop_capture/linux/x11/window_list_utils.cc @@ -19,6 +19,7 @@ #include "modules/desktop_capture/linux/x11/x_error_trap.h" #include "modules/desktop_capture/linux/x11/x_window_property.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/logging.h" namespace webrtc { diff --git a/modules/desktop_capture/linux/x11/x_error_trap.h b/modules/desktop_capture/linux/x11/x_error_trap.h index 882d690922..ceb660ccbd 100644 --- a/modules/desktop_capture/linux/x11/x_error_trap.h +++ b/modules/desktop_capture/linux/x11/x_error_trap.h @@ -13,6 +13,8 @@ #include +#include "rtc_base/constructor_magic.h" + namespace webrtc { // Helper class that registers X Window error handler. Caller can use @@ -22,15 +24,14 @@ class XErrorTrap { explicit XErrorTrap(Display* display); ~XErrorTrap(); - XErrorTrap(const XErrorTrap&) = delete; - XErrorTrap& operator=(const XErrorTrap&) = delete; - // Returns last error and removes unregisters the error handler. int GetLastErrorAndDisable(); private: XErrorHandler original_error_handler_; bool enabled_; + + RTC_DISALLOW_COPY_AND_ASSIGN(XErrorTrap); }; } // namespace webrtc diff --git a/modules/desktop_capture/linux/x11/x_server_pixel_buffer.h b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.h index 38af3a3e76..84e1de35e5 100644 --- a/modules/desktop_capture/linux/x11/x_server_pixel_buffer.h +++ b/modules/desktop_capture/linux/x11/x_server_pixel_buffer.h @@ -20,6 +20,7 @@ #include #include "modules/desktop_capture/desktop_geometry.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -33,9 +34,6 @@ class XServerPixelBuffer { XServerPixelBuffer(); ~XServerPixelBuffer(); - XServerPixelBuffer(const XServerPixelBuffer&) = delete; - XServerPixelBuffer& operator=(const XServerPixelBuffer&) = delete; - void Release(); // Allocate (or reallocate) the pixel buffer for `window`. Returns false in @@ -82,6 +80,8 @@ class XServerPixelBuffer { GC shm_gc_ = nullptr; bool xshm_get_image_succeeded_ = false; std::vector icc_profile_; + + RTC_DISALLOW_COPY_AND_ASSIGN(XServerPixelBuffer); }; } // namespace webrtc diff --git a/modules/desktop_capture/linux/x11/x_window_property.h b/modules/desktop_capture/linux/x11/x_window_property.h index 28dfb97311..71cbf06eb3 100644 --- a/modules/desktop_capture/linux/x11/x_window_property.h +++ b/modules/desktop_capture/linux/x11/x_window_property.h @@ -14,6 +14,8 @@ #include #include +#include "rtc_base/constructor_magic.h" + namespace webrtc { class XWindowPropertyBase { @@ -24,9 +26,6 @@ class XWindowPropertyBase { int expected_size); virtual ~XWindowPropertyBase(); - XWindowPropertyBase(const XWindowPropertyBase&) = delete; - XWindowPropertyBase& operator=(const XWindowPropertyBase&) = delete; - // True if we got properly value successfully. bool is_valid() const { return is_valid_; } @@ -39,6 +38,8 @@ class XWindowPropertyBase { private: bool is_valid_ = false; unsigned long size_ = 0; // NOLINT: type required by XGetWindowProperty + + RTC_DISALLOW_COPY_AND_ASSIGN(XWindowPropertyBase); }; // Convenience wrapper for XGetWindowProperty() results. @@ -49,13 +50,12 @@ class XWindowProperty : public XWindowPropertyBase { : XWindowPropertyBase(display, window, property, sizeof(PropertyType)) {} ~XWindowProperty() override = default; - XWindowProperty(const XWindowProperty&) = delete; - XWindowProperty& operator=(const XWindowProperty&) = delete; - const PropertyType* data() const { return reinterpret_cast(data_); } PropertyType* data() { return reinterpret_cast(data_); } + + RTC_DISALLOW_COPY_AND_ASSIGN(XWindowProperty); }; } // namespace webrtc diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm index 634849122e..f10111a7f0 100644 --- a/modules/desktop_capture/mac/screen_capturer_mac.mm +++ b/modules/desktop_capture/mac/screen_capturer_mac.mm @@ -15,6 +15,7 @@ #include "modules/desktop_capture/mac/desktop_frame_provider.h" #include "modules/desktop_capture/mac/window_list_utils.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/logging.h" #include "rtc_base/time_utils.h" #include "rtc_base/trace_event.h" diff --git a/modules/desktop_capture/screen_capturer_integration_test.cc b/modules/desktop_capture/screen_capturer_integration_test.cc index b33427ad42..8350ff669b 100644 --- a/modules/desktop_capture/screen_capturer_integration_test.cc +++ b/modules/desktop_capture/screen_capturer_integration_test.cc @@ -25,6 +25,7 @@ #include "modules/desktop_capture/rgba_color.h" #include "modules/desktop_capture/screen_drawer.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/logging.h" #include "rtc_base/third_party/base64/base64.h" #include "test/gmock.h" diff --git a/modules/desktop_capture/win/desktop.h b/modules/desktop_capture/win/desktop.h index 01bed8592d..382df608c8 100644 --- a/modules/desktop_capture/win/desktop.h +++ b/modules/desktop_capture/win/desktop.h @@ -15,6 +15,7 @@ #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -23,9 +24,6 @@ class RTC_EXPORT Desktop { public: ~Desktop(); - Desktop(const Desktop&) = delete; - Desktop& operator=(const Desktop&) = delete; - // Returns the name of the desktop represented by the object. Return false if // quering the name failed for any reason. bool GetName(std::wstring* desktop_name_out) const; @@ -58,6 +56,8 @@ class RTC_EXPORT Desktop { // True if `desktop_` must be closed on teardown. bool own_; + + RTC_DISALLOW_COPY_AND_ASSIGN(Desktop); }; } // namespace webrtc diff --git a/modules/desktop_capture/win/scoped_gdi_object.h b/modules/desktop_capture/win/scoped_gdi_object.h index 2b01941e20..d3ac9b9443 100644 --- a/modules/desktop_capture/win/scoped_gdi_object.h +++ b/modules/desktop_capture/win/scoped_gdi_object.h @@ -13,6 +13,8 @@ #include +#include "rtc_base/constructor_magic.h" + namespace webrtc { namespace win { @@ -25,9 +27,6 @@ class ScopedGDIObject { ~ScopedGDIObject() { Traits::Close(handle_); } - ScopedGDIObject(const ScopedGDIObject&) = delete; - ScopedGDIObject& operator=(const ScopedGDIObject&) = delete; - T Get() { return handle_; } void Set(T object) { @@ -51,6 +50,8 @@ class ScopedGDIObject { private: T handle_; + + RTC_DISALLOW_COPY_AND_ASSIGN(ScopedGDIObject); }; // The traits class that uses DeleteObject() to close a handle. diff --git a/modules/desktop_capture/win/scoped_thread_desktop.h b/modules/desktop_capture/win/scoped_thread_desktop.h index 98f151a46c..04abaafeeb 100644 --- a/modules/desktop_capture/win/scoped_thread_desktop.h +++ b/modules/desktop_capture/win/scoped_thread_desktop.h @@ -15,6 +15,7 @@ #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -26,9 +27,6 @@ class RTC_EXPORT ScopedThreadDesktop { ScopedThreadDesktop(); ~ScopedThreadDesktop(); - ScopedThreadDesktop(const ScopedThreadDesktop&) = delete; - ScopedThreadDesktop& operator=(const ScopedThreadDesktop&) = delete; - // Returns true if `desktop` has the same desktop name as the currently // assigned desktop (if assigned) or as the initial desktop (if not assigned). // Returns false in any other case including failing Win32 APIs and @@ -48,6 +46,8 @@ class RTC_EXPORT ScopedThreadDesktop { // The desktop handle assigned to the calling thread at creation. std::unique_ptr initial_; + + RTC_DISALLOW_COPY_AND_ASSIGN(ScopedThreadDesktop); }; } // namespace webrtc diff --git a/modules/desktop_capture/win/screen_capturer_win_directx.h b/modules/desktop_capture/win/screen_capturer_win_directx.h index d64913ed10..2d0fce6f90 100644 --- a/modules/desktop_capture/win/screen_capturer_win_directx.h +++ b/modules/desktop_capture/win/screen_capturer_win_directx.h @@ -23,6 +23,7 @@ #include "modules/desktop_capture/screen_capture_frame_queue.h" #include "modules/desktop_capture/win/dxgi_duplicator_controller.h" #include "modules/desktop_capture/win/dxgi_frame.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -73,9 +74,6 @@ class RTC_EXPORT ScreenCapturerWinDirectx : public DesktopCapturer { ~ScreenCapturerWinDirectx() override; - ScreenCapturerWinDirectx(const ScreenCapturerWinDirectx&) = delete; - ScreenCapturerWinDirectx& operator=(const ScreenCapturerWinDirectx&) = delete; - // DesktopCapturer implementation. void Start(Callback* callback) override; void SetSharedMemoryFactory( @@ -90,6 +88,8 @@ class RTC_EXPORT ScreenCapturerWinDirectx : public DesktopCapturer { std::unique_ptr shared_memory_factory_; Callback* callback_ = nullptr; SourceId current_screen_id_ = kFullDesktopScreenId; + + RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinDirectx); }; } // namespace webrtc diff --git a/modules/desktop_capture/win/screen_capturer_win_gdi.h b/modules/desktop_capture/win/screen_capturer_win_gdi.h index 7c3977ed42..e006c79021 100644 --- a/modules/desktop_capture/win/screen_capturer_win_gdi.h +++ b/modules/desktop_capture/win/screen_capturer_win_gdi.h @@ -20,6 +20,7 @@ #include "modules/desktop_capture/shared_desktop_frame.h" #include "modules/desktop_capture/win/display_configuration_monitor.h" #include "modules/desktop_capture/win/scoped_thread_desktop.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -34,9 +35,6 @@ class ScreenCapturerWinGdi : public DesktopCapturer { explicit ScreenCapturerWinGdi(const DesktopCaptureOptions& options); ~ScreenCapturerWinGdi() override; - ScreenCapturerWinGdi(const ScreenCapturerWinGdi&) = delete; - ScreenCapturerWinGdi& operator=(const ScreenCapturerWinGdi&) = delete; - // Overridden from ScreenCapturer: void Start(Callback* callback) override; void SetSharedMemoryFactory( @@ -76,6 +74,8 @@ class ScreenCapturerWinGdi : public DesktopCapturer { HMODULE dwmapi_library_ = NULL; DwmEnableCompositionFunc composition_func_ = nullptr; + + RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinGdi); }; } // namespace webrtc diff --git a/modules/desktop_capture/win/screen_capturer_win_magnifier.h b/modules/desktop_capture/win/screen_capturer_win_magnifier.h index 07c5b1e9e6..29966e9535 100644 --- a/modules/desktop_capture/win/screen_capturer_win_magnifier.h +++ b/modules/desktop_capture/win/screen_capturer_win_magnifier.h @@ -22,6 +22,7 @@ #include "modules/desktop_capture/screen_capturer_helper.h" #include "modules/desktop_capture/shared_desktop_frame.h" #include "modules/desktop_capture/win/scoped_thread_desktop.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -41,10 +42,6 @@ class ScreenCapturerWinMagnifier : public DesktopCapturer { ScreenCapturerWinMagnifier(); ~ScreenCapturerWinMagnifier() override; - ScreenCapturerWinMagnifier(const ScreenCapturerWinMagnifier&) = delete; - ScreenCapturerWinMagnifier& operator=(const ScreenCapturerWinMagnifier&) = - delete; - // Overridden from ScreenCapturer: void Start(Callback* callback) override; void SetSharedMemoryFactory( @@ -133,6 +130,8 @@ class ScreenCapturerWinMagnifier : public DesktopCapturer { // True if the last OnMagImageScalingCallback was called and handled // successfully. Reset at the beginning of each CaptureImage call. bool magnifier_capture_succeeded_ = true; + + RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerWinMagnifier); }; } // namespace webrtc diff --git a/modules/desktop_capture/win/window_capture_utils.h b/modules/desktop_capture/win/window_capture_utils.h index caea07958d..335d873742 100644 --- a/modules/desktop_capture/win/window_capture_utils.h +++ b/modules/desktop_capture/win/window_capture_utils.h @@ -17,6 +17,7 @@ #include "modules/desktop_capture/desktop_capturer.h" #include "modules/desktop_capture/desktop_geometry.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -103,9 +104,6 @@ class WindowCaptureHelperWin { WindowCaptureHelperWin(); ~WindowCaptureHelperWin(); - WindowCaptureHelperWin(const WindowCaptureHelperWin&) = delete; - WindowCaptureHelperWin& operator=(const WindowCaptureHelperWin&) = delete; - bool IsAeroEnabled(); bool IsWindowChromeNotification(HWND hwnd); bool AreWindowsOverlapping(HWND hwnd, @@ -129,6 +127,8 @@ class WindowCaptureHelperWin { // Only used on Win10+. Microsoft::WRL::ComPtr virtual_desktop_manager_; + + RTC_DISALLOW_COPY_AND_ASSIGN(WindowCaptureHelperWin); }; } // namespace webrtc diff --git a/modules/desktop_capture/window_capturer_null.cc b/modules/desktop_capture/window_capturer_null.cc index 6da2a76691..e7c7b0a134 100644 --- a/modules/desktop_capture/window_capturer_null.cc +++ b/modules/desktop_capture/window_capturer_null.cc @@ -11,6 +11,7 @@ #include "modules/desktop_capture/desktop_capturer.h" #include "modules/desktop_capture/desktop_frame.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { @@ -21,9 +22,6 @@ class WindowCapturerNull : public DesktopCapturer { WindowCapturerNull(); ~WindowCapturerNull() override; - WindowCapturerNull(const WindowCapturerNull&) = delete; - WindowCapturerNull& operator=(const WindowCapturerNull&) = delete; - // DesktopCapturer interface. void Start(Callback* callback) override; void CaptureFrame() override; @@ -32,6 +30,8 @@ class WindowCapturerNull : public DesktopCapturer { private: Callback* callback_ = nullptr; + + RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerNull); }; WindowCapturerNull::WindowCapturerNull() {} diff --git a/modules/remote_bitrate_estimator/test/bwe_test_logging.h b/modules/remote_bitrate_estimator/test/bwe_test_logging.h index 49e1e716b2..e85565596d 100644 --- a/modules/remote_bitrate_estimator/test/bwe_test_logging.h +++ b/modules/remote_bitrate_estimator/test/bwe_test_logging.h @@ -128,6 +128,7 @@ #include #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" #define BWE_TEST_LOGGING_GLOBAL_CONTEXT(name) \ @@ -340,10 +341,6 @@ class Logging { Logging(); ~Logging(); - - Logging(const Logging&) = delete; - Logging& operator=(const Logging&) = delete; - void PushState(const std::string& append_to_tag, int64_t timestamp_ms, bool enabled); @@ -351,6 +348,8 @@ class Logging { Mutex mutex_; ThreadMap thread_map_; + + RTC_DISALLOW_COPY_AND_ASSIGN(Logging); }; } // namespace bwe } // namespace testing diff --git a/pc/srtp_filter.h b/pc/srtp_filter.h index e2848a1090..f1e164936c 100644 --- a/pc/srtp_filter.h +++ b/pc/srtp_filter.h @@ -27,6 +27,7 @@ #include "api/sequence_checker.h" #include "pc/session_description.h" #include "rtc_base/buffer.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ssl_stream_adapter.h" // Forward declaration to avoid pulling in libsrtp headers here diff --git a/rtc_base/openssl_certificate.h b/rtc_base/openssl_certificate.h index b2debbee89..c317a72110 100644 --- a/rtc_base/openssl_certificate.h +++ b/rtc_base/openssl_certificate.h @@ -18,6 +18,7 @@ #include #include "rtc_base/buffer.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ssl_certificate.h" #include "rtc_base/ssl_identity.h" @@ -41,9 +42,6 @@ class OpenSSLCertificate final : public SSLCertificate { ~OpenSSLCertificate() override; - OpenSSLCertificate(const OpenSSLCertificate&) = delete; - OpenSSLCertificate& operator=(const OpenSSLCertificate&) = delete; - std::unique_ptr Clone() const override; X509* x509() const { return x509_; } @@ -72,6 +70,7 @@ class OpenSSLCertificate final : public SSLCertificate { private: X509* x509_; // NOT OWNED + RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLCertificate); }; } // namespace rtc diff --git a/rtc_base/openssl_identity.h b/rtc_base/openssl_identity.h index 63f46b374d..00d6c74922 100644 --- a/rtc_base/openssl_identity.h +++ b/rtc_base/openssl_identity.h @@ -17,6 +17,7 @@ #include #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/openssl_certificate.h" #include "rtc_base/openssl_key_pair.h" #include "rtc_base/ssl_certificate.h" @@ -42,9 +43,6 @@ class OpenSSLIdentity final : public SSLIdentity { const std::string& certificate_chain); ~OpenSSLIdentity() override; - OpenSSLIdentity(const OpenSSLIdentity&) = delete; - OpenSSLIdentity& operator=(const OpenSSLIdentity&) = delete; - const OpenSSLCertificate& certificate() const override; const SSLCertChain& cert_chain() const override; @@ -68,6 +66,8 @@ class OpenSSLIdentity final : public SSLIdentity { std::unique_ptr key_pair_; std::unique_ptr cert_chain_; + + RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity); }; } // namespace rtc diff --git a/rtc_base/sigslottester.h.pump b/rtc_base/sigslottester.h.pump index c3d2d6e99b..0a1f41128d 100755 --- a/rtc_base/sigslottester.h.pump +++ b/rtc_base/sigslottester.h.pump @@ -35,6 +35,7 @@ // 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 { @@ -46,14 +47,13 @@ class SigslotTester0 : public sigslot::has_slots<> { 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 @@ -78,9 +78,6 @@ class SigslotTester$i : public sigslot::has_slots<> { signal->connect(this, &SigslotTester$i::OnSignalCallback); } - SigslotTester$i(const SigslotTester$i&) = delete; - SigslotTester$i& operator=(const SigslotTester$i&) = delete; - int callback_count() const { return callback_count_; } private: @@ -94,6 +91,9 @@ class SigslotTester$i : public sigslot::has_slots<> { int callback_count_;$for j [[ C$j* capture$j[[]]_;]] + + + RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester$i); }; ]] diff --git a/rtc_base/task_queue_win.cc b/rtc_base/task_queue_win.cc index dd14a7d8e0..6382d6b15d 100644 --- a/rtc_base/task_queue_win.cc +++ b/rtc_base/task_queue_win.cc @@ -34,6 +34,7 @@ #include "api/task_queue/task_queue_base.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/event.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_conversions.h" @@ -121,9 +122,6 @@ class MultimediaTimer { ::CloseHandle(event_); } - MultimediaTimer(const MultimediaTimer&) = delete; - MultimediaTimer& operator=(const MultimediaTimer&) = delete; - bool StartOneShotTimer(UINT delay_ms) { RTC_DCHECK_EQ(0, timer_id_); RTC_DCHECK(event_ != nullptr); @@ -150,6 +148,8 @@ class MultimediaTimer { private: HANDLE event_ = nullptr; MMRESULT timer_id_ = 0; + + RTC_DISALLOW_COPY_AND_ASSIGN(MultimediaTimer); }; class TaskQueueWin : public TaskQueueBase { diff --git a/rtc_base/win/windows_version.h b/rtc_base/win/windows_version.h index 3636eabf19..dbb0d8eb58 100644 --- a/rtc_base/win/windows_version.h +++ b/rtc_base/win/windows_version.h @@ -15,6 +15,8 @@ #include +#include "rtc_base/constructor_magic.h" + typedef void* HANDLE; namespace rtc { @@ -103,9 +105,6 @@ class OSInfo { WOW64_UNKNOWN, }; - OSInfo(const OSInfo&) = delete; - OSInfo& operator=(const OSInfo&) = delete; - static OSInfo* GetInstance(); Version version() const { return version_; } @@ -141,6 +140,8 @@ class OSInfo { size_t allocation_granularity_; WOW64Status wow64_status_; std::string processor_model_name_; + + RTC_DISALLOW_COPY_AND_ASSIGN(OSInfo); }; // Because this is by far the most commonly-requested value from the above diff --git a/rtc_tools/network_tester/config_reader.h b/rtc_tools/network_tester/config_reader.h index 3735555d51..f44e7a91f4 100644 --- a/rtc_tools/network_tester/config_reader.h +++ b/rtc_tools/network_tester/config_reader.h @@ -15,6 +15,7 @@ #include #include "absl/types/optional.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ignore_wundef.h" #ifdef WEBRTC_NETWORK_TESTER_PROTO @@ -38,14 +39,12 @@ class ConfigReader { explicit ConfigReader(const std::string& config_file_path); ~ConfigReader(); - ConfigReader(const ConfigReader&) = delete; - ConfigReader& operator=(const ConfigReader&) = delete; - absl::optional GetNextConfig(); private: NetworkTesterAllConfigs proto_all_configs_; int proto_config_index_; + RTC_DISALLOW_COPY_AND_ASSIGN(ConfigReader); }; } // namespace webrtc diff --git a/rtc_tools/network_tester/packet_logger.h b/rtc_tools/network_tester/packet_logger.h index c3ac309cf7..109ee4c14f 100644 --- a/rtc_tools/network_tester/packet_logger.h +++ b/rtc_tools/network_tester/packet_logger.h @@ -14,6 +14,7 @@ #include #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/ignore_wundef.h" #ifdef WEBRTC_NETWORK_TESTER_PROTO @@ -32,13 +33,12 @@ class PacketLogger { explicit PacketLogger(const std::string& log_file_path); ~PacketLogger(); - PacketLogger(const PacketLogger&) = delete; - PacketLogger& operator=(const PacketLogger&) = delete; - void LogPacket(const NetworkTesterPacket& packet); private: std::ofstream packet_logger_stream_; + + RTC_DISALLOW_COPY_AND_ASSIGN(PacketLogger); }; } // namespace webrtc diff --git a/rtc_tools/network_tester/packet_sender.h b/rtc_tools/network_tester/packet_sender.h index 233ed6a51a..7ccecdd84c 100644 --- a/rtc_tools/network_tester/packet_sender.h +++ b/rtc_tools/network_tester/packet_sender.h @@ -16,6 +16,7 @@ #include "api/sequence_checker.h" #include "api/task_queue/task_queue_factory.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ignore_wundef.h" #include "rtc_base/system/no_unique_address.h" #include "rtc_base/task_queue.h" @@ -39,9 +40,6 @@ class PacketSender { const std::string& config_file_path); ~PacketSender(); - PacketSender(const PacketSender&) = delete; - PacketSender& operator=(const PacketSender&) = delete; - void StartSending(); void StopSending(); bool IsSending() const; @@ -61,6 +59,8 @@ class PacketSender { TestController* const test_controller_; std::unique_ptr task_queue_factory_; rtc::TaskQueue worker_queue_; + + RTC_DISALLOW_COPY_AND_ASSIGN(PacketSender); }; } // namespace webrtc diff --git a/rtc_tools/network_tester/test_controller.h b/rtc_tools/network_tester/test_controller.h index 3933b46b5b..50055fcf4c 100644 --- a/rtc_tools/network_tester/test_controller.h +++ b/rtc_tools/network_tester/test_controller.h @@ -22,6 +22,7 @@ #include "api/sequence_checker.h" #include "p2p/base/basic_packet_socket_factory.h" #include "rtc_base/async_packet_socket.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/ignore_wundef.h" #include "rtc_base/socket_address.h" #include "rtc_base/synchronization/mutex.h" @@ -50,9 +51,6 @@ class TestController : public sigslot::has_slots<> { const std::string& config_file_path, const std::string& log_file_path); - TestController(const TestController&) = delete; - TestController& operator=(const TestController&) = delete; - void Run(); void SendConnectTo(const std::string& hostname, int port); @@ -82,6 +80,8 @@ class TestController : public sigslot::has_slots<> { std::unique_ptr udp_socket_; rtc::SocketAddress remote_address_; std::unique_ptr packet_sender_; + + RTC_DISALLOW_COPY_AND_ASSIGN(TestController); }; } // namespace webrtc diff --git a/rtc_tools/rtc_event_log_visualizer/alerts.h b/rtc_tools/rtc_event_log_visualizer/alerts.h index 72f1241d50..d3e41666aa 100644 --- a/rtc_tools/rtc_event_log_visualizer/alerts.h +++ b/rtc_tools/rtc_event_log_visualizer/alerts.h @@ -19,6 +19,7 @@ #include "absl/strings/string_view.h" #include "logging/rtc_event_log/rtc_event_log_parser.h" +#include "rtc_base/constructor_magic.h" #include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h" namespace webrtc { @@ -48,9 +49,6 @@ class TriageHelper { public: explicit TriageHelper(const AnalyzerConfig& config) : config_(config) {} - TriageHelper(const TriageHelper&) = delete; - TriageHelper& operator=(const TriageHelper&) = delete; - void AnalyzeLog(const ParsedRtcEventLog& parsed_log); void AnalyzeStreamGaps(const ParsedRtcEventLog& parsed_log, @@ -82,6 +80,7 @@ class TriageHelper { it->second.count += 1; } } + RTC_DISALLOW_COPY_AND_ASSIGN(TriageHelper); }; } // namespace webrtc diff --git a/rtc_tools/sanitizers_unittest.cc b/rtc_tools/sanitizers_unittest.cc index 6404eb296d..ee575831af 100644 --- a/rtc_tools/sanitizers_unittest.cc +++ b/rtc_tools/sanitizers_unittest.cc @@ -15,6 +15,7 @@ #include #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" @@ -87,9 +88,6 @@ class IncrementThread : public Thread { explicit IncrementThread(int* value) : Thread(std::make_unique()), value_(value) {} - IncrementThread(const IncrementThread&) = delete; - IncrementThread& operator=(const IncrementThread&) = delete; - void Run() override { ++*value_; Thread::Current()->SleepMs(100); @@ -100,6 +98,8 @@ class IncrementThread : public Thread { private: int* value_; + + RTC_DISALLOW_COPY_AND_ASSIGN(IncrementThread); }; void DataRace() { diff --git a/sdk/android/native_api/jni/java_types.h b/sdk/android/native_api/jni/java_types.h index 1008737d90..8a13e3e7ce 100644 --- a/sdk/android/native_api/jni/java_types.h +++ b/sdk/android/native_api/jni/java_types.h @@ -57,9 +57,6 @@ class Iterable { ~Iterable(); - Iterable(const Iterable&) = delete; - Iterable& operator=(const Iterable&) = delete; - class Iterator { public: // Creates an iterator representing the end of any collection. @@ -74,9 +71,6 @@ class Iterable { ~Iterator(); - Iterator(const Iterator&) = delete; - Iterator& operator=(const Iterator&) = delete; - // Move assignment should not be used. Iterator& operator=(Iterator&&) = delete; @@ -102,6 +96,8 @@ class Iterable { ScopedJavaLocalRef iterator_; ScopedJavaLocalRef value_; SequenceChecker thread_checker_; + + RTC_DISALLOW_COPY_AND_ASSIGN(Iterator); }; Iterable::Iterator begin() { return Iterable::Iterator(jni_, iterable_); } @@ -110,6 +106,8 @@ class Iterable { private: JNIEnv* jni_; ScopedJavaLocalRef iterable_; + + RTC_DISALLOW_COPY_AND_ASSIGN(Iterable); }; // Returns true if `obj` == null in Java. diff --git a/sdk/android/native_api/jni/scoped_java_ref.h b/sdk/android/native_api/jni/scoped_java_ref.h index a2be447de2..634d35acc5 100644 --- a/sdk/android/native_api/jni/scoped_java_ref.h +++ b/sdk/android/native_api/jni/scoped_java_ref.h @@ -15,9 +15,9 @@ #define SDK_ANDROID_NATIVE_API_JNI_SCOPED_JAVA_REF_H_ #include - #include +#include "rtc_base/constructor_magic.h" #include "sdk/android/native_api/jni/jvm.h" namespace webrtc { @@ -34,9 +34,6 @@ class JavaRef; template <> class JavaRef { public: - JavaRef(const JavaRef&) = delete; - JavaRef& operator=(const JavaRef&) = delete; - jobject obj() const { return obj_; } bool is_null() const { // This is not valid for weak references. For weak references you need to @@ -52,19 +49,22 @@ class JavaRef { constexpr JavaRef() : obj_(nullptr) {} explicit JavaRef(jobject obj) : obj_(obj) {} jobject obj_; + + private: + RTC_DISALLOW_COPY_AND_ASSIGN(JavaRef); }; template class JavaRef : public JavaRef { public: - JavaRef(const JavaRef&) = delete; - JavaRef& operator=(const JavaRef&) = delete; - T obj() const { return static_cast(obj_); } protected: JavaRef() : JavaRef(nullptr) {} explicit JavaRef(T obj) : JavaRef(obj) {} + + private: + RTC_DISALLOW_COPY_AND_ASSIGN(JavaRef); }; // Holds a local reference to a JNI method parameter. @@ -79,8 +79,8 @@ class JavaParamRef : public JavaRef { explicit JavaParamRef(T obj) : JavaRef(obj) {} JavaParamRef(JNIEnv*, T obj) : JavaRef(obj) {} - JavaParamRef(const JavaParamRef&) = delete; - JavaParamRef& operator=(const JavaParamRef&) = delete; + private: + RTC_DISALLOW_COPY_AND_ASSIGN(JavaParamRef); }; // Holds a local reference to a Java object. The local reference is scoped @@ -186,9 +186,6 @@ class ScopedJavaGlobalRef : public JavaRef { AttachCurrentThreadIfNeeded()->DeleteGlobalRef(obj_); } - ScopedJavaGlobalRef(const ScopedJavaGlobalRef&) = delete; - ScopedJavaGlobalRef& operator=(const ScopedJavaGlobalRef&) = delete; - void operator=(const JavaRef& other) { JNIEnv* env = AttachCurrentThreadIfNeeded(); if (obj_ != nullptr) { @@ -212,6 +209,9 @@ class ScopedJavaGlobalRef : public JavaRef { obj_ = nullptr; return obj; } + + private: + RTC_DISALLOW_COPY_AND_ASSIGN(ScopedJavaGlobalRef); }; template diff --git a/test/direct_transport.h b/test/direct_transport.h index d67f9ead69..d6b70b9ce0 100644 --- a/test/direct_transport.h +++ b/test/direct_transport.h @@ -31,13 +31,10 @@ class Demuxer { public: explicit Demuxer(const std::map& payload_type_map); ~Demuxer() = default; - - Demuxer(const Demuxer&) = delete; - Demuxer& operator=(const Demuxer&) = delete; - MediaType GetMediaType(const uint8_t* packet_data, size_t packet_length) const; const std::map payload_type_map_; + RTC_DISALLOW_COPY_AND_ASSIGN(Demuxer); }; // Objects of this class are expected to be allocated and destroyed on the diff --git a/test/mac/video_renderer_mac.h b/test/mac/video_renderer_mac.h index 8e629b0a49..956f50b541 100644 --- a/test/mac/video_renderer_mac.h +++ b/test/mac/video_renderer_mac.h @@ -11,6 +11,7 @@ #ifndef TEST_MAC_VIDEO_RENDERER_MAC_H_ #define TEST_MAC_VIDEO_RENDERER_MAC_H_ +#include "rtc_base/constructor_magic.h" #include "test/gl/gl_renderer.h" @class CocoaWindow; @@ -23,9 +24,6 @@ class MacRenderer : public GlRenderer { MacRenderer(); virtual ~MacRenderer(); - MacRenderer(const MacRenderer&) = delete; - MacRenderer& operator=(const MacRenderer&) = delete; - bool Init(const char* window_title, int width, int height); // Implements GlRenderer. @@ -33,6 +31,8 @@ class MacRenderer : public GlRenderer { private: CocoaWindow* window_; + + RTC_DISALLOW_COPY_AND_ASSIGN(MacRenderer); }; } // namespace test } // namespace webrtc diff --git a/test/network/network_emulation.h b/test/network/network_emulation.h index 61dc468661..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" @@ -466,9 +467,7 @@ class EmulatedNetworkNode : public EmulatedNetworkReceiverInterface { rtc::TaskQueue* task_queue, std::unique_ptr network_behavior); ~EmulatedNetworkNode() override; - - EmulatedNetworkNode(const EmulatedNetworkNode&) = delete; - EmulatedNetworkNode& operator=(const EmulatedNetworkNode&) = delete; + RTC_DISALLOW_COPY_AND_ASSIGN(EmulatedNetworkNode); void OnPacketReceived(EmulatedIpPacket packet) override; diff --git a/test/rtp_file_reader.cc b/test/rtp_file_reader.cc index 15a05132f3..b3d0742bf8 100644 --- a/test/rtp_file_reader.cc +++ b/test/rtp_file_reader.cc @@ -18,6 +18,7 @@ #include "modules/rtp_rtcp/source/rtp_util.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/system/arch.h" @@ -117,9 +118,6 @@ class RtpDumpReader : public RtpFileReaderImpl { } } - RtpDumpReader(const RtpDumpReader&) = delete; - RtpDumpReader& operator=(const RtpDumpReader&) = delete; - bool Init(FILE* file, const std::set& ssrc_filter) override { file_ = file; @@ -189,6 +187,8 @@ class RtpDumpReader : public RtpFileReaderImpl { private: FILE* file_; + + RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpReader); }; enum { @@ -253,9 +253,6 @@ class PcapReader : public RtpFileReaderImpl { } } - PcapReader(const PcapReader&) = delete; - PcapReader& operator=(const PcapReader&) = delete; - bool Init(FILE* file, const std::set& ssrc_filter) override { return Initialize(file, ssrc_filter) == kResultSuccess; } @@ -622,6 +619,8 @@ class PcapReader : public RtpFileReaderImpl { SsrcMap packets_by_ssrc_; std::vector packets_; PacketIterator next_packet_it_; + + RTC_DISALLOW_COPY_AND_ASSIGN(PcapReader); }; RtpFileReaderImpl* CreateReaderForFormat(RtpFileReader::FileFormat format) { diff --git a/test/rtp_file_writer.cc b/test/rtp_file_writer.cc index c80b6387a7..cdd9c933a7 100644 --- a/test/rtp_file_writer.cc +++ b/test/rtp_file_writer.cc @@ -16,6 +16,7 @@ #include #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" namespace webrtc { namespace test { @@ -38,9 +39,6 @@ class RtpDumpWriter : public RtpFileWriter { } } - RtpDumpWriter(const RtpDumpWriter&) = delete; - RtpDumpWriter& operator=(const RtpDumpWriter&) = delete; - bool WritePacket(const RtpPacket* packet) override { uint16_t len = static_cast(packet->length + kPacketHeaderSize); uint16_t plen = static_cast(packet->original_length); @@ -88,6 +86,8 @@ class RtpDumpWriter : public RtpFileWriter { } FILE* file_; + + RTC_DISALLOW_COPY_AND_ASSIGN(RtpDumpWriter); }; RtpFileWriter* RtpFileWriter::Create(FileFormat format, diff --git a/test/scenario/audio_stream.h b/test/scenario/audio_stream.h index 2110c1d5cb..b561cb4c70 100644 --- a/test/scenario/audio_stream.h +++ b/test/scenario/audio_stream.h @@ -13,6 +13,7 @@ #include #include +#include "rtc_base/constructor_magic.h" #include "test/scenario/call_client.h" #include "test/scenario/column_printer.h" #include "test/scenario/network_node.h" @@ -25,11 +26,8 @@ namespace test { // stream if neccessary. class SendAudioStream { public: + RTC_DISALLOW_COPY_AND_ASSIGN(SendAudioStream); ~SendAudioStream(); - - SendAudioStream(const SendAudioStream&) = delete; - SendAudioStream& operator=(const SendAudioStream&) = delete; - void Start(); void Stop(); void SetMuted(bool mute); @@ -52,11 +50,8 @@ class SendAudioStream { // ReceiveAudioStream represents an audio receiver. It can't be used directly. class ReceiveAudioStream { public: + RTC_DISALLOW_COPY_AND_ASSIGN(ReceiveAudioStream); ~ReceiveAudioStream(); - - ReceiveAudioStream(const ReceiveAudioStream&) = delete; - ReceiveAudioStream& operator=(const ReceiveAudioStream&) = delete; - void Start(); void Stop(); AudioReceiveStream::Stats GetStats() const; @@ -79,11 +74,8 @@ class ReceiveAudioStream { // the Scenario class. class AudioStreamPair { public: + RTC_DISALLOW_COPY_AND_ASSIGN(AudioStreamPair); ~AudioStreamPair(); - - AudioStreamPair(const AudioStreamPair&) = delete; - AudioStreamPair& operator=(const AudioStreamPair&) = delete; - SendAudioStream* send() { return &send_stream_; } ReceiveAudioStream* receive() { return &receive_stream_; } diff --git a/test/scenario/call_client.h b/test/scenario/call_client.h index 489844039b..08b0131350 100644 --- a/test/scenario/call_client.h +++ b/test/scenario/call_client.h @@ -22,6 +22,7 @@ #include "call/call.h" #include "modules/audio_device/include/test_audio_device.h" #include "modules/congestion_controller/goog_cc/test/goog_cc_printer.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/task_queue_for_test.h" #include "test/logging/log_writer.h" #include "test/network/network_emulation.h" @@ -67,14 +68,8 @@ class LoggingNetworkControllerFactory public: LoggingNetworkControllerFactory(LogWriterFactoryInterface* log_writer_factory, TransportControllerConfig config); - + RTC_DISALLOW_COPY_AND_ASSIGN(LoggingNetworkControllerFactory); ~LoggingNetworkControllerFactory(); - - LoggingNetworkControllerFactory(const LoggingNetworkControllerFactory&) = - delete; - LoggingNetworkControllerFactory& operator=( - const LoggingNetworkControllerFactory&) = delete; - std::unique_ptr Create( NetworkControllerConfig config) override; TimeDelta GetProcessInterval() const override; @@ -104,12 +99,9 @@ class CallClient : public EmulatedNetworkReceiverInterface { CallClient(TimeController* time_controller, std::unique_ptr log_writer_factory, CallClientConfig config); + RTC_DISALLOW_COPY_AND_ASSIGN(CallClient); ~CallClient(); - - CallClient(const CallClient&) = delete; - CallClient& operator=(const CallClient&) = delete; - ColumnPrinter StatsPrinter(); Call::Stats GetStats(); DataRate send_bandwidth() { @@ -173,11 +165,8 @@ class CallClient : public EmulatedNetworkReceiverInterface { class CallClientPair { public: + RTC_DISALLOW_COPY_AND_ASSIGN(CallClientPair); ~CallClientPair(); - - CallClientPair(const CallClientPair&) = delete; - CallClientPair& operator=(const CallClientPair&) = delete; - CallClient* first() { return first_; } CallClient* second() { return second_; } std::pair forward() { return {first(), second()}; } diff --git a/test/scenario/column_printer.h b/test/scenario/column_printer.h index 529f4597ec..4ace50d364 100644 --- a/test/scenario/column_printer.h +++ b/test/scenario/column_printer.h @@ -14,6 +14,7 @@ #include #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/strings/string_builder.h" #include "test/logging/log_writer.h" @@ -45,12 +46,8 @@ class StatesPrinter { public: StatesPrinter(std::unique_ptr writer, std::vector printers); - + RTC_DISALLOW_COPY_AND_ASSIGN(StatesPrinter); ~StatesPrinter(); - - StatesPrinter(const StatesPrinter&) = delete; - StatesPrinter& operator=(const StatesPrinter&) = delete; - void PrintHeaders(); void PrintRow(); diff --git a/test/scenario/network_node.h b/test/scenario/network_node.h index 156cdbb6a8..ea8eb35daf 100644 --- a/test/scenario/network_node.h +++ b/test/scenario/network_node.h @@ -20,6 +20,7 @@ #include "api/units/timestamp.h" #include "call/call.h" #include "call/simulated_network.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/copy_on_write_buffer.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/task_queue.h" diff --git a/test/scenario/scenario.h b/test/scenario/scenario.h index 5d82a60c13..134cf08118 100644 --- a/test/scenario/scenario.h +++ b/test/scenario/scenario.h @@ -15,6 +15,7 @@ #include #include "api/test/time_controller.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/fake_clock.h" #include "rtc_base/task_queue.h" #include "rtc_base/task_utils/repeating_task.h" @@ -46,12 +47,8 @@ class Scenario { Scenario(std::string file_name, bool real_time); Scenario(std::unique_ptr log_writer_manager, bool real_time); - + RTC_DISALLOW_COPY_AND_ASSIGN(Scenario); ~Scenario(); - - Scenario(const Scenario&) = delete; - Scenario& operator=(const Scenario&) = delete; - NetworkEmulationManagerImpl* net() { return &network_manager_; } EmulatedNetworkNode* CreateSimulationNode(NetworkSimulationConfig config); diff --git a/test/scenario/video_stream.h b/test/scenario/video_stream.h index 1451f59c81..96b6d49f63 100644 --- a/test/scenario/video_stream.h +++ b/test/scenario/video_stream.h @@ -13,6 +13,7 @@ #include #include +#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" #include "test/fake_encoder.h" #include "test/fake_videorenderer.h" @@ -31,11 +32,8 @@ namespace test { // states at run time. class SendVideoStream { public: + RTC_DISALLOW_COPY_AND_ASSIGN(SendVideoStream); ~SendVideoStream(); - - SendVideoStream(const SendVideoStream&) = delete; - SendVideoStream& operator=(const SendVideoStream&) = delete; - void SetCaptureFramerate(int framerate); VideoSendStream::Stats GetStats() const; ColumnPrinter StatsPrinter(); @@ -74,11 +72,8 @@ class SendVideoStream { // ReceiveVideoStream represents a video receiver. It can't be used directly. class ReceiveVideoStream { public: + RTC_DISALLOW_COPY_AND_ASSIGN(ReceiveVideoStream); ~ReceiveVideoStream(); - - ReceiveVideoStream(const ReceiveVideoStream&) = delete; - ReceiveVideoStream& operator=(const ReceiveVideoStream&) = delete; - void Start(); void Stop(); VideoReceiveStream::Stats GetStats() const; @@ -108,11 +103,8 @@ class ReceiveVideoStream { // the Scenario class. class VideoStreamPair { public: + RTC_DISALLOW_COPY_AND_ASSIGN(VideoStreamPair); ~VideoStreamPair(); - - VideoStreamPair(const VideoStreamPair&) = delete; - VideoStreamPair& operator=(const VideoStreamPair&) = delete; - SendVideoStream* send() { return &send_stream_; } ReceiveVideoStream* receive() { return &receive_stream_; } VideoFrameMatcher* matcher() { return &matcher_; } diff --git a/video/adaptation/overuse_frame_detector.h b/video/adaptation/overuse_frame_detector.h index caefda1867..2b4dd61d21 100644 --- a/video/adaptation/overuse_frame_detector.h +++ b/video/adaptation/overuse_frame_detector.h @@ -18,6 +18,7 @@ #include "api/sequence_checker.h" #include "api/task_queue/task_queue_base.h" #include "api/video/video_stream_encoder_observer.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/numerics/exp_filter.h" #include "rtc_base/system/no_unique_address.h" @@ -67,9 +68,6 @@ class OveruseFrameDetector { explicit OveruseFrameDetector(CpuOveruseMetricsObserver* metrics_observer); virtual ~OveruseFrameDetector(); - OveruseFrameDetector(const OveruseFrameDetector&) = delete; - OveruseFrameDetector& operator=(const OveruseFrameDetector&) = delete; - // Start to periodically check for overuse. void StartCheckForOveruse( TaskQueueBase* task_queue_base, @@ -163,6 +161,8 @@ class OveruseFrameDetector { // If set by field trial, overrides CpuOveruseOptions::filter_time_ms. FieldTrialOptional filter_time_constant_{"tau"}; + + RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); }; } // namespace webrtc diff --git a/video/call_stats.h b/video/call_stats.h index d198223a9d..0c8e26741b 100644 --- a/video/call_stats.h +++ b/video/call_stats.h @@ -18,6 +18,7 @@ #include "modules/include/module.h" #include "modules/include/module_common_types.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/synchronization/mutex.h" #include "system_wrappers/include/clock.h" @@ -34,9 +35,6 @@ class CallStats : public Module, public RtcpRttStats { CallStats(Clock* clock, ProcessThread* process_thread); ~CallStats() override; - CallStats(const CallStats&) = delete; - CallStats& operator=(const CallStats&) = delete; - // Registers/deregisters a new observer to receive statistics updates. // Must be called from the construction thread. void RegisterStatsObserver(CallStatsObserver* observer); @@ -116,6 +114,8 @@ class CallStats : public Module, public RtcpRttStats { SequenceChecker process_thread_checker_; ProcessThread* const process_thread_; bool process_thread_running_ RTC_GUARDED_BY(construction_thread_checker_); + + RTC_DISALLOW_COPY_AND_ASSIGN(CallStats); }; } // namespace webrtc diff --git a/video/call_stats2.h b/video/call_stats2.h index b626e48840..74bd3482da 100644 --- a/video/call_stats2.h +++ b/video/call_stats2.h @@ -17,6 +17,7 @@ #include "api/units/timestamp.h" #include "modules/include/module_common_types.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/task_queue.h" #include "rtc_base/task_utils/pending_task_safety_flag.h" #include "rtc_base/task_utils/repeating_task.h" @@ -34,9 +35,6 @@ class CallStats { CallStats(Clock* clock, TaskQueueBase* task_queue); ~CallStats(); - CallStats(const CallStats&) = delete; - CallStats& operator=(const CallStats&) = delete; - // Ensure that necessary repeating tasks are started. void EnsureStarted(); @@ -127,6 +125,8 @@ class CallStats { // Used to signal destruction to potentially pending tasks. ScopedTaskSafety task_safety_; + + RTC_DISALLOW_COPY_AND_ASSIGN(CallStats); }; } // namespace internal diff --git a/video/rtp_video_stream_receiver.h b/video/rtp_video_stream_receiver.h index abd4452d1a..2df76b3846 100644 --- a/video/rtp_video_stream_receiver.h +++ b/video/rtp_video_stream_receiver.h @@ -46,6 +46,7 @@ #include "modules/video_coding/packet_buffer.h" #include "modules/video_coding/rtp_frame_reference_finder.h" #include "modules/video_coding/unique_timestamp_counter.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/synchronization/mutex.h" diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h index 48aab34a41..a361b497ed 100644 --- a/video/rtp_video_stream_receiver2.h +++ b/video/rtp_video_stream_receiver2.h @@ -43,6 +43,7 @@ #include "modules/video_coding/packet_buffer.h" #include "modules/video_coding/rtp_frame_reference_finder.h" #include "modules/video_coding/unique_timestamp_counter.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/system/no_unique_address.h" diff --git a/video/stats_counter.h b/video/stats_counter.h index 9e2b8702d6..9c3f6f8156 100644 --- a/video/stats_counter.h +++ b/video/stats_counter.h @@ -14,6 +14,8 @@ #include #include +#include "rtc_base/constructor_magic.h" + namespace webrtc { class AggregatedCounter; @@ -154,9 +156,6 @@ class AvgCounter : public StatsCounter { bool include_empty_intervals); ~AvgCounter() override {} - AvgCounter(const AvgCounter&) = delete; - AvgCounter& operator=(const AvgCounter&) = delete; - void Add(int sample); private: @@ -164,6 +163,8 @@ class AvgCounter : public StatsCounter { // Returns the last computed metric (i.e. from GetMetric). int GetValueForEmptyInterval() const override; + + RTC_DISALLOW_COPY_AND_ASSIGN(AvgCounter); }; // MaxCounter: maximum of samples @@ -179,14 +180,13 @@ class MaxCounter : public StatsCounter { int64_t process_intervals_ms); ~MaxCounter() override {} - MaxCounter(const MaxCounter&) = delete; - MaxCounter& operator=(const MaxCounter&) = delete; - void Add(int sample); private: bool GetMetric(int* metric) const override; int GetValueForEmptyInterval() const override; + + RTC_DISALLOW_COPY_AND_ASSIGN(MaxCounter); }; // PercentCounter: percentage of samples @@ -200,14 +200,13 @@ class PercentCounter : public StatsCounter { PercentCounter(Clock* clock, StatsCounterObserver* observer); ~PercentCounter() override {} - PercentCounter(const PercentCounter&) = delete; - PercentCounter& operator=(const PercentCounter&) = delete; - void Add(bool sample); private: bool GetMetric(int* metric) const override; int GetValueForEmptyInterval() const override; + + RTC_DISALLOW_COPY_AND_ASSIGN(PercentCounter); }; // PermilleCounter: permille of samples @@ -221,14 +220,13 @@ class PermilleCounter : public StatsCounter { PermilleCounter(Clock* clock, StatsCounterObserver* observer); ~PermilleCounter() override {} - PermilleCounter(const PermilleCounter&) = delete; - PermilleCounter& operator=(const PermilleCounter&) = delete; - void Add(bool sample); private: bool GetMetric(int* metric) const override; int GetValueForEmptyInterval() const override; + + RTC_DISALLOW_COPY_AND_ASSIGN(PermilleCounter); }; // RateCounter: units per second @@ -249,14 +247,13 @@ class RateCounter : public StatsCounter { bool include_empty_intervals); ~RateCounter() override {} - RateCounter(const RateCounter&) = delete; - RateCounter& operator=(const RateCounter&) = delete; - void Add(int sample); private: bool GetMetric(int* metric) const override; int GetValueForEmptyInterval() const override; // Returns zero. + + RTC_DISALLOW_COPY_AND_ASSIGN(RateCounter); }; // RateAccCounter: units per second (used for counters) @@ -277,9 +274,6 @@ class RateAccCounter : public StatsCounter { bool include_empty_intervals); ~RateAccCounter() override {} - RateAccCounter(const RateAccCounter&) = delete; - RateAccCounter& operator=(const RateAccCounter&) = delete; - void Set(int64_t sample, uint32_t stream_id); // Sets the value for previous interval. @@ -289,6 +283,8 @@ class RateAccCounter : public StatsCounter { private: bool GetMetric(int* metric) const override; int GetValueForEmptyInterval() const override; // Returns zero. + + RTC_DISALLOW_COPY_AND_ASSIGN(RateAccCounter); }; } // namespace webrtc diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 147e0110bd..9a313e1992 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -36,6 +36,7 @@ #include "modules/video_coding/svc/svc_rate_allocator.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" +#include "rtc_base/constructor_magic.h" #include "rtc_base/event.h" #include "rtc_base/experiments/alr_experiment.h" #include "rtc_base/experiments/encoder_info_settings.h" diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h index c667f049f8..30c04b2e33 100644 --- a/video/video_stream_encoder.h +++ b/video/video_stream_encoder.h @@ -82,9 +82,6 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, BitrateAllocationCallbackType allocation_cb_type); ~VideoStreamEncoder() override; - VideoStreamEncoder(const VideoStreamEncoder&) = delete; - VideoStreamEncoder& operator=(const VideoStreamEncoder&) = delete; - void AddAdaptationResource(rtc::scoped_refptr resource) override; std::vector> GetAdaptationResources() override; @@ -443,6 +440,8 @@ class VideoStreamEncoder : public VideoStreamEncoderInterface, // Used to cancel any potentially pending tasks to the worker thread. ScopedTaskSafety task_safety_; + + RTC_DISALLOW_COPY_AND_ASSIGN(VideoStreamEncoder); }; } // namespace webrtc