Loading netwerk/build/nsNetCID.h +0 −12 Original line number Diff line number Diff line Loading @@ -629,18 +629,6 @@ {0x97, 0xa7, 0x06, 0xaf, 0x5e, 0x6d, 0x84, 0xc4} \ } // Background channel registrar used for pairing HttpChannelParent // and its background channel #define NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID \ "@mozilla.org/network/background-channel-registrar;1" #define NS_BACKGROUNDCHANNELREGISTRAR_CID \ { /* 6907788a-17cc-4c2a-a7c5-59ad2d9cc079 */ \ 0x6907788a, \ 0x17cc, \ 0x4c2a, \ { 0xa7, 0xc5, 0x59, 0xad, 0x2d, 0x9c, 0xc0, 0x79} \ } /****************************************************************************** * netwerk/protocol/ftp/ classes */ Loading netwerk/build/nsNetModule.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include "nsIContentSniffer.h" #include "Predictor.h" #include "nsIThreadPool.h" #include "mozilla/net/BackgroundChannelRegistrar.h" #include "mozilla/net/NeckoChild.h" #include "RedirectChannelRegistrar.h" Loading Loading @@ -250,7 +251,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init) #include "nsHttpNTLMAuth.h" #include "nsHttpActivityDistributor.h" #include "ThrottleQueue.h" #include "BackgroundChannelRegistrar.h" #undef LOG #undef LOG_ENABLED namespace mozilla { Loading @@ -264,7 +264,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpActivityDistributor) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpBasicAuth) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDigestAuth) NS_GENERIC_FACTORY_CONSTRUCTOR(ThrottleQueue) NS_GENERIC_FACTORY_CONSTRUCTOR(BackgroundChannelRegistrar) } // namespace net } // namespace mozilla Loading Loading @@ -648,6 +647,8 @@ static void nsNetShutdown() mozilla::net::RedirectChannelRegistrar::Shutdown(); mozilla::net::BackgroundChannelRegistrar::Shutdown(); delete gNetSniffers; gNetSniffers = nullptr; delete gDataSniffers; Loading Loading @@ -722,7 +723,6 @@ NS_DEFINE_NAMED_CID(NS_HTTPAUTHMANAGER_CID); NS_DEFINE_NAMED_CID(NS_HTTPCHANNELAUTHPROVIDER_CID); NS_DEFINE_NAMED_CID(NS_HTTPACTIVITYDISTRIBUTOR_CID); NS_DEFINE_NAMED_CID(NS_THROTTLEQUEUE_CID); NS_DEFINE_NAMED_CID(NS_BACKGROUNDCHANNELREGISTRAR_CID); NS_DEFINE_NAMED_CID(NS_FTPPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_RESPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_EXTENSIONPROTOCOLHANDLER_CID); Loading Loading @@ -842,7 +842,6 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = { { &kNS_HTTPCHANNELAUTHPROVIDER_CID, false, nullptr, mozilla::net::nsHttpChannelAuthProviderConstructor }, { &kNS_HTTPACTIVITYDISTRIBUTOR_CID, false, nullptr, mozilla::net::nsHttpActivityDistributorConstructor }, { &kNS_THROTTLEQUEUE_CID, false, nullptr, mozilla::net::ThrottleQueueConstructor }, { &kNS_BACKGROUNDCHANNELREGISTRAR_CID, false, nullptr, mozilla::net::BackgroundChannelRegistrarConstructor }, { &kNS_FTPPROTOCOLHANDLER_CID, false, nullptr, nsFtpProtocolHandlerConstructor }, { &kNS_RESPROTOCOLHANDLER_CID, false, nullptr, nsResProtocolHandlerConstructor }, { &kNS_EXTENSIONPROTOCOLHANDLER_CID, false, nullptr, mozilla::ExtensionProtocolHandlerConstructor }, Loading Loading @@ -968,7 +967,6 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = { { NS_HTTPCHANNELAUTHPROVIDER_CONTRACTID, &kNS_HTTPCHANNELAUTHPROVIDER_CID }, { NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &kNS_HTTPACTIVITYDISTRIBUTOR_CID }, { NS_THROTTLEQUEUE_CONTRACTID, &kNS_THROTTLEQUEUE_CID }, { NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID, &kNS_BACKGROUNDCHANNELREGISTRAR_CID }, { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp", &kNS_FTPPROTOCOLHANDLER_CID }, { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource", &kNS_RESPROTOCOLHANDLER_CID }, { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-extension", &kNS_EXTENSIONPROTOCOLHANDLER_CID }, Loading netwerk/protocol/http/BackgroundChannelRegistrar.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ #include "HttpChannelParent.h" #include "nsIInterfaceRequestor.h" #include "nsXULAppAPI.h" #include "mozilla/StaticPtr.h" namespace { mozilla::StaticRefPtr<mozilla::net::BackgroundChannelRegistrar> gSingleton; } namespace mozilla { namespace net { Loading @@ -30,6 +35,24 @@ BackgroundChannelRegistrar::~BackgroundChannelRegistrar() MOZ_ASSERT(NS_IsMainThread()); } // static already_AddRefed<nsIBackgroundChannelRegistrar> BackgroundChannelRegistrar::GetOrCreate() { if (!gSingleton) { gSingleton = new BackgroundChannelRegistrar(); } return do_AddRef(gSingleton); } // static void BackgroundChannelRegistrar::Shutdown() { MOZ_ASSERT(NS_IsMainThread()); gSingleton = nullptr; } void BackgroundChannelRegistrar::NotifyChannelLinked( HttpChannelParent* aChannelParent, Loading netwerk/protocol/http/BackgroundChannelRegistrar.h +6 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ #include "nsIBackgroundChannelRegistrar.h" #include "nsRefPtrHashtable.h" #include "mozilla/AlreadyAddRefed.h" namespace mozilla { namespace net { Loading @@ -28,6 +29,11 @@ public: explicit BackgroundChannelRegistrar(); // Singleton accessor static already_AddRefed<nsIBackgroundChannelRegistrar> GetOrCreate(); static void Shutdown(); private: virtual ~BackgroundChannelRegistrar(); Loading netwerk/protocol/http/HttpBackgroundChannelParent.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ #include "mozilla/ipc/BackgroundParent.h" #include "mozilla/IntegerPrintfMacros.h" #include "mozilla/Unused.h" #include "nsIBackgroundChannelRegistrar.h" #include "mozilla/net/BackgroundChannelRegistrar.h" #include "nsNetCID.h" #include "nsQueryObject.h" #include "nsThreadUtils.h" Loading Loading @@ -54,7 +54,7 @@ public: MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr<nsIBackgroundChannelRegistrar> registrar = do_GetService(NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID); BackgroundChannelRegistrar::GetOrCreate(); MOZ_ASSERT(registrar); registrar->LinkBackgroundChannel(mChannelId, mActor); Loading Loading
netwerk/build/nsNetCID.h +0 −12 Original line number Diff line number Diff line Loading @@ -629,18 +629,6 @@ {0x97, 0xa7, 0x06, 0xaf, 0x5e, 0x6d, 0x84, 0xc4} \ } // Background channel registrar used for pairing HttpChannelParent // and its background channel #define NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID \ "@mozilla.org/network/background-channel-registrar;1" #define NS_BACKGROUNDCHANNELREGISTRAR_CID \ { /* 6907788a-17cc-4c2a-a7c5-59ad2d9cc079 */ \ 0x6907788a, \ 0x17cc, \ 0x4c2a, \ { 0xa7, 0xc5, 0x59, 0xad, 0x2d, 0x9c, 0xc0, 0x79} \ } /****************************************************************************** * netwerk/protocol/ftp/ classes */ Loading
netwerk/build/nsNetModule.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include "nsIContentSniffer.h" #include "Predictor.h" #include "nsIThreadPool.h" #include "mozilla/net/BackgroundChannelRegistrar.h" #include "mozilla/net/NeckoChild.h" #include "RedirectChannelRegistrar.h" Loading Loading @@ -250,7 +251,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init) #include "nsHttpNTLMAuth.h" #include "nsHttpActivityDistributor.h" #include "ThrottleQueue.h" #include "BackgroundChannelRegistrar.h" #undef LOG #undef LOG_ENABLED namespace mozilla { Loading @@ -264,7 +264,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpActivityDistributor) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpBasicAuth) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDigestAuth) NS_GENERIC_FACTORY_CONSTRUCTOR(ThrottleQueue) NS_GENERIC_FACTORY_CONSTRUCTOR(BackgroundChannelRegistrar) } // namespace net } // namespace mozilla Loading Loading @@ -648,6 +647,8 @@ static void nsNetShutdown() mozilla::net::RedirectChannelRegistrar::Shutdown(); mozilla::net::BackgroundChannelRegistrar::Shutdown(); delete gNetSniffers; gNetSniffers = nullptr; delete gDataSniffers; Loading Loading @@ -722,7 +723,6 @@ NS_DEFINE_NAMED_CID(NS_HTTPAUTHMANAGER_CID); NS_DEFINE_NAMED_CID(NS_HTTPCHANNELAUTHPROVIDER_CID); NS_DEFINE_NAMED_CID(NS_HTTPACTIVITYDISTRIBUTOR_CID); NS_DEFINE_NAMED_CID(NS_THROTTLEQUEUE_CID); NS_DEFINE_NAMED_CID(NS_BACKGROUNDCHANNELREGISTRAR_CID); NS_DEFINE_NAMED_CID(NS_FTPPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_RESPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_EXTENSIONPROTOCOLHANDLER_CID); Loading Loading @@ -842,7 +842,6 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = { { &kNS_HTTPCHANNELAUTHPROVIDER_CID, false, nullptr, mozilla::net::nsHttpChannelAuthProviderConstructor }, { &kNS_HTTPACTIVITYDISTRIBUTOR_CID, false, nullptr, mozilla::net::nsHttpActivityDistributorConstructor }, { &kNS_THROTTLEQUEUE_CID, false, nullptr, mozilla::net::ThrottleQueueConstructor }, { &kNS_BACKGROUNDCHANNELREGISTRAR_CID, false, nullptr, mozilla::net::BackgroundChannelRegistrarConstructor }, { &kNS_FTPPROTOCOLHANDLER_CID, false, nullptr, nsFtpProtocolHandlerConstructor }, { &kNS_RESPROTOCOLHANDLER_CID, false, nullptr, nsResProtocolHandlerConstructor }, { &kNS_EXTENSIONPROTOCOLHANDLER_CID, false, nullptr, mozilla::ExtensionProtocolHandlerConstructor }, Loading Loading @@ -968,7 +967,6 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = { { NS_HTTPCHANNELAUTHPROVIDER_CONTRACTID, &kNS_HTTPCHANNELAUTHPROVIDER_CID }, { NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &kNS_HTTPACTIVITYDISTRIBUTOR_CID }, { NS_THROTTLEQUEUE_CONTRACTID, &kNS_THROTTLEQUEUE_CID }, { NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID, &kNS_BACKGROUNDCHANNELREGISTRAR_CID }, { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp", &kNS_FTPPROTOCOLHANDLER_CID }, { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource", &kNS_RESPROTOCOLHANDLER_CID }, { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-extension", &kNS_EXTENSIONPROTOCOLHANDLER_CID }, Loading
netwerk/protocol/http/BackgroundChannelRegistrar.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ #include "HttpChannelParent.h" #include "nsIInterfaceRequestor.h" #include "nsXULAppAPI.h" #include "mozilla/StaticPtr.h" namespace { mozilla::StaticRefPtr<mozilla::net::BackgroundChannelRegistrar> gSingleton; } namespace mozilla { namespace net { Loading @@ -30,6 +35,24 @@ BackgroundChannelRegistrar::~BackgroundChannelRegistrar() MOZ_ASSERT(NS_IsMainThread()); } // static already_AddRefed<nsIBackgroundChannelRegistrar> BackgroundChannelRegistrar::GetOrCreate() { if (!gSingleton) { gSingleton = new BackgroundChannelRegistrar(); } return do_AddRef(gSingleton); } // static void BackgroundChannelRegistrar::Shutdown() { MOZ_ASSERT(NS_IsMainThread()); gSingleton = nullptr; } void BackgroundChannelRegistrar::NotifyChannelLinked( HttpChannelParent* aChannelParent, Loading
netwerk/protocol/http/BackgroundChannelRegistrar.h +6 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ #include "nsIBackgroundChannelRegistrar.h" #include "nsRefPtrHashtable.h" #include "mozilla/AlreadyAddRefed.h" namespace mozilla { namespace net { Loading @@ -28,6 +29,11 @@ public: explicit BackgroundChannelRegistrar(); // Singleton accessor static already_AddRefed<nsIBackgroundChannelRegistrar> GetOrCreate(); static void Shutdown(); private: virtual ~BackgroundChannelRegistrar(); Loading
netwerk/protocol/http/HttpBackgroundChannelParent.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ #include "mozilla/ipc/BackgroundParent.h" #include "mozilla/IntegerPrintfMacros.h" #include "mozilla/Unused.h" #include "nsIBackgroundChannelRegistrar.h" #include "mozilla/net/BackgroundChannelRegistrar.h" #include "nsNetCID.h" #include "nsQueryObject.h" #include "nsThreadUtils.h" Loading Loading @@ -54,7 +54,7 @@ public: MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr<nsIBackgroundChannelRegistrar> registrar = do_GetService(NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID); BackgroundChannelRegistrar::GetOrCreate(); MOZ_ASSERT(registrar); registrar->LinkBackgroundChannel(mChannelId, mActor); Loading