Enable cpplint and fix cpplint errors in webrtc/api
Adding 'explicit' to these constructors has a low risk of causing
compatibility problems:
explicit RTCConfiguration(RTCConfigurationType type)
explicit IdBase(StatsType type)
BUG=webrtc:5267
TESTED=Fixed issues reported by:
find webrtc/api -type f -name *.cc -o -name *.h | xargs cpplint.py
followed by 'git cl presubmit'.
Review-Url: https://codereview.webrtc.org/2663063003
Cr-Original-Commit-Position: refs/heads/master@{#16392}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 803dc29bb6773b60dadf5b630ef6a00b8e72f77f
diff --git a/api/datachannelinterface.h b/api/datachannelinterface.h
index 8b788c0..5fa657d 100644
--- a/api/datachannelinterface.h
+++ b/api/datachannelinterface.h
@@ -75,7 +75,7 @@
// A data buffer was successfully received.
virtual void OnMessage(const DataBuffer& buffer) = 0;
// The data channel's buffered_amount has changed.
- virtual void OnBufferedAmountChange(uint64_t previous_amount){};
+ virtual void OnBufferedAmountChange(uint64_t previous_amount) {}
protected:
virtual ~DataChannelObserver() {}
diff --git a/api/fakemetricsobserver.h b/api/fakemetricsobserver.h
index baac0ca..90046c9 100644
--- a/api/fakemetricsobserver.h
+++ b/api/fakemetricsobserver.h
@@ -13,6 +13,7 @@
#include <map>
#include <string>
+#include <vector>
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/base/thread_checker.h"
diff --git a/api/jsepicecandidate.h b/api/jsepicecandidate.h
index 7e9500b..af06431 100644
--- a/api/jsepicecandidate.h
+++ b/api/jsepicecandidate.h
@@ -14,6 +14,8 @@
#define WEBRTC_API_JSEPICECANDIDATE_H_
#include <string>
+#include <utility>
+#include <vector>
#include "webrtc/api/jsep.h"
#include "webrtc/base/constructormagic.h"
diff --git a/api/mediaconstraintsinterface.cc b/api/mediaconstraintsinterface.cc
index 5361a28..f393a2e 100644
--- a/api/mediaconstraintsinterface.cc
+++ b/api/mediaconstraintsinterface.cc
@@ -70,7 +70,7 @@
*value_out = rtc::Optional<T>(value);
}
}
-}
+} // namespace
namespace webrtc {
diff --git a/api/mediastreamproxy.h b/api/mediastreamproxy.h
index 4253a09..fe11300 100644
--- a/api/mediastreamproxy.h
+++ b/api/mediastreamproxy.h
@@ -11,6 +11,8 @@
#ifndef WEBRTC_API_MEDIASTREAMPROXY_H_
#define WEBRTC_API_MEDIASTREAMPROXY_H_
+#include <string>
+
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/proxy.h"
diff --git a/api/mediastreamtrackproxy.h b/api/mediastreamtrackproxy.h
index da371f8..9a3cb42 100644
--- a/api/mediastreamtrackproxy.h
+++ b/api/mediastreamtrackproxy.h
@@ -14,6 +14,8 @@
#ifndef WEBRTC_API_MEDIASTREAMTRACKPROXY_H_
#define WEBRTC_API_MEDIASTREAMTRACKPROXY_H_
+#include <string>
+
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/proxy.h"
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index b1b996f..0280c18 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -288,7 +288,7 @@
// Chrome in particular.
RTCConfiguration() = default;
- RTCConfiguration(RTCConfigurationType type) {
+ explicit RTCConfiguration(RTCConfigurationType type) {
if (type == RTCConfigurationType::kAggressive) {
// These parameters are also defined in Java and IOS configurations,
// so their values may be overwritten by the Java or IOS configuration.
@@ -669,7 +669,7 @@
// Triggered when a remote peer opens a data channel.
virtual void OnDataChannel(
- rtc::scoped_refptr<DataChannelInterface> data_channel){};
+ rtc::scoped_refptr<DataChannelInterface> data_channel) {}
// Deprecated; please use the version that uses a scoped_refptr.
virtual void OnDataChannel(DataChannelInterface* data_channel) {}
diff --git a/api/peerconnectionproxy.h b/api/peerconnectionproxy.h
index ed707b3..76b45d6 100644
--- a/api/peerconnectionproxy.h
+++ b/api/peerconnectionproxy.h
@@ -11,6 +11,9 @@
#ifndef WEBRTC_API_PEERCONNECTIONPROXY_H_
#define WEBRTC_API_PEERCONNECTIONPROXY_H_
+#include <string>
+#include <vector>
+
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/proxy.h"
diff --git a/api/proxy.h b/api/proxy.h
index 51cdd29..f834790 100644
--- a/api/proxy.h
+++ b/api/proxy.h
@@ -52,6 +52,7 @@
#define WEBRTC_API_PROXY_H_
#include <memory>
+#include <utility>
#include "webrtc/base/event.h"
#include "webrtc/base/thread.h"
@@ -349,6 +350,7 @@
T5 a5_;
};
+
// Helper macros to reduce code duplication.
#define PROXY_MAP_BOILERPLATE(c) \
template <class INTERNAL_CLASS> \
@@ -363,6 +365,9 @@
const INTERNAL_CLASS* internal() const { return c_.get(); } \
INTERNAL_CLASS* internal() { return c_.get(); }
+#define END_PROXY_MAP() \
+ };
+
#define SIGNALING_PROXY_MAP_BOILERPLATE(c) \
protected: \
c##ProxyWithInternal(rtc::Thread* signaling_thread, INTERNAL_CLASS* c) \
@@ -448,13 +453,13 @@
private: \
rtc::Thread* destructor_thread() const { return signaling_thread_; } \
\
- public:
+ public: // NOLINTNEXTLINE
#define PROXY_WORKER_THREAD_DESTRUCTOR() \
private: \
rtc::Thread* destructor_thread() const { return worker_thread_; } \
\
- public:
+ public: // NOLINTNEXTLINE
#define PROXY_METHOD0(r, method) \
r method() override { \
@@ -549,10 +554,6 @@
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
}
-#define END_PROXY_MAP() \
- } \
- ;
-
} // namespace webrtc
#endif // WEBRTC_API_PROXY_H_
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index c5277e7..ac00386 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -12,6 +12,7 @@
#define WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_
#include <string>
+#include <vector>
#include "webrtc/api/stats/rtcstats.h"
diff --git a/api/statstypes.h b/api/statstypes.h
index 8f90c88..40d26ab 100644
--- a/api/statstypes.h
+++ b/api/statstypes.h
@@ -18,6 +18,7 @@
#include <list>
#include <map>
#include <string>
+#include <vector>
#include "webrtc/base/basictypes.h"
#include "webrtc/base/constructormagic.h"
@@ -234,7 +235,7 @@
// Protected since users of the IdBase type will be using the Id typedef.
virtual bool Equals(const IdBase& other) const;
- IdBase(StatsType type); // Only meant for derived classes.
+ explicit IdBase(StatsType type); // Only meant for derived classes.
const StatsType type_;
static const char kSeparator = '_';
diff --git a/api/umametrics.h b/api/umametrics.h
index 3e92bac..8999447 100644
--- a/api/umametrics.h
+++ b/api/umametrics.h
@@ -113,7 +113,6 @@
class MetricsObserverInterface : public rtc::RefCountInterface {
public:
-
// |type| is the type of the enum counter to be incremented. |counter|
// is the particular counter in that type. |counter_max| is the next sequence
// number after the highest counter.