Bug 1332631 part G - file moves from xpcom/glue to xpcom/components, and remove GenericModule which is no longer useful, r=froydnj

MozReview-Commit-ID: 5NvfKRAlZqs

--HG--
rename : xpcom/glue/GenericFactory.cpp => xpcom/components/GenericFactory.cpp
rename : xpcom/glue/GenericFactory.h => xpcom/components/GenericFactory.h
rename : xpcom/glue/nsCategoryCache.cpp => xpcom/components/nsCategoryCache.cpp
rename : xpcom/glue/nsCategoryCache.h => xpcom/components/nsCategoryCache.h
rename : xpcom/glue/nsComponentManagerUtils.cpp => xpcom/components/nsComponentManagerUtils.cpp
rename : xpcom/glue/nsComponentManagerUtils.h => xpcom/components/nsComponentManagerUtils.h
rename : xpcom/glue/nsServiceManagerUtils.h => xpcom/components/nsServiceManagerUtils.h
extra : rebase_source : 2f9e4b8de99c2835c4322282b0227ed3f833c285
extra : histedit_source : 45033773c304696050a649e3fbde1ecb33ec1fea
This commit is contained in:
Benjamin Smedberg 2017-01-20 14:41:10 -05:00
Родитель 5030045d16
Коммит 9b43ba6de7
12 изменённых файлов: 7 добавлений и 130 удалений

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

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

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

@ -70,29 +70,4 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return inst->QueryInterface(aIID, aResult); \
}
#ifndef MOZILLA_INTERNAL_API
#include "nsIModule.h"
#include "nsISupportsUtils.h"
namespace mozilla {
class GenericModule final : public nsIModule
{
~GenericModule() {}
public:
explicit GenericModule(const mozilla::Module* aData) : mData(aData) {}
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIMODULE
private:
const mozilla::Module* mData;
};
} // namespace mozilla
#endif
#endif // mozilla_GenericModule_h

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

@ -17,10 +17,14 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'xpcom_components'
EXPORTS += [
'nsCategoryCache.h',
'nsCategoryManagerUtils.h',
'nsComponentManagerUtils.h',
'nsServiceManagerUtils.h',
]
EXPORTS.mozilla += [
'GenericFactory.h',
'Module.h',
'ModuleLoader.h',
'ModuleUtils.h',
@ -35,7 +39,10 @@ SOURCES += [
]
UNIFIED_SOURCES += [
'GenericFactory.cpp',
'ManifestParser.cpp',
'nsCategoryCache.cpp',
'nsComponentManagerUtils.cpp',
]
FINAL_LIBRARY = 'xul'

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

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

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

@ -1,98 +0,0 @@
/* -*- 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/. */
#include "mozilla/ModuleUtils.h"
#include "mozilla/GenericFactory.h"
#include "nsICategoryManager.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsServiceManagerUtils.h"
#include "nsXPCOMCID.h"
#include "nsStringAPI.h"
namespace mozilla {
NS_IMPL_ISUPPORTS(GenericModule, nsIModule)
NS_IMETHODIMP
GenericModule::GetClassObject(nsIComponentManager* aCompMgr,
const nsCID& aCID,
const nsIID& aIID,
void** aResult)
{
for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) {
if (e->cid->Equals(aCID)) {
nsCOMPtr<nsIFactory> f;
if (e->getFactoryProc) {
f = e->getFactoryProc(*mData, *e);
} else {
NS_ASSERTION(e->constructorProc, "No constructor proc?");
f = new GenericFactory(e->constructorProc);
}
if (!f) {
return NS_ERROR_FAILURE;
}
return f->QueryInterface(aIID, aResult);
}
}
NS_ERROR("Asking a module for a CID it doesn't implement.");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aLocation,
const char* aLoaderStr,
const char* aType)
{
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(aCompMgr);
for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) {
registrar->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
aLoaderStr, aType);
}
for (const Module::ContractIDEntry* e = mData->mContractIDs;
e && e->contractid;
++e) {
registrar->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
aLoaderStr, aType);
}
nsCOMPtr<nsICategoryManager> catman;
for (const Module::CategoryEntry* e = mData->mCategoryEntries;
e && e->category;
++e) {
if (!catman) {
catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
}
nsAutoCString prevValue;
catman->AddCategoryEntry(e->category, e->entry, e->value, true, true,
getter_Copies(prevValue));
}
return NS_OK;
}
NS_IMETHODIMP
GenericModule::UnregisterSelf(nsIComponentManager* aCompMgr,
nsIFile* aFile,
const char* aLoaderStr)
{
NS_ERROR("Nobody should ever call UnregisterSelf!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
GenericModule::CanUnload(nsIComponentManager* aCompMgr, bool* aResult)
{
NS_ERROR("Nobody should ever call CanUnload!");
*aResult = false;
return NS_OK;
}
} // namespace mozilla

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

@ -10,16 +10,12 @@ with Files('nsString*'):
DIRS += ['standalone']
EXPORTS += [
'nsCategoryCache.h',
'nsComponentManagerUtils.h',
'nsServiceManagerUtils.h',
'nsStringAPI.h',
'nsStringGlue.h',
]
EXPORTS.mozilla += [
'FileUtils.h',
'GenericFactory.h',
]
if CONFIG['ENABLE_TESTS']:

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

@ -6,8 +6,6 @@
xpcom_glue_src_lcppsrcs = [
'FileUtils.cpp',
'nsCategoryCache.cpp',
'nsComponentManagerUtils.cpp',
'XREAppData.cpp',
]
@ -16,7 +14,6 @@ xpcom_glue_src_cppsrcs = [
]
xpcom_gluens_src_lcppsrcs = [
'GenericFactory.cpp',
]
xpcom_gluens_src_cppsrcs = [