mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 831193 (part 2) - Don't use NS_MEMORY_REPORTER_IMPLEMENT for the effective-tld-service reporter. r=michal.novotny.
--HG-- extra : rebase_source : d9c79c95d14f8a958e0a5a268a5e1665efbe22ce
This commit is contained in:
parent
02caf5329e
commit
c765d05739
@ -1,4 +1,5 @@
|
||||
//* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
@ -60,21 +61,21 @@ nsDomainEntry::FuncForStaticAsserts(void)
|
||||
|
||||
static nsEffectiveTLDService *gService = nullptr;
|
||||
|
||||
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(EffectiveTLDServiceMallocSizeOf)
|
||||
|
||||
static int64_t
|
||||
GetEffectiveTLDSize()
|
||||
class EffectiveTLDServiceReporter MOZ_FINAL : public MemoryReporterBase
|
||||
{
|
||||
return gService->SizeOfIncludingThis(EffectiveTLDServiceMallocSizeOf);
|
||||
}
|
||||
public:
|
||||
EffectiveTLDServiceReporter()
|
||||
: MemoryReporterBase("explicit/xpcom/effective-TLD-service",
|
||||
KIND_HEAP, UNITS_BYTES,
|
||||
"Memory used by the effective TLD service.")
|
||||
{}
|
||||
|
||||
NS_MEMORY_REPORTER_IMPLEMENT(
|
||||
EffectiveTLDService,
|
||||
"explicit/xpcom/effective-TLD-service",
|
||||
KIND_HEAP,
|
||||
nsIMemoryReporter::UNITS_BYTES,
|
||||
GetEffectiveTLDSize,
|
||||
"Memory used by the effective TLD service.")
|
||||
private:
|
||||
int64_t Amount() MOZ_OVERRIDE
|
||||
{
|
||||
return gService ? gService->SizeOfIncludingThis(MallocSizeOf) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
nsresult
|
||||
nsEffectiveTLDService::Init()
|
||||
@ -108,16 +109,15 @@ nsEffectiveTLDService::Init()
|
||||
|
||||
MOZ_ASSERT(!gService);
|
||||
gService = this;
|
||||
mReporter = new NS_MEMORY_REPORTER_NAME(EffectiveTLDService);
|
||||
(void)::NS_RegisterMemoryReporter(mReporter);
|
||||
mReporter = new EffectiveTLDServiceReporter();
|
||||
NS_RegisterMemoryReporter(mReporter);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEffectiveTLDService::~nsEffectiveTLDService()
|
||||
{
|
||||
(void)::NS_UnregisterMemoryReporter(mReporter);
|
||||
mReporter = nullptr;
|
||||
NS_UnregisterMemoryReporter(mReporter);
|
||||
gService = nullptr;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -12,7 +13,6 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
class nsIIDNService;
|
||||
class nsIMemoryReporter;
|
||||
|
||||
#define ETLD_ENTRY_N_INDEX_BITS 30
|
||||
|
||||
@ -118,7 +118,7 @@ private:
|
||||
nsresult NormalizeHostname(nsCString &aHostname);
|
||||
~nsEffectiveTLDService();
|
||||
|
||||
nsIMemoryReporter* mReporter;
|
||||
nsCOMPtr<nsIMemoryReporter> mReporter;
|
||||
nsTHashtable<nsDomainEntry> mHash;
|
||||
nsCOMPtr<nsIIDNService> mIDNService;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user