зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1488305 - Remove the XPCOM component registration for BackgroundChannelRegistrar; r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D4893
This commit is contained in:
Родитель
7f29922ce1
Коммит
266b53e783
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
||||
|
@ -648,6 +647,8 @@ static void nsNetShutdown()
|
|||
|
||||
mozilla::net::RedirectChannelRegistrar::Shutdown();
|
||||
|
||||
mozilla::net::BackgroundChannelRegistrar::Shutdown();
|
||||
|
||||
delete gNetSniffers;
|
||||
gNetSniffers = nullptr;
|
||||
delete gDataSniffers;
|
||||
|
@ -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);
|
||||
|
@ -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 },
|
||||
|
@ -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 },
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "nsIBackgroundChannelRegistrar.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -28,6 +29,11 @@ public:
|
|||
|
||||
explicit BackgroundChannelRegistrar();
|
||||
|
||||
// Singleton accessor
|
||||
static already_AddRefed<nsIBackgroundChannelRegistrar> GetOrCreate();
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
private:
|
||||
virtual ~BackgroundChannelRegistrar();
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
@ -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);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsISupportsPriority.h"
|
||||
#include "nsIAuthPromptProvider.h"
|
||||
#include "nsIBackgroundChannelRegistrar.h"
|
||||
#include "mozilla/net/BackgroundChannelRegistrar.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
#include "nsISerializable.h"
|
||||
#include "nsIAssociatedContentSecurity.h"
|
||||
|
@ -263,7 +263,7 @@ HttpChannelParent::CleanupBackgroundChannel()
|
|||
// This HttpChannelParent might still have a reference from
|
||||
// BackgroundChannelRegistrar.
|
||||
nsCOMPtr<nsIBackgroundChannelRegistrar> registrar =
|
||||
do_GetService(NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID);
|
||||
BackgroundChannelRegistrar::GetOrCreate();
|
||||
MOZ_ASSERT(registrar);
|
||||
|
||||
registrar->DeleteChannel(mChannel->ChannelId());
|
||||
|
@ -730,7 +730,7 @@ HttpChannelParent::WaitForBgParent()
|
|||
|
||||
|
||||
nsCOMPtr<nsIBackgroundChannelRegistrar> registrar =
|
||||
do_GetService(NS_BACKGROUNDCHANNELREGISTRAR_CONTRACTID);
|
||||
BackgroundChannelRegistrar::GetOrCreate();
|
||||
MOZ_ASSERT(registrar);
|
||||
registrar->LinkHttpChannel(mChannel->ChannelId(), this);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ EXPORTS += [
|
|||
EXPORTS.mozilla.net += [
|
||||
'AltDataOutputStreamChild.h',
|
||||
'AltDataOutputStreamParent.h',
|
||||
'BackgroundChannelRegistrar.h',
|
||||
'HttpAuthUtils.h',
|
||||
'HttpBackgroundChannelChild.h',
|
||||
'HttpBackgroundChannelParent.h',
|
||||
|
|
Загрузка…
Ссылка в новой задаче