Bug 1773770: Part 4 - Migrate INI parser factory to static component registration. r=xpcom-reviewers,nika

Differential Revision: https://phabricator.services.mozilla.com/D149432
This commit is contained in:
Kris Maglione 2022-06-24 07:10:16 +00:00
Родитель 29aac4ac21
Коммит 4bd7eb42a2
6 изменённых файлов: 9 добавлений и 46 удалений

Просмотреть файл

@ -40,8 +40,6 @@
#include "nsDebugImpl.h"
#include "nsSystemInfo.h"
#include "nsINIParserImpl.h"
#include "nsComponentManager.h"
#include "nsCategoryManagerUtils.h"
#include "nsIServiceManager.h"
@ -153,30 +151,6 @@ mozilla::Atomic<bool, mozilla::SequentiallyConsistent> gXPCOMThreadsShutDown(
bool gXPCOMMainThreadEventsAreDoomed = false;
char16_t* gGREBinPath = nullptr;
static NS_DEFINE_CID(kINIParserFactoryCID, NS_INIPARSERFACTORY_CID);
static already_AddRefed<nsIFactory> CreateINIParserFactory(
const mozilla::Module& aModule, const mozilla::Module::CIDEntry& aEntry) {
nsCOMPtr<nsIFactory> f = new nsINIParserFactory();
return f.forget();
}
const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = {
{&kINIParserFactoryCID, false, CreateINIParserFactory}, {nullptr}};
const mozilla::Module::ContractIDEntry kXPCOMContracts[] = {
{NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID}, {nullptr}};
const mozilla::Module kXPCOMModule = {
mozilla::Module::kVersion,
kXPCOMCIDEntries,
kXPCOMContracts,
nullptr,
nullptr,
nullptr,
nullptr,
mozilla::Module::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS};
// gDebug will be freed during shutdown.
static nsIDebug2* gDebug = nullptr;

Просмотреть файл

@ -228,6 +228,13 @@ Classes = [
'type': 'nsVersionComparatorImpl',
'headers': ['/xpcom/base/nsVersionComparatorImpl.h'],
},
{
'cid': '{dfac10a9-dd24-43cf-a095-6ffa2e4b6a6c}',
'contract_ids': ['@mozilla.org/xpcom/ini-parser-factory;1'],
'type': 'nsINIParserFactory',
'headers': ['/xpcom/ds/nsINIParserImpl.h'],
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
},
]
if buildconfig.substs['OS_ARCH'] == 'WINNT':

Просмотреть файл

@ -361,7 +361,6 @@ nsresult nsComponentManagerImpl::Init() {
nsCategoryManager::GetSingleton()->SuppressNotifications(true);
RegisterModule(&kXPCOMModule);
RegisterModule(&kNeckoModule);
RegisterModule(&kPowerManagerModule);
RegisterModule(&kContentProcessWidgetModule);

Просмотреть файл

@ -51,8 +51,6 @@ struct PRThread;
////////////////////////////////////////////////////////////////////////////////
extern const mozilla::Module kXPCOMModule;
namespace {
class EntryWrapper;
} // namespace

Просмотреть файл

@ -26,7 +26,7 @@ class nsINIParserImpl final : public nsIINIParser, public nsIINIParserWriter {
bool ContainsNull(const nsACString& aStr);
};
NS_IMPL_ISUPPORTS(nsINIParserFactory, nsIINIParserFactory, nsIFactory)
NS_IMPL_ISUPPORTS(nsINIParserFactory, nsIINIParserFactory)
NS_IMETHODIMP
nsINIParserFactory::CreateINIParser(nsIFile* aINIFile, nsIINIParser** aResult) {
@ -45,12 +45,6 @@ nsINIParserFactory::CreateINIParser(nsIFile* aINIFile, nsIINIParser** aResult) {
return NS_OK;
}
NS_IMETHODIMP
nsINIParserFactory::CreateInstance(REFNSIID aIID, void** aResult) {
// We are our own singleton.
return QueryInterface(aIID, aResult);
}
NS_IMPL_ISUPPORTS(nsINIParserImpl, nsIINIParser, nsIINIParserWriter)
bool nsINIParserImpl::ContainsNull(const nsACString& aStr) {

Просмотреть файл

@ -8,25 +8,16 @@
#define nsINIParserImpl_h__
#include "nsIINIParser.h"
#include "nsIFactory.h"
#include "mozilla/Attributes.h"
#define NS_INIPARSERFACTORY_CID \
{ \
0xdfac10a9, 0xdd24, 0x43cf, { \
0xa0, 0x95, 0x6f, 0xfa, 0x2e, 0x4b, 0x6a, 0x6c \
} \
}
#define NS_INIPARSERFACTORY_CONTRACTID "@mozilla.org/xpcom/ini-parser-factory;1"
class nsINIParserFactory final : public nsIINIParserFactory, public nsIFactory {
class nsINIParserFactory final : public nsIINIParserFactory {
~nsINIParserFactory() = default;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIINIPARSERFACTORY
NS_DECL_NSIFACTORY
};
#endif // nsINIParserImpl_h__