Bug 1773770: Part 2 - Migrage KeyValueStore to static component registration. r=asuth

Differential Revision: https://phabricator.services.mozilla.com/D149430
This commit is contained in:
Kris Maglione 2022-06-30 09:12:16 +00:00
parent ce5a40d75a
commit 7a2e2d4aa7
6 changed files with 33 additions and 40 deletions

View File

@ -38,8 +38,6 @@
#define NS_FAVICONSERVICE_CONTRACTID "@mozilla.org/browser/favicon-service;1"
#define NS_KEY_VALUE_SERVICE_CONTRACTID "@mozilla.org/key-value-service;1"
/////////////////////////////////////////////////////////////////////////////
// {84E11F80-CA55-11DD-AD8B-0800200C9A66}
@ -101,11 +99,3 @@
0xb6, 0x05, 0x60, 0xb0, 0x22, 0xa0, 0x07, 0x56 \
} \
}
// 6cc1a0a8-af97-4d41-9b4a-58dcec46ebce
#define NS_KEY_VALUE_SERVICE_CID \
{ \
0x6cc1a0a8, 0xaf97, 0x4d41, { \
0x9b, 0x4a, 0x58, 0xdc, 0xec, 0x46, 0xeb, 0xce \
} \
}

View File

@ -0,0 +1,14 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
Classes = [
{
'cid': '{6cc1a0a8-af97-4d41-9b4a-58dcec46ebce}',
'contract_ids': ['@mozilla.org/key-value-service;1'],
'headers': ['/toolkit/components/kvstore/nsKeyValueModule.h'],
'legacy_constructor': 'nsKeyValueServiceConstructor',
},
]

View File

@ -17,10 +17,10 @@ XPIDL_SOURCES += [
"nsIKeyValue.idl",
]
XPIDL_MODULE = "kvstore"
UNIFIED_SOURCES += [
"nsKeyValueModule.cpp",
XPCOM_MANIFESTS += [
"components.conf",
]
XPIDL_MODULE = "kvstore"
FINAL_LIBRARY = "xul"

View File

@ -1,24 +0,0 @@
/* 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/. */
#include "mozilla/ModuleUtils.h"
#include "nsIClassInfoImpl.h"
#include "nsToolkitCompsCID.h"
extern "C" {
// Implemented in Rust.
nsresult nsKeyValueServiceConstructor(REFNSIID aIID, void** aResult);
} // extern "C"
NS_DEFINE_NAMED_CID(NS_KEY_VALUE_SERVICE_CID);
const mozilla::Module::CIDEntry kKeyValueCIDs[] = {
{&kNS_KEY_VALUE_SERVICE_CID, false, nullptr, nsKeyValueServiceConstructor},
{nullptr}};
const mozilla::Module::ContractIDEntry kKeyValueContracts[] = {
{NS_KEY_VALUE_SERVICE_CONTRACTID, &kNS_KEY_VALUE_SERVICE_CID}, {nullptr}};
extern const mozilla::Module kKeyValueModule = {
mozilla::Module::kVersion, kKeyValueCIDs, kKeyValueContracts, nullptr};

View File

@ -0,0 +1,15 @@
/* 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/. */
#ifndef nsKeyValueModule_h
#define nsKeyValueModule_h
#include "nsID.h"
extern "C" {
// Implemented in Rust.
nsresult nsKeyValueServiceConstructor(REFNSIID aIID, void** aResult);
} // extern "C"
#endif // defined nsKeyValueModule_h

View File

@ -277,7 +277,6 @@ extern const mozilla::Module kContentProcessWidgetModule;
#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_UIKIT)
extern const mozilla::Module kWidgetModule;
#endif
extern const mozilla::Module kKeyValueModule;
extern const mozilla::Module kXREModule;
static nsTArray<const mozilla::Module*>* sExtraStaticModules;
@ -370,7 +369,6 @@ nsresult nsComponentManagerImpl::Init() {
#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_UIKIT)
RegisterModule(&kWidgetModule);
#endif
RegisterModule(&kKeyValueModule);
RegisterModule(&kXREModule);
for (uint32_t i = 0; i < sExtraStaticModules->Length(); ++i) {