Bug 1733922 - Specialize TransportSetup into Primary/BackupTransportSetup r=necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D127410
This commit is contained in:
Valentin Gosu 2021-10-14 12:58:01 +00:00
Родитель 4cd661b6a5
Коммит bf91b5a3a9
2 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -53,13 +53,11 @@ DnsAndConnectSocket::DnsAndConnectSocket(nsHttpConnectionInfo* ci,
uint32_t caps, bool speculative,
bool isFromPredictor, bool urgentStart)
: mTransaction(trans),
mPrimaryTransport(false),
mCaps(caps),
mSpeculative(speculative),
mUrgentStart(urgentStart),
mIsFromPredictor(isFromPredictor),
mConnInfo(ci),
mBackupTransport(true) {
mConnInfo(ci) {
MOZ_ASSERT(ci && trans, "constructor with null arguments");
LOG(("Creating DnsAndConnectSocket [this=%p trans=%p ent=%s key=%s]\n", this,
trans, mConnInfo->Origin(), mConnInfo->HashKey().get()));

Просмотреть файл

@ -169,8 +169,6 @@ class DnsAndConnectSocket final : public nsIOutputStreamCallback,
void SetConnecting();
void MaybeSetConnectingDone();
explicit TransportSetup(bool isBackup);
nsresult Init(DnsAndConnectSocket* dnsAndSock);
void CancelDnsResolution();
void Abandon();
@ -184,6 +182,17 @@ class DnsAndConnectSocket final : public nsIOutputStreamCallback,
nsresult OnLookupComplete(DnsAndConnectSocket* dnsAndSock,
nsIDNSRecord* rec, nsresult status);
nsresult CheckConnectedResult(DnsAndConnectSocket* dnsAndSock);
protected:
explicit TransportSetup(bool isBackup);
};
struct PrimaryTransportSetup final : TransportSetup {
PrimaryTransportSetup() : TransportSetup(false) {}
};
struct BackupTransportSetup final : TransportSetup {
BackupTransportSetup() : TransportSetup(true) {}
};
nsresult SetupConn(bool isPrimary, nsresult status);
@ -210,7 +219,7 @@ class DnsAndConnectSocket final : public nsIOutputStreamCallback,
RefPtr<nsAHttpTransaction> mTransaction;
bool mDispatchedMTransaction = false;
TransportSetup mPrimaryTransport;
PrimaryTransportSetup mPrimaryTransport;
uint32_t mCaps;
// mSpeculative is set if the socket was created from
@ -247,7 +256,7 @@ class DnsAndConnectSocket final : public nsIOutputStreamCallback,
RefPtr<nsHttpConnectionInfo> mConnInfo;
nsCOMPtr<nsITimer> mSynTimer;
TransportSetup mBackupTransport;
BackupTransportSetup mBackupTransport;
bool mIsHttp3;