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-Commit-Position: refs/heads/master@{#16392}
This commit is contained in:
oprypin 2017-02-01 01:55:59 -08:00 committed by Commit bot
parent 83399caec5
commit 803dc29bb6
13 changed files with 25 additions and 12 deletions

View File

@ -15,6 +15,7 @@ import sys
# Directories that will be scanned by cpplint by the presubmit script.
CPPLINT_DIRS = [
'webrtc/api',
'webrtc/audio',
'webrtc/call',
'webrtc/common_video',

View File

@ -75,7 +75,7 @@ class DataChannelObserver {
// 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() {}

View File

@ -13,6 +13,7 @@
#include <map>
#include <string>
#include <vector>
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/base/thread_checker.h"

View File

@ -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"

View File

@ -70,7 +70,7 @@ void ConstraintToOptional(const webrtc::MediaConstraintsInterface* constraints,
*value_out = rtc::Optional<T>(value);
}
}
}
} // namespace
namespace webrtc {

View File

@ -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"

View File

@ -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"

View File

@ -288,7 +288,7 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
// 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 @@ class PeerConnectionObserver {
// 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) {}

View File

@ -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"

View File

@ -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 @@ class MethodCall5 : public rtc::Message,
T5 a5_;
};
// Helper macros to reduce code duplication.
#define PROXY_MAP_BOILERPLATE(c) \
template <class INTERNAL_CLASS> \
@ -363,6 +365,9 @@ class MethodCall5 : public rtc::Message,
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 @@ class MethodCall5 : public rtc::Message,
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 @@ class MethodCall5 : public rtc::Message,
return call.Marshal(RTC_FROM_HERE, worker_thread_); \
}
#define END_PROXY_MAP() \
} \
;
} // namespace webrtc
#endif // WEBRTC_API_PROXY_H_

View File

@ -12,6 +12,7 @@
#define WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_
#include <string>
#include <vector>
#include "webrtc/api/stats/rtcstats.h"

View File

@ -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 @@ class StatsReport {
// 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 = '_';

View File

@ -113,7 +113,6 @@ enum IceCandidatePairType {
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.