From 384194369b4be41912353631a68689129a49e58c Mon Sep 17 00:00:00 2001 From: henrikg Date: Wed, 16 Sep 2015 06:33:20 -0700 Subject: [PATCH] Consolidate constructormagic macros with Chromium version and remove Chromium override. Part of work removing dependency on Chromium's base. Only adds "= delete". From https://codereview.chromium.org/1151443003 : "This will guarantee the error to be at compile time, and not rely on the call visibility (private)." In consequence of that change, fixed an illegal copy and removed a bunch of unused variables. Depends on https://codereview.webrtc.org/1345433002/ BUG=chromium:468375 (in particular comment #37) NOTRY=true Review URL: https://codereview.webrtc.org/1342543004 Cr-Commit-Position: refs/heads/master@{#9954} --- talk/app/webrtc/videosource.cc | 2 -- talk/media/base/streamparams.h | 1 + webrtc/base/constructormagic.h | 21 +++++++------- webrtc/base/logging.cc | 3 +- webrtc/base/natserver.h | 1 - webrtc/base/socket.h | 1 + webrtc/base/virtualsocketserver.cc | 1 - webrtc/base/virtualsocketserver.h | 1 - .../test/bwe_test_framework.cc | 3 +- .../test/bwe_test_framework.h | 3 -- .../rtp_rtcp/source/rtp_format_h264.cc | 3 +- .../modules/rtp_rtcp/source/rtp_format_h264.h | 1 - .../video_coding/main/test/test_util.h | 1 - .../overrides/webrtc/base/constructormagic.h | 29 ------------------- 14 files changed, 16 insertions(+), 55 deletions(-) delete mode 100644 webrtc/overrides/webrtc/base/constructormagic.h diff --git a/talk/app/webrtc/videosource.cc b/talk/app/webrtc/videosource.cc index 4c56f9500b..af5f628490 100644 --- a/talk/app/webrtc/videosource.cc +++ b/talk/app/webrtc/videosource.cc @@ -318,8 +318,6 @@ class FrameInputWrapper : public cricket::VideoRenderer { private: cricket::VideoCapturer* capturer_; - int width_; - int height_; RTC_DISALLOW_COPY_AND_ASSIGN(FrameInputWrapper); }; diff --git a/talk/media/base/streamparams.h b/talk/media/base/streamparams.h index e5d0177822..3c683db385 100644 --- a/talk/media/base/streamparams.h +++ b/talk/media/base/streamparams.h @@ -49,6 +49,7 @@ #include #include "webrtc/base/basictypes.h" +#include "webrtc/base/constructormagic.h" namespace cricket { diff --git a/webrtc/base/constructormagic.h b/webrtc/base/constructormagic.h index c234d40d7e..6ef7826505 100644 --- a/webrtc/base/constructormagic.h +++ b/webrtc/base/constructormagic.h @@ -11,23 +11,24 @@ #ifndef WEBRTC_BASE_CONSTRUCTORMAGIC_H_ #define WEBRTC_BASE_CONSTRUCTORMAGIC_H_ +// Put this in the declarations for a class to be unassignable. #define RTC_DISALLOW_ASSIGN(TypeName) \ - void operator=(const TypeName&) + void operator=(const TypeName&) = delete -// A macro to disallow the evil copy constructor and operator= functions -// This should be used in the private: declarations for a class. +// A macro to disallow the copy constructor and operator= functions. This should +// be used in the declarations for a class. #define RTC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ + TypeName(const TypeName&) = delete; \ RTC_DISALLOW_ASSIGN(TypeName) -// A macro to disallow all the implicit constructors, namely the -// default constructor, copy constructor and operator= functions. +// A macro to disallow all the implicit constructors, namely the default +// constructor, copy constructor and operator= functions. // -// This should be used in the private: declarations for a class -// that wants to prevent anyone from instantiating it. This is -// especially useful for classes containing only static methods. +// This should be used in the declarations for a class that wants to prevent +// anyone from instantiating it. This is especially useful for classes +// containing only static methods. #define RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName(); \ + TypeName() = delete; \ RTC_DISALLOW_COPY_AND_ASSIGN(TypeName) #endif // WEBRTC_BASE_CONSTRUCTORMAGIC_H_ diff --git a/webrtc/base/logging.cc b/webrtc/base/logging.cc index affbb03bd4..7e308c2693 100644 --- a/webrtc/base/logging.cc +++ b/webrtc/base/logging.cc @@ -206,8 +206,7 @@ LogMessage::~LogMessage() { } uint32 delay = TimeSince(before); if (delay >= warn_slow_logs_delay_) { - LogMessage slow_log_warning = - rtc::LogMessage(__FILE__, __LINE__, LS_WARNING); + rtc::LogMessage slow_log_warning(__FILE__, __LINE__, LS_WARNING); // If our warning is slow, we don't want to warn about it, because // that would lead to inifinite recursion. So, give a really big // number for the delay threshold. diff --git a/webrtc/base/natserver.h b/webrtc/base/natserver.h index eb470dc4a9..b6a02feca3 100644 --- a/webrtc/base/natserver.h +++ b/webrtc/base/natserver.h @@ -109,7 +109,6 @@ class NATServer : public sigslot::has_slots<> { bool ShouldFilterOut(TransEntry* entry, const SocketAddress& ext_addr); NAT* nat_; - SocketFactory* internal_; SocketFactory* external_; SocketAddress external_ip_; AsyncUDPSocket* udp_server_socket_; diff --git a/webrtc/base/socket.h b/webrtc/base/socket.h index d2eb8c144d..5512c5de0a 100644 --- a/webrtc/base/socket.h +++ b/webrtc/base/socket.h @@ -26,6 +26,7 @@ #endif #include "webrtc/base/basictypes.h" +#include "webrtc/base/constructormagic.h" #include "webrtc/base/socketaddress.h" // Rather than converting errors into a private namespace, diff --git a/webrtc/base/virtualsocketserver.cc b/webrtc/base/virtualsocketserver.cc index c2f0e01dc0..a9ca98bf81 100644 --- a/webrtc/base/virtualsocketserver.cc +++ b/webrtc/base/virtualsocketserver.cc @@ -98,7 +98,6 @@ VirtualSocket::VirtualSocket(VirtualSocketServer* server, int type, bool async) : server_(server), - family_(family), type_(type), async_(async), state_(CS_CLOSED), diff --git a/webrtc/base/virtualsocketserver.h b/webrtc/base/virtualsocketserver.h index f2938ff616..f1f5d6df15 100644 --- a/webrtc/base/virtualsocketserver.h +++ b/webrtc/base/virtualsocketserver.h @@ -306,7 +306,6 @@ class VirtualSocket : public AsyncSocket, public MessageHandler { void SetLocalAddress(const SocketAddress& addr); VirtualSocketServer* server_; - int family_; int type_; bool async_; ConnState state_; diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc index 2870be8b44..d4201933e7 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc +++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc @@ -719,8 +719,7 @@ VideoSource::VideoSource(int flow_id, next_frame_ms_(first_frame_offset_ms), next_frame_rand_ms_(0), now_ms_(0), - prototype_header_(), - start_plotting_ms_(first_frame_offset_ms) { + prototype_header_() { memset(&prototype_header_, 0, sizeof(prototype_header_)); prototype_header_.ssrc = ssrc; prototype_header_.sequenceNumber = 0xf000u; diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h index 3cdf4a9021..77b03fe7b1 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h +++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h @@ -370,7 +370,6 @@ class ChokeFilter : public PacketProcessor { uint32_t capacity_kbps_; int64_t last_send_time_us_; rtc::scoped_ptr delay_cap_helper_; - int64_t max_delay_us_; RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ChokeFilter); }; @@ -447,8 +446,6 @@ class VideoSource { int64_t next_frame_rand_ms_; int64_t now_ms_; RTPHeader prototype_header_; - int64_t start_plotting_ms_; - uint32_t previous_bitrate_bps_; RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(VideoSource); }; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc index d8063b03f1..aeef44364a 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc @@ -153,8 +153,7 @@ RtpPacketizerH264::RtpPacketizerH264(FrameType frame_type, size_t max_payload_len) : payload_data_(NULL), payload_size_(0), - max_payload_len_(max_payload_len), - frame_type_(frame_type) { + max_payload_len_(max_payload_len) { } RtpPacketizerH264::~RtpPacketizerH264() { diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.h b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.h index d5ad5fd186..e32433fe90 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_format_h264.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_format_h264.h @@ -84,7 +84,6 @@ class RtpPacketizerH264 : public RtpPacketizer { const size_t max_payload_len_; RTPFragmentationHeader fragmentation_; PacketQueue packets_; - FrameType frame_type_; RTC_DISALLOW_COPY_AND_ASSIGN(RtpPacketizerH264); }; diff --git a/webrtc/modules/video_coding/main/test/test_util.h b/webrtc/modules/video_coding/main/test/test_util.h index 47e055ced4..55cf4b91af 100644 --- a/webrtc/modules/video_coding/main/test/test_util.h +++ b/webrtc/modules/video_coding/main/test/test_util.h @@ -61,7 +61,6 @@ class FileOutputFrameReceiver : public webrtc::VCMReceiveCallback { private: std::string out_filename_; - uint32_t ssrc_; FILE* out_file_; FILE* timing_file_; int width_; diff --git a/webrtc/overrides/webrtc/base/constructormagic.h b/webrtc/overrides/webrtc/base/constructormagic.h deleted file mode 100644 index ed96339d1c..0000000000 --- a/webrtc/overrides/webrtc/base/constructormagic.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2009 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// This file overrides the inclusion of webrtc/base/constructormagic.h -// We do this because constructor magic defines RTC_DISALLOW_COPY_AND_ASSIGN, -// but we want to use the version from Chromium. - -#ifndef OVERRIDES_WEBRTC_BASE_CONSTRUCTORMAGIC_H__ -#define OVERRIDES_WEBRTC_BASE_CONSTRUCTORMAGIC_H__ - -#include "base/macros.h" - -#define RTC_DISALLOW_ASSIGN(TypeName) \ - DISALLOW_ASSIGN(TypeName) - -#define RTC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - DISALLOW_COPY_AND_ASSIGN(TypeName) - -#define RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) - -#endif // OVERRIDES_WEBRTC_BASE_CONSTRUCTORMAGIC_H__