Commit a1e95257 authored by Kris Maglione's avatar Kris Maglione
Browse files

Bug 1524687: Part 11 - Convert browser modules to static registration. r=mossop

--HG--
extra : rebase_source : 501159804a98ae4e12aee2c81cbf7effd7355c7a
extra : source : 46e13c453538f73dd063284804582e5f74c1432a
parent f349027d
# -*- 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/.
pages = [
'blocked',
'certerror',
'config',
'downloads',
'home',
'library',
'newinstall',
'newtab',
'pocket-saved',
'pocket-signup',
'policies',
'preferences',
'privatebrowsing',
'reader',
'restartrequired',
'rights',
'robots',
'searchreset',
'sessionrestore',
'tabcrashed',
'welcome',
'welcomeback',
]
Classes = [
{
'cid': '{7e4bb6ad-2fc4-4dc6-89ef-23e8e5ccf980}',
'contract_ids': ['@mozilla.org/network/protocol/about;1?what=%s' % page
for page in pages],
'legacy_constructor': 'mozilla::browser::AboutRedirector::Create',
'headers': ['/browser/components/about/AboutRedirector.h'],
},
]
......@@ -17,6 +17,10 @@ SOURCES += [
'AboutRedirector.cpp',
]
XPCOM_MANIFESTS += [
'components.conf',
]
EXTRA_JS_MODULES.aboutpages = [
'AboutPrivateBrowsingHandler.jsm',
]
......
# -*- 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': '{6deb193c-f87d-4078-bc78-5e64655b4d62}',
'contract_ids': ['@mozilla.org/browser/directory-provider;1'],
'type': 'mozilla::browser::DirectoryProvider',
'headers': ['mozilla/browser/DirectoryProvider.h'],
'categories': {'xpcom-directory-providers': 'browser-directory-provider'},
},
]
TOOLKIT = buildconfig.substs['MOZ_WIDGET_TOOLKIT']
shell_service_contracts = [
'@mozilla.org/browser/shell-service;1',
'@mozilla.org/toolkit/shell-service;1',
]
if TOOLKIT == 'gtk3':
Classes += [
{
'cid': '{63c7b9f4-0cc8-43f8-b666-0a661655cb73}',
'contract_ids': shell_service_contracts,
'type': 'nsGNOMEShellService',
'headers': ['/browser/components/shell/nsGNOMEShellService.h'],
'init_method': 'Init',
},
]
elif TOOLKIT == 'cocoa':
Classes += [
{
'cid': '{6fc66a78-6cbc-4b3f-b7ba-379289b29276}',
'contract_ids': ['@mozilla.org/mac-attribution;1'],
'type': 'nsMacAttributionService',
'headers': ['nsMacAttribution.h'],
},
]
if buildconfig.substs['OS_ARCH'] == 'Darwin':
Classes += [
{
'cid': '{63c7b9f4-0cc8-43f8-b666-0a661655cb73}',
'contract_ids': shell_service_contracts,
'type': 'nsMacShellService',
'headers': ['/browser/components/shell/nsMacShellService.h'],
},
]
elif buildconfig.substs['OS_ARCH'] == 'WINNT':
Classes += [
{
'cid': '{63c7b9f4-0cc8-43f8-b666-0a661655cb73}',
'contract_ids': shell_service_contracts,
'type': 'nsWindowsShellService',
'headers': ['/browser/components/shell/nsWindowsShellService.h'],
},
{
'cid': '{93480624-806e-4756-b7cb-0fb7dd746a8f}',
'contract_ids': ['@mozilla.org/profile/migrator/iehistoryenumerator;1'],
'type': 'nsIEHistoryEnumerator',
'headers': ['/browser/components/migration/nsIEHistoryEnumerator.h'],
},
]
......@@ -7,12 +7,8 @@
with Files("**"):
BUG_COMPONENT = ("Firefox Build System", "General")
EXPORTS += [
'nsBrowserCompsCID.h',
]
SOURCES += [
'nsModule.cpp',
XPCOM_MANIFESTS += [
'components.conf',
]
Library('browsercomps')
......
......@@ -40,14 +40,6 @@
} \
}
// 7e4bb6ad-2fc4-4dc6-89ef-23e8e5ccf980
#define NS_BROWSER_ABOUT_REDIRECTOR_CID \
{ \
0x7e4bb6ad, 0x2fc4, 0x4dc6, { \
0x89, 0xef, 0x23, 0xe8, 0xe5, 0xcc, 0xf9, 0x80 \
} \
}
// {6DEB193C-F87D-4078-BC78-5E64655B4D62}
#define NS_BROWSERDIRECTORYPROVIDER_CID \
{ \
......@@ -55,14 +47,3 @@
0xbc, 0x78, 0x5e, 0x64, 0x65, 0x5b, 0x4d, 0x62 \
} \
}
#if defined(MOZ_WIDGET_COCOA)
# define NS_MACATTRIBUTIONSERVICE_CONTRACTID "@mozilla.org/mac-attribution;1"
# define NS_MACATTRIBUTIONSERVICE_CID \
{ \
0x6FC66A78, 0x6CBC, 0x4B3F, { \
0xB7, 0xBA, 0x37, 0x92, 0x89, 0xB2, 0x92, 0x76 \
} \
}
#endif
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "nsBrowserCompsCID.h"
#include "DirectoryProvider.h"
#if defined(XP_WIN)
# include "nsWindowsShellService.h"
#elif defined(XP_MACOSX)
# include "nsMacShellService.h"
#elif defined(MOZ_WIDGET_GTK)
# include "nsGNOMEShellService.h"
#endif
#include "nsIToolkitShellService.h"
#if defined(MOZ_WIDGET_COCOA)
# include "nsMacAttribution.h"
#endif
#if defined(XP_WIN)
# include "nsIEHistoryEnumerator.h"
#endif
#include "AboutRedirector.h"
#include "nsIAboutModule.h"
#include "nsNetCID.h"
using namespace mozilla::browser;
/////////////////////////////////////////////////////////////////////////////
NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider)
#if defined(XP_WIN)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
#elif defined(XP_MACOSX)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
#elif defined(MOZ_WIDGET_GTK)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
#endif
#if defined(MOZ_WIDGET_COCOA)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacAttributionService)
#endif
#if defined(XP_WIN)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEHistoryEnumerator)
#endif
NS_DEFINE_NAMED_CID(NS_BROWSERDIRECTORYPROVIDER_CID);
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(XP_MACOSX)
NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_BROWSER_ABOUT_REDIRECTOR_CID);
#if defined(XP_WIN)
NS_DEFINE_NAMED_CID(NS_WINIEHISTORYENUMERATOR_CID);
#endif
#if defined(MOZ_WIDGET_COCOA)
NS_DEFINE_NAMED_CID(NS_MACATTRIBUTIONSERVICE_CID);
#endif
static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
// clang-format off
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, nullptr, DirectoryProviderConstructor },
#if defined(XP_WIN)
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsWindowsShellServiceConstructor },
#elif defined(MOZ_WIDGET_GTK)
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsGNOMEShellServiceConstructor },
#elif defined(XP_MACOSX)
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsMacShellServiceConstructor },
#endif
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, nullptr, AboutRedirector::Create },
#if defined(XP_WIN)
{ &kNS_WINIEHISTORYENUMERATOR_CID, false, nullptr, nsIEHistoryEnumeratorConstructor },
#endif
#if defined(MOZ_WIDGET_COCOA)
{ &kNS_MACATTRIBUTIONSERVICE_CID, false, nullptr, nsMacAttributionServiceConstructor },
#endif
{ nullptr }
// clang-format on
};
static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
// clang-format off
{ NS_BROWSERDIRECTORYPROVIDER_CONTRACTID, &kNS_BROWSERDIRECTORYPROVIDER_CID },
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(XP_MACOSX)
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
{ NS_TOOLKITSHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "tabcrashed", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "searchreset", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "welcomeback", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "library", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "preferences", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "downloads", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "reader", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "restartrequired", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "welcome", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "policies", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-saved", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-signup", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newinstall", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#if defined(XP_WIN)
{ NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },
#endif
#if defined(MOZ_WIDGET_COCOA)
{ NS_MACATTRIBUTIONSERVICE_CONTRACTID, &kNS_MACATTRIBUTIONSERVICE_CID },
#endif
{ nullptr }
// clang-format on
};
static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
{XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider",
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID},
{nullptr}};
static const mozilla::Module kBrowserModule = {mozilla::Module::kVersion,
kBrowserCIDs, kBrowserContracts,
kBrowserCategories};
NSMODULE_DEFN(nsBrowserCompsModule) = &kBrowserModule;
......@@ -21,7 +21,6 @@
#include "nsShellService.h"
#include "nsIProcess.h"
#include "nsICategoryManager.h"
#include "nsBrowserCompsCID.h"
#include "nsDirectoryServiceUtils.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
......
......@@ -338,7 +338,7 @@ nsresult nsComponentManagerImpl::Create(nsISupports* aOuter, REFNSIID aIID,
return gComponentManager->QueryInterface(aIID, aResult);
}
static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 256;
static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 128;
nsComponentManagerImpl::nsComponentManagerImpl()
: mFactories(CONTRACTID_HASHTABLE_INITIAL_LENGTH),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment