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
rename from xpcom/glue/GenericFactory.cpp
rename to xpcom/components/GenericFactory.cpp
rename from xpcom/glue/GenericFactory.h
rename to xpcom/components/GenericFactory.h
--- a/xpcom/components/ModuleUtils.h
+++ b/xpcom/components/ModuleUtils.h
@@ -65,34 +65,9 @@ static nsresult
\
inst = already_AddRefed<_InstanceClass>(_GetterProc()); \
if (nullptr == inst) { \
return NS_ERROR_OUT_OF_MEMORY; \
} \
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
--- a/xpcom/components/moz.build
+++ b/xpcom/components/moz.build
@@ -12,35 +12,42 @@ XPIDL_SOURCES += [
'nsIFactory.idl',
'nsIModule.idl',
'nsIServiceManager.idl',
]
XPIDL_MODULE = 'xpcom_components'
EXPORTS += [
+ 'nsCategoryCache.h',
'nsCategoryManagerUtils.h',
+ 'nsComponentManagerUtils.h',
+ 'nsServiceManagerUtils.h',
]
EXPORTS.mozilla += [
+ 'GenericFactory.h',
'Module.h',
'ModuleLoader.h',
'ModuleUtils.h',
]
# nsCategoryManager.cpp and nsComponentManager.cpp cannot be built in
# unified mode because they use thea PL_ARENA_CONST_ALIGN_MASK macro
# with plarena.h.
SOURCES += [
'nsCategoryManager.cpp',
'nsComponentManager.cpp',
]
UNIFIED_SOURCES += [
+ 'GenericFactory.cpp',
'ManifestParser.cpp',
+ 'nsCategoryCache.cpp',
+ 'nsComponentManagerUtils.cpp',
]
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'!..',
'../base',
'../build',
rename from xpcom/glue/nsCategoryCache.cpp
rename to xpcom/components/nsCategoryCache.cpp
rename from xpcom/glue/nsCategoryCache.h
rename to xpcom/components/nsCategoryCache.h
rename from xpcom/glue/nsComponentManagerUtils.cpp
rename to xpcom/components/nsComponentManagerUtils.cpp
rename from xpcom/glue/nsComponentManagerUtils.h
rename to xpcom/components/nsComponentManagerUtils.h
rename from xpcom/glue/nsServiceManagerUtils.h
rename to xpcom/components/nsServiceManagerUtils.h
deleted file mode 100644
--- a/xpcom/glue/GenericModule.cpp
+++ /dev/null
@@ -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
--- a/xpcom/glue/moz.build
+++ b/xpcom/glue/moz.build
@@ -5,22 +5,18 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
with Files('nsString*'):
BUG_COMPONENT = ('Core', 'String')
DIRS += ['standalone']
EXPORTS += [
- 'nsCategoryCache.h',
- 'nsComponentManagerUtils.h',
- 'nsServiceManagerUtils.h',
'nsStringAPI.h',
'nsStringGlue.h',
]
EXPORTS.mozilla += [
'FileUtils.h',
- 'GenericFactory.h',
]
if CONFIG['ENABLE_TESTS']:
DIRS += ['tests/gtest']
--- a/xpcom/glue/objs.mozbuild
+++ b/xpcom/glue/objs.mozbuild
@@ -1,24 +1,21 @@
# -*- 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/.
xpcom_glue_src_lcppsrcs = [
'FileUtils.cpp',
- 'nsCategoryCache.cpp',
- 'nsComponentManagerUtils.cpp',
'XREAppData.cpp',
]
xpcom_glue_src_cppsrcs = [
'/xpcom/glue/%s' % s for s in xpcom_glue_src_lcppsrcs
]
xpcom_gluens_src_lcppsrcs = [
- 'GenericFactory.cpp',
]
xpcom_gluens_src_cppsrcs = [
'/xpcom/glue/%s' % s for s in xpcom_gluens_src_lcppsrcs
]