AltSvcTransactionParent.cpp (2250B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 // HttpLog.h should generally be included first 7 #include "HttpLog.h" 8 9 #include "AltSvcTransactionParent.h" 10 #include "AlternateServices.h" 11 #include "mozilla/net/SocketProcessParent.h" 12 #include "nsHttpConnectionInfo.h" 13 14 namespace mozilla { 15 namespace net { 16 17 NS_IMPL_ADDREF_INHERITED(AltSvcTransactionParent, NullHttpTransaction) 18 NS_IMPL_RELEASE_INHERITED(AltSvcTransactionParent, NullHttpTransaction) 19 20 NS_INTERFACE_MAP_BEGIN(AltSvcTransactionParent) 21 NS_INTERFACE_MAP_ENTRY_CONCRETE(AltSvcTransactionParent) 22 NS_INTERFACE_MAP_END_INHERITING(NullHttpTransaction) 23 24 AltSvcTransactionParent::AltSvcTransactionParent( 25 nsHttpConnectionInfo* aConnInfo, nsIInterfaceRequestor* aCallbacks, 26 uint32_t aCaps, AltSvcMappingValidator* aValidator) 27 : SpeculativeTransaction(aConnInfo, aCallbacks, 28 aCaps & ~NS_HTTP_ALLOW_KEEPALIVE), 29 mValidator(aValidator) { 30 LOG(("AltSvcTransactionParent %p ctor", this)); 31 MOZ_ASSERT(mValidator); 32 } 33 34 AltSvcTransactionParent::~AltSvcTransactionParent() { 35 LOG(("AltSvcTransactionParent %p dtor", this)); 36 } 37 38 bool AltSvcTransactionParent::Init() { 39 RefPtr<SocketProcessParent> parent = SocketProcessParent::GetSingleton(); 40 if (!parent) { 41 return false; 42 } 43 44 HttpConnectionInfoCloneArgs connInfo; 45 nsHttpConnectionInfo::SerializeHttpConnectionInfo(mConnectionInfo, connInfo); 46 return parent->SendPAltSvcTransactionConstructor(this, connInfo, mCaps); 47 } 48 49 mozilla::ipc::IPCResult AltSvcTransactionParent::Recv__delete__( 50 const bool& aValidateResult) { 51 LOG(("AltSvcTransactionParent::Recv__delete__ this=%p", this)); 52 mValidator->OnTransactionDestroy(aValidateResult); 53 return IPC_OK(); 54 } 55 56 mozilla::ipc::IPCResult AltSvcTransactionParent::RecvOnTransactionClose( 57 const bool& aValidateResult) { 58 LOG(("AltSvcTransactionParent::RecvOnTransactionClose this=%p", this)); 59 mValidator->OnTransactionClose(aValidateResult); 60 return IPC_OK(); 61 } 62 63 } // namespace net 64 } // namespace mozilla