Enable the clang style plugin in primary p2p/ target

Bug: webrtc:163
Change-Id: I318982ee549fe71cd48f74cdfad4173506742411
Reviewed-on: https://webrtc-review.googlesource.com/17040
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20509}
This commit is contained in:
Steve Anton 2017-10-31 16:27:34 -07:00 committed by Commit Bot
parent 09e09bdb27
commit f2737d23d1
18 changed files with 155 additions and 63 deletions

View File

@ -53,6 +53,7 @@ rtc_static_library("libjingle_peerconnection_api") {
"notifier.h",
"peerconnectionfactoryproxy.h",
"peerconnectionproxy.h",
"proxy.cc",
"proxy.h",
"rtcerror.cc",
"rtcerror.h",
@ -63,6 +64,7 @@ rtc_static_library("libjingle_peerconnection_api") {
"statstypes.cc",
"statstypes.h",
"turncustomizer.h",
"umametrics.cc",
"umametrics.h",
"videosourceproxy.h",
]

38
api/proxy.cc Normal file
View File

@ -0,0 +1,38 @@
/*
* Copyright 2017 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.
*/
#include "api/proxy.h"
namespace webrtc {
namespace internal {
SynchronousMethodCall::SynchronousMethodCall(rtc::MessageHandler* proxy)
: e_(), proxy_(proxy) {}
SynchronousMethodCall::~SynchronousMethodCall() = default;
void SynchronousMethodCall::Invoke(const rtc::Location& posted_from,
rtc::Thread* t) {
if (t->IsCurrent()) {
proxy_->OnMessage(nullptr);
} else {
e_.reset(new rtc::Event(false, false));
t->Post(posted_from, this, 0);
e_->Wait(rtc::Event::kForever);
}
}
void SynchronousMethodCall::OnMessage(rtc::Message*) {
proxy_->OnMessage(nullptr);
e_->Set();
}
} // namespace internal
} // namespace webrtc

View File

@ -123,25 +123,14 @@ class SynchronousMethodCall
: public rtc::MessageData,
public rtc::MessageHandler {
public:
explicit SynchronousMethodCall(rtc::MessageHandler* proxy)
: e_(), proxy_(proxy) {}
~SynchronousMethodCall() {}
explicit SynchronousMethodCall(rtc::MessageHandler* proxy);
~SynchronousMethodCall() override;
void Invoke(const rtc::Location& posted_from, rtc::Thread* t) {
if (t->IsCurrent()) {
proxy_->OnMessage(nullptr);
} else {
e_.reset(new rtc::Event(false, false));
t->Post(posted_from, this, 0);
e_->Wait(rtc::Event::kForever);
}
}
void Invoke(const rtc::Location& posted_from, rtc::Thread* t);
private:
void OnMessage(rtc::Message*) {
proxy_->OnMessage(nullptr);
e_->Set();
}
void OnMessage(rtc::Message*) override;
std::unique_ptr<rtc::Event> e_;
rtc::MessageHandler* proxy_;
};

21
api/umametrics.cc Normal file
View File

@ -0,0 +1,21 @@
/*
* Copyright 2017 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.
*/
#include "api/umametrics.h"
namespace webrtc {
void MetricsObserverInterface::IncrementSparseEnumCounter(
PeerConnectionEnumCounterType type,
int counter) {
IncrementEnumCounter(type, counter, 0 /* Ignored */);
}
} // namespace webrtc

View File

@ -124,15 +124,10 @@ class MetricsObserverInterface : public rtc::RefCountInterface {
// TODO(guoweis): Remove the implementation once the dependency's interface
// definition is updated.
virtual void IncrementSparseEnumCounter(PeerConnectionEnumCounterType type,
int counter) {
IncrementEnumCounter(type, counter, 0 /* Ignored */);
}
int counter);
virtual void AddHistogramSample(PeerConnectionMetricsName type,
int value) = 0;
protected:
virtual ~MetricsObserverInterface() {}
};
typedef MetricsObserverInterface UMAObserver;

View File

