зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1525208 - Part 4: Devirtualize the call to nsEffectiveTLDService::GetBaseDomain() from ThirdPartyUtil::GetBaseDomain(); r=baku
Depends on D18645 Differential Revision: https://phabricator.services.mozilla.com/D18646 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b613760796
Коммит
4eb46262c5
|
@ -40,10 +40,8 @@ nsresult ThirdPartyUtil::Init() {
|
|||
gService = this;
|
||||
mozilla::ClearOnShutdown(&gService);
|
||||
|
||||
nsresult rv;
|
||||
mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
|
||||
|
||||
return rv;
|
||||
mTLDService = nsEffectiveTLDService::GetInstance();
|
||||
return mTLDService ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
ThirdPartyUtil::~ThirdPartyUtil() {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "mozIThirdPartyUtil.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsEffectiveTLDService.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsIURI;
|
||||
|
@ -30,7 +30,7 @@ class ThirdPartyUtil final : public mozIThirdPartyUtil {
|
|||
nsresult IsThirdPartyInternal(const nsCString& aFirstDomain,
|
||||
nsIURI* aSecondURI, bool* aResult);
|
||||
|
||||
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
||||
RefPtr<nsEffectiveTLDService> mTLDService;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,10 @@ XPIDL_SOURCES += [
|
|||
|
||||
XPIDL_MODULE = 'necko_dns'
|
||||
|
||||
EXPORTS += [
|
||||
'nsEffectiveTLDService.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.net += [
|
||||
'ChildDNSService.h',
|
||||
'DNS.h',
|
||||
|
|
|
@ -58,6 +58,22 @@ nsEffectiveTLDService::~nsEffectiveTLDService() {
|
|||
gService = nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<nsEffectiveTLDService> nsEffectiveTLDService::GetInstance() {
|
||||
if (gService) {
|
||||
return do_AddRef(gService);
|
||||
}
|
||||
nsCOMPtr<nsIEffectiveTLDService> tldService =
|
||||
do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
|
||||
if (!tldService) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(
|
||||
gService,
|
||||
"gService must have been initialized in nsEffectiveTLDService::Init");
|
||||
return do_AddRef(gService);
|
||||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(EffectiveTLDServiceMallocSizeOf)
|
||||
|
||||
// The amount of heap memory measured here is tiny. It used to be bigger when
|
||||
|
|
|
@ -29,6 +29,8 @@ class nsEffectiveTLDService final : public nsIEffectiveTLDService,
|
|||
nsEffectiveTLDService();
|
||||
nsresult Init();
|
||||
|
||||
static already_AddRefed<nsEffectiveTLDService> GetInstance();
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче