Autogenerated with:
cp dom/.clang-format netwerk/ && mach format netwerk/**.{cpp,h,mm}
Manual fixes:
* mozurl/cbindgen.toml (including headers earlier)
* NetlinkService.h (forward-declaring a necessary struct)
* nsIWebSocketChannel.idl (forward-declaring OriginAttributes).
* nsAsyncRedirectVerifyHelper.h (forward-declaring nsIEventTarget)
* CapsuleEncoder.h gets a missing Capsule forward-decl.
* WebSocketConnectionBase.h gets some missing includes.
* HappyEyeballsConnectionAttempt gets some missing includes.
* nsUDPSocket missed nsSocketTransportService2.h for OnSocketThread().
* HttpInfo missed a forward declaration.
* MockHttpAuth missed an nsCOMPtr include.
* nsHttpAuthManager missed a forward declaration for nsIHttpAuthCache.
* WebTransportSessionProxy was using mozilla::Mutex in a member without
including it.
* win32 fixes to keep include order because windows headers suck.
* nsInputStreamPump needs an Atomics.h include.
Differential Revision: https://phabricator.services.mozilla.com/D311696
75 lines
2.3 KiB
C++
75 lines
2.3 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
// HttpLog.h should generally be included first
|
|
#include "AltSvcTransactionChild.h"
|
|
|
|
#include "AlternateServices.h"
|
|
#include "HttpLog.h"
|
|
#include "nsHttpConnectionInfo.h"
|
|
|
|
namespace mozilla {
|
|
namespace net {
|
|
|
|
AltSvcTransactionChild::AltSvcTransactionChild(nsHttpConnectionInfo* aConnInfo,
|
|
uint32_t aCaps)
|
|
: mConnInfo(aConnInfo), mCaps(aCaps) {
|
|
LOG(("AltSvcTransactionChild %p ctor", this));
|
|
}
|
|
|
|
AltSvcTransactionChild::~AltSvcTransactionChild() {
|
|
LOG(("AltSvcTransactionChild %p dtor", this));
|
|
}
|
|
|
|
void AltSvcTransactionChild::OnTransactionDestroy(bool aValidateResult) {
|
|
LOG(("AltSvcTransactionChild::OnTransactionDestroy %p aValidateResult=%d",
|
|
this, aValidateResult));
|
|
RefPtr<AltSvcTransactionChild> self = this;
|
|
auto task = [self, aValidateResult]() {
|
|
if (self->CanSend()) {
|
|
self->Send__delete__(self, aValidateResult);
|
|
}
|
|
};
|
|
if (!NS_IsMainThread()) {
|
|
NS_DispatchToMainThread(
|
|
NS_NewRunnableFunction("AltSvcTransactionChild::OnTransactionClose",
|
|
std::move(task)),
|
|
NS_DISPATCH_NORMAL);
|
|
return;
|
|
}
|
|
|
|
task();
|
|
}
|
|
|
|
void AltSvcTransactionChild::OnTransactionClose(bool aValidateResult) {
|
|
LOG(("AltSvcTransactionChild::OnTransactionClose %p aValidateResult=%d", this,
|
|
aValidateResult));
|
|
RefPtr<AltSvcTransactionChild> self = this;
|
|
auto task = [self, aValidateResult]() {
|
|
if (self->CanSend()) {
|
|
self->SendOnTransactionClose(aValidateResult);
|
|
}
|
|
};
|
|
if (!NS_IsMainThread()) {
|
|
NS_DispatchToMainThread(
|
|
NS_NewRunnableFunction("AltSvcTransactionChild::OnTransactionClose",
|
|
std::move(task)),
|
|
NS_DISPATCH_NORMAL);
|
|
return;
|
|
}
|
|
|
|
task();
|
|
}
|
|
|
|
already_AddRefed<SpeculativeTransaction>
|
|
AltSvcTransactionChild::CreateTransaction() {
|
|
RefPtr<SpeculativeTransaction> transaction =
|
|
new AltSvcTransaction<AltSvcTransactionChild>(mConnInfo, nullptr, mCaps,
|
|
this, mConnInfo->IsHttp3());
|
|
return transaction.forget();
|
|
}
|
|
|
|
} // namespace net
|
|
} // namespace mozilla
|