@ -115,11 +115,6 @@ rtc_static_library("rtc_p2p") {
"FEATURE_ENABLE_VOICEMAIL",
"FEATURE_ENABLE_PSTN",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}

View File

@ -28,12 +28,12 @@ class AsyncStunTCPSocket : public rtc::AsyncTCPSocketBase {
const rtc::SocketAddress& remote_address);
AsyncStunTCPSocket(rtc::AsyncSocket* socket, bool listen);
virtual ~AsyncStunTCPSocket() {}
virtual int Send(const void* pv, size_t cb,
const rtc::PacketOptions& options);
virtual void ProcessInput(char* data, size_t* len);
virtual void HandleIncomingConnection(rtc::AsyncSocket* socket);
int Send(const void* pv,
size_t cb,
const rtc::PacketOptions& options) override;
void ProcessInput(char* data, size_t* len) override;
void HandleIncomingConnection(rtc::AsyncSocket* socket) override;
private:
// This method returns the message hdr + length written in the header.

View File

@ -64,6 +64,45 @@ ConnectionInfo::ConnectionInfo()
nominated(false),
total_round_trip_time_ms(0) {}
ConnectionInfo::ConnectionInfo(const ConnectionInfo&) = default;
ConnectionInfo::~ConnectionInfo() = default;
TransportChannelStats::TransportChannelStats() = default;
TransportChannelStats::TransportChannelStats(const TransportChannelStats&) =
default;
TransportChannelStats::~TransportChannelStats() = default;
TransportStats::TransportStats() = default;
TransportStats::~TransportStats() = default;
IceConfig::IceConfig() = default;
IceConfig::IceConfig(int receiving_timeout_ms,
int backup_connection_ping_interval,
ContinualGatheringPolicy gathering_policy,
bool prioritize_most_likely_candidate_pairs,
int stable_writable_connection_ping_interval_ms,
bool presume_writable_when_fully_relayed,
int regather_on_failed_networks_interval_ms,
int receiving_switching_delay_ms)
: receiving_timeout(receiving_timeout_ms),
backup_connection_ping_interval(backup_connection_ping_interval),
continual_gathering_policy(gathering_policy),
prioritize_most_likely_candidate_pairs(
prioritize_most_likely_candidate_pairs),
stable_writable_connection_ping_interval(
stable_writable_connection_ping_interval_ms),
presume_writable_when_fully_relayed(presume_writable_when_fully_relayed),
regather_on_failed_networks_interval(
regather_on_failed_networks_interval_ms),
receiving_switching_delay(receiving_switching_delay_ms) {}
IceConfig::~IceConfig() = default;
bool BadTransportDescription(const std::string& desc, std::string* err_desc) {
if (err_desc) {
*err_desc = desc;
@ -128,6 +167,8 @@ JsepTransport::JsepTransport(
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate)
: mid_(mid), certificate_(certificate) {}
JsepTransport::~JsepTransport() = default;
bool JsepTransport::AddChannel(DtlsTransportInternal* dtls, int component) {
if (channels_.find(component) != channels_.end()) {
LOG(LS_ERROR) << "Adding channel for component " << component << " twice.";

View File

@ -84,6 +84,8 @@ enum ContinualGatheringPolicy {
// TODO(hta): Rename to ConnectionStats
struct ConnectionInfo {
ConnectionInfo();
ConnectionInfo(const ConnectionInfo&);
~ConnectionInfo();
bool best_connection; // Is this the best connection we have?
bool writable; // Has this connection received a STUN response?
@ -126,6 +128,10 @@ typedef std::vector<ConnectionInfo> ConnectionInfos;
// Information about a specific channel
struct TransportChannelStats {
TransportChannelStats();
TransportChannelStats(const TransportChannelStats&);
~TransportChannelStats();
int component = 0;
ConnectionInfos connection_infos;
int srtp_crypto_suite = rtc::SRTP_INVALID_CRYPTO_SUITE;
@ -139,6 +145,9 @@ typedef std::vector<TransportChannelStats> TransportChannelStatsList;
// Information about the stats of a transport.
struct TransportStats {
TransportStats();
~TransportStats();
std::string transport_name;
TransportChannelStatsList channel_stats;
};
@ -202,7 +211,7 @@ struct IceConfig {
// Measure in milliseconds.
rtc::Optional<int> ice_check_min_interval;
IceConfig() {}
IceConfig();
IceConfig(int receiving_timeout_ms,
int backup_connection_ping_interval,
ContinualGatheringPolicy gathering_policy,
@ -210,19 +219,8 @@ struct IceConfig {
int stable_writable_connection_ping_interval_ms,
bool presume_writable_when_fully_relayed,
int regather_on_failed_networks_interval_ms,
int receiving_switching_delay_ms)
: receiving_timeout(receiving_timeout_ms),
backup_connection_ping_interval(backup_connection_ping_interval),
continual_gathering_policy(gathering_policy),
prioritize_most_likely_candidate_pairs(
prioritize_most_likely_candidate_pairs),
stable_writable_connection_ping_interval(
stable_writable_connection_ping_interval_ms),
presume_writable_when_fully_relayed(
presume_writable_when_fully_relayed),
regather_on_failed_networks_interval(
regather_on_failed_networks_interval_ms),
receiving_switching_delay(receiving_switching_delay_ms) {}
int receiving_switching_delay_ms);
~IceConfig();
};
bool BadTransportDescription(const std::string& desc, std::string* err_desc);
@ -254,6 +252,7 @@ class JsepTransport : public sigslot::has_slots<> {
// may be set before a local certificate is generated.
JsepTransport(const std::string& mid,
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate);
~JsepTransport() override;
// Returns the MID of this transport.
const std::string& mid() const { return mid_; }

View File

@ -23,6 +23,8 @@ PacketLossEstimator::PacketLossEstimator(int64_t consider_lost_after_ms,
RTC_DCHECK_LT(consider_lost_after_ms, forget_after_ms);
}
PacketLossEstimator::~PacketLossEstimator() = default;
void PacketLossEstimator::ExpectResponse(std::string id, int64_t sent_time) {
tracked_packets_[id] = PacketInfo{sent_time, false};

View File

@ -39,6 +39,7 @@ class PacketLossEstimator {
public:
explicit PacketLossEstimator(int64_t consider_lost_after_ms,
int64_t forget_after_ms);
~PacketLossEstimator();
// Registers that a message with the given |id| was sent at |sent_time|.
void ExpectResponse(std::string id, int64_t sent_time);

View File

@ -168,6 +168,15 @@ Port::Port(rtc::Thread* thread,
Construct();
}
Port::Port(rtc::Thread* thread,
const std::string& type,
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
const std::string& username_fragment,
const std::string& password)
: Port(thread, type, factory, network, username_fragment, password) {}
Port::Port(rtc::Thread* thread,
const std::string& type,
rtc::PacketSocketFactory* factory,

View File

@ -151,8 +151,7 @@ class Port : public PortInterface, public rtc::MessageHandler,
rtc::Network* network,
const rtc::IPAddress& ip,
const std::string& username_fragment,
const std::string& password)
: Port(thread, type, factory, network, username_fragment, password) {}
const std::string& password);
Port(rtc::Thread* thread,
const std::string& type,
rtc::PacketSocketFactory* factory,

View File

@ -34,7 +34,7 @@ class RelayServer : public rtc::MessageHandler,
public:
// Creates a server, which will use this thread to post messages to itself.
explicit RelayServer(rtc::Thread* thread);
~RelayServer();
~RelayServer() override;
rtc::Thread* thread() { return thread_; }
@ -116,7 +116,7 @@ class RelayServer : public rtc::MessageHandler,
void RemoveBinding(RelayServerBinding* binding);
// Handle messages in our thread.
void OnMessage(rtc::Message *pmsg);
void OnMessage(rtc::Message* pmsg) override;
// Called when the timer for checking lifetime times out.
void OnTimeout(RelayServerBinding* binding);
@ -185,7 +185,7 @@ class RelayServerBinding : public rtc::MessageHandler {
const std::string& username,
const std::string& password,
int lifetime);
virtual ~RelayServerBinding();
~RelayServerBinding() override;
RelayServer* server() { return server_; }
int lifetime() { return lifetime_; }
@ -214,7 +214,7 @@ class RelayServerBinding : public rtc::MessageHandler {
const rtc::SocketAddress& ext_addr);
// MessageHandler:
void OnMessage(rtc::Message *pmsg);
void OnMessage(rtc::Message* pmsg) override;
private:
RelayServer* server_;

View File

@ -84,7 +84,7 @@ class StunRequest : public rtc::MessageHandler {
public:
StunRequest();
StunRequest(StunMessage* request);
virtual ~StunRequest();
~StunRequest() override;
// Causes our wrapped StunMessage to be Prepared
void Construct();
@ -133,7 +133,7 @@ class StunRequest : public rtc::MessageHandler {
void set_manager(StunRequestManager* manager);
// Handles messages for sending and timeout.
void OnMessage(rtc::Message* pmsg);
void OnMessage(rtc::Message* pmsg) override;
StunRequestManager* manager_;
StunMessage* msg_;

View File

@ -61,7 +61,7 @@ enum {
class TurnServerAllocation::Permission : public rtc::MessageHandler {
public:
Permission(rtc::Thread* thread, const rtc::IPAddress& peer);
~Permission();
~Permission() override;
const rtc::IPAddress& peer() const { return peer_; }
void Refresh();
@ -69,7 +69,7 @@ class TurnServerAllocation::Permission : public rtc::MessageHandler {
sigslot::signal1<Permission*> SignalDestroyed;
private:
virtual void OnMessage(rtc::Message* msg);
void OnMessage(rtc::Message* msg) override;
rtc::Thread* thread_;
rtc::IPAddress peer_;
@ -82,7 +82,7 @@ class TurnServerAllocation::Channel : public rtc::MessageHandler {
public:
Channel(rtc::Thread* thread, int id,
const rtc::SocketAddress& peer);
~Channel();
~Channel() override;
int id() const { return id_; }
const rtc::SocketAddress& peer() const { return peer_; }
@ -91,7 +91,7 @@ class TurnServerAllocation::Channel : public rtc::MessageHandler {
sigslot::signal1<Channel*> SignalDestroyed;
private:
virtual void OnMessage(rtc::Message* msg);
void OnMessage(rtc::Message* msg) override;
rtc::Thread* thread_;
int id_;

View File

@ -73,7 +73,7 @@ class TurnServerAllocation : public rtc::MessageHandler,
const TurnServerConnection& conn,
rtc::AsyncPacketSocket* server_socket,
const std::string& key);
virtual ~TurnServerAllocation();
~TurnServerAllocation() override;
TurnServerConnection* conn() { return &conn_; }
const std::string& key() const { return key_; }
@ -123,7 +123,7 @@ class TurnServerAllocation : public rtc::MessageHandler,
void OnPermissionDestroyed(Permission* perm);
void OnChannelDestroyed(Channel* channel);
virtual void OnMessage(rtc::Message* msg);
void OnMessage(rtc::Message* msg) override;
TurnServer* server_;
rtc::Thread* thread_;
@ -174,7 +174,7 @@ class TurnServer : public sigslot::has_slots<> {
AllocationMap;
explicit TurnServer(rtc::Thread* thread);
~TurnServer();
~TurnServer() override;
// Gets/sets the realm value to use for the server.
const std::string& realm() const { return realm_; }

View File

@ -35,7 +35,7 @@ public:
ConnectionMonitor(ConnectionStatsGetter* stats_getter,
rtc::Thread* network_thread,
rtc::Thread* monitoring_thread);
~ConnectionMonitor();
~ConnectionMonitor() override;
void Start(int cms);
void Stop();
@ -44,7 +44,8 @@ public:
const std::vector<ConnectionInfo>&> SignalUpdate;
protected:
void OnMessage(rtc::Message* message);
void OnMessage(rtc::Message* message) override;
private:
void PollConnectionStats_w();