Bug 1457411 - Update netwerk module to make use of newer methods introduced with c++11 and c++14. r=valentin

MozReview-Commit-ID: 666LNaHyiuQ
This commit is contained in:
Andi-Bogdan Postelnicu
2018-04-30 19:46:04 +03:00
parent c99fb101b1
commit 99cba2dd23
252 changed files with 587 additions and 1012 deletions

View File

@@ -135,7 +135,7 @@ class FailDelay
{
public:
FailDelay(nsCString address, int32_t port)
: mAddress(address), mPort(port)
: mAddress(std::move(address)), mPort(port)
{
mLastFailure = TimeStamp::Now();
mNextDelay = kWSReconnectInitialBaseDelay +
@@ -607,7 +607,7 @@ public:
}
private:
~CallOnMessageAvailable() {}
~CallOnMessageAvailable() = default;
RefPtr<WebSocketChannel> mChannel;
RefPtr<BaseWebSocketChannel::ListenerAndContextContainer> mListenerMT;
@@ -649,7 +649,7 @@ public:
}
private:
~CallOnStop() {}
~CallOnStop() = default;
RefPtr<WebSocketChannel> mChannel;
RefPtr<BaseWebSocketChannel::ListenerAndContextContainer> mListenerMT;
@@ -691,7 +691,7 @@ public:
}
private:
~CallOnServerClose() {}
~CallOnServerClose() = default;
RefPtr<WebSocketChannel> mChannel;
RefPtr<BaseWebSocketChannel::ListenerAndContextContainer> mListenerMT;
@@ -731,7 +731,7 @@ public:
}
private:
~CallAcknowledge() {}
~CallAcknowledge() = default;
RefPtr<WebSocketChannel> mChannel;
RefPtr<BaseWebSocketChannel::ListenerAndContextContainer> mListenerMT;
@@ -763,7 +763,7 @@ public:
}
private:
~CallOnTransportAvailable() {}
~CallOnTransportAvailable() = default;
RefPtr<WebSocketChannel> mChannel;
nsCOMPtr<nsISocketTransport> mTransport;
@@ -1140,7 +1140,7 @@ public:
}
private:
~OutboundEnqueuer() {}
~OutboundEnqueuer() = default;
RefPtr<WebSocketChannel> mChannel;
OutboundMessage *mMessage;
@@ -1164,16 +1164,16 @@ WebSocketChannel::WebSocketChannel() :
mAllowPMCE(1),
mPingOutstanding(0),
mReleaseOnTransmit(0),
mDataStarted(0),
mRequestedClose(0),
mClientClosed(0),
mServerClosed(0),
mStopped(0),
mCalledOnStop(0),
mTCPClosed(0),
mOpenedHttpChannel(0),
mIncrementedSessionCount(0),
mDecrementedSessionCount(0),
mDataStarted(false),
mRequestedClose(false),
mClientClosed(false),
mServerClosed(false),
mStopped(false),
mCalledOnStop(false),
mTCPClosed(false),
mOpenedHttpChannel(false),
mIncrementedSessionCount(false),
mDecrementedSessionCount(false),
mMaxMessageSize(INT32_MAX),
mStopOnClose(NS_OK),
mServerCloseCode(CLOSE_ABNORMAL),
@@ -1330,7 +1330,7 @@ WebSocketChannel::OnNetworkChanged()
}
// Trigger the ping timeout asap to fire off a new ping. Wait just
// a little bit to better avoid multi-triggers.
mPingForced = 1;
mPingForced = true;
mPingTimer->InitWithCallback(this, 200, nsITimer::TYPE_ONE_SHOT);
return NS_OK;
@@ -1418,7 +1418,7 @@ WebSocketChannel::BeginOpenInternal()
AbortSession(NS_ERROR_CONNECTION_REFUSED);
return;
}
mOpenedHttpChannel = 1;
mOpenedHttpChannel = true;
rv = NS_NewTimerWithCallback(getter_AddRefs(mOpenTimer),
this, mOpenTimeout,
@@ -1766,7 +1766,7 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count)
if (opcode == nsIWebSocketFrame::OPCODE_CLOSE) {
LOG(("WebSocketChannel:: close received\n"));
mServerClosed = 1;
mServerClosed = true;
mServerCloseCode = CLOSE_NO_STATUS;
if (payloadLength >= 2) {
@@ -2082,7 +2082,7 @@ WebSocketChannel::PrimeNewOutgoingMessage()
return;
}
mClientClosed = 1;
mClientClosed = true;
mOutHeader[0] = kFinalFragBit | nsIWebSocketFrame::OPCODE_CLOSE;
mOutHeader[1] = maskBit;
@@ -2368,7 +2368,7 @@ WebSocketChannel::StopSession(nsresult reason)
// normally this should be called on socket thread, but it is ok to call it
// from OnStartRequest before the socket thread machine has gotten underway
mStopped = 1;
mStopped = true;
if (!mOpenedHttpChannel) {
// The HTTP channel information will never be used in this case
@@ -2459,7 +2459,7 @@ WebSocketChannel::StopSession(nsresult reason)
mPMCECompressor = nullptr;
if (!mCalledOnStop) {
mCalledOnStop = 1;
mCalledOnStop = true;
nsWSAdmissionManager::OnStopSession(this, reason);
@@ -2490,11 +2490,11 @@ WebSocketChannel::AbortSession(nsresult reason)
if (mStopped)
return;
mStopped = 1;
mStopped = true;
if (mTransport && reason != NS_BASE_STREAM_CLOSED && !mRequestedClose &&
!mClientClosed && !mServerClosed && mConnecting == NOT_CONNECTING) {
mRequestedClose = 1;
mRequestedClose = true;
mStopOnClose = reason;
mSocketThread->Dispatch(
new OutboundEnqueuer(this, new OutboundMessage(kMsgTypeFin, nullptr)),
@@ -2522,7 +2522,7 @@ WebSocketChannel::IncrementSessionCount()
{
if (!mIncrementedSessionCount) {
nsWSAdmissionManager::IncrementSessionCount();
mIncrementedSessionCount = 1;
mIncrementedSessionCount = true;
}
}
@@ -2535,7 +2535,7 @@ WebSocketChannel::DecrementSessionCount()
// times when they'll never be a race condition for checking/setting them.
if (mIncrementedSessionCount && !mDecrementedSessionCount) {
nsWSAdmissionManager::DecrementSessionCount();
mDecrementedSessionCount = 1;
mDecrementedSessionCount = true;
}
}
@@ -2957,7 +2957,7 @@ WebSocketChannel::StartWebsocketData()
LOG(("WebSocketChannel::StartWebsocketData() %p", this));
MOZ_ASSERT(!mDataStarted, "StartWebsocketData twice");
mDataStarted = 1;
mDataStarted = true;
rv = mSocketIn->AsyncWait(this, 0, 0, mSocketThread);
if (NS_FAILED(rv)) {
@@ -3237,7 +3237,7 @@ WebSocketChannel::AsyncOnChannelRedirect(
// ApplyForAdmission as if we were starting from fresh...
mAddress.Truncate();
mOpenedHttpChannel = 0;
mOpenedHttpChannel = false;
rv = ApplyForAdmission();
if (NS_FAILED(rv)) {
LOG(("WebSocketChannel: Redirect failed due to DNS failure\n"));
@@ -3298,7 +3298,7 @@ WebSocketChannel::Notify(nsITimer *timer)
MOZ_ASSERT(mPingInterval || mPingForced);
LOG(("nsWebSocketChannel:: Generating Ping\n"));
mPingOutstanding = 1;
mPingForced = 0;
mPingForced = false;
mPingTimer->InitWithCallback(this, mPingResponseTimeout,
nsITimer::TYPE_ONE_SHOT);
GeneratePing();
@@ -3584,7 +3584,7 @@ WebSocketChannel::Close(uint16_t code, const nsACString & reason)
if (reason.Length() > 123)
return NS_ERROR_ILLEGAL_VALUE;
mRequestedClose = 1;
mRequestedClose = true;
mScriptCloseReason = reason;
mScriptCloseCode = code;