mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
476dc527b7
The static XPCOM manifest format makes it easy to define a component in a single place, without separate contract ID and CID macro definitions in headers, and variable constants in module files. Without any other changes, however, those macros are still required in order to create instances of or retrieve services for the component. This patch solves that problem by allowing component definitions to include an explicit component name, and adding helpers for each named component to Components.h: mozilla::components::<Name>::CID() to retrieve its class ID. mozilla::components::<Name>::Create() to create a new instance. mozilla::components::<Name>::Service() to retrieve its service instance. These getters have the benefit of doing full compile-time sanity checking, with no possibilty of using a mistyped contract ID string, or a macro constant which has gotten out of sync with the component entry. Moreover, when possible, these getters are optimized to operate on module entries directly, without going through expensive hash lookups or virtual calls. Differential Revision: https://phabricator.services.mozilla.com/D15037 --HG-- extra : rebase_source : ab07ef6a7ad8b26cd4e1901d3365beeb8c22ec3b extra : source : 929fd654c9dfc3222e1972faadea3cc066e51654 |
||
---|---|---|
.. | ||
base | ||
build | ||
components | ||
doc | ||
ds | ||
glue | ||
idl-parser | ||
io | ||
libxpt/xptcall | ||
reflect | ||
rust | ||
string | ||
system | ||
tests | ||
threads | ||
windbgdlg | ||
xpidl | ||
moz.build | ||
xpcom-config.h.in | ||
xpcom-private.h.in |