Quellcode-Bibliothek StaticComponents.h
Interaktion und PortierbarkeitC
/* -*- 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/. */
/** * Represents a string entry in the static string table. Can be converted to a * nsCString using GetString() in StaticComponents.cpp. * * This is a struct rather than a pure offset primarily for the purposes of type * safety, but also so that it can easily be extended to include a static length * in the future, if efficiency concerns warrant it.
*/ struct StringOffset final {
uint32_t mOffset;
};
/** * Represents an offset into the interfaces table.
*/ struct InterfaceOffset final {
uint16_t mOffset;
};
/** * Represents a static component entry defined in a `Classes` list in an XPCOM * manifest. Handles creating instances of and caching service instances for * that class.
*/ struct StaticModule {
nsID mCID;
StringOffset mContractID;
Module::ProcessSelector mProcessSelector;
/** * Returns this entry's index in the gStaticModules array.
*/
size_t Idx() const { return size_t(ID()); }
/** * Returns true if this component's corresponding contract ID is expected to * be overridden at runtime. If so, it should always be looked up by its * ContractID() when retrieving its service instance.
*/ bool Overridable() const;
/** * If this entry is overridable, returns its associated contract ID string. * The component should always be looked up by this contract ID when * retrieving its service instance. * * Note: This may *only* be called if Overridable() returns true.
*/
nsCString ContractID() const;
/** * Returns true if this entry is active. Typically this will only return false * if the entry's process selector does not match this process.
*/ bool Active() const;
/** * Represents a static mapping between a contract ID string and a StaticModule * entry.
*/ struct ContractEntry final {
StringOffset mContractID;
ModuleID mModuleID;
/** * Returns true if this entry's underlying module is active, and its contract * ID matches the given contract ID string. This is used by the PerfectHash * function to determine whether to return a result for this entry.
*/ bool Matches(const nsACString& aContractID) const;
/** * Returns true if this entry has been invalidated, and should be ignored. * * Contract IDs may be overwritten at runtime. When that happens for a static * contract ID, we mark its entry invalid, and ignore it thereafter.
*/ bool Invalid() const { return GetBit(gInvalidContracts, Idx()); }
/** * Marks this entry invalid (or unsets the invalid bit if aInvalid is false), * after which it will be ignored in contract ID lookup attempts. See * `Invalid()` above.
*/ void SetInvalid(bool aInvalid = true) const { return SetBit(gInvalidContracts, Idx(), aInvalid);
}
};
/** * Represents a declared category manager entry declared in an XPCOM manifest. * * The entire set of static category entries is read at startup and loaded into * the category manager's dynamic hash tables, so there is memory and * initialization overhead for each entry in these tables. This may be further * optimized in the future to reduce some of that overhead.
*/ struct StaticCategoryEntry final {
StringOffset mEntry;
StringOffset mValue;
Module::BackgroundTasksSelector mBackgroundTasksSelector;
Module::ProcessSelector mProcessSelector;
/** * Marks a static contract ID entry invalid (or unsets the invalid bit if * aInvalid is false). See `CategoryEntry::Invalid()`.
*/ staticbool InvalidateContractID(const nsACString& aContractID, bool aInvalid = true);
/** * Calls any module unload from manifests whose components have been loaded.
*/ staticvoid Shutdown();
};
} // namespace xpcom
} // namespace mozilla
#endif// defined StaticComponents_h
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.