Reformat the WebRTC code base
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
diff --git a/pc/datachannel.cc b/pc/datachannel.cc
index b7a717c..6971ca8 100644
--- a/pc/datachannel.cc
+++ b/pc/datachannel.cc
@@ -122,10 +122,9 @@
return channel;
}
-DataChannel::DataChannel(
- DataChannelProviderInterface* provider,
- cricket::DataChannelType dct,
- const std::string& label)
+DataChannel::DataChannel(DataChannelProviderInterface* provider,
+ cricket::DataChannelType dct,
+ const std::string& label)
: label_(label),
observer_(nullptr),
state_(kConnecting),
@@ -141,14 +140,11 @@
receive_ssrc_set_(false),
writable_(false),
send_ssrc_(0),
- receive_ssrc_(0) {
-}
+ receive_ssrc_(0) {}
bool DataChannel::Init(const InternalDataChannelInit& config) {
if (data_channel_type_ == cricket::DCT_RTP) {
- if (config.reliable ||
- config.id != -1 ||
- config.maxRetransmits != -1 ||
+ if (config.reliable || config.id != -1 || config.maxRetransmits != -1 ||
config.maxRetransmitTime != -1) {
RTC_LOG(LS_ERROR) << "Failed to initialize the RTP data channel due to "
"invalid DataChannelInit.";
@@ -156,8 +152,7 @@
}
handshake_state_ = kHandshakeReady;
} else if (data_channel_type_ == cricket::DCT_SCTP) {
- if (config.id < -1 ||
- config.maxRetransmits < -1 ||
+ if (config.id < -1 || config.maxRetransmits < -1 ||
config.maxRetransmitTime < -1) {
RTC_LOG(LS_ERROR) << "Failed to initialize the SCTP data channel due to "
"invalid DataChannelInit.";
@@ -171,15 +166,15 @@
config_ = config;
switch (config_.open_handshake_role) {
- case webrtc::InternalDataChannelInit::kNone: // pre-negotiated
- handshake_state_ = kHandshakeReady;
- break;
- case webrtc::InternalDataChannelInit::kOpener:
- handshake_state_ = kHandshakeShouldSendOpen;
- break;
- case webrtc::InternalDataChannelInit::kAcker:
- handshake_state_ = kHandshakeShouldSendAck;
- break;
+ case webrtc::InternalDataChannelInit::kNone: // pre-negotiated
+ handshake_state_ = kHandshakeReady;
+ break;
+ case webrtc::InternalDataChannelInit::kOpener:
+ handshake_state_ = kHandshakeShouldSendOpen;
+ break;
+ case webrtc::InternalDataChannelInit::kAcker:
+ handshake_state_ = kHandshakeShouldSendAck;
+ break;
}
// Try to connect to the transport in case the transport channel already
@@ -214,8 +209,7 @@
if (data_channel_type_ == cricket::DCT_RTP) {
return false;
} else {
- return config_.maxRetransmits == -1 &&
- config_.maxRetransmitTime == -1;
+ return config_.maxRetransmits == -1 && config_.maxRetransmitTime == -1;
}
}
@@ -476,9 +470,8 @@
WriteDataChannelOpenAckMessage(&payload);
SendControlMessage(payload);
}
- if (writable_ &&
- (handshake_state_ == kHandshakeReady ||
- handshake_state_ == kHandshakeWaitingForAck)) {
+ if (writable_ && (handshake_state_ == kHandshakeReady ||
+ handshake_state_ == kHandshakeWaitingForAck)) {
SetState(kOpen);
// If we have received buffers before the channel got writable.
// Deliver them now.